[FFmpeg-devel] Should there be IsAlphaPixelFormat ?

Paul B Mahol onemda at gmail.com
Wed Jan 23 10:40:28 CET 2013


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.


More information about the ffmpeg-devel mailing list