[FFmpeg-devel] [PATCH 3/5] swscale: use a function for isBayer

Michael Niedermayer michael at niedermayer.cc
Sun Mar 19 17:35:12 EET 2017


On Sun, Mar 19, 2017 at 03:33:41PM +0100, Clément Bœsch wrote:
> ---
>  libswscale/swscale_internal.h | 20 ++++++--------------
>  1 file changed, 6 insertions(+), 14 deletions(-)
> 
> diff --git a/libswscale/swscale_internal.h b/libswscale/swscale_internal.h
> index 6bcb4640ee..b3bb1695fb 100644
> --- a/libswscale/swscale_internal.h
> +++ b/libswscale/swscale_internal.h
> @@ -760,20 +760,12 @@ static av_always_inline int isGray(enum AVPixelFormat pix_fmt)
>          || (x) == AV_PIX_FMT_BGR24       \
>      )
>  
> -#define isBayer(x) ( \
> -           (x)==AV_PIX_FMT_BAYER_BGGR8    \
> -        || (x)==AV_PIX_FMT_BAYER_BGGR16LE \
> -        || (x)==AV_PIX_FMT_BAYER_BGGR16BE \
> -        || (x)==AV_PIX_FMT_BAYER_RGGB8    \
> -        || (x)==AV_PIX_FMT_BAYER_RGGB16LE \
> -        || (x)==AV_PIX_FMT_BAYER_RGGB16BE \
> -        || (x)==AV_PIX_FMT_BAYER_GBRG8    \
> -        || (x)==AV_PIX_FMT_BAYER_GBRG16LE \
> -        || (x)==AV_PIX_FMT_BAYER_GBRG16BE \
> -        || (x)==AV_PIX_FMT_BAYER_GRBG8    \
> -        || (x)==AV_PIX_FMT_BAYER_GRBG16LE \
> -        || (x)==AV_PIX_FMT_BAYER_GRBG16BE \
> -    )
> +static av_always_inline int isBayer(enum AVPixelFormat pix_fmt)
> +{
> +    const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(pix_fmt);
> +    av_assert0(desc);
> +    return !strncmp(desc->name, "bayer_", 6);

iam not sure strncmp() is a good idea speed wise

[...]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Everything should be made as simple as possible, but not simpler.
-- Albert Einstein
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 181 bytes
Desc: Digital signature
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20170319/05d46642/attachment.sig>


More information about the ffmpeg-devel mailing list