avfilter/vf_extractplanes: define common 8-bit pixel formats
authorPaul B Mahol <onemda@gmail.com>
Sun, 9 Sep 2018 16:06:22 +0000 (18:06 +0200)
committerPaul B Mahol <onemda@gmail.com>
Sun, 9 Sep 2018 16:06:22 +0000 (18:06 +0200)
libavfilter/vf_extractplanes.c

index 6bce313..fc73e63 100644 (file)
@@ -64,31 +64,34 @@ static const AVOption extractplanes_options[] = {
 
 AVFILTER_DEFINE_CLASS(extractplanes);
 
+#define EIGHTBIT_FORMATS                           \
+        AV_PIX_FMT_YUV410P,                        \
+        AV_PIX_FMT_YUV411P,                        \
+        AV_PIX_FMT_YUV440P,                        \
+        AV_PIX_FMT_YUV420P, AV_PIX_FMT_YUVA420P,   \
+        AV_PIX_FMT_YUV422P, AV_PIX_FMT_YUVA422P,   \
+        AV_PIX_FMT_YUVJ420P, AV_PIX_FMT_YUVJ422P,  \
+        AV_PIX_FMT_YUVJ440P, AV_PIX_FMT_YUVJ444P,  \
+        AV_PIX_FMT_YUVJ411P,                       \
+        AV_PIX_FMT_YUV444P, AV_PIX_FMT_YUVA444P,   \
+        AV_PIX_FMT_GRAY8, AV_PIX_FMT_GRAY8A,       \
+        AV_PIX_FMT_RGB24, AV_PIX_FMT_BGR24,        \
+        AV_PIX_FMT_RGBA, AV_PIX_FMT_BGRA,          \
+        AV_PIX_FMT_ARGB, AV_PIX_FMT_ABGR,          \
+        AV_PIX_FMT_RGB0, AV_PIX_FMT_BGR0,          \
+        AV_PIX_FMT_0RGB, AV_PIX_FMT_0BGR,          \
+        AV_PIX_FMT_GBRP, AV_PIX_FMT_GBRAP
+
 static int query_formats(AVFilterContext *ctx)
 {
     static const enum AVPixelFormat in_pixfmts_le[] = {
-        AV_PIX_FMT_YUV410P,
-        AV_PIX_FMT_YUV411P,
-        AV_PIX_FMT_YUV440P,
-        AV_PIX_FMT_YUV420P, AV_PIX_FMT_YUVA420P,
-        AV_PIX_FMT_YUV422P, AV_PIX_FMT_YUVA422P,
-        AV_PIX_FMT_YUVJ420P, AV_PIX_FMT_YUVJ422P,
-        AV_PIX_FMT_YUVJ440P, AV_PIX_FMT_YUVJ444P,
-        AV_PIX_FMT_YUVJ411P,
-        AV_PIX_FMT_YUV444P, AV_PIX_FMT_YUVA444P,
+        EIGHTBIT_FORMATS,
+        AV_PIX_FMT_YA16LE, AV_PIX_FMT_GRAY16LE,
         AV_PIX_FMT_YUV420P16LE, AV_PIX_FMT_YUVA420P16LE,
         AV_PIX_FMT_YUV422P16LE, AV_PIX_FMT_YUVA422P16LE,
         AV_PIX_FMT_YUV444P16LE, AV_PIX_FMT_YUVA444P16LE,
-        AV_PIX_FMT_GRAY8, AV_PIX_FMT_GRAY8A,
-        AV_PIX_FMT_YA16LE, AV_PIX_FMT_GRAY16LE,
-        AV_PIX_FMT_RGB24, AV_PIX_FMT_BGR24,
-        AV_PIX_FMT_RGBA, AV_PIX_FMT_BGRA,
-        AV_PIX_FMT_ARGB, AV_PIX_FMT_ABGR,
-        AV_PIX_FMT_RGB0, AV_PIX_FMT_BGR0,
-        AV_PIX_FMT_0RGB, AV_PIX_FMT_0BGR,
         AV_PIX_FMT_RGB48LE, AV_PIX_FMT_BGR48LE,
         AV_PIX_FMT_RGBA64LE, AV_PIX_FMT_BGRA64LE,
-        AV_PIX_FMT_GBRP, AV_PIX_FMT_GBRAP,
         AV_PIX_FMT_GBRP16LE, AV_PIX_FMT_GBRAP16LE,
         AV_PIX_FMT_YUV420P10LE,
         AV_PIX_FMT_YUV422P10LE,
@@ -117,28 +120,13 @@ static int query_formats(AVFilterContext *ctx)
         AV_PIX_FMT_NONE,
     };
     static const enum AVPixelFormat in_pixfmts_be[] = {
-        AV_PIX_FMT_YUV410P,
-        AV_PIX_FMT_YUV411P,
-        AV_PIX_FMT_YUV440P,
-        AV_PIX_FMT_YUV420P, AV_PIX_FMT_YUVA420P,
-        AV_PIX_FMT_YUV422P, AV_PIX_FMT_YUVA422P,
-        AV_PIX_FMT_YUVJ420P, AV_PIX_FMT_YUVJ422P,
-        AV_PIX_FMT_YUVJ440P, AV_PIX_FMT_YUVJ444P,
-        AV_PIX_FMT_YUVJ411P,
-        AV_PIX_FMT_YUV444P, AV_PIX_FMT_YUVA444P,
+        EIGHTBIT_FORMATS,
+        AV_PIX_FMT_YA16BE, AV_PIX_FMT_GRAY16BE,
         AV_PIX_FMT_YUV420P16BE, AV_PIX_FMT_YUVA420P16BE,
         AV_PIX_FMT_YUV422P16BE, AV_PIX_FMT_YUVA422P16BE,
         AV_PIX_FMT_YUV444P16BE, AV_PIX_FMT_YUVA444P16BE,
-        AV_PIX_FMT_GRAY8, AV_PIX_FMT_GRAY8A,
-        AV_PIX_FMT_YA16BE, AV_PIX_FMT_GRAY16BE,
-        AV_PIX_FMT_RGB24, AV_PIX_FMT_BGR24,
-        AV_PIX_FMT_RGBA, AV_PIX_FMT_BGRA,
-        AV_PIX_FMT_ARGB, AV_PIX_FMT_ABGR,
-        AV_PIX_FMT_RGB0, AV_PIX_FMT_BGR0,
-        AV_PIX_FMT_0RGB, AV_PIX_FMT_0BGR,
         AV_PIX_FMT_RGB48BE, AV_PIX_FMT_BGR48BE,
         AV_PIX_FMT_RGBA64BE, AV_PIX_FMT_BGRA64BE,
-        AV_PIX_FMT_GBRP, AV_PIX_FMT_GBRAP,
         AV_PIX_FMT_GBRP16BE, AV_PIX_FMT_GBRAP16BE,
         AV_PIX_FMT_YUV420P10BE,
         AV_PIX_FMT_YUV422P10BE,