mirror of
https://github.com/xenia-project/FFmpeg.git
synced 2024-11-28 22:10:34 +00:00
avfilter/vf_decimate: 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:
parent
2d349631b1
commit
925d2f4f5b
@ -273,29 +273,21 @@ static av_cold int decimate_init(AVFilterContext *ctx)
|
|||||||
{
|
{
|
||||||
DecimateContext *dm = ctx->priv;
|
DecimateContext *dm = ctx->priv;
|
||||||
AVFilterPad pad = {
|
AVFilterPad pad = {
|
||||||
.name = av_strdup("main"),
|
.name = "main",
|
||||||
.type = AVMEDIA_TYPE_VIDEO,
|
.type = AVMEDIA_TYPE_VIDEO,
|
||||||
.filter_frame = filter_frame,
|
.filter_frame = filter_frame,
|
||||||
.config_props = config_input,
|
.config_props = config_input,
|
||||||
};
|
};
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
if (!pad.name)
|
if ((ret = ff_insert_inpad(ctx, INPUT_MAIN, &pad)) < 0)
|
||||||
return AVERROR(ENOMEM);
|
|
||||||
if ((ret = ff_insert_inpad(ctx, INPUT_MAIN, &pad)) < 0) {
|
|
||||||
av_freep(&pad.name);
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
|
||||||
|
|
||||||
if (dm->ppsrc) {
|
if (dm->ppsrc) {
|
||||||
pad.name = av_strdup("clean_src");
|
pad.name = "clean_src";
|
||||||
pad.config_props = NULL;
|
pad.config_props = NULL;
|
||||||
if (!pad.name)
|
if ((ret = ff_insert_inpad(ctx, INPUT_CLEANSRC, &pad)) < 0)
|
||||||
return AVERROR(ENOMEM);
|
|
||||||
if ((ret = ff_insert_inpad(ctx, INPUT_CLEANSRC, &pad)) < 0) {
|
|
||||||
av_freep(&pad.name);
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((dm->blockx & (dm->blockx - 1)) ||
|
if ((dm->blockx & (dm->blockx - 1)) ||
|
||||||
@ -326,8 +318,6 @@ static av_cold void decimate_uninit(AVFilterContext *ctx)
|
|||||||
av_frame_free(&dm->clean_src[i]);
|
av_frame_free(&dm->clean_src[i]);
|
||||||
}
|
}
|
||||||
av_freep(&dm->clean_src);
|
av_freep(&dm->clean_src);
|
||||||
for (i = 0; i < ctx->nb_inputs; i++)
|
|
||||||
av_freep(&ctx->input_pads[i].name);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static int request_inlink(AVFilterContext *ctx, int lid)
|
static int request_inlink(AVFilterContext *ctx, int lid)
|
||||||
|
Loading…
Reference in New Issue
Block a user