The driver is ati radeon 8.12, the kernel object loaded is fglrx.ko<br><br><div class="gmail_quote">2009/1/22 Corbin Simpson <span dir="ltr"><<a href="mailto:mostawesomedude@gmail.com">mostawesomedude@gmail.com</a>></span><br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><div><div></div><div class="Wj3C7c">Amos Tibaldi wrote:<br>
> Hello,<br>
>   I am trying to use the Xv extension in order to display images on windows.<br>
> I have obtained the image formats with<br>
>  <a href="http://xvc.fo" target="_blank">xvc.fo</a> = XvListImageFormats( xvc.display, xvc.port, (int *)&formats );<br>
> and I have chosen the format<br>
>       id: 0x59565955 (UYVY)<br>
>         guid: 55595659-0000-0010-8000-00aa00389b71<br>
>         bits per pixel: 16<br>
>         number of planes: 1<br>
>         type: YUV (packed)<br>
><br>
> I'd like to convert from RGB to UYVY and I have found that for the struct<br>
><br>
> typedef struct {<br>
>   int id;                      /* Unique descriptor for the format */<br>
>   int type;                    /* XvRGB, XvYUV */<br>
>   int byte_order;              /* LSBFirst, MSBFirst */<br>
>   char guid[16];               /* Globally Unique IDentifier */<br>
>   int bits_per_pixel;<br>
>   int format;                  /* XvPacked, XvPlanar */<br>
>   int num_planes;<br>
><br>
>   /* for RGB formats only */<br>
>   int depth;<br>
>   unsigned int red_mask;<br>
>   unsigned int green_mask;<br>
>   unsigned int blue_mask;<br>
><br>
>   /* for YUV formats only */<br>
>   unsigned int y_sample_bits;<br>
>   unsigned int u_sample_bits;<br>
>   unsigned int v_sample_bits;<br>
>   unsigned int horz_y_period;<br>
>   unsigned int horz_u_period;<br>
>   unsigned int horz_v_period;<br>
>   unsigned int vert_y_period;<br>
>   unsigned int vert_u_period;<br>
>   unsigned int vert_v_period;<br>
>   char component_order[32];    /* eg. UYVY */<br>
>   int scanline_order;          /* XvTopToBottom, XvBottomToTop */<br>
> } XvImageFormatValues;<br>
><br>
> that image format has: ysb 8; usb 8; vsb 8; hyp 1; hup 2; hvp 2; vyp 1; vup<br>
> 1; vvp 1; 'UYVY'slo: 0<br>
><br>
> So I'm trying to convert the bytes from rgb with:<br>
><br>
><br>
> void RGBToUYVY(unsigned short int r,<br>
>                unsigned short int g,<br>
>                unsigned short int b,<br>
>                unsigned short int * u,<br>
>                unsigned short int * y,<br>
>                unsigned short int * v)<br>
> {<br>
>     //cout << "r=" << r << " g=" << g << " b=" << b;<br>
>     r &= 0x00FF; g &= 0x00FF; b &= 0x00FF;<br>
>    *y = (unsigned short<br>
> int)(0.299f*(float)r+0.587f*(float)g+0.114f*(float)b);<br>
>     *u = (unsigned short<br>
> int)(-0.147f*(float)r-0.289f*(float)g+0.436f*(float)b);<br>
>     *v = (unsigned short<br>
> int)(0.615f*(float)r-0.515f*(float)g-0.100f*(float)b);<br>
>     *y &= 0x00FF;<br>
>     *u &= 0x00FF;<br>
>     *v &= 0x00FF;<br>
>     //cout << " y=" << *y << " u=" << *u << " v=" << *v <<endl;<br>
> }<br>
><br>
> and to display the image with<br>
> void XVWindow::Redraw()<br>
> {<br>
>     unsigned short int u, y, v;<br>
>     RGBToUYVY(255,255,0,&u,&y,&v);<br>
>     unsigned short int thecolor =  u << 12 | y << 8 | v << 4 | y;<br>
><br>
>       for ( int y=0; y<ImageHeight; y++ )<br>
>     for ( int x=0; x<ImageWidth; x++ )<br>
>       ((unsigned short int *)BGimage->data)[ y * ImageWidth + x ] =<br>
> thecolor;<br>
><br>
>     counter++;<br>
>             XvPutImage( xvc.display, xvc.port, window, gc,<br>
>                     BGimage, 0, 0, ImageWidth, ImageHeight,<br>
>                        0, 0, WindowWidth, WindowHeight );<br>
> }<br>
><br>
> but the colors are always different. I have tried to use the blue, the red<br>
> and the green to see if I could obtain them separately but the mapping was<br>
> always wrong and different colours were showing on the window with respect<br>
> to those that I'd like to use in RGB.<br>
><br>
> What can I do? Is my RGB to UYVY correct? Why do I obtain on the screen<br>
> different colours. There are some kind of manual on how to map colors with<br>
> XV images?<br>
<br>
</div></div>Which driver, exactly? Most drivers provide RGB Xv formats, and those<br>
that don't probably could be hacked to add it.<br>
<font color="#888888"><br>
~ C.<br>
</font></blockquote></div><br><br clear="all"><br>-- <br>Amos Tibaldi<br>