aboutsummaryrefslogtreecommitdiffstats
path: root/libavfilter/vf_tinterlace.c
diff options
context:
space:
mode:
authorJames Almer <jamrial@gmail.com>2023-05-11 14:34:57 -0300
committerJames Almer <jamrial@gmail.com>2023-05-12 16:21:18 -0300
commit7f890b2fbb75fa38e7b197cdd509afc7c391f998 (patch)
tree745329348e92c17b8f0b2cc378f31bb7d2d1f5cd /libavfilter/vf_tinterlace.c
parent86ee0317951d6793b83fce03942ee26177663cec (diff)
downloadffmpeg-7f890b2fbb75fa38e7b197cdd509afc7c391f998.tar.gz
avfilter/ccfifo: remove unnecessary context allocations
This is not public API, no it has no need for an alloc() and free() functions. The struct can reside on stack. Signed-off-by: James Almer <jamrial@gmail.com>
Diffstat (limited to 'libavfilter/vf_tinterlace.c')
-rw-r--r--libavfilter/vf_tinterlace.c18
1 files changed, 9 insertions, 9 deletions
diff --git a/libavfilter/vf_tinterlace.c b/libavfilter/vf_tinterlace.c
index e1057ffc8e..63f1fc72f2 100644
--- a/libavfilter/vf_tinterlace.c
+++ b/libavfilter/vf_tinterlace.c
@@ -203,7 +203,7 @@ static av_cold void uninit(AVFilterContext *ctx)
av_frame_free(&tinterlace->next);
av_freep(&tinterlace->black_data[0][0]);
av_freep(&tinterlace->black_data[1][0]);
- ff_ccfifo_freep(&tinterlace->cc_fifo);
+ ff_ccfifo_uninit(&tinterlace->cc_fifo);
}
static int config_out_props(AVFilterLink *outlink)
@@ -212,7 +212,7 @@ static int config_out_props(AVFilterLink *outlink)
AVFilterLink *inlink = outlink->src->inputs[0];
const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(outlink->format);
TInterlaceContext *tinterlace = ctx->priv;
- int i;
+ int ret, i;
tinterlace->vsub = desc->log2_chroma_h;
outlink->w = inlink->w;
@@ -224,7 +224,6 @@ static int config_out_props(AVFilterLink *outlink)
if (tinterlace->mode == MODE_PAD) {
uint8_t black[4] = { 0, 0, 0, 16 };
- int ret;
ff_draw_init(&tinterlace->draw, outlink->format, 0);
ff_draw_color(&tinterlace->draw, &tinterlace->color, black);
/* limited range */
@@ -292,9 +291,10 @@ static int config_out_props(AVFilterLink *outlink)
#endif
}
- if (!(tinterlace->cc_fifo = ff_ccfifo_alloc(outlink->frame_rate, ctx))) {
+ ret = ff_ccfifo_init(&tinterlace->cc_fifo, outlink->frame_rate, ctx);
+ if (ret < 0) {
av_log(ctx, AV_LOG_ERROR, "Failure to setup CC FIFO queue\n");
- return AVERROR(ENOMEM);
+ return ret;
}
av_log(ctx, AV_LOG_VERBOSE, "mode:%d filter:%s h:%d -> h:%d\n", tinterlace->mode,
@@ -381,7 +381,7 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *picref)
tinterlace->cur = tinterlace->next;
tinterlace->next = picref;
- ff_ccfifo_extract(tinterlace->cc_fifo, picref);
+ ff_ccfifo_extract(&tinterlace->cc_fifo, picref);
cur = tinterlace->cur;
next = tinterlace->next;
@@ -464,7 +464,7 @@ FF_ENABLE_DEPRECATION_WARNINGS
if (!out)
return AVERROR(ENOMEM);
out->pts /= 2; // adjust pts to new framerate
- ff_ccfifo_inject(tinterlace->cc_fifo, out);
+ ff_ccfifo_inject(&tinterlace->cc_fifo, out);
ret = ff_filter_frame(outlink, out);
return ret;
}
@@ -514,7 +514,7 @@ FF_ENABLE_DEPRECATION_WARNINGS
out->pts = cur->pts*2;
out->pts = av_rescale_q(out->pts, tinterlace->preout_time_base, outlink->time_base);
- ff_ccfifo_inject(tinterlace->cc_fifo, out);
+ ff_ccfifo_inject(&tinterlace->cc_fifo, out);
if ((ret = ff_filter_frame(outlink, out)) < 0)
return ret;
@@ -559,7 +559,7 @@ FF_ENABLE_DEPRECATION_WARNINGS
out->pts = av_rescale_q(out->pts, tinterlace->preout_time_base, outlink->time_base);
out->duration = av_rescale_q(1, av_inv_q(outlink->frame_rate), outlink->time_base);
- ff_ccfifo_inject(tinterlace->cc_fifo, out);
+ ff_ccfifo_inject(&tinterlace->cc_fifo, out);
ret = ff_filter_frame(outlink, out);
return ret;