From patchwork Fri Mar 17 20:09:36 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Devin Heitmueller X-Patchwork-Id: 34900 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:d046:b0:cd:afd7:272c with SMTP id hv6csp14722pzb; Fri, 17 Mar 2023 13:10:15 -0700 (PDT) X-Google-Smtp-Source: AK7set+jGC722J00a//7KUg8IpG5j5NjER208G5bZYNX1R0i1yuIVoVMj2IEkoViLjm9Ql+V73zD X-Received: by 2002:a50:fe81:0:b0:4fd:2193:7400 with SMTP id d1-20020a50fe81000000b004fd21937400mr4620510edt.4.1679083815397; Fri, 17 Mar 2023 13:10:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1679083815; cv=none; d=google.com; s=arc-20160816; b=wEyIPX2qfCP7u+/NwuBfnl9X7HrGtJYiPGqKTwEcZbKLld2XKIAbwcVUJu+NWqxVNz m6usZahWP6zpgst9x+LHclbZY4JEpEOwsK6UasGLx80xif63brI+Syj/Kta5iRC+oYqP IKwJ6wZCKbXtWyhvlTI/OkvgZQa2VPFHmH5NdFCT5YGW5UkryMEVI5t7uHbGzoi9eHXR anftHSlWTLtosl+Lx2dKQSMdChQaTRm7SaN+01gPtMbGNPlaJS22ILxOqyEfQnn8IvDv EdtgsXMFSzfnJr9tAPu0VF01n75wYPEQYBRdPzERMDEzwsvJ8hqcnXmlWEOeNOR+aNPn 2G5Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:cc:reply-to :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:mime-version:message-id:date:to:from :dkim-signature:delivered-to; bh=DVuk+ROg1WKm9IhTzxn6LgHa5GSX/OgHZGbwbq+S4qQ=; b=xkNbEvP64936AstBAqz9qFOcu92Gne6aQoiZNZXcHRtBZpFodBV0ReIfrHCsJTJM5A xXUTzVszU8R+xh3iIRnZqhKdhfgOrEeGx6CTSaLTJdT+3V6OSroz5XKgxN5j10ESG/zy anAi1sJ2EK2aaxG+BkSWC2CCKX6boUepI9962ILGGHQg91zPjem0J7uGWhCkdZ9X7lgI geBLR8+Zv3a477OULT5m2hzBeU3No7CZ0Cs2tuTUVE3g8eeJ2b3koxvkz9s9eo0Ll47F wA24wELILqUsqrvKJL+8+vAjBGsDyBNv88XT2vhuXK8hLFofzjMImSRsP5tEoM2Hg8t/ NIgw== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@ltnglobal-com.20210112.gappssmtp.com header.s=20210112 header.b="Dn/hSj9N"; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id m3-20020a056402050300b004c461474e86si3451818edv.152.2023.03.17.13.09.59; Fri, 17 Mar 2023 13:10:15 -0700 (PDT) Received-SPF: pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) client-ip=79.124.17.100; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@ltnglobal-com.20210112.gappssmtp.com header.s=20210112 header.b="Dn/hSj9N"; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 0570868C10D; Fri, 17 Mar 2023 22:09:55 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-qt1-f176.google.com (mail-qt1-f176.google.com [209.85.160.176]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 1809468C154 for ; Fri, 17 Mar 2023 22:09:47 +0200 (EET) Received: by mail-qt1-f176.google.com with SMTP id d7so6927289qtr.12 for ; Fri, 17 Mar 2023 13:09:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ltnglobal-com.20210112.gappssmtp.com; s=20210112; t=1679083786; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=uHCpAutkGkcpA9WzDl+hYzqiLPpZJxjpdHI0kYy9xZk=; b=Dn/hSj9Nvrmrtl0qxhnFfCC3g/olsc1LvWbsRlLOZzfIXF8fSY53zbnyXu8k8pXVjg 4zGZlY70A9+G2LOcOsvVIsHHplDmF/1xbhEmDrgPfPerXser4xUOg6l+CS0OW9QwdpWz kkwhcNMGv7Ol5gcSSDecmgM1Fz9iByZKO9i2Dv4yH3jOooNskDtzP0614DbBbg5X32iy sEbcDjVDhoIj3HLqcMxlJvBzp/n+WQ8SWHPcw/BkAJ5P8OX03Uv5z949nl22b00GJviP r44eGdr1GsE0vIe8MB5kshQn5t7adtJCc0RDExbJQyrn1T4m/ZeLNgELjKUC1rDE/ZyD /b1Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1679083786; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=uHCpAutkGkcpA9WzDl+hYzqiLPpZJxjpdHI0kYy9xZk=; b=fFAONbkBYMEHR5k+5M6BCc5GPbG1JiNyqYUqRaW4seGJcNpOJYONNbGff4E13Eyjms 4CsUGa1Fo+ZyqKMO5HVPxQqF5M7eli32XDF7IAui1iWPB/sIOppxq5zVJr5yijeqH2cT 9t9mszNJMibgHgHyJSirLqkySldLNN6mDJupRu3Fkp7KWX7CaSJtExtj2z3cZyajfDrp qipT5xNNSuDrBWp3Y8PaPN1N7Sh4ATAzP+m6yIiAJfurANqS0ll94zb3/eTBtkR+5GpQ agHDktd1an8i6K5CQoXZJzgTwQXu+ekV5QNQCSXUQ2fjEwCyFUmsgC2atY7Fbat2Spjw I/qg== X-Gm-Message-State: AO0yUKWn28SgFODHPkp62YRP0PEiZjp7JSI88MQOPfZszw0S8MnmFyft diZAmI+M0aeWPM4lCFAtd6AP0fwS759021teyTk= X-Received: by 2002:a05:622a:180d:b0:3b8:6d3a:5ec7 with SMTP id t13-20020a05622a180d00b003b86d3a5ec7mr15596190qtc.22.1679083786270; Fri, 17 Mar 2023 13:09:46 -0700 (PDT) Received: from klab-nyc-kernellabs2.localdomain (pool-71-105-132-214.nycmny.fios.verizon.net. [71.105.132.214]) by smtp.gmail.com with ESMTPSA id j5-20020ac86645000000b003bd0e7ff466sm2065685qtp.7.2023.03.17.13.09.45 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Fri, 17 Mar 2023 13:09:45 -0700 (PDT) From: Devin Heitmueller X-Google-Original-From: Devin Heitmueller To: ffmpeg-devel@ffmpeg.org Date: Fri, 17 Mar 2023 16:09:36 -0400 Message-Id: <20230317200941.3936-1-dheitmueller@ltnglobal.com> X-Mailer: git-send-email 2.35.1.655.ga68dfadae5 MIME-Version: 1.0 Subject: [FFmpeg-devel] [RFC PATCH 0/5] Properly handle CEA-708 caption data when transcoding 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 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: ACKG04Nf4MDP This patch series is intended to address long-standing known issues where CEA-708 caption data is either duplicated or corrupted (i.e. 50% of the data is lost). We employ an intermediate queue, which is available to filters that change the frame rate of the video, which stashes the 608/708 data and reconstructs properly formed 708 tuples on the output side (injecting appropriate padding as needed). The common functions are implemented in libavutil, but I am open to suggestions. While all the users in this patch series are within libavfilter, there are use cases where this functionality would be useful within libavformat (which is why libavutil was chosen). Comments/feedback are welcomed. Thanks, Devin Devin Heitmueller (5): ccfifo: Properly handle CEA-708 captions through framerate conversion vf_fps: properly preserve CEA-708 captions yadif: Properly preserve CEA-708 closed captions tinterlace: Properly preserve CEA-708 closed captions vf_ccrepack: Add new filter to repack CEA-708 side data doc/filters.texi | 10 ++ libavfilter/Makefile | 1 + libavfilter/allfilters.c | 1 + libavfilter/tinterlace.h | 2 + libavfilter/vf_bwdif.c | 7 ++ libavfilter/vf_ccrepack.c | 95 ++++++++++++++++++ libavfilter/vf_fps.c | 9 +- libavfilter/vf_tinterlace.c | 10 ++ libavfilter/vf_yadif.c | 6 ++ libavfilter/vf_yadif_cuda.c | 8 ++ libavfilter/yadif.h | 2 + libavfilter/yadif_common.c | 5 + libavutil/Makefile | 2 + libavutil/ccfifo.c | 192 ++++++++++++++++++++++++++++++++++++ libavutil/ccfifo.h | 85 ++++++++++++++++ 15 files changed, 434 insertions(+), 1 deletion(-) create mode 100644 libavfilter/vf_ccrepack.c create mode 100644 libavutil/ccfifo.c create mode 100644 libavutil/ccfifo.h