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 A6EF545D70 for ; Fri, 7 Apr 2023 21:03:49 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id A807168BAE8; Sat, 8 Apr 2023 00:03:14 +0300 (EEST) Received: from mail-qv1-f43.google.com (mail-qv1-f43.google.com [209.85.219.43]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id A79AE68B6CA for ; Sat, 8 Apr 2023 00:03:05 +0300 (EEST) Received: by mail-qv1-f43.google.com with SMTP id kj14so4638qvb.12 for ; Fri, 07 Apr 2023 14:03:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ltnglobal-com.20210112.gappssmtp.com; s=20210112; t=1680901384; x=1683493384; h=references:in-reply-to:message-id:date:subject:cc:to:from:from:to :cc:subject:date:message-id:reply-to; bh=rRpMBNpUWem3BV21BZG3HkzeATIVq7Xa7cR2Qq7/quo=; b=b9+JWZAzyw4urCUMOBkC2w/kkQsrutUXVb+q1ItC0IKrryDxk5WO3NxAWF74mRgyl3 350U5GJr52/WNTUpiAFfmWZEfoZ5svtB3N2r7hBu6WekG5iJqlriGMeh6s7c8x5oT/Wd X6n3pOc7gsR2/ImdbVpNPIZ8nDIPc1xoVh5J2R983V15fqsOJ7sW0K5yLhnSQBtjuBsv aZi2RRbGLckDnw7ZBJoTpEmwcmZGI8A6RsY8+AqcmiWIQADYXVlneis5yQ+8dvgQxgMW ofK9x/VrJ7RUyme8vU8VcevB0sH3DdfK75bsM0JFenH2WVkckVRhFK8kE+Ot9JVOAlCl Vy1w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1680901384; x=1683493384; h=references:in-reply-to:message-id:date:subject:cc:to:from :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=rRpMBNpUWem3BV21BZG3HkzeATIVq7Xa7cR2Qq7/quo=; b=eQ8aWEzcDFif2b2+wBl05Y/4Gh/V4qe1lnxodW6EnJIxasjJeoyQLtnBJttY/rQqdv GEflkRUHFy7b3FLkD93F1yONwaky847BBt96YHdI2RwINGfer3JbQzWxfeVT2n6mm1QC hH6qb7kJkPk/L0Ab5YDvCiCHyisUVjDvH8z5btSLM4m39sbyJS5S/K5MAl9gwo5WabMS O/3hOi8Qy8fw8Gjf4GINWCAVcFWT0jzaL+pvyAePD4A02DnukKr9WMnd+f+1wF6+IQxd BkXbYJN+RRlCOfdYKPu33pbjtt7rwOjgsvDEP/K/Cd3kLcK/xEEjVCKu215DjO/0080t wlvA== X-Gm-Message-State: AAQBX9ehcTi3xEG7Q8FWvh40NlzyyOEdm6SBQ5yRBPfWPO2q9vHovqMd 7UfkusHt3smZUeQanu2bwxLEQceAepBg0jAK0+M= X-Google-Smtp-Source: AKy350aCVFurp4PZaKmDNd2OtNjVtl8qQbS7QYNsZYFKqYmEp9C+xnee7DMkJRLfd7P+zNghJ+teJA== X-Received: by 2002:a05:6214:1316:b0:5cb:ab2e:b15c with SMTP id pn22-20020a056214131600b005cbab2eb15cmr7556145qvb.30.1680901384230; Fri, 07 Apr 2023 14:03:04 -0700 (PDT) Received: from ltnt-nyc-580testdevin.livetimenet.com (pool-71-105-132-214.nycmny.fios.verizon.net. [71.105.132.214]) by smtp.gmail.com with ESMTPSA id z13-20020ad4414d000000b005dd8b9345d8sm1405143qvp.112.2023.04.07.14.03.03 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Fri, 07 Apr 2023 14:03:03 -0700 (PDT) From: Devin Heitmueller X-Google-Original-From: Devin Heitmueller To: ffmpeg-devel@ffmpeg.org Date: Fri, 7 Apr 2023 17:58:28 -0400 Message-Id: <1680904709-25951-5-git-send-email-dheitmueller@ltnglobal.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1680904709-25951-1-git-send-email-dheitmueller@ltnglobal.com> References: <1680904709-25951-1-git-send-email-dheitmueller@ltnglobal.com> Subject: [FFmpeg-devel] [PATCH v2 4/5] tinterlace: 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 MIME-Version: 1.0 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: Because the interlacing filter halves the effective framerate, we need to ensure that no CEA-708 data is lost as frames are merged. Make use of the new ccfifo mechanism to ensure that caption data is properly preserved as frames pass through the filter. Thanks to Thomas Mundt for review and noticing a couple of missed codepaths for injection on output. Signed-off-by: Devin Heitmueller --- libavfilter/tinterlace.h | 2 ++ libavfilter/vf_tinterlace.c | 8 ++++++++ 2 files changed, 10 insertions(+) diff --git a/libavfilter/tinterlace.h b/libavfilter/tinterlace.h index 37b6c10..9f5ce7e 100644 --- a/libavfilter/tinterlace.h +++ b/libavfilter/tinterlace.h @@ -32,6 +32,7 @@ #include "libavutil/pixdesc.h" #include "drawutils.h" #include "avfilter.h" +#include "ccfifo.h" #define TINTERLACE_FLAG_VLPF 01 #define TINTERLACE_FLAG_CVLPF 2 @@ -77,6 +78,7 @@ typedef struct TInterlaceContext { const AVPixFmtDescriptor *csp; void (*lowpass_line)(uint8_t *dstp, ptrdiff_t width, const uint8_t *srcp, ptrdiff_t mref, ptrdiff_t pref, int clip_max); + AVCCFifo *cc_fifo; } TInterlaceContext; void ff_tinterlace_init_x86(TInterlaceContext *interlace); diff --git a/libavfilter/vf_tinterlace.c b/libavfilter/vf_tinterlace.c index 0326292..226983c 100644 --- a/libavfilter/vf_tinterlace.c +++ b/libavfilter/vf_tinterlace.c @@ -291,6 +291,9 @@ static int config_out_props(AVFilterLink *outlink) #endif } + if (!(tinterlace->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"); + av_log(ctx, AV_LOG_VERBOSE, "mode:%d filter:%s h:%d -> h:%d\n", tinterlace->mode, (tinterlace->flags & TINTERLACE_FLAG_CVLPF) ? "complex" : (tinterlace->flags & TINTERLACE_FLAG_VLPF) ? "linear" : "off", @@ -375,6 +378,8 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *picref) tinterlace->cur = tinterlace->next; tinterlace->next = picref; + av_ccfifo_extract(tinterlace->cc_fifo, picref); + cur = tinterlace->cur; next = tinterlace->next; /* we need at least two frames */ @@ -451,6 +456,7 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *picref) if (!out) return AVERROR(ENOMEM); out->pts /= 2; // adjust pts to new framerate + av_ccfifo_inject(tinterlace->cc_fifo, out); ret = ff_filter_frame(outlink, out); return ret; } @@ -486,6 +492,7 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *picref) out->pts = cur->pts*2; out->pts = av_rescale_q(out->pts, tinterlace->preout_time_base, outlink->time_base); + av_ccfifo_inject(tinterlace->cc_fifo, out); if ((ret = ff_filter_frame(outlink, out)) < 0) return ret; @@ -521,6 +528,7 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *picref) 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); + av_ccfifo_inject(tinterlace->cc_fifo, out); ret = ff_filter_frame(outlink, out); return ret; -- 1.8.3.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".