From patchwork Sat Nov 25 20:39:44 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Cosmin Stejerean X-Patchwork-Id: 44794 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:bca6:b0:181:818d:5e7f with SMTP id fx38csp2349205pzb; Sat, 25 Nov 2023 12:39:57 -0800 (PST) X-Google-Smtp-Source: AGHT+IGFiqN41E0zUF/iOhUtZjOuIMDHNqKxO0waKxOxliDOpgPB6eqwZP9HXVa62IEv2CIl/oij X-Received: by 2002:a05:6402:31e5:b0:54a:f8e9:a9a8 with SMTP id dy5-20020a05640231e500b0054af8e9a9a8mr4738273edb.20.1700944797463; Sat, 25 Nov 2023 12:39:57 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1700944797; cv=none; d=google.com; s=arc-20160816; b=kKyfKtYrMmr+tT2ifHxHEbsayTINDXI9XgWpCiS1DhkFRnFfDjCx4e9lVF/xS8wTLr ySKpcRB36SH4Wz8KqRtQ5A5sCOP9N/lYsbEkwxBtGJJd7M14ZDamVDTpSlLlAHlZxvC5 +fvbVRS5JfeXDMtoTktndLGN7vx48inmAlTLk+rCAjbzTuWF7HW06J+d97uqdxpKPSWM nLI/wRYrKQmyJuystB+nBmyCAvvGUnY0/7lbiDebihPm+GaaUCWSaqvyveRbWNGAwjHt 77F1QITYrOz4lslWRq66jaducbh3zkmXZWTRZ2oio0U+Mo8gohiHF6xRD5BA7pGVnSW+ 1nKQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:cc:reply-to:from :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:feedback-id:message-id:thread-topic :thread-index:references:mime-version:date:to:delivered-to; bh=ZhUW070rFXQJCPjXfGQqY0lQ7AWl8lReMIqw09pRgjU=; fh=CBS/D0cB4KwqFBY8d8UQ4TY1w6HZ9TulitLE+VqI2+k=; b=ehb1bR0Hd4oowxcFoqOC/CvrEvOfcZgDLfzQDlRGXEKfFPHFus2yvb86ryGEyHVHYp KuFPuefUa+V2exyJWK2bBvinL+plGzsmzfrgEvfsD67ltwKavXj3+N2/lhw7NAppz/1v VaU+pKAP9Ieuv3Tg8I7952AYIyL81ebHeCOOZLsW6bHCosmlTeVF9HsW0D4UOXe+1dBW GqkbmROEPWTIl4Kej2uyt3VYHznueNmtS3vxYPuIbi+dZ1xt9GSOubW80w1npbFxE4y5 hUiylg6x0jpO0YJ16QpyDj2rCH3+eU7/A6t5aSDli9+MBDzehd6kkYQB2TTSVWtFh7yK JoAg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id t22-20020a508d56000000b0054b2daa94d6si653516edt.344.2023.11.25.12.39.57; Sat, 25 Nov 2023 12:39:57 -0800 (PST) Received-SPF: pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) client-ip=79.124.17.100; Authentication-Results: mx.google.com; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 6F00568CF49; Sat, 25 Nov 2023 22:39:54 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from a27-90.smtp-out.us-west-2.amazonses.com (a27-90.smtp-out.us-west-2.amazonses.com [54.240.27.90]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id CEA9B68CDE8 for ; Sat, 25 Nov 2023 22:39:47 +0200 (EET) To: =?utf-8?q?ffmpeg-devel=40ffmpeg=2Eorg?= Date: Sat, 25 Nov 2023 20:39:44 +0000 Mime-Version: 1.0 References: <20231125203938.76291-1-cosmin@cosmin.at> X-Mailer: Amazon WorkMail Thread-Index: AQHaH9+EBd6OPQxuS2qbEwznaRUqRQ== Thread-Topic: [PATCH] avfilter/vf_bwdif: consider chroma subsampling when enforcing minimum dimensions X-Original-Mailer: git-send-email 2.39.2 (Apple Git-143) X-Wm-Sent-Timestamp: 1700944783 Message-ID: <0101018c0835aafa-0a570ead-e0fc-4e1f-98c1-cf44ae96b7c3-000000@us-west-2.amazonses.com> Feedback-ID: 1.us-west-2.An468LAV0jCjQDrDLvlZjeAthld7qrhZr+vow8irkvU=:AmazonSES X-SES-Outgoing: 2023.11.25-54.240.27.90 Subject: [FFmpeg-devel] [PATCH] avfilter/vf_bwdif: consider chroma subsampling when enforcing minimum dimensions X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: FFmpeg development discussions and patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Cosmin Stejerean via ffmpeg-devel From: Cosmin Stejerean Reply-To: FFmpeg development discussions and patches Cc: =?utf-8?q?Cosmin_Stejerean?= Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: OyZK0JnI17bO Fixes #10688 Signed-off-by: Cosmin Stejerean --- 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);