[FFmpeg-devel] Should there be IsAlphaPixelFormat ?

Don Moir donmoir at comcast.net
Wed Jan 23 11:51:23 CET 2013


----- Original Message ----- 
From: "Paul B Mahol" <onemda at gmail.com>
To: "FFmpeg development discussions and patches" <ffmpeg-devel at ffmpeg.org>
Sent: Wednesday, January 23, 2013 4:40 AM
Subject: Re: [FFmpeg-devel] Should there be IsAlphaPixelFormat ?


> On 1/23/13, Don Moir <donmoir at comcast.net> wrote:
>> Currently I extract the code from swscale_internal.h:
>>
>> static av_always_inline int isALPHA(enum AVPixelFormat pix_fmt)
>> {
>>     const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(pix_fmt);
>>     av_assert0(desc);
>>     return desc->nb_components == 2 || desc->nb_components == 4;
>> }
>>
>> This is useful for to determine if I should create a transparent or
>> non-transparent texture.
>>
>> Although I don't know why it checks nb_components instead of desc->flags &
>> AV_FMT_ALPHA. nb_components of 2 and 4 always == ALPHA but seems flags
>> should be used instead. AV_FMT_ALPHA is always set for alpha formats.
>>
>> So I need to include libavutil/pixdesc.h to gain access to
>> AVPixFmtDescriptor.
>>
>> Wondering if you think this should be exported generally ?
>
> It already is, just swscale code needs some love.

Ok just wondering if you think avutil.h should include pixdesc.h. Not a big deal of course but just had to hunt it down. pixdesc.h 
is not includeed with any of the main header files so I need to include libavutil/pixdesc.h which is no biggie. Just thinking 
something like that should not have be searched for. 'av_pix_fmt_desc_get' is also declared in pixdesc.h 



More information about the ffmpeg-devel mailing list