[FFmpeg-devel] [PATCH] swscale alpha channel support

Cédric Schieli cschieli
Wed Mar 25 09:42:54 CET 2009


2009/3/25 Reimar D?ffinger <Reimar.Doeffinger at gmx.de>:
> On Wed, Mar 25, 2009 at 08:25:39AM +0100, C?dric Schieli wrote:
>> ? ? ? ? ?case PIX_FMT_RGB4_BYTE:
>> - ? ? ? ? ? ?r= (i>>3 ? ?)*255;
>> + ? ? ? ? ? ?a= (i>>4 ? ?)*17;
>> + ? ? ? ? ? ?r= ((i>>3)&1)*255;
>> ? ? ? ? ? ? ?g= ((i>>1)&3)*85;
>> ? ? ? ? ? ? ?b= (i&1 ? ? )*255;
>> ? ? ? ? ? ? ?break;
>> ? ? ? ? ?case PIX_FMT_BGR4_BYTE:
>> - ? ? ? ? ? ?b= (i>>3 ? ?)*255;
>> + ? ? ? ? ? ?a= (i>>4 ? ?)*17;
>> + ? ? ? ? ? ?b= ((i>>3)&1)*255;
>
>
> ??? the changes to r and b seem right, but what are you calculating for
> a?

I'm calculating "a" according to what suggested Stefano here :
http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/2009-March/066144.html

> Just const int a = 255 should do it.
> Also instead of those r,b changes it would make more sense to let the loop
> only run to 16 for PIX_FMT_RGB4_BYTE and PIX_FMT_BGR4_BYTE.
> And actually for now you could just add
> pal[i] |= 0xff000000;
> and change nothing else at all, but I don't know what Michael prefers.

If those 4 msb bits are simply to be ignored then yes, of course.

BTW, where can I found some doc on this pixel format ?



More information about the ffmpeg-devel mailing list