From patchwork Sun Jun 18 11:17:08 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Niklas Haas X-Patchwork-Id: 42192 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:be15:b0:121:b37c:e101 with SMTP id ge21csp56841pzb; Sun, 18 Jun 2023 04:21:38 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7Pc5SHkeD0vTaKZlgpN7wQI1k5zG0XorRwTgYwq4Ia23VCDuxgcZ61T7lLgT8juuaZZ+vU X-Received: by 2002:a17:907:c1f:b0:973:d857:9a33 with SMTP id ga31-20020a1709070c1f00b00973d8579a33mr6690419ejc.11.1687087298098; Sun, 18 Jun 2023 04:21:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1687087298; cv=none; d=google.com; s=arc-20160816; b=iQL1Z7kh20vbFPXvT08Dx0H4UFL8Iqzg/OOM2JvUH8ZvmkNn0vDQVNi6T4A2OTzHBJ CM7tcWUNIn/t8fkyggNs3eVYWAB+8J0gpVV5+0oPe6K3YsLjdcSTcCogmfy8HfdNf8hR QRRBYsh3/ZupQZDnkAxL5wIjD5ccQ4PoADq/ETQ2Eh9FwstaNRCiPgMAigvgIPyvjLuc F3TQqvCA0ySwot+/Aa6uywaGNVXMh6HvDnbcAUJYmBFWZraCGkfd8o8eGdRTGYNANQqS flRRc85Gs5rjf7dnnukf57dLJyqtEUo2wOsgot6qQDbVrpgsBElO6skKrMUpGIj+GqYO e0hg== 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:dkim-signature:delivered-to; bh=FHRGzCHH/13W3wtinwDJogc8p3G2qhJkgqP4hBMbLbc=; b=zcUxxlRV8d7DbimR11ZwqAhIobCUwA3r+NMYAlQ7ffEKb5dgTQvizj0y4wH5QKYWje JSLR+cC290hd9D70FFZWUfmNEELAfACnpl22GeGFh81sfFU8Sxh9XA69GSUzqwWPXztD UJ1zBkI63HbmXPR9L6HybnMd2GZvl+GjzqxPf12kc8RBS5SWONAup0bUQrfj2buGB2Gf 5S+8kT33vOEPOsQfLMLNq5PLk1z5u4ayDZuWboRdFlWTQ1XGwE7Dsn9UqYPPnRSfHzu4 HgavUO5SJiW0lppedPtli23K+7ebuc4as5cIpdSSDkzJVYFE7Fu7xX1mNi5Ujxhj3rQe o9DA== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@haasn.xyz header.s=mail header.b=mdd+S+j9; 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 z3-20020aa7d403000000b005187910e766si7288425edq.191.2023.06.18.04.21.37; Sun, 18 Jun 2023 04:21:38 -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; dkim=neutral (body hash did not verify) header.i=@haasn.xyz header.s=mail header.b=mdd+S+j9; 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 AFE4668C0C1; Sun, 18 Jun 2023 14:20:22 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from haasn.dev (haasn.dev [78.46.187.166]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 18CDA68BFB2 for ; Sun, 18 Jun 2023 14:20:16 +0300 (EEST) Received: from haasn.dev (unknown [10.30.0.2]) by haasn.dev (Postfix) with ESMTP id 4A7284B7DD; Sun, 18 Jun 2023 13:20:12 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=haasn.xyz; s=mail; t=1687087212; bh=7XkGtk2CzxnJDD/ie7anlTg7yXlwKqsQndTSWPpr0gE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=mdd+S+j9AkyWiWKTHsVxycU+cWTo6Jhj349ky2hYD0s4fGXrkJciwi3RLwD+GTl+j c/qRTJ9vnNA89Lz6V0TLMFGd2nLtD3U55/tiZyC824h61Vb7jC18mY+6HYKPzHnSye exgPTiyvrdXe+26DFYMiRdE0b3PIGPxtgMY5QGDs= From: Niklas Haas To: ffmpeg-devel@ffmpeg.org Date: Sun, 18 Jun 2023 13:17:08 +0200 Message-ID: <20230618111955.40994-18-ffmpeg@haasn.xyz> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230618111955.40994-2-ffmpeg@haasn.xyz> References: <20230618111955.40994-2-ffmpeg@haasn.xyz> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH v2 16/22] lavfi/vf_libplacebo: make input-dependent vars dynamic 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: Niklas Haas Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: ZNFOHM0MXpUX From: Niklas Haas Because these can differ based on the input, for multiple inputs. --- libavfilter/vf_libplacebo.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/libavfilter/vf_libplacebo.c b/libavfilter/vf_libplacebo.c index 6399aae0c67..a3a034766e2 100644 --- a/libavfilter/vf_libplacebo.c +++ b/libavfilter/vf_libplacebo.c @@ -741,6 +741,11 @@ static void update_crops(AVFilterContext *ctx, LibplaceboInput *in, double image_pts = src->pts * av_q2d(in->link->time_base); /* Update dynamic variables */ + s->var_values[VAR_IN_W] = s->var_values[VAR_IW] = in->link->w; + s->var_values[VAR_IN_H] = s->var_values[VAR_IH] = in->link->h; + s->var_values[VAR_A] = (double) in->link->w / in->link->h; + s->var_values[VAR_SAR] = in->link->sample_aspect_ratio.num ? + av_q2d(in->link->sample_aspect_ratio) : 1.0; s->var_values[VAR_IN_T] = s->var_values[VAR_T] = image_pts; s->var_values[VAR_OUT_T] = s->var_values[VAR_OT] = target_pts; s->var_values[VAR_N] = ctx->outputs[0]->frame_count_out; @@ -1193,13 +1198,8 @@ static int libplacebo_config_output(AVFilterLink *outlink) } /* Static variables */ - s->var_values[VAR_IN_W] = s->var_values[VAR_IW] = inlink->w; - s->var_values[VAR_IN_H] = s->var_values[VAR_IH] = inlink->h; s->var_values[VAR_OUT_W] = s->var_values[VAR_OW] = outlink->w; s->var_values[VAR_OUT_H] = s->var_values[VAR_OH] = outlink->h; - s->var_values[VAR_A] = (double) inlink->w / inlink->h; - s->var_values[VAR_SAR] = inlink->sample_aspect_ratio.num ? - av_q2d(inlink->sample_aspect_ratio) : 1.0; s->var_values[VAR_DAR] = outlink->sample_aspect_ratio.num ? av_q2d(outlink->sample_aspect_ratio) : 1.0; s->var_values[VAR_HSUB] = 1 << desc->log2_chroma_w;