[FFmpeg-devel] [PATCH] imgconvert: add macro pixdesc_has_alpha for checking if a pixel format has an alpha component
Stefano Sabatini
stefasab at gmail.com
Fri Mar 9 17:16:41 CET 2012
On date Thursday 2012-03-08 17:01:28 +0100, Michael Niedermayer encoded:
> On Thu, Mar 08, 2012 at 02:44:47PM +0100, Stefano Sabatini wrote:
> > Reduce redundancy and simplify.
> > ---
> > libavcodec/imgconvert.c | 21 ++++++---------------
> > 1 files changed, 6 insertions(+), 15 deletions(-)
> >
> > diff --git a/libavcodec/imgconvert.c b/libavcodec/imgconvert.c
> > index 058a0d5..0d1ce3f 100644
> > --- a/libavcodec/imgconvert.c
> > +++ b/libavcodec/imgconvert.c
> > @@ -55,9 +55,12 @@
> > #define deinterlace_line deinterlace_line_c
> > #endif
> >
> > +#define pixdesc_has_alpha(pix_desc) \
> > + (pix_desc->nb_components == 2 || pix_desc->nb_components == 4 \
> > + || pix_desc->flags & PIX_FMT_PAL)
>
> does this match is_alpha for all pix fmts ?
These are the alpha formats, after and before:
pal8
argb
rgba
abgr
bgra
yuva420p
gray8a
rgba64be
rgba64le
bgra64be
bgra64le
yuva444p
Note that this is the same trick employed in libswscale.
--
FFmpeg = Fostering & Friendly Martial Practical Evil Game
More information about the ffmpeg-devel
mailing list