Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
 help / color / mirror / Atom feed
From: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
To: ffmpeg-devel@ffmpeg.org
Subject: Re: [FFmpeg-devel] [PATCH 09/22] lavfi/vf_libplacebo: replace s->input by dynamic array
Date: Fri, 16 Jun 2023 14:09:56 +0200
Message-ID: <AS8P250MB0744525C51F939EA9A10F05E8F58A@AS8P250MB0744.EURP250.PROD.OUTLOOK.COM> (raw)
In-Reply-To: <20230616092959.5247-9-ffmpeg@haasn.xyz>

Niklas Haas:
> From: Niklas Haas <git@haasn.dev>
> 
> 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);

In case the allocation of s->inputs fails, nb_inputs is 1 and the above
loop will try to uninit a non-existant input.

>      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;
>  

_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".

  reply	other threads:[~2023-06-16 12:09 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-06-16  9:29 [FFmpeg-devel] [PATCH 01/22] lavfi/vf_libplacebo: drop redundant case Niklas Haas
2023-06-16  9:29 ` [FFmpeg-devel] [PATCH 02/22] lavfi/vf_libplacebo: move input-specific state to struct Niklas Haas
2023-06-16  9:29 ` [FFmpeg-devel] [PATCH 03/22] lavfi/vf_libplacebo: move input handling to separate function Niklas Haas
2023-06-16  9:29 ` [FFmpeg-devel] [PATCH 04/22] lavfi/vf_libplacebo: cosmetic Niklas Haas
2023-06-16  9:29 ` [FFmpeg-devel] [PATCH 05/22] lavfi/vf_libplacebo: move temporary vars into per-input struct Niklas Haas
2023-06-16  9:29 ` [FFmpeg-devel] [PATCH 06/22] lavif/vf_libplacebo: remove pl_frame_mix from output_frame_mix Niklas Haas
2023-06-16  9:29 ` [FFmpeg-devel] [PATCH 07/22] lavfi/vf_libplacebo: factor out ref frame logic Niklas Haas
2023-06-16  9:29 ` [FFmpeg-devel] [PATCH 08/22] lavfi/vf_libplacebo: use correct link in update_crops() Niklas Haas
2023-06-16  9:29 ` [FFmpeg-devel] [PATCH 09/22] lavfi/vf_libplacebo: replace s->input by dynamic array Niklas Haas
2023-06-16 12:09   ` Andreas Rheinhardt [this message]
2023-06-16 12:22     ` Niklas Haas
2023-06-16  9:29 ` [FFmpeg-devel] [PATCH 10/22] lavfi/vf_libplacebo: keep track of latest status globally Niklas Haas
2023-06-16  9:29 ` [FFmpeg-devel] [PATCH 11/22] lavfi/vf_libplacebo: support blending multiple inputs Niklas Haas
2023-06-16  9:29 ` [FFmpeg-devel] [PATCH 12/22] lavfi/vf_libplacebo: handle " Niklas Haas
2023-06-16  9:29 ` [FFmpeg-devel] [PATCH 13/22] lavfi/vf_libplacebo: determine PTS of next frame from any input Niklas Haas
2023-06-16  9:29 ` [FFmpeg-devel] [PATCH 14/22] lavfi/vf_libplacebo: only drain actually used PTS Niklas Haas
2023-06-16  9:29 ` [FFmpeg-devel] [PATCH 15/22] lavfi/vf_libplacebo: generalize frame update to multiple inputs Niklas Haas
2023-06-16  9:29 ` [FFmpeg-devel] [PATCH 16/22] lavfi/vf_libplacebo: make input-dependent vars dynamic Niklas Haas
2023-06-16  9:29 ` [FFmpeg-devel] [PATCH 17/22] lavfi/vf_libplacebo: add in_idx variable Niklas Haas
2023-06-16  9:29 ` [FFmpeg-devel] [PATCH 18/22] lavfi/vf_libplacebo: set format list for all inputs Niklas Haas
2023-06-16  9:29 ` [FFmpeg-devel] [PATCH 19/22] lavfi/vf_libplacebo: skip cache selectively per-input Niklas Haas
2023-06-16  9:29 ` [FFmpeg-devel] [PATCH 20/22] lavfi/vf_libplacebo: also skip cache if in FPS == out FPS Niklas Haas
2023-06-16  9:29 ` [FFmpeg-devel] [PATCH 21/22] lavfi/vf_libplacebo: set time_base/frame_rate dynamically Niklas Haas
2023-06-16  9:29 ` [FFmpeg-devel] [PATCH 22/22] lavfi/vf_libplacebo: add nb_inputs option Niklas Haas

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=AS8P250MB0744525C51F939EA9A10F05E8F58A@AS8P250MB0744.EURP250.PROD.OUTLOOK.COM \
    --to=andreas.rheinhardt@outlook.com \
    --cc=ffmpeg-devel@ffmpeg.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://master.gitmailbox.com/ffmpegdev/0 ffmpegdev/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 ffmpegdev ffmpegdev/ https://master.gitmailbox.com/ffmpegdev \
		ffmpegdev@gitmailbox.com
	public-inbox-index ffmpegdev

Example config snippet for mirrors.


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git