From 7faa2be248b5a2cbb54314983e2305b62906e0aa Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Cl=C3=A9ment=20B=C5=93sch?= <u@pkh.me>
Date: Sun, 19 Mar 2017 15:04:53 +0100
Subject: [PATCH 4/6] swscale: use a function for isBayer
---
libswscale/swscale_internal.h | 20 ++++++--------------
1 file changed, 6 insertions(+), 14 deletions(-)
@@ -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) \
( \
--
2.12.0