Hi,

On Thu, May 5, 2011 at 9:35 PM, Daniel Verkamp <[email protected]> wrote:
> On Wed, May 4, 2011 at 10:00 AM, Ronald S. Bultje <[email protected]> wrote:
>>> +                unsigned b =  c        &  0x1F;
>>> +                unsigned g = (c >>  5) &  0x1F;
>>> +                unsigned r =  c >> 10;
>>> +                /* 000aabbb -> aa bbb aa  */
>>> +                *dst++ = (b << 3) | (r >> 3);
>>> +                *dst++ = (g << 3) | (g >> 3);
>>> +                *dst++ = (r << 3) | (b >> 3);
>>
>> Why?
>
> Just a typo, should be ordered b,g,r on both sides of the |. (The idea
> is to use the full output range, i.e. the 0x1F is mapped to 0xFF, not
> 0xF8.  There's probably a better/faster way to do this.)

Should also be >> 2, not >> 3 then, otherwise you end up with 11111b
becoming 11111000b | 11b (remember, 5 bits shifted 3, leaves only 2) =
11111011b.

But yes, that makes more sense.

Ronald
_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel

Reply via email to