[FFmpeg-cvslog] swscale: use a function for isBayer

Clément Bœsch git at videolan.org
Mon Mar 20 09:06:24 EET 2017


ffmpeg | branch: master | Clément Bœsch <u at pkh.me> | Sun Mar 19 15:04:53 2017 +0100| [c30875e8b2bd785ff02cbc828295f583ccc488c6] | committer: Clément Bœsch

swscale: use a function for isBayer

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=c30875e8b2bd785ff02cbc828295f583ccc488c6
---

 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 6bcb464..3413074 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 !!(desc->flags & AV_PIX_FMT_FLAG_BAYER);
+}
 
 #define isAnyRGB(x) \
     (           \



More information about the ffmpeg-cvslog mailing list