Browse code

lavfi/vmafmotion: Allow more pix_fmts.

Carl Eugen Hoyos authored on 2017/10/01 04:39:08
Showing 1 changed files
... ...
@@ -261,15 +261,19 @@ int ff_vmafmotion_init(VMAFMotionData *s,
261 261
 
262 262
 static int query_formats(AVFilterContext *ctx)
263 263
 {
264
-    static const enum AVPixelFormat pix_fmts[] = {
265
-        AV_PIX_FMT_YUV444P, AV_PIX_FMT_YUV422P, AV_PIX_FMT_YUV420P,
266
-        AV_PIX_FMT_YUV444P10, AV_PIX_FMT_YUV422P10, AV_PIX_FMT_YUV420P10,
267
-        AV_PIX_FMT_NONE
268
-    };
269
-
270
-    AVFilterFormats *fmts_list = ff_make_format_list(pix_fmts);
271
-    if (!fmts_list)
272
-        return AVERROR(ENOMEM);
264
+    AVFilterFormats *fmts_list = NULL;
265
+    int format, ret;
266
+
267
+    for (format = 0; av_pix_fmt_desc_get(format); format++) {
268
+        const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(format);
269
+        if (!(desc->flags & (AV_PIX_FMT_FLAG_RGB | AV_PIX_FMT_FLAG_HWACCEL | AV_PIX_FMT_FLAG_BITSTREAM | AV_PIX_FMT_FLAG_PAL)) &&
270
+            (desc->flags & AV_PIX_FMT_FLAG_PLANAR || desc->nb_components == 1) &&
271
+            (!(desc->flags & AV_PIX_FMT_FLAG_BE) == !HAVE_BIGENDIAN || desc->comp[0].depth == 8) &&
272
+            (desc->comp[0].depth == 8 || desc->comp[0].depth == 10) &&
273
+            (ret = ff_add_format(&fmts_list, format)) < 0)
274
+            return ret;
275
+    }
276
+
273 277
     return ff_set_common_formats(ctx, fmts_list);
274 278
 }
275 279