[FFmpeg-devel] [PATCH]Simplify some palette calculations
Reimar Döffinger
Reimar.Doeffinger at gmx.de
Mon Nov 14 09:05:27 CET 2011
On 14 Nov 2011, at 08:51, Reimar Döffinger <Reimar.Doeffinger at gmx.de> wrote:
> On 13 Nov 2011, at 20:11, Carl Eugen Hoyos <cehoyos at ag.or.at> wrote:
>> As suggested by Reimar.
>>
>> Please comment, Carl
>
> &a[0] is the same as just a.
> As for the comment Michael had, for example a & ~0x03030303 after the shift would make the new code equivalent.
> I am not sure what is correct, but I think a lot of other palette handling code has this same issue of giving weird results if there are more than 6 bits set in the palette variable.
> I wonder whether all those shouldn't be using VGA palette and rotate the highest two bits in each byte in the lowest bit instead of shifting them up into the next component.
And maybe we should have a two inline ff_pal_from_vga and ff_pal_from_6bit functions doing
0xFF000000 | ((a << 2) & ~0x03030303) | ((a >> 6) & 0x03030303)
and
0xFF000000 | ((a << 2) & ~0x03030303) | ((a >> 4) & 0x03030303)
Respectively?
More information about the ffmpeg-devel
mailing list