From patchwork Sun Jun 18 11:17:00 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Niklas Haas X-Patchwork-Id: 42198 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:be15:b0:121:b37c:e101 with SMTP id ge21csp57185pzb; Sun, 18 Jun 2023 04:22:38 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5ijJn6UV4v8S4mIXSTOjEv86I60BrPPLHr2/coo33wZjzv9IqdRK9BvGGz63agXeLCaVyL X-Received: by 2002:a17:907:944e:b0:987:1c6b:6e6d with SMTP id dl14-20020a170907944e00b009871c6b6e6dmr4093285ejc.28.1687087358463; Sun, 18 Jun 2023 04:22:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1687087358; cv=none; d=google.com; s=arc-20160816; b=KMb5qy/YmDNTRFUvQNeSBmKEKvRBqTaE7DFXZP2sNYQ9wXIP6Z9PEsgZFjVBaOcwdV ahTIcHWn5xe8K2lz1OcU7O9v4eBl3VeI0mTCYjyzMqkEuZGCUKiIAUJm4H2HWmPx5xz5 pkK/hjMqNNXHLdbT1NXbFfO9BxOxt1E1cJLJedUGojyQMGZjjGZPOVR+iUYEdl97MM2g HjU3KCKlhWAkmFLQa/WpnttXuw/yMq8XhthBxH0f6BG+Rf1UfnszFkDsKwsbmVIp+O8O ISEE+7SML6U5KinUWH6ZeJ2boiBerixkSVASkqOhERlh1zbdssfgQRzr51lJFvmV7W1v 9/kw== 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=nTJEpYA9urqGhr8v0udbeQ7foRi4bPpTPh8lE1xqLUU=; b=B2giG28SR7s+OmczSRvjkmEwr5j/vE0tGwo8MzCiFLlpZUBu33JgnySHUz91gv4UVC 8YaLFkGKi8nNic36NNDali6zGyAg3p7nc7fGRrVzx6vppbtWCaiOs5drsN0fUtMTDsWj 5knxZ4Qyhs6kujd0UiIRD+uQqFV1iYzFbLt6+e1x28kZI1PQYSQ4X3dJcbJLESX7xsrF aOoQ7f0aU2vHE4YMrtye21dsJfjsrX9K/2gQzaaJxrHl9tCRm7AQf3eq7sajV0NkxSMX 3yWAx+BOQGxmojm0z/PKdncqdeSf5Mi16MQFq2DkbG9CMiheWaL0skUY+Ykqwnp5EU9M XekQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@haasn.xyz header.s=mail header.b=VSuHppsK; 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 jp23-20020a170906f75700b00988a13c6a90si61902ejb.601.2023.06.18.04.22.38; Sun, 18 Jun 2023 04:22: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=VSuHppsK; 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 386F068C1CC; Sun, 18 Jun 2023 14:20:29 +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 D979168C047 for ; Sun, 18 Jun 2023 14:20:13 +0300 (EEST) Received: from haasn.dev (unknown [10.30.0.2]) by haasn.dev (Postfix) with ESMTP id 4FAB84A5A4; Sun, 18 Jun 2023 13:20:10 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=haasn.xyz; s=mail; t=1687087210; bh=y04IUW3cL1HARAjFcGEpSVoByb8wtEQGdTjIVyyeVJE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=VSuHppsKtylF3TsO4zCIZG2rnPJDJhXT/8lbdO8d+skO+WS3ycvQ7jRm3NMx6+cxr vQSYpkfJmd4XMcArmUKyRK6uSft6U9z45f7oW4CiOTazGhLYmFKFw7qaMkeDal85ay pXGR72GnqhE2AMDN2BfOe3OXh6yIUl3ePpfjNhoM= From: Niklas Haas To: ffmpeg-devel@ffmpeg.org Date: Sun, 18 Jun 2023 13:17:00 +0200 Message-ID: <20230618111955.40994-10-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 08/22] lavfi/vf_libplacebo: use correct link in update_crops() 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: OpfadqKymBI4 From: Niklas Haas Instead of hard-coding input 0, pass the per-input structure and use the link contained inside it. --- libavfilter/vf_libplacebo.c | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/libavfilter/vf_libplacebo.c b/libavfilter/vf_libplacebo.c index b83df24a84b..408fb3918aa 100644 --- a/libavfilter/vf_libplacebo.c +++ b/libavfilter/vf_libplacebo.c @@ -715,19 +715,18 @@ static const AVFrame *ref_frame(const struct pl_frame_mix *mix) return NULL; } -static void update_crops(AVFilterContext *ctx, - struct pl_frame_mix *mix, struct pl_frame *target, - double target_pts) +static void update_crops(AVFilterContext *ctx, LibplaceboInput *in, + struct pl_frame *target, double target_pts) { LibplaceboContext *s = ctx->priv; - const AVFrame *ref = ref_frame(mix); + const AVFrame *ref = ref_frame(&in->mix); - for (int i = 0; i < mix->num_frames; i++) { + for (int i = 0; i < in->mix.num_frames; i++) { // Mutate the `pl_frame.crop` fields in-place. This is fine because we // own the entire pl_queue, and hence, the pointed-at frames. - struct pl_frame *image = (struct pl_frame *) mix->frames[i]; + struct pl_frame *image = (struct pl_frame *) in->mix.frames[i]; const AVFrame *src = pl_get_mapped_avframe(image); - double image_pts = src->pts * av_q2d(ctx->inputs[0]->time_base); + double image_pts = src->pts * av_q2d(in->link->time_base); /* Update dynamic variables */ s->var_values[VAR_IN_T] = s->var_values[VAR_T] = image_pts; @@ -851,7 +850,7 @@ static int output_frame(AVFilterContext *ctx, int64_t pts) goto fail; } - update_crops(ctx, &in->mix, &target, out->pts * av_q2d(outlink->time_base)); + update_crops(ctx, in, &target, out->pts * av_q2d(outlink->time_base)); pl_render_image_mix(in->renderer, &in->mix, &target, &s->params); if (outdesc->flags & AV_PIX_FMT_FLAG_HWACCEL) {