[FFmpeg-devel] [PATCH] avfilter/vf_bwdif: consider chroma subsampling when enforcing minimum dimensions

Cosmin Stejerean cosmin at cosmin.at
Sat Nov 25 22:39:44 EET 2023


Fixes #10688

Signed-off-by: Cosmin Stejerean <cosmin at cosmin.at>
---
 libavfilter/vf_bwdif.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/libavfilter/vf_bwdif.c b/libavfilter/vf_bwdif.c
index 137cd5ef13..bce11c39f7 100644
--- a/libavfilter/vf_bwdif.c
+++ b/libavfilter/vf_bwdif.c
@@ -197,6 +197,18 @@ static int config_props(AVFilterLink *link)
     }
 
     yadif->csp = av_pix_fmt_desc_get(link->format);
+
+    if (yadif->csp->nb_components > 1) {
+        int w_chroma, h_chroma;
+        h_chroma = AV_CEIL_RSHIFT(link->h, yadif->csp->log2_chroma_h);
+        w_chroma = AV_CEIL_RSHIFT(link->w, yadif->csp->log2_chroma_w);
+
+        if (w_chroma < 3 || h_chroma < 4) {
+            av_log(ctx, AV_LOG_ERROR, "Video with planes less than 3 columns or 4 lines is not supported\n");
+            return AVERROR(EINVAL);
+        }
+    }
+
     yadif->filter = filter;
     ff_bwdif_init_filter_line(&s->dsp, yadif->csp->comp[0].depth);
 
-- 
2.39.2 (Apple Git-143)



More information about the ffmpeg-devel mailing list