From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by master.gitmailbox.com (Postfix) with ESMTP id 20055430D7 for ; Sat, 18 Mar 2023 15:48:30 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 43EE068C306; Sat, 18 Mar 2023 17:48:27 +0200 (EET) Received: from mail-io1-f52.google.com (mail-io1-f52.google.com [209.85.166.52]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 89EA768C24F for ; Sat, 18 Mar 2023 17:48:20 +0200 (EET) Received: by mail-io1-f52.google.com with SMTP id f14so3623730iow.5 for ; Sat, 18 Mar 2023 08:48:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; t=1679154498; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=ycG8UoaXpUzf1IVv3KMA9fpbcvGgmdnNSSpPp/VLsrY=; b=ISyaEn7Atg5aoIHN+beVKeJ0XdyhHcbIuo+ylBobMHePRpNyQMsE+eMYGpArnvcL8b UiuOkW1JeMRJOXJfmWeFCoMS39LLv4HMhNHncqryc+ywXJCXJzqYAxNz+o5ONZO1odCz 4kciCZ6+KxTQUBTd+hixN49e5yjGOfASMdMpIR/U3EK2wVAq8nUNscEx+UYbl5l1qYLN aVuG14l7X2ZslHBrJeNq5XtaiVsUfydEAWQs+wdB8/OV+Kdywh3L4wLd3kteHbhtC26G LvFI73k/AeEn0bsKmdtxQhK1E9sy5meN5NC8sMViqFzjQEtMzWBXNTqEq8L0QseG3686 G7/A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1679154498; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=ycG8UoaXpUzf1IVv3KMA9fpbcvGgmdnNSSpPp/VLsrY=; b=EgX6ADEgMSOf2dHe1zX9jsDkK+DWx2qK/7viR0F7+wa+ccC3KFt/EC2Xs/CREgXmWM b+3s0pnNcv88hB5gsfoia9BTbpIuhPpBdxNCELnN11+lnf9VaIg+YdUZzt96Nv0kQaab ZkgDD1yNKjeZszgIptjREMuXVCtNZ5/ep2YjbT81uICqgcHtl3e4Dc0OqaXJV8OMMuQD YfHzqQ+mcWTAxiTwfBwfUBGsWcAmbeG7bhObdHgJ+vPZcOuSL8Wdyq5IvHIljqhU5JaY BCBsch6FMOybyPWqgK9lpcT9zmhF59mwtLPOLYEhswHF1KU4PF7DyqS8L1d+HKr0NnHu Wvrw== X-Gm-Message-State: AO0yUKUKm11VKjMUIbD8TDMOOSZ+KHlYhWJV7VOWDBw5eZgON+PnQXHq oRWc6KtjMy89FQpDWM3ztzUIhWwsNP66WkYWi7entjJd X-Google-Smtp-Source: AK7set8HmYMzI/qp4oYPeLRGWwVuG0d4/QT9tbjd0/l4y9E0wizfzeV10uY2LuBkXg6NpAy3LcGMdAqPBZIDFeaWYzU= X-Received: by 2002:a02:848a:0:b0:3c5:14cb:a83a with SMTP id f10-20020a02848a000000b003c514cba83amr911093jai.2.1679154497663; Sat, 18 Mar 2023 08:48:17 -0700 (PDT) MIME-Version: 1.0 References: <20230317200941.3936-1-dheitmueller@ltnglobal.com> <20230317200941.3936-4-dheitmueller@ltnglobal.com> In-Reply-To: <20230317200941.3936-4-dheitmueller@ltnglobal.com> From: Dennis Mungai Date: Sat, 18 Mar 2023 18:48:06 +0300 Message-ID: To: FFmpeg development discussions and patches X-Content-Filtered-By: Mailman/MimeDel 2.1.29 Subject: Re: [FFmpeg-devel] [RFC PATCH 3/5] yadif: Properly preserve CEA-708 closed captions X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: FFmpeg development discussions and patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: FFmpeg development discussions and patches Cc: Devin Heitmueller Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Archived-At: List-Archive: List-Post: On Fri, 17 Mar 2023, 23:11 Devin Heitmueller, < devin.heitmueller@ltnglobal.com> wrote: > 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 > --- > libavfilter/vf_bwdif.c | 7 +++++++ > libavfilter/vf_yadif.c | 6 ++++++ > libavfilter/vf_yadif_cuda.c | 8 ++++++++ > libavfilter/yadif.h | 2 ++ > libavfilter/yadif_common.c | 5 +++++ > 5 files changed, 28 insertions(+) > > diff --git a/libavfilter/vf_bwdif.c b/libavfilter/vf_bwdif.c > index 65c617ebb3..de937d83cf 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); > + av_ccfifo_freep(&yadif->cc_fifo); > } > > static const enum AVPixelFormat pix_fmts[] = { > @@ -332,6 +333,12 @@ 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 = av_ccfifo_alloc(&link->frame_rate, ctx))) > + av_log(ctx, AV_LOG_VERBOSE, "Failure to setup CC FIFO queue. > Captions will be passed through\n"); > + > > 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"); > diff --git a/libavfilter/vf_yadif.c b/libavfilter/vf_yadif.c > index 1be02de1a9..b51d21f6ff 100644 > --- a/libavfilter/vf_yadif.c > +++ b/libavfilter/vf_yadif.c > @@ -261,6 +261,7 @@ static av_cold void uninit(AVFilterContext *ctx) > av_frame_free(&yadif->prev); > av_frame_free(&yadif->cur ); > av_frame_free(&yadif->next); > + av_ccfifo_freep(&yadif->cc_fifo); > } > > static const enum AVPixelFormat pix_fmts[] = { > @@ -293,6 +294,11 @@ static int config_output(AVFilterLink *outlink) > if(s->mode & 1) > outlink->frame_rate = av_mul_q(ctx->inputs[0]->frame_rate, > (AVRational){2, 1}); > + else > + outlink->frame_rate = ctx->inputs[0]->frame_rate; > + > + if (!(s->cc_fifo = av_ccfifo_alloc(&outlink->frame_rate, ctx))) > + av_log(ctx, AV_LOG_VERBOSE, "Failure to setup CC FIFO queue. > Captions will be passed through\n"); > > if (outlink->w < 3 || outlink->h < 3) { > av_log(ctx, AV_LOG_ERROR, "Video of less than 3 columns or lines > is not supported\n"); > diff --git a/libavfilter/vf_yadif_cuda.c b/libavfilter/vf_yadif_cuda.c > index 685b8a2035..d96ec391a0 100644 > --- a/libavfilter/vf_yadif_cuda.c > +++ b/libavfilter/vf_yadif_cuda.c > @@ -206,6 +206,9 @@ static av_cold void deint_cuda_uninit(AVFilterContext > *ctx) > av_frame_free(&y->cur); > av_frame_free(&y->next); > > + if (yadif->cc_fifo) > + av_cc_fifo_free(yadif->cc_fifo); > + > av_buffer_unref(&s->device_ref); > s->hwctx = NULL; > av_buffer_unref(&s->input_frames_ref); > @@ -291,6 +294,11 @@ static int config_output(AVFilterLink *link) > if(y->mode & 1) > link->frame_rate = av_mul_q(ctx->inputs[0]->frame_rate, > (AVRational){2, 1}); > + else > + outlink->frame_rate = ctx->inputs[0]->frame_rate; > + > + if (!(s->cc_fifo = av_cc_fifo_alloc(&outlink->frame_rate, ctx))) > + av_log(ctx, AV_LOG_VERBOSE, "Failure to setup CC FIFO queue. > Captions will be passed through\n"); > > if (link->w < 3 || link->h < 3) { > av_log(ctx, AV_LOG_ERROR, "Video of less than 3 columns or lines > is not supported\n"); > diff --git a/libavfilter/yadif.h b/libavfilter/yadif.h > index c928911b35..ccd4304860 100644 > --- a/libavfilter/yadif.h > +++ b/libavfilter/yadif.h > @@ -21,6 +21,7 @@ > > #include "libavutil/opt.h" > #include "libavutil/pixdesc.h" > +#include "libavutil/ccfifo.h" > #include "avfilter.h" > > enum YADIFMode { > @@ -76,6 +77,7 @@ typedef struct YADIFContext { > int eof; > uint8_t *temp_line; > int temp_line_size; > + AVCCFifo *cc_fifo; > > /* > * An algorithm that treats first and/or last fields in a sequence > diff --git a/libavfilter/yadif_common.c b/libavfilter/yadif_common.c > index a10cf7a17f..f95b8c10d3 100644 > --- a/libavfilter/yadif_common.c > +++ b/libavfilter/yadif_common.c > @@ -43,6 +43,7 @@ static int return_frame(AVFilterContext *ctx, int > is_second) > return AVERROR(ENOMEM); > > av_frame_copy_props(yadif->out, yadif->cur); > + av_ccfifo_inject(yadif->cc_fifo, yadif->out); > yadif->out->interlaced_frame = 0; > if (yadif->current_field == YADIF_FIELD_BACK_END) > yadif->current_field = YADIF_FIELD_END; > @@ -96,6 +97,8 @@ int ff_yadif_filter_frame(AVFilterLink *link, AVFrame > *frame) > > av_assert0(frame); > > + av_ccfifo_extract(yadif->cc_fifo, frame); > + > if (yadif->frame_pending) > return_frame(ctx, 1); > > @@ -137,6 +140,7 @@ int ff_yadif_filter_frame(AVFilterLink *link, AVFrame > *frame) > if (!yadif->out) > return AVERROR(ENOMEM); > > + av_ccfifo_inject(yadif->cc_fifo, yadif->out); > av_frame_free(&yadif->prev); > if (yadif->out->pts != AV_NOPTS_VALUE) > yadif->out->pts *= 2; > @@ -148,6 +152,7 @@ int ff_yadif_filter_frame(AVFilterLink *link, AVFrame > *frame) > return AVERROR(ENOMEM); > > av_frame_copy_props(yadif->out, yadif->cur); > + av_ccfifo_inject(yadif->cc_fifo, yadif->out); > yadif->out->interlaced_frame = 0; > > if (yadif->out->pts != AV_NOPTS_VALUE) > -- > 2.35.1.655.ga68dfadae5 > Hello Devin, How would this be propagated (or replicated) in other deinterlacers, namely Intel's OneVPL based deinterlace_qsv, vpp_qsv and VAAPI's deinterlace_vaapi? > _______________________________________________ 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".