From patchwork Sun Jun 18 11:16:58 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Niklas Haas X-Patchwork-Id: 42189 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:be15:b0:121:b37c:e101 with SMTP id ge21csp56649pzb; Sun, 18 Jun 2023 04:21:11 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ479QvzOazGVrfv6EfgeEkegvVKbFVBNqydr07uYgKDLkoTelHev+x9M/RLcXMZx+SA6/Ji X-Received: by 2002:a17:906:4fc5:b0:96f:d556:b926 with SMTP id i5-20020a1709064fc500b0096fd556b926mr5884444ejw.77.1687087271220; Sun, 18 Jun 2023 04:21:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1687087271; cv=none; d=google.com; s=arc-20160816; b=pfrRd4KFAztiRv122Aiq5kTYjyAsyoBIcwMxqaq7WElSzpra4aFGcZ3URehA2PDwjw Moudqfl1Iz18wXkuemhjvp0kBjiNv4X2WUnid9mxmSDl+ilOw6rarGmdPaNBp7alJwdV XeIl8AI6ovUCaBWzFcWOgcwFqHdeieoYf3SefQtSCPfobeTvnazHJyPr+YdWQtJAXOjl oRqgkjFCDF9jOtSvu2pr60dVJvJhPBDf0TvRYVlk9cLNY10/TxxPkDc4fY1VYYod0KUn Nt+vs1ZeVOoYfgY0+H/W2q7h0WRHZn/yrpGMvzTQjxIyP+DnrFkhOnYWCtEHQ62xxB2d ScLw== 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=QItjZLjxaEeYRRaRD3GQc4Ps/qR0RIDkOUKl4uSvKXI=; b=GDKHMODGWVgV1YGpmYZPm4v72z0IJgD/LqP7/9Z9Mf1IK8S88NaJkc+TBeBRQlmlYj 2zpzb/AphqqiA6LaOPWwsY4+MNXLMLU6tzx21nl5iFkMRzJpqTHfd6j/S5i5ZEu32hDu 0+ahWqXu65T03a9GF/CXGDfNXhKdKOJKok6xZl6vGi5NuNKK3NsurmqItTbIb4patHx+ luaEm/iy2iFWWvFiq5qTF9AyA8lJVWAql59jEVfOyZyuS1hvCFHWDA9oHXnCiL10v+gu lBd7w+RuSMZS51As6Q223pr0mRw+uG/CCYJpAAw1kyjvrDj8LqcVmGn/fbHIRtFYtDd4 Vfew== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@haasn.xyz header.s=mail header.b=DHNZw2Tr; 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 r8-20020a170906350800b0098886e6c322si399350eja.915.2023.06.18.04.21.10; Sun, 18 Jun 2023 04:21:11 -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=DHNZw2Tr; 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 BC45F68C08C; Sun, 18 Jun 2023 14:20:19 +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 D18FF68BFA9 for ; Sun, 18 Jun 2023 14:20:10 +0300 (EEST) Received: from haasn.dev (unknown [10.30.0.2]) by haasn.dev (Postfix) with ESMTP id BCA7743FC3; Sun, 18 Jun 2023 13:20:09 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=haasn.xyz; s=mail; t=1687087209; bh=zv97IvB3Ya9Sgjx532DMpkfE+Nb2vtS35mkCKDfGoZ0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=DHNZw2TrP3BZWE+S7HQmcs9UBdq4XynAeRU4NdeW01fgIhNL/K/L/315wz4cjLgM9 a/GVEY6lMkhLQB2JV0FsG6CRnaD++dqz0nOhSY38Uo6fL6RKMcpGpzh7owUu3Ee47E HVacFyjCZQBH0533guMRFVFLx57F1wYbUsTot3t0= From: Niklas Haas To: ffmpeg-devel@ffmpeg.org Date: Sun, 18 Jun 2023 13:16:58 +0200 Message-ID: <20230618111955.40994-8-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 06/22] lavif/vf_libplacebo: remove pl_frame_mix from output_frame_mix 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: 4CqeVZ0C7XPb From: Niklas Haas Instead, rename this function to `output_frame` and make it pull the `pl_frame_mix` from the input structure. Step towards handling multiple inputs. --- libavfilter/vf_libplacebo.c | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/libavfilter/vf_libplacebo.c b/libavfilter/vf_libplacebo.c index 4baa766bacf..0289187b46b 100644 --- a/libavfilter/vf_libplacebo.c +++ b/libavfilter/vf_libplacebo.c @@ -760,20 +760,19 @@ static void update_crops(AVFilterContext *ctx, } } -/* Construct and emit an output frame for a given frame mix */ -static int output_frame_mix(AVFilterContext *ctx, - struct pl_frame_mix *mix, - int64_t pts) +/* Construct and emit an output frame for a given timestamp */ +static int output_frame(AVFilterContext *ctx, int64_t pts) { int err = 0, ok, changed_csp; LibplaceboContext *s = ctx->priv; + LibplaceboInput *in = &s->input; AVFilterLink *outlink = ctx->outputs[0]; const AVPixFmtDescriptor *outdesc = av_pix_fmt_desc_get(outlink->format); struct pl_frame target; const AVFrame *ref; AVFrame *out; uint64_t ref_sig; - if (!mix->num_frames) + if (!in->mix.num_frames) return 0; out = ff_get_video_buffer(outlink, outlink->w, outlink->h); @@ -781,11 +780,11 @@ static int output_frame_mix(AVFilterContext *ctx, return AVERROR(ENOMEM); /* Use the last frame before current PTS value as reference */ - for (int i = 0; i < mix->num_frames; i++) { - if (i && mix->timestamps[i] > 0.0f) + for (int i = 0; i < in->mix.num_frames; i++) { + if (i && in->mix.timestamps[i] > 0.0f) break; - ref = pl_get_mapped_avframe(mix->frames[i]); - ref_sig = mix->signatures[i]; + ref = pl_get_mapped_avframe(in->mix.frames[i]); + ref_sig = in->mix.signatures[i]; } RET(av_frame_copy_props(out, ref)); @@ -851,8 +850,8 @@ static int output_frame_mix(AVFilterContext *ctx, goto fail; } - update_crops(ctx, mix, &target, ref_sig, out->pts * av_q2d(outlink->time_base)); - pl_render_image_mix(s->input.renderer, mix, &target, &s->params); + update_crops(ctx, &in->mix, &target, ref_sig, 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) { pl_unmap_avframe(s->gpu, &target); @@ -984,7 +983,7 @@ static int libplacebo_activate(AVFilterContext *ctx) case PL_QUEUE_OK: if (!s->fps.num) av_fifo_drain2(in->out_pts, 1); - return output_frame_mix(ctx, &in->mix, pts); + return output_frame(ctx, pts); case PL_QUEUE_ERR: return AVERROR_EXTERNAL; }