summaryrefslogtreecommitdiff
path: root/libswscale/swscale_internal.h
diff options
context:
space:
mode:
authorClément Bœsch <u@pkh.me>2017-03-19 14:57:29 +0100
committerClément Bœsch <u@pkh.me>2017-03-20 08:02:30 +0100
commitf052b1b40f94dd89ce86330cffb8f6e4793ff203 (patch)
tree515a6bd9fed608775fd837b1eaad30ef675b6b12 /libswscale/swscale_internal.h
parent08e1376d81f380a22fc7d4c1f783e83364d4ceb6 (diff)
downloadffmpeg-f052b1b40f94dd89ce86330cffb8f6e4793ff203.tar.gz
swscale: use a function for isGray
Diffstat (limited to 'libswscale/swscale_internal.h')
-rw-r--r--libswscale/swscale_internal.h27
1 files changed, 10 insertions, 17 deletions
diff --git a/libswscale/swscale_internal.h b/libswscale/swscale_internal.h
index af82396b1c..6bcb4640ee 100644
--- a/libswscale/swscale_internal.h
+++ b/libswscale/swscale_internal.h
@@ -687,23 +687,16 @@ static av_always_inline int isRGB(enum AVPixelFormat pix_fmt)
return (desc->flags & AV_PIX_FMT_FLAG_RGB);
}
-#if 0 // FIXME
-#define isGray(x) \
- (!(av_pix_fmt_desc_get(x)->flags & AV_PIX_FMT_FLAG_PAL) && \
- av_pix_fmt_desc_get(x)->nb_components <= 2)
-#else
-#define isGray(x) \
- ((x) == AV_PIX_FMT_GRAY8 || \
- (x) == AV_PIX_FMT_YA8 || \
- (x) == AV_PIX_FMT_GRAY10BE || \
- (x) == AV_PIX_FMT_GRAY10LE || \
- (x) == AV_PIX_FMT_GRAY12BE || \
- (x) == AV_PIX_FMT_GRAY12LE || \
- (x) == AV_PIX_FMT_GRAY16BE || \
- (x) == AV_PIX_FMT_GRAY16LE || \
- (x) == AV_PIX_FMT_YA16BE || \
- (x) == AV_PIX_FMT_YA16LE)
-#endif
+static av_always_inline int isGray(enum AVPixelFormat pix_fmt)
+{
+ const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(pix_fmt);
+ av_assert0(desc);
+ return !(desc->flags & AV_PIX_FMT_FLAG_PAL) &&
+ !(desc->flags & AV_PIX_FMT_FLAG_HWACCEL) &&
+ desc->nb_components <= 2 &&
+ pix_fmt != AV_PIX_FMT_MONOBLACK &&
+ pix_fmt != AV_PIX_FMT_MONOWHITE;
+}
#define isRGBinInt(x) \
( \