Re: BGR->RGB

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]



Whoops, here goes addendum1:

On Tue, 2002-11-26 at 19:03, Ronald Bultje wrote:
> static void
> bgr16_to_rgb16 (unsigned char *src,
>                 unsigned char *dest,
>                 unsigned int   size)
> {
>   guint16 temp;
>   while (size > 3) {
>     temp = ((*((guint16*)src))&0xf800)>>11 |
>            ((*((guint16*)src))&0x0770)     |
>            ((*((guint16*)src))&0x008f)<<11;
>     src += 2;
>     *((guint32*)dest) = dest<<16           |
                          ^^^^
That should have been 'temp' instead of 'dest', I'm just noticing. These
4-char variable names are all just too much alike. ;-).

>            ((*((guint16*)src))&0xf800)>>11 |
>            ((*((guint16*)src))&0x0770)     |
>            ((*((guint16*)src))&0x008f)<<11;
>     src += 2; dest += 4; size -= 4;
>   }
> 
>   if (size > 1)
>     *((guint16*)dest) = ((*((guint16*)src))&0xf800)>>11 |
>                         ((*((guint16*)src))&0x0770)     |
>                         ((*((guint16*)src))&0x008f)<<11;
> }

Still untested though. ;-).

-- 
Ronald Bultje <rbultje@xxxxxxxxxxxxxxxxxxx>
Linux Video/Multimedia developer





[Index of Archives]     [Linux DVB]     [Video Disk Recorder]     [Asterisk]     [Photo]     [DCCP]     [Netdev]     [Xorg]     [Util Linux NG]     [Xfree86]     [Free Photo Albums]     [Fedora Users]     [Fedora Women]     [ALSA Users]     [ALSA Devel]     [Linux USB]

Powered by Linux