1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2025-04-14 00:58:38 +02:00

avfilter/vf_bm3d: Don't allocate inpad names

These names are always the same, so not using duplicates saves
allocations, checks for the allocations as well as frees.

Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
This commit is contained in:
Andreas Rheinhardt 2020-08-22 04:17:11 +02:00
parent 9b34600bd2
commit 3ac3f39314

View File

@ -942,28 +942,20 @@ static av_cold int init(AVFilterContext *ctx)
} }
pad.type = AVMEDIA_TYPE_VIDEO; pad.type = AVMEDIA_TYPE_VIDEO;
pad.name = av_strdup("source"); pad.name = "source";
pad.config_props = config_input; pad.config_props = config_input;
if (!pad.name)
return AVERROR(ENOMEM);
if ((ret = ff_insert_inpad(ctx, 0, &pad)) < 0) { if ((ret = ff_insert_inpad(ctx, 0, &pad)) < 0)
av_freep(&pad.name);
return ret; return ret;
}
if (s->ref) { if (s->ref) {
pad.type = AVMEDIA_TYPE_VIDEO; pad.type = AVMEDIA_TYPE_VIDEO;
pad.name = av_strdup("reference"); pad.name = "reference";
pad.config_props = NULL; pad.config_props = NULL;
if (!pad.name)
return AVERROR(ENOMEM);
if ((ret = ff_insert_inpad(ctx, 1, &pad)) < 0) { if ((ret = ff_insert_inpad(ctx, 1, &pad)) < 0)
av_freep(&pad.name);
return ret; return ret;
} }
}
return 0; return 0;
} }
@ -1027,9 +1019,6 @@ static av_cold void uninit(AVFilterContext *ctx)
BM3DContext *s = ctx->priv; BM3DContext *s = ctx->priv;
int i; int i;
for (i = 0; i < ctx->nb_inputs; i++)
av_freep(&ctx->input_pads[i].name);
if (s->ref) if (s->ref)
ff_framesync_uninit(&s->fs); ff_framesync_uninit(&s->fs);