From patchwork Mon Mar 14 21:06:01 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marton Balint X-Patchwork-Id: 34736 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6838:3486:0:0:0:0 with SMTP id ek6csp2497331nkb; Mon, 14 Mar 2022 14:06:29 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxt+hXPoWf44K3sz11if1XU5a5VaElOcdqVQ9n+jpN/wLWhv1lLW1YN/w14gOgIeHCmBOA4 X-Received: by 2002:a17:906:9ad4:b0:6d6:e972:a9e9 with SMTP id ah20-20020a1709069ad400b006d6e972a9e9mr20111445ejc.669.1647291989648; Mon, 14 Mar 2022 14:06:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1647291989; cv=none; d=google.com; s=arc-20160816; b=xwvBGowL6e4zIA5btr61xidPtYPxZNql7fj+wotwHCg4M2L4Sn+rAsJAEUHI8Y6tRy WDeTro8vw37trIWQ17IERrZ3SXSBmhjI5gL4po3l8eExPYSiIVUUBxWVFMVQmxBPqPKU oyq9H1JbKUdT+FbQTvCECmEkahO9V4sjK0xi/Kh8PEANbfDCshn9+l9TRXZjBJlh8MOY 6RiPv/qDqyfqWVwuQmg9NRv8G9OUzESYt3BTG3GLxQSLrO/9uegFg4oJKMMQEcPyQUsF CrXubfN3Gz/dK2dwkDGYUzchKpTLeJUZUYw9KIOWNpxALKb9Gkm2+SS5wWSpQNmvv8dk lqtw== 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 :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:mime-version:references:in-reply-to :message-id:date:to:from:delivered-to; bh=xOxQngoMcCyS3BDwg2k8KG81KorXwHAkSOW8aJDj/MU=; b=tIDAwlJ1dnxMxNk+LfQ45i0p8lyScrLQCiUoA7MzKGXVzoGisUUzTEKo3nsslPart2 xgBT/mpXl2o0KmeHph5o5q7HqJoyqsnZfVQoZyeIB5fuiCzja3gufLYOogsQD+u9lrl7 U/aQWBMeEELxB7Yfsg5h9u1pYsZ091aGQ80gLVs4Fvf0Yls/D59+keVEy067zkmayAJQ Vbj/sMg3LAMDcYsfH/1sKHJF8trgW8AnzMhe9uS6c11LNyMSakSu6/RIntXt+EkDMw0J L3BN2NucFLwkkwMyI6dt2boRu0YQ0mhBFXYwAT4BcnhvHIQk4Z7orx4YoCswtitXamgB Jp5g== 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 nc24-20020a1709071c1800b006da825b1354si11946223ejc.766.2022.03.14.14.06.29; Mon, 14 Mar 2022 14:06:29 -0700 (PDT) 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 5F30768B0AE; Mon, 14 Mar 2022 23:06:18 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from iq.passwd.hu (iq.passwd.hu [217.27.212.140]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 7213F68ADDE for ; Mon, 14 Mar 2022 23:06:12 +0200 (EET) Received: from localhost (localhost [127.0.0.1]) by iq.passwd.hu (Postfix) with ESMTP id CF401E67E3; Mon, 14 Mar 2022 22:06:12 +0100 (CET) X-Virus-Scanned: amavisd-new at passwd.hu Received: from iq.passwd.hu ([127.0.0.1]) by localhost (iq.passwd.hu [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id C4jtZHfFdJ0p; Mon, 14 Mar 2022 22:06:10 +0100 (CET) Received: from bluegene.passwd.hu (localhost [127.0.0.1]) by iq.passwd.hu (Postfix) with ESMTP id BB9A2E67D9; Mon, 14 Mar 2022 22:06:10 +0100 (CET) From: Marton Balint To: ffmpeg-devel@ffmpeg.org Date: Mon, 14 Mar 2022 22:06:01 +0100 Message-Id: <20220314210603.23870-2-cus@passwd.hu> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20220314210603.23870-1-cus@passwd.hu> References: <20220314210603.23870-1-cus@passwd.hu> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 2/4] avfilter/vf_zscale: fix number of threads 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: , Reply-To: FFmpeg development discussions and patches Cc: Marton Balint Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: TXWwulKWfVUW Make sure it is between [1, MAX_THERADS] and also take into account the outlink size in order not to request zero height output from zscale. Signed-off-by: Marton Balint --- libavfilter/vf_zscale.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavfilter/vf_zscale.c b/libavfilter/vf_zscale.c index bb457423b3..bab87b0c94 100644 --- a/libavfilter/vf_zscale.c +++ b/libavfilter/vf_zscale.c @@ -799,7 +799,7 @@ static int filter_frame(AVFilterLink *link, AVFrame *in) link->dst->inputs[0]->w = in->width; link->dst->inputs[0]->h = in->height; - s->nb_threads = FFMIN(ff_filter_get_nb_threads(ctx), link->h / 8); + s->nb_threads = av_clip(FFMIN(ff_filter_get_nb_threads(ctx), FFMIN(link->h, outlink->h) / 8), 1, MAX_THREADS); s->in_colorspace = in->colorspace; s->in_trc = in->color_trc; s->in_primaries = in->color_primaries;