summaryrefslogtreecommitdiff
path: root/libavfilter/vf_bwdif.c
diff options
context:
space:
mode:
authorDevin Heitmueller <devin.heitmueller@ltnglobal.com>2023-05-05 15:09:04 -0400
committerLimin Wang <lance.lmwang@gmail.com>2023-05-11 22:06:20 +0800
commitcecf35ae3e997dd884295d692aa6829462394132 (patch)
treea5740c36e21fc6827a531e68bc05251cbe77a681 /libavfilter/vf_bwdif.c
parent61a9f3c0ce7f74ba869f44a49e16f3cd1b79e18d (diff)
downloadffmpeg-cecf35ae3e997dd884295d692aa6829462394132.tar.gz
avfilter/yadif: Properly preserve CEA-708 closed captions
Various deinterlacing modes have the effect of doubling the framerate, and we need to ensure that the caption data isn't duplicated (or else you get double captions on-screen). Use the new ccfifo mechanism for yadif (and yadif_cuda and bwdif since they use the same yadif core) so that CEA-708 data is properly preserved through this filter. Signed-off-by: Devin Heitmueller <dheitmueller@ltnglobal.com> Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
Diffstat (limited to 'libavfilter/vf_bwdif.c')
-rw-r--r--libavfilter/vf_bwdif.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/libavfilter/vf_bwdif.c b/libavfilter/vf_bwdif.c
index 34e8c5e234..51e1e02503 100644
--- a/libavfilter/vf_bwdif.c
+++ b/libavfilter/vf_bwdif.c
@@ -297,6 +297,7 @@ static av_cold void uninit(AVFilterContext *ctx)
av_frame_free(&yadif->prev);
av_frame_free(&yadif->cur );
av_frame_free(&yadif->next);
+ ff_ccfifo_freep(&yadif->cc_fifo);
}
static const enum AVPixelFormat pix_fmts[] = {
@@ -332,6 +333,13 @@ static int config_props(AVFilterLink *link)
if(yadif->mode&1)
link->frame_rate = av_mul_q(link->src->inputs[0]->frame_rate, (AVRational){2,1});
+ else
+ link->frame_rate = ctx->inputs[0]->frame_rate;
+
+ if (!(yadif->cc_fifo = ff_ccfifo_alloc(link->frame_rate, ctx))) {
+ av_log(ctx, AV_LOG_ERROR, "Failure to setup CC FIFO queue\n");
+ return AVERROR(ENOMEM);
+ }
if (link->w < 3 || link->h < 4) {
av_log(ctx, AV_LOG_ERROR, "Video of less than 3 columns or 4 lines is not supported\n");