diff mbox series

[FFmpeg-devel,v2,3/3] avfilter/vf_bwdif_vulkan: consider chroma subsampling when enforcing minimum dimensions

Message ID 0101018c1d9c6bcb-6f87bd45-efc7-41f2-ac24-450704936b41-000000@us-west-2.amazonses.com
State New
Headers show
Series consider chroma subsampling for bwdif (including CUDA and Vulkan) | expand

Checks

Context Check Description
andriy/make_x86 success Make finished
andriy/make_fate_x86 success Make fate finished

Commit Message

Cosmin Stejerean Nov. 30, 2023, 12:23 a.m. UTC
From: Cosmin Stejerean <cosmin@cosmin.at>

Signed-off-by: Cosmin Stejerean <cosmin@cosmin.at>
---
 libavfilter/vf_bwdif_vulkan.c | 14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)
diff mbox series

Patch

diff --git a/libavfilter/vf_bwdif_vulkan.c b/libavfilter/vf_bwdif_vulkan.c
index 690a89c4ba..6a886d11ac 100644
--- a/libavfilter/vf_bwdif_vulkan.c
+++ b/libavfilter/vf_bwdif_vulkan.c
@@ -362,13 +362,19 @@  static int bwdif_vulkan_config_output(AVFilterLink *outlink)
         outlink->frame_rate = av_mul_q(avctx->inputs[0]->frame_rate,
                                        (AVRational){2, 1});
 
-    if (outlink->w < 4 || outlink->h < 4) {
-        av_log(avctx, AV_LOG_ERROR, "Video of less than 4 columns or lines is not "
-               "supported\n");
+    const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(vkctx->frames->sw_format);
+
+    int h = link->h;
+    int w = link->w;
+    int h_chroma = AV_CEIL_RSHIFT(h, desc->log2_chroma_h);
+    int w_chroma = AV_CEIL_RSHIFT(w, desc->log2_chroma_w);
+
+    if (w < 4 || w_chroma < 4 || h < 4 || h_chroma < 4) {
+        av_log(ctx, AV_LOG_ERROR, "Video with planes less than 4 columns or lines is not supported\n");
         return AVERROR(EINVAL);
     }
 
-    y->csp = av_pix_fmt_desc_get(vkctx->frames->sw_format);
+    y->csp = desc;
     y->filter = bwdif_vulkan_filter_frame;
 
     return init_filter(avctx);