Message ID | 20200825140927.16433-8-andreas.rheinhardt@gmail.com |
---|---|
State | Accepted |
Commit | 9b34600bd2d72a790f250aa539cf29176fec6ae7 |
Headers | show |
Series | [FFmpeg-devel,01/19] avfilter/avfilter: Fix indentation | expand |
Context | Check | Description |
---|---|---|
andriy/default | pending | |
andriy/make | success | Make finished |
andriy/make_fate | success | Make fate finished |
On 8/25/20, Andreas Rheinhardt <andreas.rheinhardt@gmail.com> wrote: > These names are mostly the same, so not using duplicates saves > allocations, checks for the allocations as well as frees. > > Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com> > --- > libavfilter/f_ebur128.c | 18 ++++-------------- > 1 file changed, 4 insertions(+), 14 deletions(-) > LGTM > diff --git a/libavfilter/f_ebur128.c b/libavfilter/f_ebur128.c > index 31b75ab097..5ae3dc25b8 100644 > --- a/libavfilter/f_ebur128.c > +++ b/libavfilter/f_ebur128.c > @@ -527,30 +527,22 @@ static av_cold int init(AVFilterContext *ctx) > /* insert output pads */ > if (ebur128->do_video) { > pad = (AVFilterPad){ > - .name = av_strdup("out0"), > + .name = "out0", > .type = AVMEDIA_TYPE_VIDEO, > .config_props = config_video_output, > }; > - if (!pad.name) > - return AVERROR(ENOMEM); > ret = ff_insert_outpad(ctx, 0, &pad); > - if (ret < 0) { > - av_freep(&pad.name); > + if (ret < 0) > return ret; > - } > } > pad = (AVFilterPad){ > - .name = av_asprintf("out%d", ebur128->do_video), > + .name = ebur128->do_video ? "out1" : "out0", > .type = AVMEDIA_TYPE_AUDIO, > .config_props = config_audio_output, > }; > - if (!pad.name) > - return AVERROR(ENOMEM); > ret = ff_insert_outpad(ctx, ebur128->do_video, &pad); > - if (ret < 0) { > - av_freep(&pad.name); > + if (ret < 0) > return ret; > - } > > /* summary */ > av_log(ctx, AV_LOG_VERBOSE, "EBU +%d scale\n", ebur128->meter); > @@ -990,8 +982,6 @@ static av_cold void uninit(AVFilterContext *ctx) > av_freep(&ebur128->i400.cache[i]); > av_freep(&ebur128->i3000.cache[i]); > } > - for (i = 0; i < ctx->nb_outputs; i++) > - av_freep(&ctx->output_pads[i].name); > av_frame_free(&ebur128->outpicref); > #if CONFIG_SWRESAMPLE > av_freep(&ebur128->swr_buf); > -- > 2.20.1 > > _______________________________________________ > 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".
diff --git a/libavfilter/f_ebur128.c b/libavfilter/f_ebur128.c index 31b75ab097..5ae3dc25b8 100644 --- a/libavfilter/f_ebur128.c +++ b/libavfilter/f_ebur128.c @@ -527,30 +527,22 @@ static av_cold int init(AVFilterContext *ctx) /* insert output pads */ if (ebur128->do_video) { pad = (AVFilterPad){ - .name = av_strdup("out0"), + .name = "out0", .type = AVMEDIA_TYPE_VIDEO, .config_props = config_video_output, }; - if (!pad.name) - return AVERROR(ENOMEM); ret = ff_insert_outpad(ctx, 0, &pad); - if (ret < 0) { - av_freep(&pad.name); + if (ret < 0) return ret; - } } pad = (AVFilterPad){ - .name = av_asprintf("out%d", ebur128->do_video), + .name = ebur128->do_video ? "out1" : "out0", .type = AVMEDIA_TYPE_AUDIO, .config_props = config_audio_output, }; - if (!pad.name) - return AVERROR(ENOMEM); ret = ff_insert_outpad(ctx, ebur128->do_video, &pad); - if (ret < 0) { - av_freep(&pad.name); + if (ret < 0) return ret; - } /* summary */ av_log(ctx, AV_LOG_VERBOSE, "EBU +%d scale\n", ebur128->meter); @@ -990,8 +982,6 @@ static av_cold void uninit(AVFilterContext *ctx) av_freep(&ebur128->i400.cache[i]); av_freep(&ebur128->i3000.cache[i]); } - for (i = 0; i < ctx->nb_outputs; i++) - av_freep(&ctx->output_pads[i].name); av_frame_free(&ebur128->outpicref); #if CONFIG_SWRESAMPLE av_freep(&ebur128->swr_buf);
These names are mostly the same, so not using duplicates saves allocations, checks for the allocations as well as frees. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com> --- libavfilter/f_ebur128.c | 18 ++++-------------- 1 file changed, 4 insertions(+), 14 deletions(-)