From patchwork Fri Jun 16 09:29:46 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Niklas Haas X-Patchwork-Id: 42143 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:c526:b0:117:ac03:c9de with SMTP id gm38csp1391589pzb; Fri, 16 Jun 2023 02:32:15 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5n0cIUEzM6elMWm/qs7agznglmoqnCR009yErGD+mCqJkyLit1uYnSs+Y9DUisq+7UMXNG X-Received: by 2002:a50:fe8f:0:b0:518:7a3b:e9fb with SMTP id d15-20020a50fe8f000000b005187a3be9fbmr841485edt.19.1686907935161; Fri, 16 Jun 2023 02:32:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1686907935; cv=none; d=google.com; s=arc-20160816; b=mNW0DpNEubklmM3kqQBMDpzdmPfTiB81fh8FH4sXlgswaCxiI+B/5jE7TDQT557QVC /p7Y/VzI7JM+HGsJ0+v4PneKmTaJhNcdq5jiy0kY7i4PBSqd8gdqF1RwoGlCWqXrvGSW P346LW6hfLEm9vFHqPQYleNgGnP2jJoVmMk0912LXiWxJgQxXO33loThgb2WnjS9nDd/ /s/8ISYN8SWETWMjm8NcigWWFpJztm9YUOaXur10iyjHgSFtzTDCi+qchp2L39mPxtcs 1vTFAmwu0xRPl3gedksmx7hLr+NIcMKQjCj9d3VUPhBmb7h1p+H9ggS599i/zo91CUD4 +wYQ== 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=c8/fM0+iSIJUDFN12ax46O57S8wgXcTuxPstD2Z0sl0=; b=U0S9ZVDtsvtzvImH3s1xBP6ExiOyWGi9CydrksNvWiDXw2Ko85K8fQK+11ikZJc+3V SlvBZ2r1XkSFF2tPHVjr9zhhRBgLb0tmhSlleXtFYyrNIT5vaEadAeoTBbO4aJywxZHR 3PJucyL5mv3Y5ND8PJc/OwDmgJ2RkCd7COxm6dihrjV21d2DPqINYJuAP00vEqHA9ZmM yNV6Xl0OZF21f+BL9MXI+YnOVdJ7inyAX6916dTr+rcAjk9sWdgnaH24VTHQrtGtdXBP djtubmNPbr2G26TG3Nrk8RrwbCDAmac9Rw5c3t/ZmfuI7OKxZAK9B4xtQFZxWts0bS3O uugw== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@haasn.xyz header.s=mail header.b="tEiZQ/+T"; 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 n18-20020aa7c692000000b005187a786308si3956395edq.688.2023.06.16.02.32.14; Fri, 16 Jun 2023 02:32:15 -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="tEiZQ/+T"; 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 F32DC68C5C4; Fri, 16 Jun 2023 12:30:37 +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 0B07468C5C0 for ; Fri, 16 Jun 2023 12:30:26 +0300 (EEST) Received: from localhost (217-74-0-168.hsi.r-kom.net [217.74.0.168]) by haasn.dev (Postfix) with ESMTPSA id 7897743714; Fri, 16 Jun 2023 11:30:24 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=haasn.xyz; s=mail; t=1686907824; bh=vNiGGHp2lazVo5ammIAKiWvdA2xRkhwsCSBH7lv/Jps=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=tEiZQ/+T6CofS9rFUKk7rIuLsqhWF/pnhCZ/exJISUByDeuwzBT3higv9jqA5Eza8 6Il/vLOnABLsFLbEuZAdhLCHLb6fYc/sCVs/3XwhHLtwtIBhBYs1C1PKbxohXus1l8 lo9HpfhV07hOWnDeH5pVuIGm9WBbO0eEvCqyrG2c= From: Niklas Haas To: ffmpeg-devel@ffmpeg.org Date: Fri, 16 Jun 2023 11:29:46 +0200 Message-ID: <20230616092959.5247-9-ffmpeg@haasn.xyz> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230616092959.5247-1-ffmpeg@haasn.xyz> References: <20230616092959.5247-1-ffmpeg@haasn.xyz> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 09/22] lavfi/vf_libplacebo: replace s->input by dynamic array 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: VnYCj1i1kXrG From: Niklas Haas For now, hard-coded to 1 element. --- libavfilter/vf_libplacebo.c | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/libavfilter/vf_libplacebo.c b/libavfilter/vf_libplacebo.c index 408fb3918a..fbac1b0354 100644 --- a/libavfilter/vf_libplacebo.c +++ b/libavfilter/vf_libplacebo.c @@ -136,7 +136,8 @@ typedef struct LibplaceboContext { pl_tex tex[4]; /* input state */ - LibplaceboInput input; + LibplaceboInput *inputs; + int nb_inputs; /* settings */ char *out_format_string; @@ -660,7 +661,12 @@ static int init_vulkan(AVFilterContext *avctx, const AVVulkanDeviceContext *hwct } /* Initialize inputs */ - RET(input_init(avctx, avctx->inputs[0], &s->input)); + s->nb_inputs = 1; + s->inputs = av_calloc(s->nb_inputs, sizeof(*s->inputs)); + if (!s->inputs) + return AVERROR(ENOMEM); + for (int i = 0; i < s->nb_inputs; i++) + RET(input_init(avctx, avctx->inputs[i], &s->inputs[i])); /* fall through */ fail: @@ -677,7 +683,9 @@ static void libplacebo_uninit(AVFilterContext *avctx) pl_tex_destroy(s->gpu, &s->tex[i]); for (int i = 0; i < s->num_hooks; i++) pl_mpv_user_shader_destroy(&s->hooks[i]); - input_uninit(&s->input); + for (int i = 0; i < s->nb_inputs && s->inputs; i++) + input_uninit(&s->inputs[i]); + av_freep(&s->inputs); pl_vulkan_destroy(&s->vulkan); pl_log_destroy(&s->log); ff_vk_uninit(&s->vkctx); @@ -774,7 +782,7 @@ static int output_frame(AVFilterContext *ctx, int64_t pts) { int err = 0, ok, changed_csp; LibplaceboContext *s = ctx->priv; - LibplaceboInput *in = &s->input; + LibplaceboInput *in = &s->inputs[0]; AVFilterLink *outlink = ctx->outputs[0]; const AVPixFmtDescriptor *outdesc = av_pix_fmt_desc_get(outlink->format); const AVFrame *ref = ref_frame(&in->mix); @@ -942,7 +950,7 @@ static int libplacebo_activate(AVFilterContext *ctx) { int ret; LibplaceboContext *s = ctx->priv; - LibplaceboInput *in = &s->input; + LibplaceboInput *in = &s->inputs[0]; AVFilterLink *outlink = ctx->outputs[0]; int64_t pts;