From patchwork Thu Apr 27 14:25:41 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anton Khirnov X-Patchwork-Id: 41365 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:dca6:b0:f3:34fa:f187 with SMTP id ky38csp563138pzb; Thu, 27 Apr 2023 07:26:42 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4WO7lfq7Ckcaxzr75F3RUyZjoY9GBQeYDbcHZMOSHekGfWTW3F8HkQLjYw+2V3jXeZTpd1 X-Received: by 2002:a17:907:1ca8:b0:94a:9f9a:b3c4 with SMTP id nb40-20020a1709071ca800b0094a9f9ab3c4mr1766022ejc.49.1682605602435; Thu, 27 Apr 2023 07:26:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1682605602; cv=none; d=google.com; s=arc-20160816; b=RWNQ2ZlhaVQaEYn1Dox8RmXqCKU9e2GNg1uK/V6G1isdRokfVDe13WIkYLjNy4Apvg wDxeui0M60gOVDQ6ovRgJ2qT/aLFs5x3EVFmlH1zPf9LHfYJ7ryzf3NlqCKQdrPkmxig YbQWEzqBXO3Kw0fpRkv+pmxH3qZxVd277MH81mje5XdUJZMF8h7COgK1+jMSYPMikJFT vizpzeAMk6iMbDa2IYDPq6Lakkl6dfODLw9+BQM4dZP1h0RMEZDzJiK2sZcouODvf8kh BsVnY6rrGnj5skqN+IXFYyUFpSOCGYCRIqEqjhJfLDEPgaQLrKIv/053H+qNGUxTg8Js urWw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:reply-to:list-subscribe :list-help:list-post:list-archive:list-unsubscribe:list-id :precedence:subject:mime-version:message-id:date:to:from :delivered-to; bh=MPfxnZAW8o3nhk3H3Wq/1zuhi0ujIum35RndPzUxza8=; b=TgpLcNPWlhhJLCmu41OW+oyJSwtBklEyVBg7IEm0lriDwxYH1E0wtZb4ezX7AT9D/8 zygGQTyE+TZIfcqyIMbDPASfLFpOstqqRvx28Ld0t/aeZnWBkYcDBN8xHY1HnW57cHXU dhhF1m2HWJsoqI6Xzn1DXIrZIDq8doJEcxjJd+6S9D7Xf1OGGqosjz79qpRZ6q5yfGgW WHnvQFkOneCf7S0vt+PJCnbVl/zRkFS60e+bi1dtsCJg+dNNsLSnCzzeUYAFR+8Lu+4c tZCvDx5hSfvn9FjkjjLkOQ9RBd6ZQas4cMx8jpxJNu/h05xEl7tIqyRbtS9mSa9zUNB5 tRMA== ARC-Authentication-Results: i=1; mx.google.com; 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 g6-20020a170906538600b0094ed126d448si12542500ejo.445.2023.04.27.07.26.42; Thu, 27 Apr 2023 07:26:42 -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; 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 DDA7B68BF89; Thu, 27 Apr 2023 17:26:16 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail0.khirnov.net (red.khirnov.net [176.97.15.12]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 4F6CA68BEC0 for ; Thu, 27 Apr 2023 17:26:07 +0300 (EEST) Received: from localhost (localhost [IPv6:::1]) by mail0.khirnov.net (Postfix) with ESMTP id 1767E2404EE for ; Thu, 27 Apr 2023 16:26:07 +0200 (CEST) Received: from mail0.khirnov.net ([IPv6:::1]) by localhost (mail0.khirnov.net [IPv6:::1]) (amavisd-new, port 10024) with ESMTP id osBvdl7dacCL for ; Thu, 27 Apr 2023 16:26:05 +0200 (CEST) Received: from libav.khirnov.net (libav.khirnov.net [IPv6:2a00:c500:561:201::7]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "libav.khirnov.net", Issuer "smtp.khirnov.net SMTP CA" (verified OK)) by mail0.khirnov.net (Postfix) with ESMTPS id 443B42404EC for ; Thu, 27 Apr 2023 16:26:05 +0200 (CEST) Received: from libav.khirnov.net (libav.khirnov.net [IPv6:::1]) by libav.khirnov.net (Postfix) with ESMTP id 048773A031B for ; Thu, 27 Apr 2023 16:26:05 +0200 (CEST) From: Anton Khirnov To: ffmpeg-devel@ffmpeg.org Date: Thu, 27 Apr 2023 16:25:41 +0200 Message-Id: <20230427142601.2613-1-anton@khirnov.net> X-Mailer: git-send-email 2.39.2 MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 01/21] fftools/ffmpeg: deprecate -adrift_threshold 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 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: B2nN58N/wuig This option has had no effect since -async was removed in 3d86a13b47b726e49c2d780c5f723c290e8a36b4 --- doc/ffmpeg.texi | 6 ------ fftools/ffmpeg.h | 2 +- fftools/ffmpeg_opt.c | 14 ++++++++++++-- 3 files changed, 13 insertions(+), 9 deletions(-) diff --git a/doc/ffmpeg.texi b/doc/ffmpeg.texi index 34c413355e..0fea0bacb1 100644 --- a/doc/ffmpeg.texi +++ b/doc/ffmpeg.texi @@ -1749,12 +1749,6 @@ The default is -1.1. One possible usecase is to avoid framedrops in case of noisy timestamps or to increase frame drop precision in case of exact timestamps. -@item -adrift_threshold @var{time} -Set the minimum difference between timestamps and audio data (in seconds) to trigger -adding/dropping samples to make it match the timestamps. This option effectively is -a threshold to select between hard (add/drop) and soft (squeeze/stretch) compensation. -@code{-async} must be set to a positive value. - @item -apad @var{parameters} (@emph{output,per-stream}) Pad the output audio stream(s). This is the same as applying @code{-af apad}. Argument is a string of filter parameters composed the same as with the @code{apad} filter. diff --git a/fftools/ffmpeg.h b/fftools/ffmpeg.h index 95591f4bba..a41bc9b518 100644 --- a/fftools/ffmpeg.h +++ b/fftools/ffmpeg.h @@ -55,6 +55,7 @@ #define FFMPEG_OPT_MAP_SYNC 1 #define FFMPEG_ROTATION_METADATA 1 #define FFMPEG_OPT_QPHIST 1 +#define FFMPEG_OPT_ADRIFT_THRESHOLD 1 enum VideoSyncMethod { VSYNC_AUTO = -1, @@ -728,7 +729,6 @@ extern int nb_filtergraphs; extern char *vstats_filename; extern char *sdp_filename; -extern float audio_drift_threshold; extern float dts_delta_threshold; extern float dts_error_threshold; diff --git a/fftools/ffmpeg_opt.c b/fftools/ffmpeg_opt.c index c99263b6a5..cf385c388e 100644 --- a/fftools/ffmpeg_opt.c +++ b/fftools/ffmpeg_opt.c @@ -1347,6 +1347,14 @@ static int opt_qphist(void *optctx, const char *opt, const char *arg) } #endif +#if FFMPEG_OPT_ADRIFT_THRESHOLD +static int opt_adrift_threshold(void *optctx, const char *opt, const char *arg) +{ + av_log(NULL, AV_LOG_WARNING, "Option -%s is deprecated and has no effect\n", opt); + return 0; +} +#endif + #define OFFSET(x) offsetof(OptionsContext, x) const OptionDef options[] = { /* main options */ @@ -1453,8 +1461,10 @@ const OptionDef options[] = { "set video sync method globally; deprecated, use -fps_mode", "" }, { "frame_drop_threshold", HAS_ARG | OPT_FLOAT | OPT_EXPERT, { &frame_drop_threshold }, "frame drop threshold", "" }, - { "adrift_threshold", HAS_ARG | OPT_FLOAT | OPT_EXPERT, { &audio_drift_threshold }, - "audio drift threshold", "threshold" }, +#if FFMPEG_OPT_ADRIFT_THRESHOLD + { "adrift_threshold", HAS_ARG | OPT_EXPERT, { .func_arg = opt_adrift_threshold }, + "deprecated, does nothing", "threshold" }, +#endif { "copyts", OPT_BOOL | OPT_EXPERT, { ©_ts }, "copy timestamps" }, { "start_at_zero", OPT_BOOL | OPT_EXPERT, { &start_at_zero }, From patchwork Thu Apr 27 14:25:42 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anton Khirnov X-Patchwork-Id: 41364 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:dca6:b0:f3:34fa:f187 with SMTP id ky38csp563000pzb; Thu, 27 Apr 2023 07:26:30 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7iudmlXXIONrlj4OwT9ZrdDUJGxer5NGARFKk9E+F2wz8Pccfi5sJGKDxgs4NoKFgUZZ+M X-Received: by 2002:aa7:cf03:0:b0:506:c41c:bd14 with SMTP id a3-20020aa7cf03000000b00506c41cbd14mr1539404edy.33.1682605590344; Thu, 27 Apr 2023 07:26:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1682605590; cv=none; d=google.com; s=arc-20160816; b=JMbX0K60HHC4eb+ZGlJLpCj5NOKQAJWouqpZgd0yJVMuNOSAF2vRAVcG1GDiedNzgR MrR73vwDcdxEwmxaYbP8JdRx9qLHY+7Ig5y4PHFHVxosJgSAE8cgZdrF0yxeeOG4BUsQ KlpMJfGun1nlaP5T66Nn3+Cmi2IXTH3b9Qx6Xh1o5TzyWLyf35zwMGgwOetdNsTWuDyS UGATnD5tHXkXRFtaSDvS6YUVmYCOkR9p+QxEmaMzIRcKtf3ya2bJq+mVJQg3SLRpz7Kz UtyFnJxuA93g69MWMHX492kE2Wuiu9dKF0reyxCmktV/ngSkx1UcEMH6MnV7tU28O2TH MD2w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:reply-to:list-subscribe :list-help:list-post:list-archive:list-unsubscribe:list-id :precedence:subject:mime-version:references:in-reply-to:message-id :date:to:from:delivered-to; bh=ORXccee/0QbmhKUZqQAnnZZwNPMSXTASrT0TxwZPT18=; b=J4kVHAQe40gxeucMY9CCZ9kZe8tSBqnZg51E02cNNJ8CPqpXZSVOp1l0nJn7XQhzrN 22uRIjEJymcMJ0xRAJiBvCa92HWpsQWvoDfa0qBwbjMX1Q/VjiCEVg2T62Qd8szoK9tu rNqVXo5HdkpgjEn265NzqVUqDtupxKvxRLN5h4sqeu1w1W7JQa4EAoQ95XKw1XxcdEPq voSQ0q6qsnqcoXpI1xeVAR7enWhaPWY6XwYQ1TxdhhVdPTtI0kngKsK6f6c9GQvKBuAi Lz6DHcK9M+EUjAxYUmyuMmC5K+U5gHQAjcAcH4vf6weU9hkpGExJj4VgfPbMoOPK3joc 5SFg== ARC-Authentication-Results: i=1; mx.google.com; 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 l24-20020aa7c318000000b00506974c7f10si15585800edq.398.2023.04.27.07.26.29; Thu, 27 Apr 2023 07:26:30 -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; 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 DA0F268BF55; Thu, 27 Apr 2023 17:26:15 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail0.khirnov.net (red.khirnov.net [176.97.15.12]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id E909A68BEC0 for ; Thu, 27 Apr 2023 17:26:06 +0300 (EEST) Received: from localhost (localhost [IPv6:::1]) by mail0.khirnov.net (Postfix) with ESMTP id B2D482404F5 for ; Thu, 27 Apr 2023 16:26:06 +0200 (CEST) Received: from mail0.khirnov.net ([IPv6:::1]) by localhost (mail0.khirnov.net [IPv6:::1]) (amavisd-new, port 10024) with ESMTP id 5cQZKEErqJ6B for ; Thu, 27 Apr 2023 16:26:06 +0200 (CEST) Received: from libav.khirnov.net (libav.khirnov.net [IPv6:2a00:c500:561:201::7]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "libav.khirnov.net", Issuer "smtp.khirnov.net SMTP CA" (verified OK)) by mail0.khirnov.net (Postfix) with ESMTPS id 45D302404EE for ; Thu, 27 Apr 2023 16:26:05 +0200 (CEST) Received: from libav.khirnov.net (libav.khirnov.net [IPv6:::1]) by libav.khirnov.net (Postfix) with ESMTP id 11F5B3A03E5 for ; Thu, 27 Apr 2023 16:26:05 +0200 (CEST) From: Anton Khirnov To: ffmpeg-devel@ffmpeg.org Date: Thu, 27 Apr 2023 16:25:42 +0200 Message-Id: <20230427142601.2613-2-anton@khirnov.net> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230427142601.2613-1-anton@khirnov.net> References: <20230427142601.2613-1-anton@khirnov.net> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 02/21] fftools/ffmpeg: reduce access to OutputStream.enc_ctx 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 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: gxA94KF65VY/ It will be made private to Encoder in the future. --- fftools/ffmpeg.c | 7 +++---- fftools/ffmpeg_mux.c | 2 +- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/fftools/ffmpeg.c b/fftools/ffmpeg.c index 15fe839914..1ae2c5c18f 100644 --- a/fftools/ffmpeg.c +++ b/fftools/ffmpeg.c @@ -649,8 +649,7 @@ static void print_report(int is_last_report, int64_t timer_start, int64_t cur_ti av_bprint_init(&buf, 0, AV_BPRINT_SIZE_AUTOMATIC); av_bprint_init(&buf_script, 0, AV_BPRINT_SIZE_AUTOMATIC); for (OutputStream *ost = ost_iter(NULL); ost; ost = ost_iter(ost)) { - const AVCodecContext * const enc = ost->enc_ctx; - const float q = enc ? ost->quality / (float) FF_QP2LAMBDA : -1; + const float q = ost->enc ? ost->quality / (float) FF_QP2LAMBDA : -1; if (vid && ost->type == AVMEDIA_TYPE_VIDEO) { av_bprintf(&buf, "q=%2.1f ", q); @@ -1155,7 +1154,7 @@ static int process_subtitle(InputStream *ist, AVSubtitle *subtitle, int *got_out for (int oidx = 0; oidx < ist->nb_outputs; oidx++) { OutputStream *ost = ist->outputs[oidx]; - if (!ost->enc_ctx || ost->enc_ctx->codec_type != AVMEDIA_TYPE_SUBTITLE) + if (!ost->enc || ost->type != AVMEDIA_TYPE_SUBTITLE) continue; enc_subtitle(output_files[ost->file_index], ost, subtitle); @@ -1527,7 +1526,7 @@ static int process_input_packet(InputStream *ist, const AVPacket *pkt, int no_eo for (int oidx = 0; oidx < ist->nb_outputs; oidx++) { OutputStream *ost = ist->outputs[oidx]; - if (ost->enc_ctx || (!pkt && no_eof)) + if (ost->enc || (!pkt && no_eof)) continue; if (duration_exceeded) { diff --git a/fftools/ffmpeg_mux.c b/fftools/ffmpeg_mux.c index a19f1a1f1e..52f98fb76a 100644 --- a/fftools/ffmpeg_mux.c +++ b/fftools/ffmpeg_mux.c @@ -742,7 +742,7 @@ static void mux_final_stats(Muxer *mux) av_log(of, AV_LOG_VERBOSE, " Output stream #%d:%d (%s): ", of->index, j, av_get_media_type_string(type)); - if (ost->enc_ctx) { + if (ost->enc) { av_log(of, AV_LOG_VERBOSE, "%"PRIu64" frames encoded", ost->frames_encoded); if (type == AVMEDIA_TYPE_AUDIO) From patchwork Thu Apr 27 14:25:43 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anton Khirnov X-Patchwork-Id: 41363 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:dca6:b0:f3:34fa:f187 with SMTP id ky38csp562887pzb; Thu, 27 Apr 2023 07:26:20 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6JUSpQlc6MatID4fWFRIEBmAovEHlbyuhTplZBnYvCXNpP07rkikW5dV9M1cXqVarkFpcK X-Received: by 2002:a19:7409:0:b0:4ea:f7be:e071 with SMTP id v9-20020a197409000000b004eaf7bee071mr587259lfe.46.1682605580510; Thu, 27 Apr 2023 07:26:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1682605580; cv=none; d=google.com; s=arc-20160816; b=u5wH8h09tNpgUzk4sUoAVxY+1r/praKr4lqW+AvCWwHNoWdpjX78iCe++U8an8X3nL fxEcVvupogbpL68/ve/0fWJrl+lT2Ai9CSlS0VQtAwk2Q7BtdcRMQZr8O8VaWBz5WhYw YEI26N6mPfI5oVLjtXgDCJwPYDLB8vTZZi/AcTJu1jbrMiRMXAbEbx6mdrmGefvpyL0e 2VOI7zr5N4a5K1aoauhvROFGCA0wHaaWfkpeG2s7nfACITJFZBawOt9yslalDrLGJ57m gOlK7IlhLkq8wyIBG5yu9QK4UB0Fj6DGCg1hV+ROi7y9OrybyBLD3zVyil05aWUfCT1o 3bIA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:reply-to:list-subscribe :list-help:list-post:list-archive:list-unsubscribe:list-id :precedence:subject:mime-version:references:in-reply-to:message-id :date:to:from:delivered-to; bh=IN/S0XCUiOgnIB3j21kDxyfTzKnKU5SpEMwG76/y00A=; b=zCnzYqYiesAbx/XFdtXJy7UtAnlhn0Vz0e0t7kvawYqWxfSwkwE0Bur/dETdRS/czn 2no+LLUQlnyTVvW+kuMKCvkhoVHYe9tgvEOFVLmKiKoor3NRImrnnIn1OoAVzS3n+vok Q17Zwh0O9PvUsPFoCOBONZ/dnrP0wsO6QTDF02sJxDmrnnNKzWwqhptzS5IbldFQlxc+ 3LxJlqh50zr8I24sCllDmnVqQRh8Cba0tSXzDRFkEz39x0Gp3NQq9Z95ULFMj6Q13v2l UNAYTR9U3r9qBmsqrWM+54bjcbd+KD/+iy9eeciCazdqZkjcYahz0bpoK36tuHoz0y0k /vEA== ARC-Authentication-Results: i=1; mx.google.com; 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 o11-20020aa7d3cb000000b00504a290ccccsi14930560edr.6.2023.04.27.07.26.16; Thu, 27 Apr 2023 07:26:20 -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; 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 B0E1568BF18; Thu, 27 Apr 2023 17:26:12 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail0.khirnov.net (red.khirnov.net [176.97.15.12]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 7BB3668BDB3 for ; Thu, 27 Apr 2023 17:26:06 +0300 (EEST) Received: from localhost (localhost [IPv6:::1]) by mail0.khirnov.net (Postfix) with ESMTP id 22466240D1C for ; Thu, 27 Apr 2023 16:26:06 +0200 (CEST) Received: from mail0.khirnov.net ([IPv6:::1]) by localhost (mail0.khirnov.net [IPv6:::1]) (amavisd-new, port 10024) with ESMTP id taUBbKslAsd9 for ; Thu, 27 Apr 2023 16:26:05 +0200 (CEST) Received: from libav.khirnov.net (libav.khirnov.net [IPv6:2a00:c500:561:201::7]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "libav.khirnov.net", Issuer "smtp.khirnov.net SMTP CA" (verified OK)) by mail0.khirnov.net (Postfix) with ESMTPS id 4B9522404F5 for ; Thu, 27 Apr 2023 16:26:05 +0200 (CEST) Received: from libav.khirnov.net (libav.khirnov.net [IPv6:::1]) by libav.khirnov.net (Postfix) with ESMTP id 1D6273A03F3 for ; Thu, 27 Apr 2023 16:26:05 +0200 (CEST) From: Anton Khirnov To: ffmpeg-devel@ffmpeg.org Date: Thu, 27 Apr 2023 16:25:43 +0200 Message-Id: <20230427142601.2613-3-anton@khirnov.net> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230427142601.2613-1-anton@khirnov.net> References: <20230427142601.2613-1-anton@khirnov.net> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 03/21] fftools/ffmpeg: drop OutputStream.pict_type 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 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: lkgISOrguTxK It is no longer used outside of update_video_stats(), so make it a stack variable in that function. --- fftools/ffmpeg.h | 3 --- fftools/ffmpeg_enc.c | 5 +++-- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/fftools/ffmpeg.h b/fftools/ffmpeg.h index a41bc9b518..c3cb365a3b 100644 --- a/fftools/ffmpeg.h +++ b/fftools/ffmpeg.h @@ -671,9 +671,6 @@ typedef struct OutputStream { /* packet quality factor */ int quality; - /* packet picture type */ - int pict_type; - /* frame encode sum of squared error values */ int64_t error[4]; diff --git a/fftools/ffmpeg_enc.c b/fftools/ffmpeg_enc.c index 859c7fdeee..096e0ce14a 100644 --- a/fftools/ffmpeg_enc.c +++ b/fftools/ffmpeg_enc.c @@ -587,11 +587,12 @@ static void update_video_stats(OutputStream *ost, const AVPacket *pkt, int write const uint8_t *sd = av_packet_get_side_data(pkt, AV_PKT_DATA_QUALITY_STATS, NULL); AVCodecContext *enc = ost->enc_ctx; + enum AVPictureType pict_type; int64_t frame_number; double ti1, bitrate, avg_bitrate; ost->quality = sd ? AV_RL32(sd) : -1; - ost->pict_type = sd ? sd[4] : AV_PICTURE_TYPE_NONE; + pict_type = sd ? sd[4] : AV_PICTURE_TYPE_NONE; for (int i = 0; ierror); i++) { if (sd && i < sd[5]) @@ -634,7 +635,7 @@ static void update_video_stats(OutputStream *ost, const AVPacket *pkt, int write avg_bitrate = (double)(e->data_size * 8) / ti1 / 1000.0; fprintf(vstats_file, "s_size= %8.0fkB time= %0.3f br= %7.1fkbits/s avg_br= %7.1fkbits/s ", (double)e->data_size / 1024, ti1, bitrate, avg_bitrate); - fprintf(vstats_file, "type= %c\n", av_get_picture_type_char(ost->pict_type)); + fprintf(vstats_file, "type= %c\n", av_get_picture_type_char(pict_type)); } static int encode_frame(OutputFile *of, OutputStream *ost, AVFrame *frame) From patchwork Thu Apr 27 14:25:44 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anton Khirnov X-Patchwork-Id: 41376 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:dca6:b0:f3:34fa:f187 with SMTP id ky38csp564364pzb; Thu, 27 Apr 2023 07:28:41 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4H28RLl9FTkCuK5SsczcM6MNldnG6DjOeToUCTqrTWH3Q8Tr2IQnysLaaFMEXQxVUl0EKP X-Received: by 2002:a05:6402:50cd:b0:504:77ed:5a33 with SMTP id h13-20020a05640250cd00b0050477ed5a33mr5640778edb.8.1682605721107; Thu, 27 Apr 2023 07:28:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1682605721; cv=none; d=google.com; s=arc-20160816; b=Lg/w5mXjOVClza4L+YuJLK6SpxMmIIW6lqKvLRQkyQG7x8qCTRxDcRlrObgzH6zZXL YfR94KLZzbWewnPbIxnNRsHlnmDBDQyLmH72YLcifKYAINzL5IkV+veqO+vMrnWY3lEX OEC1eb1fneDEdQp+6NGfj86UYb9l/is3tv+/bR02p4LTrRKIit4l5ZizcJNiXB+YjFrF bZ7BM0jiffwHf8f++XWPqTNO+mZh9DVUKE4VQNK0gKr5dxxZG+3hpvYHNNO/u+Z5ZpQo 8ddeN5otV7j/91cdCRlq0xPc12U5DnjUna1r8TXwpODn8gayu0+EXV3hV+BhuZAo3ScB AXHg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:reply-to:list-subscribe :list-help:list-post:list-archive:list-unsubscribe:list-id :precedence:subject:mime-version:references:in-reply-to:message-id :date:to:from:delivered-to; bh=wK1MiwO1IybzetCaP/0XPi/yn/zbFUHlUBPuEk7cmfA=; b=WJTT6l/j8tRwOooyvNzEEOD+3Qhd/LqYLycMBLQ8xFo29UjeYNQl4oYZ/hkEJo1g1w YmkQ8G0Kkll8WNdh3BrS/nNrQnEnyiWGXn3NQqebS77x0bFIQUqEolaPtEIeUk4cwByH ///R9OGtdV0K6ZNU+EygiRQTBqPJVYRYqMWN16GMGkWldG+s87x3NSABsBLeWblL8Nl5 P3HIXh7HWNmpPTjFsvWff+zLuoFDvinZ6jupObDcIn5mo93r4/5AzYSn5J0YjfjpspVm hZRSRx+K5ZKVNLLmrbk4TkMzb0Dor+6xArTJySYgmZXJ4eS3/LO0LCWEhAQww/UIjZkK yzYg== ARC-Authentication-Results: i=1; mx.google.com; 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 z24-20020aa7cf98000000b0050506e006a9si14347691edx.611.2023.04.27.07.28.40; Thu, 27 Apr 2023 07:28:41 -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; 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 B823D68C022; Thu, 27 Apr 2023 17:26:32 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail0.khirnov.net (red.khirnov.net [176.97.15.12]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id BE08568BF56 for ; Thu, 27 Apr 2023 17:26:11 +0300 (EEST) Received: from localhost (localhost [IPv6:::1]) by mail0.khirnov.net (Postfix) with ESMTP id DBFA02405F9 for ; Thu, 27 Apr 2023 16:26:08 +0200 (CEST) Received: from mail0.khirnov.net ([IPv6:::1]) by localhost (mail0.khirnov.net [IPv6:::1]) (amavisd-new, port 10024) with ESMTP id U_rLXDT7fVUI for ; Thu, 27 Apr 2023 16:26:07 +0200 (CEST) Received: from libav.khirnov.net (libav.khirnov.net [IPv6:2a00:c500:561:201::7]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "libav.khirnov.net", Issuer "smtp.khirnov.net SMTP CA" (verified OK)) by mail0.khirnov.net (Postfix) with ESMTPS id 59A4E2405B5 for ; Thu, 27 Apr 2023 16:26:05 +0200 (CEST) Received: from libav.khirnov.net (libav.khirnov.net [IPv6:::1]) by libav.khirnov.net (Postfix) with ESMTP id 2874D3A0404 for ; Thu, 27 Apr 2023 16:26:05 +0200 (CEST) From: Anton Khirnov To: ffmpeg-devel@ffmpeg.org Date: Thu, 27 Apr 2023 16:25:44 +0200 Message-Id: <20230427142601.2613-4-anton@khirnov.net> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230427142601.2613-1-anton@khirnov.net> References: <20230427142601.2613-1-anton@khirnov.net> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 04/21] fftools/ffmpeg: drop OutputStream.error 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 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: HM3/Z2lRRPZh Only the first component is used in update_video_stats(), so make it a stack variable in that function. --- fftools/ffmpeg.h | 8 -------- fftools/ffmpeg_enc.c | 20 +++++++++++++------- 2 files changed, 13 insertions(+), 15 deletions(-) diff --git a/fftools/ffmpeg.h b/fftools/ffmpeg.h index c3cb365a3b..c4b77ab2c8 100644 --- a/fftools/ffmpeg.h +++ b/fftools/ffmpeg.h @@ -671,9 +671,6 @@ typedef struct OutputStream { /* packet quality factor */ int quality; - /* frame encode sum of squared error values */ - int64_t error[4]; - int sq_idx_encode; int sq_idx_mux; @@ -920,11 +917,6 @@ InputStream *ist_iter(InputStream *prev); * pass NULL to start iteration */ OutputStream *ost_iter(OutputStream *prev); -static inline double psnr(double d) -{ - return -10.0 * log10(d); -} - void close_output_stream(OutputStream *ost); int trigger_fix_sub_duration_heartbeat(OutputStream *ost, const AVPacket *pkt); void update_benchmark(const char *fmt, ...); diff --git a/fftools/ffmpeg_enc.c b/fftools/ffmpeg_enc.c index 096e0ce14a..c368097cd0 100644 --- a/fftools/ffmpeg_enc.c +++ b/fftools/ffmpeg_enc.c @@ -581,6 +581,11 @@ void enc_stats_write(OutputStream *ost, EncStats *es, avio_flush(io); } +static inline double psnr(double d) +{ + return -10.0 * log10(d); +} + static void update_video_stats(OutputStream *ost, const AVPacket *pkt, int write_vstats) { Encoder *e = ost->enc; @@ -590,15 +595,16 @@ static void update_video_stats(OutputStream *ost, const AVPacket *pkt, int write enum AVPictureType pict_type; int64_t frame_number; double ti1, bitrate, avg_bitrate; + double psnr_val = -1; ost->quality = sd ? AV_RL32(sd) : -1; pict_type = sd ? sd[4] : AV_PICTURE_TYPE_NONE; - for (int i = 0; ierror); i++) { - if (sd && i < sd[5]) - ost->error[i] = AV_RL64(sd + 8 + 8*i); - else - ost->error[i] = -1; + if ((enc->flags & AV_CODEC_FLAG_PSNR) && sd && sd[5]) { + // FIXME the scaling assumes 8bit + double error = AV_RL64(sd + 8) / (enc->width * enc->height * 255.0 * 255.0); + if (error >= 0 && error <= 1) + psnr_val = psnr(error); } if (!write_vstats) @@ -622,8 +628,8 @@ static void update_video_stats(OutputStream *ost, const AVPacket *pkt, int write ost->quality / (float)FF_QP2LAMBDA); } - if (ost->error[0]>=0 && (enc->flags & AV_CODEC_FLAG_PSNR)) - fprintf(vstats_file, "PSNR= %6.2f ", psnr(ost->error[0] / (enc->width * enc->height * 255.0 * 255.0))); + if (psnr_val >= 0) + fprintf(vstats_file, "PSNR= %6.2f ", psnr_val); fprintf(vstats_file,"f_size= %6d ", pkt->size); /* compute pts value */ From patchwork Thu Apr 27 14:25:45 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anton Khirnov X-Patchwork-Id: 41375 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:dca6:b0:f3:34fa:f187 with SMTP id ky38csp564269pzb; Thu, 27 Apr 2023 07:28:32 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5SL40Uw1P+wLPF50gUlWKuG+xvoTKPit5jOE6wUu8EUAZkBlK3LtHyEZeE0kcghH/k5zgA X-Received: by 2002:aa7:dbc9:0:b0:504:aaba:9b0c with SMTP id v9-20020aa7dbc9000000b00504aaba9b0cmr1817541edt.31.1682605711937; Thu, 27 Apr 2023 07:28:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1682605711; cv=none; d=google.com; s=arc-20160816; b=Dw3dk5JKlwUaWIIJyU0D+WeZkEbPXzXF0vJ5bu44Jed/XR3rvuGIc4xd4s8lK5QXAP fgErTuKJvwRAu6gQlru5i1nMg2DOsMqd7wsnUsrS7pLnMyAk6uvQxQbPFATLoUT79OBI TmVaWaZLQHQx4Y9tZMsmbRv9/hUbb23RvmOSQ7k5dx7nrhquF7atvCcjfUW610dxTdtC XB1V5NnHDPg5zVOA7sVD5fHc7XjF75IIJ2A/B937OkhNL0FzDUmSW0RBgFHXrnYYb9/f xqTXkGdJ8DhPLRQnl0ruACr4bJTuqg1WRtwB6BrJqWUWPRWNV0ndNOl4WgG/wQFrUw1q sEBQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:reply-to:list-subscribe :list-help:list-post:list-archive:list-unsubscribe:list-id :precedence:subject:mime-version:references:in-reply-to:message-id :date:to:from:delivered-to; bh=W7uRS6qojYmXucnbHzNBALpL1jG1eVIzKLBRChS6gxI=; b=W/W36aNRUiA5wIX6mZ8ot4Qv0lFDLB6o1RjnfWkZdzKqHb0brdHneCHiC6GHMlzONg PtovJvZfd6Gc4dlr5arj3nRCwSiVHVPKQ1m+TUxcCiV9e9i7byIlIco6HnabdQBA7TIb ULL7/pcMAwtqhAp297el5ZueJ7QGSzUXzpXrLurkW6QZlZZ87Bqe7drHK7XC+G6WVjg4 vrTolsQerw6Guk95FSh4NkwSuuK7Og9iEZKxUBjbZYTGNuGE1pVfircrYu9K9msm4P8o 5AufjAtVT4GZQ/neYLWtABrwQk9qSikGeWvTLGzRsDK3x0pmQ5XuQjBa3pfEdtbNyQ2d QRBw== ARC-Authentication-Results: i=1; mx.google.com; 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 c16-20020aa7c990000000b00505069a74f4si14207102edt.350.2023.04.27.07.28.31; Thu, 27 Apr 2023 07:28:31 -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; 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 EF22568C007; Thu, 27 Apr 2023 17:26:31 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail0.khirnov.net (red.khirnov.net [176.97.15.12]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id B21B868BF89 for ; Thu, 27 Apr 2023 17:26:11 +0300 (EEST) Received: from localhost (localhost [IPv6:::1]) by mail0.khirnov.net (Postfix) with ESMTP id 3A6D8240591 for ; Thu, 27 Apr 2023 16:26:08 +0200 (CEST) Received: from mail0.khirnov.net ([IPv6:::1]) by localhost (mail0.khirnov.net [IPv6:::1]) (amavisd-new, port 10024) with ESMTP id cFAg5btuv3ZK for ; Thu, 27 Apr 2023 16:26:07 +0200 (CEST) Received: from libav.khirnov.net (libav.khirnov.net [IPv6:2a00:c500:561:201::7]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "libav.khirnov.net", Issuer "smtp.khirnov.net SMTP CA" (verified OK)) by mail0.khirnov.net (Postfix) with ESMTPS id 651D62405F9 for ; Thu, 27 Apr 2023 16:26:05 +0200 (CEST) Received: from libav.khirnov.net (libav.khirnov.net [IPv6:::1]) by libav.khirnov.net (Postfix) with ESMTP id 33F143A0586 for ; Thu, 27 Apr 2023 16:26:05 +0200 (CEST) From: Anton Khirnov To: ffmpeg-devel@ffmpeg.org Date: Thu, 27 Apr 2023 16:25:45 +0200 Message-Id: <20230427142601.2613-5-anton@khirnov.net> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230427142601.2613-1-anton@khirnov.net> References: <20230427142601.2613-1-anton@khirnov.net> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 05/21] fftools/ffmpeg: move OutputStream.packets_encoded to Encoder 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 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: 1gK91hARVzj8 It is no longer used outside of ffmpeg_enc. --- fftools/ffmpeg.h | 2 -- fftools/ffmpeg_enc.c | 9 ++++++--- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/fftools/ffmpeg.h b/fftools/ffmpeg.h index c4b77ab2c8..116087354d 100644 --- a/fftools/ffmpeg.h +++ b/fftools/ffmpeg.h @@ -665,8 +665,6 @@ typedef struct OutputStream { // number of frames/samples sent to the encoder uint64_t frames_encoded; uint64_t samples_encoded; - // number of packets received from the encoder - uint64_t packets_encoded; /* packet quality factor */ int quality; diff --git a/fftools/ffmpeg_enc.c b/fftools/ffmpeg_enc.c index c368097cd0..5707199ac5 100644 --- a/fftools/ffmpeg_enc.c +++ b/fftools/ffmpeg_enc.c @@ -59,6 +59,9 @@ struct Encoder { // combined size of all the packets received from the encoder uint64_t data_size; + + // number of packets received from the encoder + uint64_t packets_encoded; }; static uint64_t dup_warning = 1000; @@ -619,7 +622,7 @@ static void update_video_stats(OutputStream *ost, const AVPacket *pkt, int write } } - frame_number = ost->packets_encoded; + frame_number = e->packets_encoded; if (vstats_version <= 1) { fprintf(vstats_file, "frame= %5"PRId64" q= %2.1f ", frame_number, ost->quality / (float)FF_QP2LAMBDA); @@ -708,7 +711,7 @@ static int encode_frame(OutputFile *of, OutputStream *ost, AVFrame *frame) update_video_stats(ost, pkt, !!vstats_filename); if (ost->enc_stats_post.io) enc_stats_write(ost, &ost->enc_stats_post, NULL, pkt, - ost->packets_encoded); + e->packets_encoded); if (debug_ts) { av_log(ost, AV_LOG_INFO, "encoder -> type:%s " @@ -742,7 +745,7 @@ static int encode_frame(OutputFile *of, OutputStream *ost, AVFrame *frame) e->data_size += pkt->size; - ost->packets_encoded++; + e->packets_encoded++; of_output_packet(of, pkt, ost, 0); } From patchwork Thu Apr 27 14:25:46 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anton Khirnov X-Patchwork-Id: 41366 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:dca6:b0:f3:34fa:f187 with SMTP id ky38csp563251pzb; Thu, 27 Apr 2023 07:26:52 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5zbWt7wZFY4owlaG55A6cdheKvyxd/DImTWoqO90j5sZvM39GS6QbGJ64gdraRYdvvzvC9 X-Received: by 2002:a17:907:da4:b0:94a:96c4:2361 with SMTP id go36-20020a1709070da400b0094a96c42361mr1959823ejc.73.1682605612726; Thu, 27 Apr 2023 07:26:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1682605612; cv=none; d=google.com; s=arc-20160816; b=emp+KNtWUiEWxTFDPIfRg8t2UGVisrLe8iGaE4Is8hXFAP/7CdpN+zE8wKfYY8uSXY cz0mpL2afg2KV1MwnILnHSxovoOW/C+/hQxbjI7ok6xmyH+dYpkuK9SFJ+CgGRlQeFSE oD9akbyqfFQFzXiShZGBsVnYH6HNFT6wXUoTyWwcEMIIbHaZwmH2976xEumOJq4RyywW mabcrmY+Z2aI5+3aQZVj5M5PaQyF0SvPjY/OFrkTuZqP3NDU0472lfV7W55zSUh0roCN mgQtXfE2/Amclgtmi+Ic1I1gk8EvZSFtpZVI2+giES6Mow3z8V9nMm1nn42xkRGvcE+3 5TQg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:reply-to:list-subscribe :list-help:list-post:list-archive:list-unsubscribe:list-id :precedence:subject:mime-version:references:in-reply-to:message-id :date:to:from:delivered-to; bh=bpG3jt4Nc2z3zfNwvdB+ki0plcGZ6O0qia2D08nzS3U=; b=0Vrw+jouhtVIxTzYwvxzcVUNFSsBiYxyTN5UukJUihtsKHjl889q5AZsx5RoxnGSCr CAbt57dpIsCSE/DTJANaXtKz0MuaSuMvsbHVvheL86V4RwEkVAy7tzArB1gQbv+Mgned RdszIOhJY38VbTDXCHDp4MAPomPdNsH6PNCkhiz77sMc1ZmYIVqOQp1HkIkF+orB4owg uKavIJDzsKnz1ETq4ZS3szeMY7PWKtjUkqx7WRjSVCnmLYtDOheVX833iIjqTbgh/SwN XEQuUgfvaVCk4Sq2tFanoKEHDaXVbGWIyIIWiglPtPNoq8aCo+3+qTxNUDNStPIitTjA +xAg== ARC-Authentication-Results: i=1; mx.google.com; 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 y24-20020a1709060a9800b0094ec7b0c6a4si14408091ejf.284.2023.04.27.07.26.52; Thu, 27 Apr 2023 07:26:52 -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; 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 E59E668BF97; Thu, 27 Apr 2023 17:26:17 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail0.khirnov.net (red.khirnov.net [176.97.15.12]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 66B7C68BF18 for ; Thu, 27 Apr 2023 17:26:07 +0300 (EEST) Received: from localhost (localhost [IPv6:::1]) by mail0.khirnov.net (Postfix) with ESMTP id 250432404EC for ; Thu, 27 Apr 2023 16:26:07 +0200 (CEST) Received: from mail0.khirnov.net ([IPv6:::1]) by localhost (mail0.khirnov.net [IPv6:::1]) (amavisd-new, port 10024) with ESMTP id IVTaYJ-Sh9_z for ; Thu, 27 Apr 2023 16:26:06 +0200 (CEST) Received: from libav.khirnov.net (libav.khirnov.net [IPv6:2a00:c500:561:201::7]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "libav.khirnov.net", Issuer "smtp.khirnov.net SMTP CA" (verified OK)) by mail0.khirnov.net (Postfix) with ESMTPS id 52D212404F8 for ; Thu, 27 Apr 2023 16:26:05 +0200 (CEST) Received: from libav.khirnov.net (libav.khirnov.net [IPv6:::1]) by libav.khirnov.net (Postfix) with ESMTP id 3F6493A058B for ; Thu, 27 Apr 2023 16:26:05 +0200 (CEST) From: Anton Khirnov To: ffmpeg-devel@ffmpeg.org Date: Thu, 27 Apr 2023 16:25:46 +0200 Message-Id: <20230427142601.2613-6-anton@khirnov.net> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230427142601.2613-1-anton@khirnov.net> References: <20230427142601.2613-1-anton@khirnov.net> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 06/21] fftools/ffmpeg: drop undocumented runtime debug-setting 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 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: gE7gmhhJlK3V This feature is of highly questionable usefulness and - as the comment in the code says - is not actually supported by the API. --- fftools/ffmpeg.c | 35 ----------------------------------- 1 file changed, 35 deletions(-) diff --git a/fftools/ffmpeg.c b/fftools/ffmpeg.c index 1ae2c5c18f..453d3763be 100644 --- a/fftools/ffmpeg.c +++ b/fftools/ffmpeg.c @@ -1768,40 +1768,6 @@ static int check_keyboard_interaction(int64_t cur_time) "only %d given in string '%s'\n", n, buf); } } - if (key == 'd' || key == 'D'){ - int debug=0; - if(key == 'D') { - InputStream *ist = ist_iter(NULL); - - if (ist) - debug = ist->dec_ctx->debug << 1; - - if(!debug) debug = 1; - while (debug & FF_DEBUG_DCT_COEFF) //unsupported, would just crash - debug += debug; - }else{ - char buf[32]; - int k = 0; - i = 0; - set_tty_echo(1); - while ((k = read_key()) != '\n' && k != '\r' && i < sizeof(buf)-1) - if (k > 0) - buf[i++] = k; - buf[i] = 0; - set_tty_echo(0); - fprintf(stderr, "\n"); - if (k <= 0 || sscanf(buf, "%d", &debug)!=1) - fprintf(stderr,"error parsing debug value\n"); - } - for (InputStream *ist = ist_iter(NULL); ist; ist = ist_iter(ist)) - ist->dec_ctx->debug = debug; - for (OutputStream *ost = ost_iter(NULL); ost; ost = ost_iter(ost)) { - if (ost->enc_ctx) - ost->enc_ctx->debug = debug; - } - if(debug) av_log_set_level(AV_LOG_DEBUG); - fprintf(stderr,"debug=%d\n", debug); - } if (key == '?'){ fprintf(stderr, "key function\n" "? show this help\n" @@ -1809,7 +1775,6 @@ static int check_keyboard_interaction(int64_t cur_time) "- decrease verbosity\n" "c Send command to first matching filter supporting it\n" "C Send/Queue command to all matching filters\n" - "D cycle through available debug modes\n" "h dump packets/hex press to cycle through the 3 states\n" "q quit\n" "s Show QP histogram\n" From patchwork Thu Apr 27 14:25:47 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anton Khirnov X-Patchwork-Id: 41367 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:dca6:b0:f3:34fa:f187 with SMTP id ky38csp563351pzb; Thu, 27 Apr 2023 07:27:03 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4ACQ2rqbt64GpbtR82wwsAz9i+NFDW9iiqJUfS/GelzbwFQeJPi9DVcp27G4V8Gu18lITM X-Received: by 2002:a17:907:3ea7:b0:94f:2b80:f3b4 with SMTP id hs39-20020a1709073ea700b0094f2b80f3b4mr2419709ejc.69.1682605623113; Thu, 27 Apr 2023 07:27:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1682605623; cv=none; d=google.com; s=arc-20160816; b=d92KQrFeaqz+lChN5zluBCwezXDEahZygbzqo/NIjLWpG3k1N1MCWi1i3dd9rNmGUo Fo+cHRwmwo/alqDHaYLcxX6b5d5k3RT4E/tiUKmY7Sb+veyclj0yI/CaJ/AN143fzvUR pFzbMNYkLbSwTd90MsTzpqf7h/JXY45fw5nASEZDFNn/iHjp8DjU7LKuRI6VqG7btcPY w/Tredlwn+h9gTbVAgzrtWZYX1MR7llKXaoElHlKD6D3NyAQdSwRT+WznRvVOghW3aJm veZF1bhzDVTZWLbT/tk3V6TDporZawcvusGXuTA3fiQls6HKgCO9kJd6CI08hv4Kdgwg QfQQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:reply-to:list-subscribe :list-help:list-post:list-archive:list-unsubscribe:list-id :precedence:subject:mime-version:references:in-reply-to:message-id :date:to:from:delivered-to; bh=i71+JWQW0+0mHMB9lEM/7B7iZeBj80jgLG5wc1MSzpc=; b=cx2llRyIDakGfCyTczd8QAV2enM7k3+AH1DCU/MwjfKqTpFLV1r+WMvpBO7R/EGNVH /83Ww4NW0e9GuJ3DTvjBIpDGqVi3CQE2m3zNtL2GiPrQSWp8kNkbnDJC8qFtmGgcLhez v0rhPA4+Fr7BhJw6Io4qTPgddVi+hDwQARbAXMGFtPJKyROXn58eW1bZeDYXaht3p0KQ NBOoViLg/kXY1kdKSGJSn3lfJ9TfNQ9R7zl7KqlWB56lHw3xfP2Ihh5S7yugL2pn9scC DKIKoOkY/hUiE93fo3j4NmOmHFVLJB5hxNFm/o/vzn7Banl2RBbFPb8aU0scLNDRBKiC 6kEg== ARC-Authentication-Results: i=1; mx.google.com; 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 nc19-20020a1709071c1300b0094f8729d9a7si17726877ejc.42.2023.04.27.07.27.02; Thu, 27 Apr 2023 07:27:03 -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; 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 0A95A68B74D; Thu, 27 Apr 2023 17:26:19 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail0.khirnov.net (red.khirnov.net [176.97.15.12]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id D86C668BF47 for ; Thu, 27 Apr 2023 17:26:07 +0300 (EEST) Received: from localhost (localhost [IPv6:::1]) by mail0.khirnov.net (Postfix) with ESMTP id 9B4232404F8 for ; Thu, 27 Apr 2023 16:26:07 +0200 (CEST) Received: from mail0.khirnov.net ([IPv6:::1]) by localhost (mail0.khirnov.net [IPv6:::1]) (amavisd-new, port 10024) with ESMTP id h_nLbmMxTEJA for ; Thu, 27 Apr 2023 16:26:07 +0200 (CEST) Received: from libav.khirnov.net (libav.khirnov.net [IPv6:2a00:c500:561:201::7]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "libav.khirnov.net", Issuer "smtp.khirnov.net SMTP CA" (verified OK)) by mail0.khirnov.net (Postfix) with ESMTPS id 57F11240591 for ; Thu, 27 Apr 2023 16:26:05 +0200 (CEST) Received: from libav.khirnov.net (libav.khirnov.net [IPv6:::1]) by libav.khirnov.net (Postfix) with ESMTP id 4A42F3A0664 for ; Thu, 27 Apr 2023 16:26:05 +0200 (CEST) From: Anton Khirnov To: ffmpeg-devel@ffmpeg.org Date: Thu, 27 Apr 2023 16:25:47 +0200 Message-Id: <20230427142601.2613-7-anton@khirnov.net> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230427142601.2613-1-anton@khirnov.net> References: <20230427142601.2613-1-anton@khirnov.net> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 07/21] fftools/ffmpeg_filter: make ifilter_parameters_from_frame() static 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 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: UPnhVUCRwi2O It is no longer used outside of this file. --- fftools/ffmpeg.h | 1 - fftools/ffmpeg_filter.c | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/fftools/ffmpeg.h b/fftools/ffmpeg.h index 116087354d..cc384b4b30 100644 --- a/fftools/ffmpeg.h +++ b/fftools/ffmpeg.h @@ -794,7 +794,6 @@ void sub2video_update(InputStream *ist, int64_t heartbeat_pts, AVSubtitle *sub); int ifilter_send_frame(InputFilter *ifilter, AVFrame *frame, int keep_reference); int ifilter_send_eof(InputFilter *ifilter, int64_t pts); -int ifilter_parameters_from_frame(InputFilter *ifilter, const AVFrame *frame); int ifilter_parameters_from_codecpar(InputFilter *ifilter, AVCodecParameters *par); int ifilter_has_all_input_formats(FilterGraph *fg); diff --git a/fftools/ffmpeg_filter.c b/fftools/ffmpeg_filter.c index b26160b375..c90e8bec91 100644 --- a/fftools/ffmpeg_filter.c +++ b/fftools/ffmpeg_filter.c @@ -1309,7 +1309,7 @@ fail: return ret; } -int ifilter_parameters_from_frame(InputFilter *ifilter, const AVFrame *frame) +static int ifilter_parameters_from_frame(InputFilter *ifilter, const AVFrame *frame) { AVFrameSideData *sd; int ret; From patchwork Thu Apr 27 14:25:48 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anton Khirnov X-Patchwork-Id: 41379 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:dca6:b0:f3:34fa:f187 with SMTP id ky38csp564706pzb; Thu, 27 Apr 2023 07:29:12 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5kt4/VRt3QCcChz9pGHOWk8nZqh46NTYAEjvo/duUpUAdxFhGWQaExVsB8AZhq9g0c4BDz X-Received: by 2002:a17:907:7e8d:b0:94f:2020:b5fb with SMTP id qb13-20020a1709077e8d00b0094f2020b5fbmr2427063ejc.27.1682605752070; Thu, 27 Apr 2023 07:29:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1682605752; cv=none; d=google.com; s=arc-20160816; b=TiTS7piJRT2meXHPw9fs3byX7QyWnQUHkoooFnQwHehvZEJuQOfXzciwrFVbPuZK0r Up4YFu4k9Qn6+DQcLm4RlJihqJDDCKSgLBPmU9kNN0KgkEsulPWHZMVqJyTpVShi2Irx lZyujDun6tD16O5p2YRt7Z8yHB8YkegEGT3WUgiYm1ONEAW2LrearDH3fS/m5lyHFPzR VWeTHxAj+I9bNis0kN0oCxdCijRBqcN3pUu3vVQV7sjnF5UEknyQz/185ezRgmx/JuOB sbyuUC0LHBKmmISP/Zzjpx8u5eV6aoCctHh4nWu8E3KYK5RPdCd6x5oQeMVGvhDfLlFa 9g+A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:reply-to:list-subscribe :list-help:list-post:list-archive:list-unsubscribe:list-id :precedence:subject:mime-version:references:in-reply-to:message-id :date:to:from:delivered-to; bh=csJppqJDzx4yHno6YifvP8n+Xrr+cOl39UlEPR5oh70=; b=iCsPc+xz0l20JvYzLjJ0oPXnvaM2M8uVytwjcfARC7+vC8MhS/YZvTl2p9G9flaKie osnlV/88OJ9/xlohZwe3RnZFiqez/RET5PMHbl/5VXnIggNtKer6V1c2Pt0+vtW2/TkE /GgFUs5m3/22U4n155OrWh92PLl4l4FLiEn89BTfCzHxrguPqL4T3UoYKx/z9ag3SIpQ AN2SgePjG+d1XQ3guq/fubvAO/VkdF1ys7zjdOspGi+2QKXa1nVFRa4rHgjl7KTNr8Nb uKs3vHz+mMUk5BlP9YxaN2zAmWawjhDV8YKjJpPxpNJr9/nLPaYzGtcceW0fJiLvM+jH 1I/w== ARC-Authentication-Results: i=1; mx.google.com; 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 y20-20020a170906071400b0094fa1fef0fasi10961448ejb.374.2023.04.27.07.29.09; Thu, 27 Apr 2023 07:29:12 -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; 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 985BA68C035; Thu, 27 Apr 2023 17:26:35 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail0.khirnov.net (red.khirnov.net [176.97.15.12]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 8F92468BF36 for ; Thu, 27 Apr 2023 17:26:12 +0300 (EEST) Received: from localhost (localhost [IPv6:::1]) by mail0.khirnov.net (Postfix) with ESMTP id 5DBD12406CA for ; Thu, 27 Apr 2023 16:26:10 +0200 (CEST) Received: from mail0.khirnov.net ([IPv6:::1]) by localhost (mail0.khirnov.net [IPv6:::1]) (amavisd-new, port 10024) with ESMTP id GQ-JblFrLTd1 for ; Thu, 27 Apr 2023 16:26:08 +0200 (CEST) Received: from libav.khirnov.net (libav.khirnov.net [IPv6:2a00:c500:561:201::7]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "libav.khirnov.net", Issuer "smtp.khirnov.net SMTP CA" (verified OK)) by mail0.khirnov.net (Postfix) with ESMTPS id 64A362405EC for ; Thu, 27 Apr 2023 16:26:05 +0200 (CEST) Received: from libav.khirnov.net (libav.khirnov.net [IPv6:::1]) by libav.khirnov.net (Postfix) with ESMTP id 54EB63A031B for ; Thu, 27 Apr 2023 16:26:05 +0200 (CEST) From: Anton Khirnov To: ffmpeg-devel@ffmpeg.org Date: Thu, 27 Apr 2023 16:25:48 +0200 Message-Id: <20230427142601.2613-8-anton@khirnov.net> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230427142601.2613-1-anton@khirnov.net> References: <20230427142601.2613-1-anton@khirnov.net> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 08/21] fftools/ffmpeg_filter: add filtergraph private data 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 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: WPswqLDpY7lL Start by moving OutputStream.filtered_frame to it, which really belongs to the filtergraph rather than the output stream. --- fftools/ffmpeg.h | 1 - fftools/ffmpeg_filter.c | 31 ++++++++++++++++++++++++++----- fftools/ffmpeg_mux.c | 1 - fftools/ffmpeg_mux_init.c | 4 ---- 4 files changed, 26 insertions(+), 11 deletions(-) diff --git a/fftools/ffmpeg.h b/fftools/ffmpeg.h index cc384b4b30..2acbccfe2c 100644 --- a/fftools/ffmpeg.h +++ b/fftools/ffmpeg.h @@ -604,7 +604,6 @@ typedef struct OutputStream { Encoder *enc; AVCodecContext *enc_ctx; - AVFrame *filtered_frame; AVPacket *pkt; int64_t last_dropped; diff --git a/fftools/ffmpeg_filter.c b/fftools/ffmpeg_filter.c index c90e8bec91..4b7b34b05d 100644 --- a/fftools/ffmpeg_filter.c +++ b/fftools/ffmpeg_filter.c @@ -38,6 +38,18 @@ #include "libavutil/samplefmt.h" #include "libavutil/timestamp.h" +typedef struct FilterGraphPriv { + FilterGraph fg; + + // frame for temporarily holding output from the filtergraph + AVFrame *frame; +} FilterGraphPriv; + +static FilterGraphPriv *fgp_from_fg(FilterGraph *fg) +{ + return (FilterGraphPriv*)fg; +} + // FIXME: YUV420P etc. are actually supported with full color range, // yet the latter information isn't available here. static const enum AVPixelFormat *get_compliance_normal_pix_fmts(const AVCodec *codec, const enum AVPixelFormat default_formats[]) @@ -192,9 +204,11 @@ static OutputFilter *ofilter_alloc(FilterGraph *fg) void fg_free(FilterGraph **pfg) { FilterGraph *fg = *pfg; + FilterGraphPriv *fgp; if (!fg) return; + fgp = fgp_from_fg(fg); avfilter_graph_free(&fg->graph); for (int j = 0; j < fg->nb_inputs; j++) { @@ -230,17 +244,23 @@ void fg_free(FilterGraph **pfg) av_freep(&fg->outputs); av_freep(&fg->graph_desc); + av_frame_free(&fgp->frame); + av_freep(pfg); } FilterGraph *fg_create(char *graph_desc) { - FilterGraph *fg; + FilterGraphPriv *fgp = allocate_array_elem(&filtergraphs, sizeof(*fgp), &nb_filtergraphs); + FilterGraph *fg = &fgp->fg; - fg = ALLOC_ARRAY_ELEM(filtergraphs, nb_filtergraphs); fg->index = nb_filtergraphs - 1; fg->graph_desc = graph_desc; + fgp->frame = av_frame_alloc(); + if (!fgp->frame) + report_and_exit(AVERROR(ENOMEM)); + return fg; } @@ -1348,18 +1368,19 @@ int filtergraph_is_simple(FilterGraph *fg) int reap_filters(int flush) { - AVFrame *filtered_frame = NULL; - /* Reap all buffers present in the buffer sinks */ for (OutputStream *ost = ost_iter(NULL); ost; ost = ost_iter(ost)) { + FilterGraphPriv *fgp; + AVFrame *filtered_frame; AVFilterContext *filter; int ret = 0; if (!ost->filter || !ost->filter->graph->graph) continue; filter = ost->filter->filter; + fgp = fgp_from_fg(ost->filter->graph); - filtered_frame = ost->filtered_frame; + filtered_frame = fgp->frame; while (1) { ret = av_buffersink_get_frame_flags(filter, filtered_frame, diff --git a/fftools/ffmpeg_mux.c b/fftools/ffmpeg_mux.c index 52f98fb76a..afcd4df99b 100644 --- a/fftools/ffmpeg_mux.c +++ b/fftools/ffmpeg_mux.c @@ -845,7 +845,6 @@ static void ost_free(OutputStream **post) av_bsf_free(&ms->bsf_ctx); - av_frame_free(&ost->filtered_frame); av_packet_free(&ost->pkt); av_dict_free(&ost->encoder_opts); diff --git a/fftools/ffmpeg_mux_init.c b/fftools/ffmpeg_mux_init.c index 7a2db9f0e8..2c0e2faf4a 100644 --- a/fftools/ffmpeg_mux_init.c +++ b/fftools/ffmpeg_mux_init.c @@ -1026,10 +1026,6 @@ static OutputStream *ost_add(Muxer *mux, const OptionsContext *o, av_strlcat(ms->log_name, "/copy", sizeof(ms->log_name)); } - ost->filtered_frame = av_frame_alloc(); - if (!ost->filtered_frame) - report_and_exit(AVERROR(ENOMEM)); - ost->pkt = av_packet_alloc(); if (!ost->pkt) report_and_exit(AVERROR(ENOMEM)); From patchwork Thu Apr 27 14:25:49 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anton Khirnov X-Patchwork-Id: 41378 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:dca6:b0:f3:34fa:f187 with SMTP id ky38csp564599pzb; Thu, 27 Apr 2023 07:29:00 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7DtMOJE8x6nmQCJ62DslkUAsAzIv+E3sx5XHvAA6yOisymtsmMPiJMw1E0KKGy9VLzICQk X-Received: by 2002:aa7:dbd2:0:b0:50a:16ab:340e with SMTP id v18-20020aa7dbd2000000b0050a16ab340emr1856841edt.29.1682605740574; Thu, 27 Apr 2023 07:29:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1682605740; cv=none; d=google.com; s=arc-20160816; b=uCZb8N40XktDTNUEdVAS6IWpvwzM+TXgxEcSzVSxmi/c2zFo/azhZrhKhMksRibaMQ yCPNmjjiRrGx9BFZ+rcv7Oj3TEZVr3yGpWqTCDUUVDdpv5Gcf8dHytN4uwLZngShKp/v kgPuLsGPoR/kZrtym0/5eRjpfY4bXVaatlE0kv9fYxfjKQJ1DTDQuutb2jtCyjxmZkiK iEa42Uw9nUqrZSP4A8rubGsIzNdBEVln64Z1x3fFTZARRfcQ/SthjA7C/lLceoFbz8xV VZ1bghybYuiwQKXEywnwGRc8a5bJMk66tXaBLQeWFX3Wbva5U0KYEe7W47iYa9vLtAWq 3iGg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:reply-to:list-subscribe :list-help:list-post:list-archive:list-unsubscribe:list-id :precedence:subject:mime-version:references:in-reply-to:message-id :date:to:from:delivered-to; bh=Y3r+fgxvT1oKhFCFDKJPKn1O+v3tfYet5MLb5viINWk=; b=oCIqTmglvgzaDxlLUW2BjBTEr467tuiRJlrYdiaWDIM6WdJFbTbyxvdrszZtPifniE xJsF8Tpv0nDFVdRXI79exerByOy+sM0NdQs5zAg16zOBLp7+DAzPne1LW6aQ8zcOM6Dk CxgKwKVwt/R1uJJzLacMsOzPDMtypeGyuK9MNNnH1rw5yAki820wsivIs89h1UjL7y// DTUc6PZBHJLkAeLPH8fYQl0+K+yzyJbx/3QAAYrllqTsdvRdSwB4Y3Edw8JvNPM4Lu/m lss9fl+yWgLY+pNZ4nUV7pkYt18D0ge955nkKUvqfZnVWgzVXX7XC3WYZoG4DIUoy/6A MUEA== ARC-Authentication-Results: i=1; mx.google.com; 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 d9-20020a05640208c900b004fb076448e4si15234205edz.163.2023.04.27.07.28.59; Thu, 27 Apr 2023 07:29:00 -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; 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 8B07268C02C; Thu, 27 Apr 2023 17:26:34 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail0.khirnov.net (red.khirnov.net [176.97.15.12]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 3496068BF92 for ; Thu, 27 Apr 2023 17:26:12 +0300 (EEST) Received: from localhost (localhost [IPv6:::1]) by mail0.khirnov.net (Postfix) with ESMTP id 2045C2406CB for ; Thu, 27 Apr 2023 16:26:10 +0200 (CEST) Received: from mail0.khirnov.net ([IPv6:::1]) by localhost (mail0.khirnov.net [IPv6:::1]) (amavisd-new, port 10024) with ESMTP id 5D6NULRiqWQP for ; Thu, 27 Apr 2023 16:26:09 +0200 (CEST) Received: from libav.khirnov.net (libav.khirnov.net [IPv6:2a00:c500:561:201::7]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "libav.khirnov.net", Issuer "smtp.khirnov.net SMTP CA" (verified OK)) by mail0.khirnov.net (Postfix) with ESMTPS id 6D1362406CA for ; Thu, 27 Apr 2023 16:26:05 +0200 (CEST) Received: from libav.khirnov.net (libav.khirnov.net [IPv6:::1]) by libav.khirnov.net (Postfix) with ESMTP id 5FA613A03E5 for ; Thu, 27 Apr 2023 16:26:05 +0200 (CEST) From: Anton Khirnov To: ffmpeg-devel@ffmpeg.org Date: Thu, 27 Apr 2023 16:25:49 +0200 Message-Id: <20230427142601.2613-9-anton@khirnov.net> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230427142601.2613-1-anton@khirnov.net> References: <20230427142601.2613-1-anton@khirnov.net> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 09/21] fftools/ffmpeg_filter: make graph_desc private 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 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: nKITXbOaLceu It is not used outside of ffmpeg_filter. --- fftools/ffmpeg.h | 1 - fftools/ffmpeg_filter.c | 22 ++++++++++++++-------- 2 files changed, 14 insertions(+), 9 deletions(-) diff --git a/fftools/ffmpeg.h b/fftools/ffmpeg.h index 2acbccfe2c..e0e923e902 100644 --- a/fftools/ffmpeg.h +++ b/fftools/ffmpeg.h @@ -323,7 +323,6 @@ typedef struct OutputFilter { typedef struct FilterGraph { int index; - const char *graph_desc; AVFilterGraph *graph; // true when the filtergraph contains only meta filters diff --git a/fftools/ffmpeg_filter.c b/fftools/ffmpeg_filter.c index 4b7b34b05d..12ecf54998 100644 --- a/fftools/ffmpeg_filter.c +++ b/fftools/ffmpeg_filter.c @@ -41,6 +41,8 @@ typedef struct FilterGraphPriv { FilterGraph fg; + const char *graph_desc; + // frame for temporarily holding output from the filtergraph AVFrame *frame; } FilterGraphPriv; @@ -242,7 +244,7 @@ void fg_free(FilterGraph **pfg) av_freep(&fg->outputs[j]); } av_freep(&fg->outputs); - av_freep(&fg->graph_desc); + av_freep(&fgp->graph_desc); av_frame_free(&fgp->frame); @@ -255,7 +257,7 @@ FilterGraph *fg_create(char *graph_desc) FilterGraph *fg = &fgp->fg; fg->index = nb_filtergraphs - 1; - fg->graph_desc = graph_desc; + fgp->graph_desc = graph_desc; fgp->frame = av_frame_alloc(); if (!fgp->frame) @@ -312,6 +314,7 @@ static char *describe_filter_link(FilterGraph *fg, AVFilterInOut *inout, int in) static void init_input_filter(FilterGraph *fg, AVFilterInOut *in) { + FilterGraphPriv *fgp = fgp_from_fg(fg); InputStream *ist = NULL; enum AVMediaType type = avfilter_pad_get_type(in->filter_ctx->input_pads, in->pad_idx); InputFilter *ifilter; @@ -332,7 +335,7 @@ static void init_input_filter(FilterGraph *fg, AVFilterInOut *in) if (file_idx < 0 || file_idx >= nb_input_files) { av_log(NULL, AV_LOG_FATAL, "Invalid file index %d in filtergraph description %s.\n", - file_idx, fg->graph_desc); + file_idx, fgp->graph_desc); exit_program(1); } s = input_files[file_idx]->ctx; @@ -350,13 +353,13 @@ static void init_input_filter(FilterGraph *fg, AVFilterInOut *in) } if (!st) { av_log(NULL, AV_LOG_FATAL, "Stream specifier '%s' in filtergraph description %s " - "matches no streams.\n", p, fg->graph_desc); + "matches no streams.\n", p, fgp->graph_desc); exit_program(1); } ist = input_files[file_idx]->streams[st->index]; if (ist->user_set_discard == AVDISCARD_ALL) { av_log(NULL, AV_LOG_FATAL, "Stream specifier '%s' in filtergraph description %s " - "matches a disabled input stream.\n", p, fg->graph_desc); + "matches a disabled input stream.\n", p, fgp->graph_desc); exit_program(1); } } else { @@ -560,6 +563,7 @@ fail: int init_complex_filtergraph(FilterGraph *fg) { + FilterGraphPriv *fgp = fgp_from_fg(fg); AVFilterInOut *inputs, *outputs, *cur; AVFilterGraph *graph; int ret = 0; @@ -571,7 +575,7 @@ int init_complex_filtergraph(FilterGraph *fg) return AVERROR(ENOMEM); graph->nb_threads = 1; - ret = graph_parse(graph, fg->graph_desc, &inputs, &outputs, NULL); + ret = graph_parse(graph, fgp->graph_desc, &inputs, &outputs, NULL); if (ret < 0) goto fail; @@ -1179,11 +1183,12 @@ static int graph_is_meta(AVFilterGraph *graph) int configure_filtergraph(FilterGraph *fg) { + FilterGraphPriv *fgp = fgp_from_fg(fg); AVBufferRef *hw_device; AVFilterInOut *inputs, *outputs, *cur; int ret, i, simple = filtergraph_is_simple(fg); const char *graph_desc = simple ? fg->outputs[0]->ost->avfilter : - fg->graph_desc; + fgp->graph_desc; cleanup_filtergraph(fg); if (!(fg->graph = avfilter_graph_alloc())) @@ -1363,7 +1368,8 @@ static int ifilter_parameters_from_frame(InputFilter *ifilter, const AVFrame *fr int filtergraph_is_simple(FilterGraph *fg) { - return !fg->graph_desc; + FilterGraphPriv *fgp = fgp_from_fg(fg); + return !fgp->graph_desc; } int reap_filters(int flush) From patchwork Thu Apr 27 14:25:50 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anton Khirnov X-Patchwork-Id: 41377 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:dca6:b0:f3:34fa:f187 with SMTP id ky38csp564472pzb; Thu, 27 Apr 2023 07:28:50 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ47hkwbjtA6WmEihR7FA/HJMRThOR/X/sNJ4BhYfd0eH85eyECZ2HY/ngnxSbp4BMvQmZw+ X-Received: by 2002:a05:6402:1288:b0:506:a44c:e213 with SMTP id w8-20020a056402128800b00506a44ce213mr2061231edv.20.1682605730675; Thu, 27 Apr 2023 07:28:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1682605730; cv=none; d=google.com; s=arc-20160816; b=hka5TxEDpEG7Q/lC8U/VAIDagygDK1WeVH4YTJJ5BLtXR1pD5b7bGuErdyIzFydD8A 3l6Wup1vz4ZoTUfztdMj9bhNiRyw66w547HvriGpAxWNSVOQLJZPE5IA+RBkCnmBa58I onKbAo1tiGKj2RQbIsz9xH/T1mBewvI8PE+qC1hGMS92GXApzOOYSRAwtbu+6RN3k6Rg aXsw6k7nUzgg9fP+ZMyK1dYIvsfMltEYmA6WmOSC9Bo1Ei2lVg9YF9xG4iNLEGH8TntS aALVLvn3mSb5vobbZmT//28NVG1Qw4+C0ou2U+0bWpyGw3bMC1DrV2kVcVdVf2pbGP6Z zOVg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:reply-to:list-subscribe :list-help:list-post:list-archive:list-unsubscribe:list-id :precedence:subject:mime-version:references:in-reply-to:message-id :date:to:from:delivered-to; bh=utKa+JEtmYGa0CDqGoyjv9tXzh77VnuAqVGyLCXgDBU=; b=TLsm8ULK5g7wJQORZY1x7c4LUkB9LNtmaosbuWZdzwCx3++bMEJNrqSzoIgHquW1wK C2kJXi7dZI69XEV2getWtfSdkHpS12/75cd6nBG3u0fTo0TxE2Agu/Q+h3isuvpAKx8V skK6yvcnQcdDuOSPWgM+oEzqWNzPN5SVz7PjnFy/8uvwMw+qJg2DC5oodbkOTaHo5yBL UPHGcjMnEiv0fWbKfL8ea1zKCbNfV+HZ814sV+9oDhrWHs2xBX0zrBYsFdHW8U2wvCQY hRbmAKRY8bWTrVuXpwBd7DeWA7FUlHw4jHTRFLBL8a3FoVKnkQGg1Uih5uWbLLgXEflm XJjA== ARC-Authentication-Results: i=1; mx.google.com; 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 v22-20020a056402185600b0050697d54502si13420810edy.545.2023.04.27.07.28.50; Thu, 27 Apr 2023 07:28:50 -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; 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 8DA2368C026; Thu, 27 Apr 2023 17:26:33 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail0.khirnov.net (red.khirnov.net [176.97.15.12]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 2B8DA68BF71 for ; Thu, 27 Apr 2023 17:26:12 +0300 (EEST) Received: from localhost (localhost [IPv6:::1]) by mail0.khirnov.net (Postfix) with ESMTP id 71ACD2405B5 for ; Thu, 27 Apr 2023 16:26:09 +0200 (CEST) Received: from mail0.khirnov.net ([IPv6:::1]) by localhost (mail0.khirnov.net [IPv6:::1]) (amavisd-new, port 10024) with ESMTP id jGCTeh0TKCbA for ; Thu, 27 Apr 2023 16:26:08 +0200 (CEST) Received: from libav.khirnov.net (libav.khirnov.net [IPv6:2a00:c500:561:201::7]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "libav.khirnov.net", Issuer "smtp.khirnov.net SMTP CA" (verified OK)) by mail0.khirnov.net (Postfix) with ESMTPS id 7802D2406CB for ; Thu, 27 Apr 2023 16:26:05 +0200 (CEST) Received: from libav.khirnov.net (libav.khirnov.net [IPv6:::1]) by libav.khirnov.net (Postfix) with ESMTP id 6A6303A03F3 for ; Thu, 27 Apr 2023 16:26:05 +0200 (CEST) From: Anton Khirnov To: ffmpeg-devel@ffmpeg.org Date: Thu, 27 Apr 2023 16:25:50 +0200 Message-Id: <20230427142601.2613-10-anton@khirnov.net> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230427142601.2613-1-anton@khirnov.net> References: <20230427142601.2613-1-anton@khirnov.net> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 10/21] fftools/ffmpeg_filter: factorize allocating InputFilter 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 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: oGpBLxM8d9j8 --- fftools/ffmpeg_filter.c | 31 +++++++++++++++++-------------- 1 file changed, 17 insertions(+), 14 deletions(-) diff --git a/fftools/ffmpeg_filter.c b/fftools/ffmpeg_filter.c index 12ecf54998..ecabf3f886 100644 --- a/fftools/ffmpeg_filter.c +++ b/fftools/ffmpeg_filter.c @@ -203,6 +203,21 @@ static OutputFilter *ofilter_alloc(FilterGraph *fg) return ofilter; } +static InputFilter *ifilter_alloc(FilterGraph *fg) +{ + InputFilter *ifilter; + + ifilter = ALLOC_ARRAY_ELEM(fg->inputs, fg->nb_inputs); + ifilter->graph = fg; + ifilter->format = -1; + + ifilter->frame_queue = av_fifo_alloc2(8, sizeof(AVFrame*), AV_FIFO_FLAG_AUTO_GROW); + if (!ifilter->frame_queue) + report_and_exit(AVERROR(ENOMEM)); + + return ifilter; +} + void fg_free(FilterGraph **pfg) { FilterGraph *fg = *pfg; @@ -281,14 +296,8 @@ int init_simple_filtergraph(InputStream *ist, OutputStream *ost) ost->filter = ofilter; - ifilter = ALLOC_ARRAY_ELEM(fg->inputs, fg->nb_inputs); + ifilter = ifilter_alloc(fg); ifilter->ist = ist; - ifilter->graph = fg; - ifilter->format = -1; - - ifilter->frame_queue = av_fifo_alloc2(8, sizeof(AVFrame*), AV_FIFO_FLAG_AUTO_GROW); - if (!ifilter->frame_queue) - report_and_exit(AVERROR(ENOMEM)); ist_filter_add(ist, ifilter, 1); @@ -379,17 +388,11 @@ static void init_input_filter(FilterGraph *fg, AVFilterInOut *in) } av_assert0(ist); - ifilter = ALLOC_ARRAY_ELEM(fg->inputs, fg->nb_inputs); + ifilter = ifilter_alloc(fg); ifilter->ist = ist; - ifilter->graph = fg; - ifilter->format = -1; ifilter->type = ist->st->codecpar->codec_type; ifilter->name = describe_filter_link(fg, in, 1); - ifilter->frame_queue = av_fifo_alloc2(8, sizeof(AVFrame*), AV_FIFO_FLAG_AUTO_GROW); - if (!ifilter->frame_queue) - report_and_exit(AVERROR(ENOMEM)); - ist_filter_add(ist, ifilter, 0); } From patchwork Thu Apr 27 14:25:51 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anton Khirnov X-Patchwork-Id: 41380 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:dca6:b0:f3:34fa:f187 with SMTP id ky38csp564783pzb; Thu, 27 Apr 2023 07:29:19 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ68kkGnyGKd/hhAkhfqQi7TJTsDtxJ/O/051C4cNdsiKrv4ZKAnGj49DIVhBu5jwpDcVb/T X-Received: by 2002:aa7:dbc9:0:b0:506:bd8f:9301 with SMTP id v9-20020aa7dbc9000000b00506bd8f9301mr1667479edt.2.1682605759594; Thu, 27 Apr 2023 07:29:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1682605759; cv=none; d=google.com; s=arc-20160816; b=dAPNeYll6I+p8nFh44KYmVS1b0ArSIXX0fszxUH5CfRpC1FADfdJOktzWwpVI9asxz dWlGvlUQKsIJkDsLRdC1gpYi+qoSPI+66FQAgxU4qS3PIqapCIBmEXrrSfiTIR8fGgkh 0D7Jn4lLDmzOQanY7rIdKRCXycnGaZj2T63myOWNBKXZLw2tLb3Mmpd5wjSo927OEN6Q PNCH4m7KqOLQoH/2v7XzrmRhGHfcZCclLlRcpPEAqRSIL8o0iRVsAbiRtX9gwJC51mmD wdw0v2IU3VHYhYZ4qKNGjyXnUsYSGa7KbvMCVLZFDHutN96DxJlf53EoADc4FSOaD9pP G9nA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:reply-to:list-subscribe :list-help:list-post:list-archive:list-unsubscribe:list-id :precedence:subject:mime-version:references:in-reply-to:message-id :date:to:from:delivered-to; bh=uHsNlHI+medlgkWN0LyN4bjuv1ixh6I16liOWLDxgjs=; b=c1HdzgAkakQBrvxryZa8XqM/KDcxbVZqCklz0eWbwIw8qIkv2Yk0ZMAKfr5z7IXLOE 8L01VHLhObEXIpRnwkdbNpeXedhiGY1qLxolsKJKyksI3LgpjMXmczO7D+B+izcZbKKV FjeKFjbX+qq89lSUcHADtp7nj0MHE8r0sNby02xycvk1f+sftKQS3Rz9shFZ7oGiauju izN+MxAaAIiW9ABOT+odX/hRjpQPMOKt3iv8rJySX7Rifn0X7xN0aO9Qrqpm58fdEus8 N9A/gADYHJd8N+3HTC+QMaoEPO6VP5nYrHr2lZYUeFQNb3UKy2fm7dla2Hj8aFj7CpQe 1lbQ== ARC-Authentication-Results: i=1; mx.google.com; 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 n21-20020a05640206d500b005021f0d5758si13941890edy.671.2023.04.27.07.29.19; Thu, 27 Apr 2023 07:29:19 -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; 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 ABE4768C03B; Thu, 27 Apr 2023 17:26:36 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail0.khirnov.net (red.khirnov.net [176.97.15.12]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 940E868BF67 for ; Thu, 27 Apr 2023 17:26:12 +0300 (EEST) Received: from localhost (localhost [IPv6:::1]) by mail0.khirnov.net (Postfix) with ESMTP id C2A572405EC for ; Thu, 27 Apr 2023 16:26:10 +0200 (CEST) Received: from mail0.khirnov.net ([IPv6:::1]) by localhost (mail0.khirnov.net [IPv6:::1]) (amavisd-new, port 10024) with ESMTP id eksbOUKtn-AG for ; Thu, 27 Apr 2023 16:26:10 +0200 (CEST) Received: from libav.khirnov.net (libav.khirnov.net [IPv6:2a00:c500:561:201::7]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "libav.khirnov.net", Issuer "smtp.khirnov.net SMTP CA" (verified OK)) by mail0.khirnov.net (Postfix) with ESMTPS id 841F22406CC for ; Thu, 27 Apr 2023 16:26:05 +0200 (CEST) Received: from libav.khirnov.net (libav.khirnov.net [IPv6:::1]) by libav.khirnov.net (Postfix) with ESMTP id 7536B3A0404 for ; Thu, 27 Apr 2023 16:26:05 +0200 (CEST) From: Anton Khirnov To: ffmpeg-devel@ffmpeg.org Date: Thu, 27 Apr 2023 16:25:51 +0200 Message-Id: <20230427142601.2613-11-anton@khirnov.net> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230427142601.2613-1-anton@khirnov.net> References: <20230427142601.2613-1-anton@khirnov.net> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 11/21] fftools/ffmpeg_filter: add InputFilter private data 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 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: q8G+lBtiCcds Move InputFilter.frame_queue to it, which is not accessed outside of ffmpeg_filter. --- fftools/ffmpeg.h | 2 -- fftools/ffmpeg_filter.c | 33 ++++++++++++++++++++++++--------- 2 files changed, 24 insertions(+), 11 deletions(-) diff --git a/fftools/ffmpeg.h b/fftools/ffmpeg.h index e0e923e902..07322fdd79 100644 --- a/fftools/ffmpeg.h +++ b/fftools/ffmpeg.h @@ -277,8 +277,6 @@ typedef struct InputFilter { uint8_t *name; enum AVMediaType type; // AVMEDIA_TYPE_SUBTITLE for sub2video - AVFifo *frame_queue; - // parameters configured for this input int format; diff --git a/fftools/ffmpeg_filter.c b/fftools/ffmpeg_filter.c index ecabf3f886..6b92bc074e 100644 --- a/fftools/ffmpeg_filter.c +++ b/fftools/ffmpeg_filter.c @@ -52,6 +52,17 @@ static FilterGraphPriv *fgp_from_fg(FilterGraph *fg) return (FilterGraphPriv*)fg; } +typedef struct InputFilterPriv { + InputFilter ifilter; + + AVFifo *frame_queue; +} InputFilterPriv; + +static InputFilterPriv *ifp_from_ifilter(InputFilter *ifilter) +{ + return (InputFilterPriv*)ifilter; +} + // FIXME: YUV420P etc. are actually supported with full color range, // yet the latter information isn't available here. static const enum AVPixelFormat *get_compliance_normal_pix_fmts(const AVCodec *codec, const enum AVPixelFormat default_formats[]) @@ -205,14 +216,15 @@ static OutputFilter *ofilter_alloc(FilterGraph *fg) static InputFilter *ifilter_alloc(FilterGraph *fg) { - InputFilter *ifilter; + InputFilterPriv *ifp = allocate_array_elem(&fg->inputs, sizeof(*ifp), + &fg->nb_inputs); + InputFilter *ifilter = &ifp->ifilter; - ifilter = ALLOC_ARRAY_ELEM(fg->inputs, fg->nb_inputs); ifilter->graph = fg; ifilter->format = -1; - ifilter->frame_queue = av_fifo_alloc2(8, sizeof(AVFrame*), AV_FIFO_FLAG_AUTO_GROW); - if (!ifilter->frame_queue) + ifp->frame_queue = av_fifo_alloc2(8, sizeof(AVFrame*), AV_FIFO_FLAG_AUTO_GROW); + if (!ifp->frame_queue) report_and_exit(AVERROR(ENOMEM)); return ifilter; @@ -230,13 +242,14 @@ void fg_free(FilterGraph **pfg) avfilter_graph_free(&fg->graph); for (int j = 0; j < fg->nb_inputs; j++) { InputFilter *ifilter = fg->inputs[j]; + InputFilterPriv *ifp = ifp_from_ifilter(ifilter); struct InputStream *ist = ifilter->ist; - if (ifilter->frame_queue) { + if (ifp->frame_queue) { AVFrame *frame; - while (av_fifo_read(ifilter->frame_queue, &frame, 1) >= 0) + while (av_fifo_read(ifp->frame_queue, &frame, 1) >= 0) av_frame_free(&frame); - av_fifo_freep2(&ifilter->frame_queue); + av_fifo_freep2(&ifp->frame_queue); } av_freep(&ifilter->displaymatrix); if (ist->sub2video.sub_queue) { @@ -1300,8 +1313,9 @@ int configure_filtergraph(FilterGraph *fg) } for (i = 0; i < fg->nb_inputs; i++) { + InputFilterPriv *ifp = ifp_from_ifilter(fg->inputs[i]); AVFrame *tmp; - while (av_fifo_read(fg->inputs[i]->frame_queue, &tmp, 1) >= 0) { + while (av_fifo_read(ifp->frame_queue, &tmp, 1) >= 0) { ret = av_buffersrc_add_frame(fg->inputs[i]->filter, tmp); av_frame_free(&tmp); if (ret < 0) @@ -1458,6 +1472,7 @@ int ifilter_send_eof(InputFilter *ifilter, int64_t pts) int ifilter_send_frame(InputFilter *ifilter, AVFrame *frame, int keep_reference) { + InputFilterPriv *ifp = ifp_from_ifilter(ifilter); FilterGraph *fg = ifilter->graph; AVFrameSideData *sd; int need_reinit, ret; @@ -1506,7 +1521,7 @@ int ifilter_send_frame(InputFilter *ifilter, AVFrame *frame, int keep_reference) if (!tmp) return AVERROR(ENOMEM); - ret = av_fifo_write(ifilter->frame_queue, &tmp, 1); + ret = av_fifo_write(ifp->frame_queue, &tmp, 1); if (ret < 0) av_frame_free(&tmp); From patchwork Thu Apr 27 14:25:52 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anton Khirnov X-Patchwork-Id: 41381 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:dca6:b0:f3:34fa:f187 with SMTP id ky38csp564891pzb; Thu, 27 Apr 2023 07:29:29 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6wYJFMclaUrAB9Qg/fJkLnhTN6L390R7m6/UENsa6iZOY/Gd34/C1fux7phyYbiPnb5kSN X-Received: by 2002:a17:906:db0d:b0:957:2934:4d9d with SMTP id xj13-20020a170906db0d00b0095729344d9dmr1938366ejb.30.1682605769252; Thu, 27 Apr 2023 07:29:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1682605769; cv=none; d=google.com; s=arc-20160816; b=yF07ZG34EK8wAkHI1jXYNthTiLIspoGnn6cbcQHtggCGZBKHw/y+BBSKluvEGF2mH8 EkhdntM2HvgB/iJH+GV2RuRuZg69FxXtVyTedAsUbqUTTm26edkB1JBTlzMEESuPRUnG sqWf0Off0sB97+NCzYUS8gUVm5B8cbh3KO5OQkmWaI2/3zKYor56SnR4CtqDSd1FcP+z vB+HLztg0fqvH/7B5PZpPFCU7ty9AxO6AnbI8RPq5iP3/qtOCmHE4djFmGUmqGBGyoM2 +G9DpFq/KBIyMEjSMCO6vOsZkIE9Uv31QR3L6/ppxTdtBVjA5funhaowq6MYvK6OD9/e wjGA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:reply-to:list-subscribe :list-help:list-post:list-archive:list-unsubscribe:list-id :precedence:subject:mime-version:references:in-reply-to:message-id :date:to:from:delivered-to; bh=CSCExhJOYrVqMLRgUTKfRWZ9jowDF8UGVJskjaR8Mn8=; b=jWm+JhkzBM8P2TUzfi7s27XRgkkyD27zLfAkxK/ln6wZ8Xev6cS+UVJZqqqeP2PK8K 9/4Rl71DXOrSE4etFvcJlYRk7n/80rF7h1AbdatqtbdXViJ46j9E5yYrLQ7q0nT7aBSJ ooFPoAUFLHRKMDGZNUivcfC9cvN3UhFife2r5RDvJqEQEGttCvJ5JorLi+VfrN2pW8tN Xf34sA0+fp0iHRYGold53rWdXo0M8pEiF0kRDf47pUeLjCxA5WeAVjhI6DymufkW14+N JGmzaFjm7WfQZlFUMBKixlpnqXLHHTLD7AMxkOE3K2zpzJs4ZRw+avBzLv24ptkuGXpB ISEQ== ARC-Authentication-Results: i=1; mx.google.com; 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 n3-20020a170906724300b0094f1eee5a9dsi14833922ejk.555.2023.04.27.07.29.28; Thu, 27 Apr 2023 07:29:29 -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; 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 9934C68C042; Thu, 27 Apr 2023 17:26:37 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail0.khirnov.net (red.khirnov.net [176.97.15.12]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id A290968BF96 for ; Thu, 27 Apr 2023 17:26:12 +0300 (EEST) Received: from localhost (localhost [IPv6:::1]) by mail0.khirnov.net (Postfix) with ESMTP id EA38A2406CC for ; Thu, 27 Apr 2023 16:26:10 +0200 (CEST) Received: from mail0.khirnov.net ([IPv6:::1]) by localhost (mail0.khirnov.net [IPv6:::1]) (amavisd-new, port 10024) with ESMTP id 5rbF7ySquL0w for ; Thu, 27 Apr 2023 16:26:10 +0200 (CEST) Received: from libav.khirnov.net (libav.khirnov.net [IPv6:2a00:c500:561:201::7]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "libav.khirnov.net", Issuer "smtp.khirnov.net SMTP CA" (verified OK)) by mail0.khirnov.net (Postfix) with ESMTPS id 8F8F82406CD for ; Thu, 27 Apr 2023 16:26:05 +0200 (CEST) Received: from libav.khirnov.net (libav.khirnov.net [IPv6:::1]) by libav.khirnov.net (Postfix) with ESMTP id 801533A031B for ; Thu, 27 Apr 2023 16:26:05 +0200 (CEST) From: Anton Khirnov To: ffmpeg-devel@ffmpeg.org Date: Thu, 27 Apr 2023 16:25:52 +0200 Message-Id: <20230427142601.2613-12-anton@khirnov.net> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230427142601.2613-1-anton@khirnov.net> References: <20230427142601.2613-1-anton@khirnov.net> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 12/21] fftools/ffmpeg_filter: keep track of filtergraph input timebase 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 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: JFI6YXdkHXwp Will be useful in following commits. --- fftools/ffmpeg_filter.c | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/fftools/ffmpeg_filter.c b/fftools/ffmpeg_filter.c index 6b92bc074e..3c6c580093 100644 --- a/fftools/ffmpeg_filter.c +++ b/fftools/ffmpeg_filter.c @@ -55,6 +55,8 @@ static FilterGraphPriv *fgp_from_fg(FilterGraph *fg) typedef struct InputFilterPriv { InputFilter ifilter; + AVRational time_base; + AVFifo *frame_queue; } InputFilterPriv; @@ -969,13 +971,13 @@ static int sub2video_prepare(InputStream *ist, InputFilter *ifilter) static int configure_input_video_filter(FilterGraph *fg, InputFilter *ifilter, AVFilterInOut *in) { + InputFilterPriv *ifp = ifp_from_ifilter(ifilter); + AVFilterContext *last_filter; const AVFilter *buffer_filt = avfilter_get_by_name("buffer"); const AVPixFmtDescriptor *desc; InputStream *ist = ifilter->ist; InputFile *f = input_files[ist->file_index]; - AVRational tb = ist->framerate.num ? av_inv_q(ist->framerate) : - ist->st->time_base; AVRational fr = ist->framerate; AVRational sar; AVBPrint args; @@ -1004,6 +1006,9 @@ static int configure_input_video_filter(FilterGraph *fg, InputFilter *ifilter, goto fail; } + ifp->time_base = ist->framerate.num ? av_inv_q(ist->framerate) : + ist->st->time_base; + sar = ifilter->sample_aspect_ratio; if(!sar.den) sar = (AVRational){0,1}; @@ -1012,7 +1017,7 @@ static int configure_input_video_filter(FilterGraph *fg, InputFilter *ifilter, "video_size=%dx%d:pix_fmt=%d:time_base=%d/%d:" "pixel_aspect=%d/%d", ifilter->width, ifilter->height, ifilter->format, - tb.num, tb.den, sar.num, sar.den); + ifp->time_base.num, ifp->time_base.den, sar.num, sar.den); if (fr.num && fr.den) av_bprintf(&args, ":frame_rate=%d/%d", fr.num, fr.den); snprintf(name, sizeof(name), "graph %d input from stream %d:%d", fg->index, @@ -1094,6 +1099,7 @@ fail: static int configure_input_audio_filter(FilterGraph *fg, InputFilter *ifilter, AVFilterInOut *in) { + InputFilterPriv *ifp = ifp_from_ifilter(ifilter); AVFilterContext *last_filter; const AVFilter *abuffer_filt = avfilter_get_by_name("abuffer"); InputStream *ist = ifilter->ist; @@ -1108,9 +1114,11 @@ static int configure_input_audio_filter(FilterGraph *fg, InputFilter *ifilter, return AVERROR(EINVAL); } + ifp->time_base = (AVRational){ 1, ifilter->sample_rate }; + av_bprint_init(&args, 0, AV_BPRINT_SIZE_AUTOMATIC); av_bprintf(&args, "time_base=%d/%d:sample_rate=%d:sample_fmt=%s", - 1, ifilter->sample_rate, + ifp->time_base.num, ifp->time_base.den, ifilter->sample_rate, av_get_sample_fmt_name(ifilter->format)); if (av_channel_layout_check(&ifilter->ch_layout) && From patchwork Thu Apr 27 14:25:53 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anton Khirnov X-Patchwork-Id: 41382 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:dca6:b0:f3:34fa:f187 with SMTP id ky38csp564990pzb; Thu, 27 Apr 2023 07:29:40 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4A4nQOUxzOFDVYZhfeoiQuIWN5tanZ3wjp/g5vm1HN3wcy4hxF07BXI6apAjqnC9d5Ng7T X-Received: by 2002:a17:907:6e16:b0:94f:3d6e:f584 with SMTP id sd22-20020a1709076e1600b0094f3d6ef584mr1897602ejc.5.1682605779831; Thu, 27 Apr 2023 07:29:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1682605779; cv=none; d=google.com; s=arc-20160816; b=OKhQ5u/k1U6O9MiHXLmG/cztj5Ae4ZqJG8+aKCbtafaQSWEFja84eo0ztBAeoW2asU 3FQOnIbD7/ufazOZrOHDxiDudnKl7WxMVOthdq5qJXBGJa49YvNNmCOdC4OOjuq6+QUn DfUWyG2DC5Y0qGw44sTNBkRoiYafADVUmeVkJ4ktaQL8ybeX/tQYpKT+mqF9vJoBGwZS tE8ytwoYhwnSwgwvGI2KAdlUrNQflyXTMTCbHGGmaXzELMpwjyyzV1tXi2nTEdpHgG7H ulXXV1d9TGzTiSKXtxN1+5tU8PBwnaABN1AdqwFaGWBgLutzBwJa7GYkGZvkrKJdAEfb SnYQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:reply-to:list-subscribe :list-help:list-post:list-archive:list-unsubscribe:list-id :precedence:subject:mime-version:references:in-reply-to:message-id :date:to:from:delivered-to; bh=g+cuVluoGD5Ddq2HFB4ZAgDsVlSw69vQydQFFwJ1xZU=; b=VygBRDxjE7xhS67E9HuW5UYl+Tdz0DfZ9V2hlRe4fWKr2m/MAYh422eNlYANFQsyjm nYFPvNRVG4fAkv/chH3u5s0KU0eSnOSBOAXf8V27Bt7K0QEOb7RRGg34nixxc0RAK4F0 8GnMJ4gH/hfpGHHzTKJozKLCJEIA3BAN/TPN6MEFKDmGQ4bpLfgsTAYrpfwvAQ3gkKVs usXy/8WB6FZff2euMdEcpbmMFH+pDlTdmPbmU44n/2MWpBR612eVvYy+tj59ROLojQb9 5iq/GRYoIFv7M0SRFjwgJH6wp0cAzqVVnxL3IBaa9osB1D0IBJ1nRrS+AUOVvampbixL +Qfg== ARC-Authentication-Results: i=1; mx.google.com; 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 s2-20020a170906bc4200b0094fa39e9ac9si13321023ejv.245.2023.04.27.07.29.38; Thu, 27 Apr 2023 07:29:39 -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; 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 7773F68C048; Thu, 27 Apr 2023 17:26:38 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail0.khirnov.net (red.khirnov.net [176.97.15.12]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id A73D268BF97 for ; Thu, 27 Apr 2023 17:26:12 +0300 (EEST) Received: from localhost (localhost [IPv6:::1]) by mail0.khirnov.net (Postfix) with ESMTP id 5A00D2406CD for ; Thu, 27 Apr 2023 16:26:11 +0200 (CEST) Received: from mail0.khirnov.net ([IPv6:::1]) by localhost (mail0.khirnov.net [IPv6:::1]) (amavisd-new, port 10024) with ESMTP id KitDrJvNpukH for ; Thu, 27 Apr 2023 16:26:10 +0200 (CEST) Received: from libav.khirnov.net (libav.khirnov.net [IPv6:2a00:c500:561:201::7]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "libav.khirnov.net", Issuer "smtp.khirnov.net SMTP CA" (verified OK)) by mail0.khirnov.net (Postfix) with ESMTPS id 9B69B2406CE for ; Thu, 27 Apr 2023 16:26:05 +0200 (CEST) Received: from libav.khirnov.net (libav.khirnov.net [IPv6:::1]) by libav.khirnov.net (Postfix) with ESMTP id 8CFF13A03E5 for ; Thu, 27 Apr 2023 16:26:05 +0200 (CEST) From: Anton Khirnov To: ffmpeg-devel@ffmpeg.org Date: Thu, 27 Apr 2023 16:25:53 +0200 Message-Id: <20230427142601.2613-13-anton@khirnov.net> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230427142601.2613-1-anton@khirnov.net> References: <20230427142601.2613-1-anton@khirnov.net> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 13/21] fftools/ffmpeg_filter: use correct timebase for filter EOF timestamp 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 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: AgPaTgavXGtk It does not need to be equal to demuxer timebase. --- fftools/ffmpeg.c | 5 +---- fftools/ffmpeg.h | 2 +- fftools/ffmpeg_filter.c | 6 +++++- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/fftools/ffmpeg.c b/fftools/ffmpeg.c index 453d3763be..eae0093cce 100644 --- a/fftools/ffmpeg.c +++ b/fftools/ffmpeg.c @@ -1320,12 +1320,9 @@ static int transcode_subtitles(InputStream *ist, const AVPacket *pkt, static int send_filter_eof(InputStream *ist) { int i, ret; - /* TODO keep pts also in stream time base to avoid converting back */ - int64_t pts = av_rescale_q_rnd(ist->pts, AV_TIME_BASE_Q, ist->st->time_base, - AV_ROUND_NEAR_INF | AV_ROUND_PASS_MINMAX); for (i = 0; i < ist->nb_filters; i++) { - ret = ifilter_send_eof(ist->filters[i], pts); + ret = ifilter_send_eof(ist->filters[i], ist->pts, AV_TIME_BASE_Q); if (ret < 0) return ret; } diff --git a/fftools/ffmpeg.h b/fftools/ffmpeg.h index 07322fdd79..c07a1b86b6 100644 --- a/fftools/ffmpeg.h +++ b/fftools/ffmpeg.h @@ -788,7 +788,7 @@ int init_complex_filtergraph(FilterGraph *fg); void sub2video_update(InputStream *ist, int64_t heartbeat_pts, AVSubtitle *sub); int ifilter_send_frame(InputFilter *ifilter, AVFrame *frame, int keep_reference); -int ifilter_send_eof(InputFilter *ifilter, int64_t pts); +int ifilter_send_eof(InputFilter *ifilter, int64_t pts, AVRational tb); int ifilter_parameters_from_codecpar(InputFilter *ifilter, AVCodecParameters *par); int ifilter_has_all_input_formats(FilterGraph *fg); diff --git a/fftools/ffmpeg_filter.c b/fftools/ffmpeg_filter.c index 3c6c580093..50a97ccf2a 100644 --- a/fftools/ffmpeg_filter.c +++ b/fftools/ffmpeg_filter.c @@ -1452,13 +1452,17 @@ int reap_filters(int flush) return 0; } -int ifilter_send_eof(InputFilter *ifilter, int64_t pts) +int ifilter_send_eof(InputFilter *ifilter, int64_t pts, AVRational tb) { + InputFilterPriv *ifp = ifp_from_ifilter(ifilter); int ret; ifilter->eof = 1; if (ifilter->filter) { + pts = av_rescale_q_rnd(pts, tb, ifp->time_base, + AV_ROUND_NEAR_INF | AV_ROUND_PASS_MINMAX); + ret = av_buffersrc_close(ifilter->filter, pts, AV_BUFFERSRC_FLAG_PUSH); if (ret < 0) return ret; From patchwork Thu Apr 27 14:25:54 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anton Khirnov X-Patchwork-Id: 41369 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:dca6:b0:f3:34fa:f187 with SMTP id ky38csp563631pzb; Thu, 27 Apr 2023 07:27:27 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6tlm+W1NdgdOlZ88OGmBwNXWk+yF5/wfjblGPZjywucvMNxHnDuv9aJSy4gNqO3GTx2Axd X-Received: by 2002:aa7:d391:0:b0:506:b211:489 with SMTP id x17-20020aa7d391000000b00506b2110489mr1579656edq.35.1682605646719; Thu, 27 Apr 2023 07:27:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1682605646; cv=none; d=google.com; s=arc-20160816; b=eGoqxchxcZzYJIXaF+JEdyQXr96ytYxmeUj5Ju1oyzoD0JFpsYGB8OdeQC8hUzw2ZF NIT7JFD73u1zE5MQ1Phs5nWInvM6ffIF5u2kPSdiEShoNB8TuWy23rYhG3ZJRrHHQZke mUrHduRaG33aj/ajMDvfjvLmxOA67Zyw4ObjAByxCvJXINelAkMJ/NHtnB957IFb1YsS wxPqHbcynegtznx/jquxkCm5ohJ2m7UMgzmhAH9DX+mQoJE/c6063NkFpZO+Z8FI7ZrJ 8gofV80XAdZMyIw820EBowu4KiSy9sVoX1ptO1W8Nn4bLSlZTRb0KhZCseDYSvNYzOcr 2b/Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:reply-to:list-subscribe :list-help:list-post:list-archive:list-unsubscribe:list-id :precedence:subject:mime-version:references:in-reply-to:message-id :date:to:from:delivered-to; bh=5RP3UK8EegnhCA6GiwxT2tZS156sSifrqNTlGjrduJY=; b=YBZZqppYOHWfSk2AtI6nMDf9r8jctZfM5JJdiM9R2DgiNJVsqrapp0lATe0BlREeP+ KDmxCfmaC30b9SBqspsQfdwLv6aPHsMW5fssG/7YRHKFX4DOEOSwGzC9gXhcGtf9wJca wt/++x79aT7yHp94S+p+rn1xuGK3gbm+ZNw7b6ZdStOTzeLJ4CwalptlIMBx6lVS4n23 FO+hVuAgBXi7YSagxBnV4XGUu+Ey6bGFbyWq9HL+SYX7EUYeaek4hKOMppcuViOSqSvo LRBVcSoDGCtvKF1SELM50V2eshzelk6HAdlUgktxgfrIFyuB+lIwr+6jdTClq9jNh8fS PvlA== ARC-Authentication-Results: i=1; mx.google.com; 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 r22-20020aa7cfd6000000b0050847f2103fsi13651332edy.687.2023.04.27.07.27.21; Thu, 27 Apr 2023 07:27:26 -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; 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 3F09D68BFBB; Thu, 27 Apr 2023 17:26:21 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail0.khirnov.net (red.khirnov.net [176.97.15.12]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 3BD4468BF51 for ; Thu, 27 Apr 2023 17:26:13 +0300 (EEST) Received: from localhost (localhost [IPv6:::1]) by mail0.khirnov.net (Postfix) with ESMTP id 07D512404EC for ; Thu, 27 Apr 2023 16:26:13 +0200 (CEST) Received: from mail0.khirnov.net ([IPv6:::1]) by localhost (mail0.khirnov.net [IPv6:::1]) (amavisd-new, port 10024) with ESMTP id Q7wEc8MQkQrY for ; Thu, 27 Apr 2023 16:26:10 +0200 (CEST) Received: from libav.khirnov.net (libav.khirnov.net [IPv6:2a00:c500:561:201::7]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "libav.khirnov.net", Issuer "smtp.khirnov.net SMTP CA" (verified OK)) by mail0.khirnov.net (Postfix) with ESMTPS id A65412406CF for ; Thu, 27 Apr 2023 16:26:05 +0200 (CEST) Received: from libav.khirnov.net (libav.khirnov.net [IPv6:::1]) by libav.khirnov.net (Postfix) with ESMTP id 984903A031B for ; Thu, 27 Apr 2023 16:26:05 +0200 (CEST) From: Anton Khirnov To: ffmpeg-devel@ffmpeg.org Date: Thu, 27 Apr 2023 16:25:54 +0200 Message-Id: <20230427142601.2613-14-anton@khirnov.net> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230427142601.2613-1-anton@khirnov.net> References: <20230427142601.2613-1-anton@khirnov.net> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 14/21] fftools/ffmpeg: stop using packet pts for decoded audio frame pts 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 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: jIsEZg/Y/qZ3 If input packets have timestamps, they will be propagated to output frames by the decoder, so at best this block does not do anything. There can also be an arbitrary amount of delay between packets sent to the decoder and decoded frames (e.g. due to decoder's intrinsic delay or frame threading), so deriving any timestamps from packet properties is wrong. --- fftools/ffmpeg.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/fftools/ffmpeg.c b/fftools/ffmpeg.c index eae0093cce..5913a57d16 100644 --- a/fftools/ffmpeg.c +++ b/fftools/ffmpeg.c @@ -911,9 +911,6 @@ static int decode_audio(InputStream *ist, AVPacket *pkt, int *got_output, if (decoded_frame->pts != AV_NOPTS_VALUE) { decoded_frame_tb = ist->st->time_base; - } else if (pkt && pkt->pts != AV_NOPTS_VALUE) { - decoded_frame->pts = pkt->pts; - decoded_frame_tb = pkt->time_base; }else { decoded_frame->pts = ist->dts; decoded_frame_tb = AV_TIME_BASE_Q; From patchwork Thu Apr 27 14:25:55 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anton Khirnov X-Patchwork-Id: 41368 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:dca6:b0:f3:34fa:f187 with SMTP id ky38csp563468pzb; Thu, 27 Apr 2023 07:27:12 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5t56yNLFTebcI98+k4JFJNO0OF8D04LDJPhCMVVUXZwdwUwrG9Qhyu6F0lTqo2fwG8AZdo X-Received: by 2002:a17:907:e87:b0:94f:27a1:f1d with SMTP id ho7-20020a1709070e8700b0094f27a10f1dmr2164497ejc.77.1682605632535; Thu, 27 Apr 2023 07:27:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1682605632; cv=none; d=google.com; s=arc-20160816; b=w7R+gCJEufs+JQZSjXCKEUjRGhxLa3n+IHm+Xw/MM+YRDdf2CHzbdQpocIJ8a8BjF5 HyG54k8n6hLBfZkrLqJrXyvQOqg7U7tl/5EfTvLtBQOvXmmHySrdRFB7XTIgpau1yTN5 5HN9E1QyGXVTVbDlzVDnvLKi8QvhTxCUN73H2oWkfGJbvy49wPmOxwGZxMYQMgVK7kRG Hc5WK2FYYuxmrdd2NVllXEQfQ03It8zFv8Xyh/1b49PrdLR1voWVO1Y96ir4S86rmedr xNiESwUJ/8e+ET6tYkkYJVSzKLQf9ibbayoYNoRgfP+kyuAmVVadhoewLDc/JcyL1eXB RmPw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:reply-to:list-subscribe :list-help:list-post:list-archive:list-unsubscribe:list-id :precedence:subject:mime-version:references:in-reply-to:message-id :date:to:from:delivered-to; bh=L6KysXHsa5r8ZPkctAWvHhiyKbIRnMqBGNwrh5jR4kU=; b=iU2fKJrjrIITH0AMwcqrGVxNWo0Ab/kt9bml3kHkOOmZuI+y4VoK6Xv31HPsOFtlke IaNY3OENIxWcpMH4JGZXPBjuhuIHl7T7gSJRGHuSMfUM2UGr6+6ojHy+gAc2MQDDsrC9 zJQjB6IsgVSQjZBtId9brXLZ9Yte00M4nIEeTT9BpaVJtCclqIBgRz8DSrBj+E/ZYagY UCbdgit/Tt6wl1lnh0ClltO1dWV1ZVoIVvHSGdnFMy6YLmxqG4N8cYEdtPnJUmqD5hbh NYyaO/ilxc6UpuXbWhBnE+6193n7K6u0Q5BYhKQPneJcWeGCMCJn4gLo6yLSZHYIQEc8 CazQ== ARC-Authentication-Results: i=1; mx.google.com; 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 m5-20020a17090607c500b0094f2e8d96a5si13232542ejc.985.2023.04.27.07.27.11; Thu, 27 Apr 2023 07:27:12 -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; 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 3135668BF71; Thu, 27 Apr 2023 17:26:20 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail0.khirnov.net (red.khirnov.net [176.97.15.12]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 2E69C68BF4F for ; Thu, 27 Apr 2023 17:26:13 +0300 (EEST) Received: from localhost (localhost [IPv6:::1]) by mail0.khirnov.net (Postfix) with ESMTP id E1AC02406CE for ; Thu, 27 Apr 2023 16:26:11 +0200 (CEST) Received: from mail0.khirnov.net ([IPv6:::1]) by localhost (mail0.khirnov.net [IPv6:::1]) (amavisd-new, port 10024) with ESMTP id y4_2MJcr9A4H for ; Thu, 27 Apr 2023 16:26:11 +0200 (CEST) Received: from libav.khirnov.net (libav.khirnov.net [IPv6:2a00:c500:561:201::7]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "libav.khirnov.net", Issuer "smtp.khirnov.net SMTP CA" (verified OK)) by mail0.khirnov.net (Postfix) with ESMTPS id B27292406D0 for ; Thu, 27 Apr 2023 16:26:05 +0200 (CEST) Received: from libav.khirnov.net (libav.khirnov.net [IPv6:::1]) by libav.khirnov.net (Postfix) with ESMTP id A331B3A03E5 for ; Thu, 27 Apr 2023 16:26:05 +0200 (CEST) From: Anton Khirnov To: ffmpeg-devel@ffmpeg.org Date: Thu, 27 Apr 2023 16:25:55 +0200 Message-Id: <20230427142601.2613-15-anton@khirnov.net> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230427142601.2613-1-anton@khirnov.net> References: <20230427142601.2613-1-anton@khirnov.net> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 15/21] fftools/ffmpeg: set AVFrame.time_base for decoded frames 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 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: KBUwOs1UjIU9 Makes it easier to keep track of the timebase the frames are in. --- fftools/ffmpeg.c | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/fftools/ffmpeg.c b/fftools/ffmpeg.c index 5913a57d16..8829a163e0 100644 --- a/fftools/ffmpeg.c +++ b/fftools/ffmpeg.c @@ -855,6 +855,8 @@ static int decode(InputStream *ist, AVCodecContext *avctx, fd->idx = avctx->frame_num - 1; } + frame->time_base = avctx->pkt_timebase; + *got_frame = 1; } @@ -885,7 +887,6 @@ static int decode_audio(InputStream *ist, AVPacket *pkt, int *got_output, AVFrame *decoded_frame = ist->decoded_frame; AVCodecContext *avctx = ist->dec_ctx; int ret, err = 0; - AVRational decoded_frame_tb; update_benchmark(NULL); ret = decode(ist, avctx, decoded_frame, got_output, pkt); @@ -909,23 +910,24 @@ static int decode_audio(InputStream *ist, AVPacket *pkt, int *got_output, ist->next_dts += ((int64_t)AV_TIME_BASE * decoded_frame->nb_samples) / decoded_frame->sample_rate; - if (decoded_frame->pts != AV_NOPTS_VALUE) { - decoded_frame_tb = ist->st->time_base; - }else { + if (decoded_frame->pts == AV_NOPTS_VALUE) { decoded_frame->pts = ist->dts; - decoded_frame_tb = AV_TIME_BASE_Q; + decoded_frame->time_base = AV_TIME_BASE_Q; } if (pkt && pkt->duration && ist->prev_pkt_pts != AV_NOPTS_VALUE && pkt->pts != AV_NOPTS_VALUE && pkt->pts - ist->prev_pkt_pts > pkt->duration) ist->filter_in_rescale_delta_last = AV_NOPTS_VALUE; if (pkt) ist->prev_pkt_pts = pkt->pts; - if (decoded_frame->pts != AV_NOPTS_VALUE) - decoded_frame->pts = av_rescale_delta(decoded_frame_tb, decoded_frame->pts, - (AVRational){1, decoded_frame->sample_rate}, - decoded_frame->nb_samples, + if (decoded_frame->pts != AV_NOPTS_VALUE) { + AVRational tb_filter = (AVRational){1, decoded_frame->sample_rate}; + decoded_frame->pts = av_rescale_delta(decoded_frame->time_base, decoded_frame->pts, + tb_filter, decoded_frame->nb_samples, &ist->filter_in_rescale_delta_last, - (AVRational){1, decoded_frame->sample_rate}); + tb_filter); + decoded_frame->time_base = tb_filter; + } + ist->nb_samples = decoded_frame->nb_samples; err = send_frame_to_filters(ist, decoded_frame); From patchwork Thu Apr 27 14:25:56 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anton Khirnov X-Patchwork-Id: 41372 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:dca6:b0:f3:34fa:f187 with SMTP id ky38csp563951pzb; Thu, 27 Apr 2023 07:28:01 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7ObAoMOnMTqvK26HjFBcW3XeK3ABf4+GkFsH1BCARDAayeZPtm9YMeekcwGvIMf70x8xcz X-Received: by 2002:aa7:d9c4:0:b0:506:c288:118 with SMTP id v4-20020aa7d9c4000000b00506c2880118mr1697436eds.39.1682605681083; Thu, 27 Apr 2023 07:28:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1682605681; cv=none; d=google.com; s=arc-20160816; b=q6M1TUR7X9d566/vKARZMEdva6TEx8GEsHRcgtQagtLR3OM3nFGx27ifWWGmyCUZdO OaOnkD20z2hAWr64Ezj6gtJ+A27tkqXRy/dknkEux4qRdcsvVi/IC1lRbvaN6qLwbg/b lhO5PF5iXJ+3Ho0HjC6YzpEDx6y2XfLab4MFMGQZQ3VBUocZ6qBRPX/b+oeHjUtjo+5+ F9c11TXzEJak6ZrXJr/qmyH2nqUiqDNTgHPYdVe146BLx7tpsGokVatNSkAzlgx5yPFV ujB9tEbqWEyNW/twEJXbNP9lbsExcS8MOeE5zKZlQ3PkL7yAIkhP060gTVE2YzgPJD/L f9ew== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:reply-to:list-subscribe :list-help:list-post:list-archive:list-unsubscribe:list-id :precedence:subject:mime-version:references:in-reply-to:message-id :date:to:from:delivered-to; bh=frrNajL38HwsR8LTBCcldC+TWIGwGpCpTLi2s6rZZLQ=; b=h9oyj2pWMkCV4YVRlXolyEUVC0KihV9iYx0GCw3X714zBBlMyLj/Vm3qwezkyQmFfz fW5SjJ1yfA+rcPq48HK14U+sPdEHpjuvX284I24hPjGEGjao807QRAkGJcryGYmiiykC yJ3XEdVB9qkRe38bc1tzwTSkYYg6yfDjvS/VlGaQOY8DDDo4jNsnS+O9ezk0ygw/qg6p ePIwXE5zvkAJx9UVXkPW5BYhevKe5zjGF6VTaS5dsYBBAuEo1UM6240E2fPW9VH7dbtp 3COPOQxHbH6YjGgdNOrs2wiYTPEl5ZULjSrNF17bIhYwU5IdPiukViV+fAKd3XJ8YgKS JDaw== ARC-Authentication-Results: i=1; mx.google.com; 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 y5-20020aa7c245000000b00509d22a3a07si9387295edo.456.2023.04.27.07.28.00; Thu, 27 Apr 2023 07:28:01 -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; 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 02E7A68BF11; Thu, 27 Apr 2023 17:26:27 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail0.khirnov.net (red.khirnov.net [176.97.15.12]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 79B0768BF55 for ; Thu, 27 Apr 2023 17:26:15 +0300 (EEST) Received: from localhost (localhost [IPv6:::1]) by mail0.khirnov.net (Postfix) with ESMTP id 34FB52404EC for ; Thu, 27 Apr 2023 16:26:15 +0200 (CEST) Received: from mail0.khirnov.net ([IPv6:::1]) by localhost (mail0.khirnov.net [IPv6:::1]) (amavisd-new, port 10024) with ESMTP id 17vudXrsnHRy for ; Thu, 27 Apr 2023 16:26:11 +0200 (CEST) Received: from libav.khirnov.net (libav.khirnov.net [IPv6:2a00:c500:561:201::7]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "libav.khirnov.net", Issuer "smtp.khirnov.net SMTP CA" (verified OK)) by mail0.khirnov.net (Postfix) with ESMTPS id BFC72240705 for ; Thu, 27 Apr 2023 16:26:05 +0200 (CEST) Received: from libav.khirnov.net (libav.khirnov.net [IPv6:::1]) by libav.khirnov.net (Postfix) with ESMTP id AF5213A031B for ; Thu, 27 Apr 2023 16:26:05 +0200 (CEST) From: Anton Khirnov To: ffmpeg-devel@ffmpeg.org Date: Thu, 27 Apr 2023 16:25:56 +0200 Message-Id: <20230427142601.2613-16-anton@khirnov.net> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230427142601.2613-1-anton@khirnov.net> References: <20230427142601.2613-1-anton@khirnov.net> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 16/21] fftools/ffmpeg: rework audio-decode timestamp handling 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 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: d3OzHJo0Z+re Stop using InputStream.dts for generating missing timestamps for decoded frames, because it contains pre-decoding timestamps and there may be arbitrary amount of delay between input packets and output frames (e.g. dependent on the thread count when frame threading is used). It is also in AV_TIME_BASE (i.e. microseconds), which may introduce unnecessary rounding issues. New code maintains a timebase that is the inverse of the LCM of all the samplerates seen so far, and thus can accurately represent every audio sample. This timebase is used to generate missing timestamps after decoding. Changes the result of the following FATE tests * pcm_dvd-16-5.1-96000 * lavf-smjpeg * adpcm-ima-smjpeg In all of these the timestamps now better correspond to actual frame durations. --- fftools/ffmpeg.c | 90 +++- fftools/ffmpeg.h | 8 +- fftools/ffmpeg_demux.c | 6 +- tests/ref/fate/adpcm-ima-smjpeg | 658 ++++++++++++++-------------- tests/ref/fate/pcm_dvd-16-5.1-96000 | 8 +- tests/ref/lavf/smjpeg | 2 +- 6 files changed, 415 insertions(+), 357 deletions(-) diff --git a/fftools/ffmpeg.c b/fftools/ffmpeg.c index 8829a163e0..d074d3e03b 100644 --- a/fftools/ffmpeg.c +++ b/fftools/ffmpeg.c @@ -881,6 +881,77 @@ static int send_frame_to_filters(InputStream *ist, AVFrame *decoded_frame) return ret; } +static AVRational audio_samplerate_update(InputStream *ist, const AVFrame *frame) +{ + const int prev = ist->last_frame_tb.den; + const int sr = frame->sample_rate; + + AVRational tb_new; + int64_t gcd; + + if (frame->sample_rate == ist->last_frame_sample_rate) + goto finish; + + gcd = av_gcd(prev, sr); + + if (prev / gcd >= INT_MAX / sr) { + av_log(ist, AV_LOG_WARNING, + "Audio timestamps cannot be represented exactly after " + "sample rate change: %d -> %d\n", prev, sr); + goto finish; + } + tb_new = (AVRational){ 1, prev / gcd * sr }; + + if (ist->last_frame_pts != AV_NOPTS_VALUE) + ist->last_frame_pts = av_rescale_q(ist->last_frame_pts, + ist->last_frame_tb, tb_new); + ist->last_frame_duration_est = av_rescale_q(ist->last_frame_duration_est, + ist->last_frame_tb, tb_new); + + ist->last_frame_tb = tb_new; + ist->last_frame_sample_rate = frame->sample_rate; + +finish: + return ist->last_frame_tb; +} + +static void audio_ts_process(InputStream *ist, AVFrame *frame) +{ + AVRational tb_filter = (AVRational){1, frame->sample_rate}; + AVRational tb; + int64_t pts_pred; + + // on samplerate change, choose a new internal timebase for timestamp + // generation that can represent timestamps from all the samplerates + // seen so far + tb = audio_samplerate_update(ist, frame); + pts_pred = ist->last_frame_pts == AV_NOPTS_VALUE ? 0 : + ist->last_frame_pts + ist->last_frame_duration_est; + + if (frame->pts == AV_NOPTS_VALUE) { + frame->pts = pts_pred; + frame->time_base = tb; + } else if (ist->last_frame_pts != AV_NOPTS_VALUE && + frame->pts > av_rescale_q_rnd(pts_pred, tb, frame->time_base, + AV_ROUND_UP)) { + // there was a gap in timestamps, reset conversion state + ist->filter_in_rescale_delta_last = AV_NOPTS_VALUE; + } + + frame->pts = av_rescale_delta(frame->time_base, frame->pts, + tb, frame->nb_samples, + &ist->filter_in_rescale_delta_last, tb); + + ist->last_frame_pts = frame->pts; + ist->last_frame_duration_est = av_rescale_q(frame->nb_samples, + tb_filter, tb); + + // finally convert to filtering timebase + frame->pts = av_rescale_q(frame->pts, tb, tb_filter); + frame->duration = frame->nb_samples; + frame->time_base = tb_filter; +} + static int decode_audio(InputStream *ist, AVPacket *pkt, int *got_output, int *decode_failed) { @@ -910,23 +981,7 @@ static int decode_audio(InputStream *ist, AVPacket *pkt, int *got_output, ist->next_dts += ((int64_t)AV_TIME_BASE * decoded_frame->nb_samples) / decoded_frame->sample_rate; - if (decoded_frame->pts == AV_NOPTS_VALUE) { - decoded_frame->pts = ist->dts; - decoded_frame->time_base = AV_TIME_BASE_Q; - } - if (pkt && pkt->duration && ist->prev_pkt_pts != AV_NOPTS_VALUE && - pkt->pts != AV_NOPTS_VALUE && pkt->pts - ist->prev_pkt_pts > pkt->duration) - ist->filter_in_rescale_delta_last = AV_NOPTS_VALUE; - if (pkt) - ist->prev_pkt_pts = pkt->pts; - if (decoded_frame->pts != AV_NOPTS_VALUE) { - AVRational tb_filter = (AVRational){1, decoded_frame->sample_rate}; - decoded_frame->pts = av_rescale_delta(decoded_frame->time_base, decoded_frame->pts, - tb_filter, decoded_frame->nb_samples, - &ist->filter_in_rescale_delta_last, - tb_filter); - decoded_frame->time_base = tb_filter; - } + audio_ts_process(ist, decoded_frame); ist->nb_samples = decoded_frame->nb_samples; err = send_frame_to_filters(ist, decoded_frame); @@ -1076,6 +1131,7 @@ static int decode_video(InputStream *ist, AVPacket *pkt, int *got_output, int64_ // update timestamp history ist->last_frame_duration_est = video_duration_estimate(ist, decoded_frame); ist->last_frame_pts = decoded_frame->pts; + ist->last_frame_tb = decoded_frame->time_base; if (debug_ts) { av_log(ist, AV_LOG_INFO, diff --git a/fftools/ffmpeg.h b/fftools/ffmpeg.h index c07a1b86b6..c4abf89b58 100644 --- a/fftools/ffmpeg.h +++ b/fftools/ffmpeg.h @@ -359,7 +359,6 @@ typedef struct InputStream { AVRational framerate_guessed; - int64_t prev_pkt_pts; int64_t start; /* time when read started */ /* predicted dts of the next packet read for this stream or (when there are * several frames in a packet) of the next frame in current packet (in AV_TIME_BASE units) */ @@ -371,10 +370,13 @@ typedef struct InputStream { int64_t next_pts; int64_t pts; ///< current pts of the decoded frame (in AV_TIME_BASE units) - // pts/estimated duration of the last decoded video frame - // in decoder timebase + // pts/estimated duration of the last decoded frame + // * in decoder timebase for video, + // * in last_frame_tb (may change during decoding) for audio int64_t last_frame_pts; int64_t last_frame_duration_est; + AVRational last_frame_tb; + int last_frame_sample_rate; int wrap_correction_done; diff --git a/fftools/ffmpeg_demux.c b/fftools/ffmpeg_demux.c index 5afb3ff2c8..f8d95d1de6 100644 --- a/fftools/ffmpeg_demux.c +++ b/fftools/ffmpeg_demux.c @@ -864,7 +864,9 @@ static void add_input_streams(const OptionsContext *o, Demuxer *d) } ist->filter_in_rescale_delta_last = AV_NOPTS_VALUE; - ist->prev_pkt_pts = AV_NOPTS_VALUE; + + ist->last_frame_pts = AV_NOPTS_VALUE; + ist->last_frame_tb = (AVRational){ 1, 1 }; ist->dec_ctx = avcodec_alloc_context3(ist->dec); if (!ist->dec_ctx) @@ -905,8 +907,6 @@ static void add_input_streams(const OptionsContext *o, Demuxer *d) ist->framerate_guessed = av_guess_frame_rate(ic, st, NULL); - ist->last_frame_pts = AV_NOPTS_VALUE; - break; case AVMEDIA_TYPE_AUDIO: { int guess_layout_max = INT_MAX; diff --git a/tests/ref/fate/adpcm-ima-smjpeg b/tests/ref/fate/adpcm-ima-smjpeg index 723fa2336e..b9cf1f38db 100644 --- a/tests/ref/fate/adpcm-ima-smjpeg +++ b/tests/ref/fate/adpcm-ima-smjpeg @@ -8,348 +8,348 @@ 0, 1024, 1024, 512, 1024, 0xed2d3f6b 0, 1533, 1533, 512, 1024, 0x51f6ccb3 0, 2040, 2040, 512, 1024, 0x58bd75aa -0, 2558, 2558, 512, 1024, 0xd857a310 -0, 3070, 3070, 512, 1024, 0xc483a5b8 -0, 3582, 3582, 512, 1024, 0x923ecf67 -0, 4091, 4091, 512, 1024, 0xf87dcd53 +0, 2552, 2552, 512, 1024, 0xd857a310 +0, 3064, 3064, 512, 1024, 0xc483a5b8 +0, 3576, 3576, 512, 1024, 0x923ecf67 +0, 4088, 4088, 512, 1024, 0xf87dcd53 0, 4598, 4598, 512, 1024, 0xdc32c002 -0, 5116, 5116, 512, 1024, 0xb760def1 -0, 5628, 5628, 512, 1024, 0x6838d2b2 -0, 6140, 6140, 512, 1024, 0xe45aca1e -0, 6649, 6649, 512, 1024, 0xde1fb955 -0, 7166, 7166, 512, 1024, 0x9e23b949 -0, 7678, 7678, 512, 1024, 0x840cc000 -0, 8190, 8190, 512, 1024, 0x0a29cbfa -0, 8699, 8699, 512, 1024, 0x9871d4c4 +0, 5110, 5110, 512, 1024, 0xb760def1 +0, 5622, 5622, 512, 1024, 0x6838d2b2 +0, 6134, 6134, 512, 1024, 0xe45aca1e +0, 6646, 6646, 512, 1024, 0xde1fb955 +0, 7158, 7158, 512, 1024, 0x9e23b949 +0, 7670, 7670, 512, 1024, 0x840cc000 +0, 8182, 8182, 512, 1024, 0x0a29cbfa +0, 8694, 8694, 512, 1024, 0x9871d4c4 0, 9206, 9206, 512, 1024, 0xb35dc9f2 -0, 9724, 9724, 512, 1024, 0xf37fda0a -0, 10236, 10236, 512, 1024, 0xa640f990 -0, 10748, 10748, 512, 1024, 0x516fe6f5 -0, 11257, 11257, 512, 1024, 0xc78bc6a6 -0, 11775, 11775, 512, 1024, 0x700fd6ee -0, 12287, 12287, 512, 1024, 0x5383d5ad -0, 12799, 12799, 512, 1024, 0xbe01d091 -0, 13308, 13308, 512, 1024, 0x72dfcfc7 -0, 13815, 13815, 512, 1024, 0xd8fecea9 -0, 14333, 14333, 512, 1024, 0xa464d79b -0, 14845, 14845, 512, 1024, 0xf394e2cb -0, 15357, 15357, 512, 1024, 0xa301ec49 -0, 15865, 15865, 512, 1024, 0x5e09d60f -0, 16383, 16383, 512, 1024, 0xd13edd6f -0, 16895, 16895, 512, 1024, 0x7423ef39 -0, 17407, 17407, 512, 1024, 0x96e2f083 -0, 17916, 17916, 512, 1024, 0x5ed7dbee -0, 18423, 18423, 512, 1024, 0x3874f714 -0, 18941, 18941, 512, 1024, 0xa5e6edab -0, 19453, 19453, 512, 1024, 0x0a04ee3a -0, 19965, 19965, 512, 1024, 0xadfee6b9 -0, 20474, 20474, 512, 1024, 0xd0bbe6d2 -0, 20992, 20992, 512, 1024, 0x223eebb7 -0, 21504, 21504, 512, 1024, 0x0473e479 -0, 22016, 22016, 512, 1024, 0xdf15e51e -0, 22525, 22525, 512, 1024, 0xa954e483 -0, 23032, 23032, 512, 1024, 0x6df3ed03 -0, 23549, 23549, 512, 1024, 0x0860e544 -0, 24061, 24061, 512, 1024, 0xc241e8dc -0, 24573, 24573, 512, 1024, 0xd0e1d6a4 -0, 25082, 25082, 512, 1024, 0xcb2ff988 +0, 9718, 9718, 512, 1024, 0xf37fda0a +0, 10230, 10230, 512, 1024, 0xa640f990 +0, 10742, 10742, 512, 1024, 0x516fe6f5 +0, 11254, 11254, 512, 1024, 0xc78bc6a6 +0, 11766, 11766, 512, 1024, 0x700fd6ee +0, 12278, 12278, 512, 1024, 0x5383d5ad +0, 12790, 12790, 512, 1024, 0xbe01d091 +0, 13302, 13302, 512, 1024, 0x72dfcfc7 +0, 13814, 13814, 512, 1024, 0xd8fecea9 +0, 14326, 14326, 512, 1024, 0xa464d79b +0, 14838, 14838, 512, 1024, 0xf394e2cb +0, 15350, 15350, 512, 1024, 0xa301ec49 +0, 15862, 15862, 512, 1024, 0x5e09d60f +0, 16374, 16374, 512, 1024, 0xd13edd6f +0, 16886, 16886, 512, 1024, 0x7423ef39 +0, 17398, 17398, 512, 1024, 0x96e2f083 +0, 17910, 17910, 512, 1024, 0x5ed7dbee +0, 18422, 18422, 512, 1024, 0x3874f714 +0, 18934, 18934, 512, 1024, 0xa5e6edab +0, 19446, 19446, 512, 1024, 0x0a04ee3a +0, 19958, 19958, 512, 1024, 0xadfee6b9 +0, 20470, 20470, 512, 1024, 0xd0bbe6d2 +0, 20982, 20982, 512, 1024, 0x223eebb7 +0, 21494, 21494, 512, 1024, 0x0473e479 +0, 22006, 22006, 512, 1024, 0xdf15e51e +0, 22518, 22518, 512, 1024, 0xa954e483 +0, 23030, 23030, 512, 1024, 0x6df3ed03 +0, 23542, 23542, 512, 1024, 0x0860e544 +0, 24054, 24054, 512, 1024, 0xc241e8dc +0, 24566, 24566, 512, 1024, 0xd0e1d6a4 +0, 25078, 25078, 512, 1024, 0xcb2ff988 0, 25590, 25590, 512, 1024, 0x51fae08e -0, 26107, 26107, 512, 1024, 0xae39f2fc -0, 26619, 26619, 512, 1024, 0xfd74f07c -0, 27131, 27131, 512, 1024, 0x1936edc1 -0, 27640, 27640, 512, 1024, 0x95f8deae -0, 28158, 28158, 512, 1024, 0x93bdf605 -0, 28670, 28670, 512, 1024, 0x7a07dd32 -0, 29182, 29182, 512, 1024, 0x6889fdc1 -0, 29691, 29691, 512, 1024, 0x989bf024 +0, 26102, 26102, 512, 1024, 0xae39f2fc +0, 26614, 26614, 512, 1024, 0xfd74f07c +0, 27126, 27126, 512, 1024, 0x1936edc1 +0, 27638, 27638, 512, 1024, 0x95f8deae +0, 28150, 28150, 512, 1024, 0x93bdf605 +0, 28662, 28662, 512, 1024, 0x7a07dd32 +0, 29174, 29174, 512, 1024, 0x6889fdc1 +0, 29686, 29686, 512, 1024, 0x989bf024 0, 30198, 30198, 512, 1024, 0xc764ce80 -0, 30716, 30716, 512, 1024, 0x0e62d721 -0, 31228, 31228, 512, 1024, 0x59c2fbe3 -0, 31740, 31740, 512, 1024, 0xf14ee29d -0, 32249, 32249, 512, 1024, 0x02a0f21b -0, 32766, 32766, 512, 1024, 0xadb3d361 -0, 33278, 33278, 512, 1024, 0xdcb3d1fc -0, 33790, 33790, 512, 1024, 0x2924f9dc -0, 34299, 34299, 512, 1024, 0x7507ebec +0, 30710, 30710, 512, 1024, 0x0e62d721 +0, 31222, 31222, 512, 1024, 0x59c2fbe3 +0, 31734, 31734, 512, 1024, 0xf14ee29d +0, 32246, 32246, 512, 1024, 0x02a0f21b +0, 32758, 32758, 512, 1024, 0xadb3d361 +0, 33270, 33270, 512, 1024, 0xdcb3d1fc +0, 33782, 33782, 512, 1024, 0x2924f9dc +0, 34294, 34294, 512, 1024, 0x7507ebec 0, 34806, 34806, 512, 1024, 0xe009f343 -0, 35324, 35324, 512, 1024, 0x21e9e7ac -0, 35836, 35836, 512, 1024, 0x845bda9e -0, 36348, 36348, 512, 1024, 0xb1b3e632 -0, 36857, 36857, 512, 1024, 0x61ccf593 -0, 37375, 37375, 512, 1024, 0x8cdbf603 -0, 37887, 37887, 512, 1024, 0xf8f7e673 -0, 38399, 38399, 512, 1024, 0x55efdd24 -0, 38908, 38908, 512, 1024, 0x4059e8ff -0, 39415, 39415, 512, 1024, 0xb3afe5be -0, 39933, 39933, 512, 1024, 0x7236e965 -0, 40445, 40445, 512, 1024, 0xe683db69 -0, 40957, 40957, 512, 1024, 0x29e3d93c -0, 41466, 41466, 512, 1024, 0x74f2f27f -0, 41983, 41983, 512, 1024, 0x32cde3ba -0, 42495, 42495, 512, 1024, 0xe907f171 -0, 43007, 43007, 512, 1024, 0x206ae2a5 -0, 43516, 43516, 512, 1024, 0x6379efa1 -0, 44023, 44023, 512, 1024, 0x0f0fee85 -0, 44541, 44541, 512, 1024, 0x3195e314 -0, 45053, 45053, 512, 1024, 0x4646ead3 -0, 45565, 45565, 512, 1024, 0x5635dcf5 -0, 46074, 46074, 512, 1024, 0xd76fc780 -0, 46592, 46592, 512, 1024, 0x847ff8a5 -0, 47104, 47104, 512, 1024, 0xaca8eda3 -0, 47616, 47616, 512, 1024, 0x9a2de1ea -0, 48125, 48125, 512, 1024, 0xc92ff23a -0, 48632, 48632, 512, 1024, 0x0e0ef038 -0, 49149, 49149, 512, 1024, 0xc32cf495 -0, 49661, 49661, 512, 1024, 0x6ab1ec79 -0, 50173, 50173, 512, 1024, 0xe43cd8d6 -0, 50682, 50682, 512, 1024, 0x4ba2deab +0, 35318, 35318, 512, 1024, 0x21e9e7ac +0, 35830, 35830, 512, 1024, 0x845bda9e +0, 36342, 36342, 512, 1024, 0xb1b3e632 +0, 36854, 36854, 512, 1024, 0x61ccf593 +0, 37366, 37366, 512, 1024, 0x8cdbf603 +0, 37878, 37878, 512, 1024, 0xf8f7e673 +0, 38390, 38390, 512, 1024, 0x55efdd24 +0, 38902, 38902, 512, 1024, 0x4059e8ff +0, 39414, 39414, 512, 1024, 0xb3afe5be +0, 39926, 39926, 512, 1024, 0x7236e965 +0, 40438, 40438, 512, 1024, 0xe683db69 +0, 40950, 40950, 512, 1024, 0x29e3d93c +0, 41462, 41462, 512, 1024, 0x74f2f27f +0, 41974, 41974, 512, 1024, 0x32cde3ba +0, 42486, 42486, 512, 1024, 0xe907f171 +0, 42998, 42998, 512, 1024, 0x206ae2a5 +0, 43510, 43510, 512, 1024, 0x6379efa1 +0, 44022, 44022, 512, 1024, 0x0f0fee85 +0, 44534, 44534, 512, 1024, 0x3195e314 +0, 45046, 45046, 512, 1024, 0x4646ead3 +0, 45558, 45558, 512, 1024, 0x5635dcf5 +0, 46070, 46070, 512, 1024, 0xd76fc780 +0, 46582, 46582, 512, 1024, 0x847ff8a5 +0, 47094, 47094, 512, 1024, 0xaca8eda3 +0, 47606, 47606, 512, 1024, 0x9a2de1ea +0, 48118, 48118, 512, 1024, 0xc92ff23a +0, 48630, 48630, 512, 1024, 0x0e0ef038 +0, 49142, 49142, 512, 1024, 0xc32cf495 +0, 49654, 49654, 512, 1024, 0x6ab1ec79 +0, 50166, 50166, 512, 1024, 0xe43cd8d6 +0, 50678, 50678, 512, 1024, 0x4ba2deab 0, 51190, 51190, 512, 1024, 0x6d16ea0e -0, 51707, 51707, 512, 1024, 0xe5b0ee70 -0, 52219, 52219, 512, 1024, 0xcf6cf074 -0, 52731, 52731, 512, 1024, 0x2206e61d -0, 53240, 53240, 512, 1024, 0xfbb9e7e7 -0, 53758, 53758, 512, 1024, 0x2bc1e115 -0, 54270, 54270, 512, 1024, 0x4ca6e5c5 -0, 54782, 54782, 512, 1024, 0x061cead0 -0, 55291, 55291, 512, 1024, 0x3dc9f950 +0, 51702, 51702, 512, 1024, 0xe5b0ee70 +0, 52214, 52214, 512, 1024, 0xcf6cf074 +0, 52726, 52726, 512, 1024, 0x2206e61d +0, 53238, 53238, 512, 1024, 0xfbb9e7e7 +0, 53750, 53750, 512, 1024, 0x2bc1e115 +0, 54262, 54262, 512, 1024, 0x4ca6e5c5 +0, 54774, 54774, 512, 1024, 0x061cead0 +0, 55286, 55286, 512, 1024, 0x3dc9f950 0, 55798, 55798, 512, 1024, 0x9399f10d -0, 56316, 56316, 512, 1024, 0xa2bff5ae -0, 56828, 56828, 512, 1024, 0xd21de569 -0, 57340, 57340, 512, 1024, 0x1c45e3be -0, 57849, 57849, 512, 1024, 0xff5dff1c -0, 58366, 58366, 512, 1024, 0x992df5d3 -0, 58878, 58878, 512, 1024, 0xafedea2f -0, 59390, 59390, 512, 1024, 0x6e73d6a8 -0, 59899, 59899, 512, 1024, 0x72dff283 +0, 56310, 56310, 512, 1024, 0xa2bff5ae +0, 56822, 56822, 512, 1024, 0xd21de569 +0, 57334, 57334, 512, 1024, 0x1c45e3be +0, 57846, 57846, 512, 1024, 0xff5dff1c +0, 58358, 58358, 512, 1024, 0x992df5d3 +0, 58870, 58870, 512, 1024, 0xafedea2f +0, 59382, 59382, 512, 1024, 0x6e73d6a8 +0, 59894, 59894, 512, 1024, 0x72dff283 0, 60406, 60406, 512, 1024, 0x50b5f1a6 -0, 60924, 60924, 512, 1024, 0xffe1decb -0, 61436, 61436, 512, 1024, 0x8993ecff -0, 61948, 61948, 512, 1024, 0x954bd63a -0, 62457, 62457, 512, 1024, 0x4707f577 -0, 62975, 62975, 512, 1024, 0x7a88f81f -0, 63487, 63487, 512, 1024, 0xc771f537 -0, 63999, 63999, 512, 1024, 0x7aade6af -0, 64508, 64508, 512, 1024, 0x8af5ede5 -0, 65015, 65015, 512, 1024, 0x7500f3f1 -0, 65533, 65533, 512, 1024, 0xea36f707 -0, 66045, 66045, 512, 1024, 0x1a26e39a -0, 66557, 66557, 512, 1024, 0xa04cf00d -0, 67066, 67066, 512, 1024, 0xc362f182 -0, 67583, 67583, 512, 1024, 0x79c8f82c -0, 68095, 68095, 512, 1024, 0x6480eee1 -0, 68607, 68607, 512, 1024, 0x7152eaa0 -0, 69116, 69116, 512, 1024, 0x5dfee6a9 -0, 69623, 69623, 512, 1024, 0x0afae660 -0, 70141, 70141, 512, 1024, 0xdc98e9fc -0, 70653, 70653, 512, 1024, 0x10b7da06 -0, 71165, 71165, 512, 1024, 0x0571e585 -0, 71674, 71674, 512, 1024, 0x18ddf45e -0, 72192, 72192, 512, 1024, 0x2cbef242 -0, 72704, 72704, 512, 1024, 0xf5380845 -0, 73216, 73216, 512, 1024, 0x34fff45e -0, 73725, 73725, 512, 1024, 0x6f97e490 -0, 74232, 74232, 512, 1024, 0x77d6f0db -0, 74750, 74750, 512, 1024, 0xa25ce2db -0, 75262, 75262, 512, 1024, 0x8260e4e9 -0, 75774, 75774, 512, 1024, 0xc3b2f7d2 -0, 76282, 76282, 512, 1024, 0x82a7edae +0, 60918, 60918, 512, 1024, 0xffe1decb +0, 61430, 61430, 512, 1024, 0x8993ecff +0, 61942, 61942, 512, 1024, 0x954bd63a +0, 62454, 62454, 512, 1024, 0x4707f577 +0, 62966, 62966, 512, 1024, 0x7a88f81f +0, 63478, 63478, 512, 1024, 0xc771f537 +0, 63990, 63990, 512, 1024, 0x7aade6af +0, 64502, 64502, 512, 1024, 0x8af5ede5 +0, 65014, 65014, 512, 1024, 0x7500f3f1 +0, 65526, 65526, 512, 1024, 0xea36f707 +0, 66038, 66038, 512, 1024, 0x1a26e39a +0, 66550, 66550, 512, 1024, 0xa04cf00d +0, 67062, 67062, 512, 1024, 0xc362f182 +0, 67574, 67574, 512, 1024, 0x79c8f82c +0, 68086, 68086, 512, 1024, 0x6480eee1 +0, 68598, 68598, 512, 1024, 0x7152eaa0 +0, 69110, 69110, 512, 1024, 0x5dfee6a9 +0, 69622, 69622, 512, 1024, 0x0afae660 +0, 70134, 70134, 512, 1024, 0xdc98e9fc +0, 70646, 70646, 512, 1024, 0x10b7da06 +0, 71158, 71158, 512, 1024, 0x0571e585 +0, 71670, 71670, 512, 1024, 0x18ddf45e +0, 72182, 72182, 512, 1024, 0x2cbef242 +0, 72694, 72694, 512, 1024, 0xf5380845 +0, 73206, 73206, 512, 1024, 0x34fff45e +0, 73718, 73718, 512, 1024, 0x6f97e490 +0, 74230, 74230, 512, 1024, 0x77d6f0db +0, 74742, 74742, 512, 1024, 0xa25ce2db +0, 75254, 75254, 512, 1024, 0x8260e4e9 +0, 75766, 75766, 512, 1024, 0xc3b2f7d2 +0, 76278, 76278, 512, 1024, 0x82a7edae 0, 76790, 76790, 512, 1024, 0x7d08dd54 -0, 77307, 77307, 512, 1024, 0x9059eda6 -0, 77819, 77819, 512, 1024, 0xbebaec88 -0, 78331, 78331, 512, 1024, 0xd9afd586 -0, 78840, 78840, 512, 1024, 0x0ca3e622 -0, 79358, 79358, 512, 1024, 0x4123e9e6 -0, 79870, 79870, 512, 1024, 0x2ff9f95c -0, 80382, 80382, 512, 1024, 0x8522e261 -0, 80891, 80891, 512, 1024, 0xe4f8f499 +0, 77302, 77302, 512, 1024, 0x9059eda6 +0, 77814, 77814, 512, 1024, 0xbebaec88 +0, 78326, 78326, 512, 1024, 0xd9afd586 +0, 78838, 78838, 512, 1024, 0x0ca3e622 +0, 79350, 79350, 512, 1024, 0x4123e9e6 +0, 79862, 79862, 512, 1024, 0x2ff9f95c +0, 80374, 80374, 512, 1024, 0x8522e261 +0, 80886, 80886, 512, 1024, 0xe4f8f499 0, 81398, 81398, 512, 1024, 0x34f3f2bd -0, 81916, 81916, 512, 1024, 0x82efe863 -0, 82428, 82428, 512, 1024, 0x9966fcea -0, 82940, 82940, 512, 1024, 0xe94de3fd -0, 83449, 83449, 512, 1024, 0x1ce0e27b -0, 83966, 83966, 512, 1024, 0xd718dcde -0, 84478, 84478, 512, 1024, 0xd503e724 -0, 84990, 84990, 512, 1024, 0x427ee3b2 -0, 85499, 85499, 512, 1024, 0x4512dcc4 -0, 86007, 86007, 512, 1024, 0xcf31e77c -0, 86524, 86524, 512, 1024, 0xeb41ea81 -0, 87036, 87036, 512, 1024, 0xfa43e67c -0, 87548, 87548, 512, 1024, 0x8162f3c9 -0, 88057, 88057, 512, 1024, 0x1b55f6b0 -0, 88575, 88575, 512, 1024, 0x3ebeec44 -0, 89087, 89087, 512, 1024, 0x740fe0c4 -0, 89599, 89599, 512, 1024, 0x8fb4e8b2 -0, 90108, 90108, 512, 1024, 0xe49de6a2 -0, 90615, 90615, 512, 1024, 0xd64febdf -0, 91133, 91133, 512, 1024, 0x0e74ee08 -0, 91645, 91645, 512, 1024, 0x6c0ddf07 -0, 92157, 92157, 512, 1024, 0x7fb8e3c9 -0, 92666, 92666, 512, 1024, 0x52bfe96c -0, 93183, 93183, 512, 1024, 0xfc22ee64 -0, 93695, 93695, 512, 1024, 0xe20ae718 -0, 94207, 94207, 512, 1024, 0xa94be395 -0, 94716, 94716, 512, 1024, 0xded306d0 -0, 95223, 95223, 512, 1024, 0x31f7c831 -0, 95741, 95741, 512, 1024, 0x0ffde0a8 -0, 96253, 96253, 512, 1024, 0xc692e3e0 -0, 96765, 96765, 512, 1024, 0x1d8ff7c7 -0, 97274, 97274, 512, 1024, 0x038ee172 -0, 97792, 97792, 512, 1024, 0x9a1eef59 -0, 98304, 98304, 512, 1024, 0x158fe750 -0, 98816, 98816, 512, 1024, 0xac15e42c -0, 99325, 99325, 512, 1024, 0x6323ed44 -0, 99832, 99832, 512, 1024, 0xd10ce4bb -0, 100350, 100350, 512, 1024, 0xc1cce296 -0, 100862, 100862, 512, 1024, 0x0782f094 -0, 101374, 101374, 512, 1024, 0xd109de36 -0, 101883, 101883, 512, 1024, 0x175600fb +0, 81910, 81910, 512, 1024, 0x82efe863 +0, 82422, 82422, 512, 1024, 0x9966fcea +0, 82934, 82934, 512, 1024, 0xe94de3fd +0, 83446, 83446, 512, 1024, 0x1ce0e27b +0, 83958, 83958, 512, 1024, 0xd718dcde +0, 84470, 84470, 512, 1024, 0xd503e724 +0, 84982, 84982, 512, 1024, 0x427ee3b2 +0, 85494, 85494, 512, 1024, 0x4512dcc4 +0, 86006, 86006, 512, 1024, 0xcf31e77c +0, 86518, 86518, 512, 1024, 0xeb41ea81 +0, 87030, 87030, 512, 1024, 0xfa43e67c +0, 87542, 87542, 512, 1024, 0x8162f3c9 +0, 88054, 88054, 512, 1024, 0x1b55f6b0 +0, 88566, 88566, 512, 1024, 0x3ebeec44 +0, 89078, 89078, 512, 1024, 0x740fe0c4 +0, 89590, 89590, 512, 1024, 0x8fb4e8b2 +0, 90102, 90102, 512, 1024, 0xe49de6a2 +0, 90614, 90614, 512, 1024, 0xd64febdf +0, 91126, 91126, 512, 1024, 0x0e74ee08 +0, 91638, 91638, 512, 1024, 0x6c0ddf07 +0, 92150, 92150, 512, 1024, 0x7fb8e3c9 +0, 92662, 92662, 512, 1024, 0x52bfe96c +0, 93174, 93174, 512, 1024, 0xfc22ee64 +0, 93686, 93686, 512, 1024, 0xe20ae718 +0, 94198, 94198, 512, 1024, 0xa94be395 +0, 94710, 94710, 512, 1024, 0xded306d0 +0, 95222, 95222, 512, 1024, 0x31f7c831 +0, 95734, 95734, 512, 1024, 0x0ffde0a8 +0, 96246, 96246, 512, 1024, 0xc692e3e0 +0, 96758, 96758, 512, 1024, 0x1d8ff7c7 +0, 97270, 97270, 512, 1024, 0x038ee172 +0, 97782, 97782, 512, 1024, 0x9a1eef59 +0, 98294, 98294, 512, 1024, 0x158fe750 +0, 98806, 98806, 512, 1024, 0xac15e42c +0, 99318, 99318, 512, 1024, 0x6323ed44 +0, 99830, 99830, 512, 1024, 0xd10ce4bb +0, 100342, 100342, 512, 1024, 0xc1cce296 +0, 100854, 100854, 512, 1024, 0x0782f094 +0, 101366, 101366, 512, 1024, 0xd109de36 +0, 101878, 101878, 512, 1024, 0x175600fb 0, 102390, 102390, 512, 1024, 0x95d5e8d9 -0, 102907, 102907, 512, 1024, 0xebb6eee1 -0, 103419, 103419, 512, 1024, 0x187cfadc -0, 103931, 103931, 512, 1024, 0xce35fa5c -0, 104440, 104440, 512, 1024, 0x8327eea2 -0, 104958, 104958, 512, 1024, 0x5543f219 -0, 105470, 105470, 512, 1024, 0xaacbe0dc -0, 105982, 105982, 512, 1024, 0xa538e9fb -0, 106491, 106491, 512, 1024, 0x4dcbe655 +0, 102902, 102902, 512, 1024, 0xebb6eee1 +0, 103414, 103414, 512, 1024, 0x187cfadc +0, 103926, 103926, 512, 1024, 0xce35fa5c +0, 104438, 104438, 512, 1024, 0x8327eea2 +0, 104950, 104950, 512, 1024, 0x5543f219 +0, 105462, 105462, 512, 1024, 0xaacbe0dc +0, 105974, 105974, 512, 1024, 0xa538e9fb +0, 106486, 106486, 512, 1024, 0x4dcbe655 0, 106998, 106998, 512, 1024, 0x86b6d93b -0, 107516, 107516, 512, 1024, 0x1a06f878 -0, 108028, 108028, 512, 1024, 0xd926e8ef -0, 108540, 108540, 512, 1024, 0xc624db2f -0, 109049, 109049, 512, 1024, 0x2153e20d -0, 109566, 109566, 512, 1024, 0x01dce868 -0, 110078, 110078, 512, 1024, 0xfa5fd3cd -0, 110590, 110590, 512, 1024, 0x2adef2d5 -0, 111099, 111099, 512, 1024, 0x4f48f8e2 -0, 111607, 111607, 512, 1024, 0x613feeee -0, 112124, 112124, 512, 1024, 0x3780de8a -0, 112636, 112636, 512, 1024, 0x2093eb65 -0, 113148, 113148, 512, 1024, 0x54baebbb -0, 113657, 113657, 512, 1024, 0x8686dd7c -0, 114175, 114175, 512, 1024, 0x7f8ae80c -0, 114687, 114687, 512, 1024, 0x7aede972 -0, 115199, 115199, 512, 1024, 0x971bebc0 -0, 115708, 115708, 512, 1024, 0x2dd5fd4b -0, 116215, 116215, 512, 1024, 0xb1b3e4a3 -0, 116733, 116733, 512, 1024, 0x192defc6 -0, 117245, 117245, 512, 1024, 0x5e46ec44 -0, 117757, 117757, 512, 1024, 0xe6d8e05a -0, 118266, 118266, 512, 1024, 0x7e2fe2b0 -0, 118783, 118783, 512, 1024, 0x9e3bdf80 -0, 119295, 119295, 512, 1024, 0xa98cd85e -0, 119807, 119807, 512, 1024, 0x6061e0c4 -0, 120316, 120316, 512, 1024, 0x6112f3fc -0, 120823, 120823, 512, 1024, 0x99bdfb01 -0, 121341, 121341, 512, 1024, 0x3f5df3ca -0, 121853, 121853, 512, 1024, 0xf5ebeb05 -0, 122365, 122365, 512, 1024, 0x8498e565 -0, 122874, 122874, 512, 1024, 0x0497f0b7 -0, 123392, 123392, 512, 1024, 0x626ae800 -0, 123904, 123904, 512, 1024, 0xfb71eec4 -0, 124416, 124416, 512, 1024, 0xa86ee739 -0, 124925, 124925, 512, 1024, 0x25c0e050 -0, 125432, 125432, 512, 1024, 0x6027e91e -0, 125950, 125950, 512, 1024, 0x6772df6e -0, 126462, 126462, 512, 1024, 0xfefff844 -0, 126974, 126974, 512, 1024, 0x547be862 -0, 127483, 127483, 512, 1024, 0xca84e795 +0, 107510, 107510, 512, 1024, 0x1a06f878 +0, 108022, 108022, 512, 1024, 0xd926e8ef +0, 108534, 108534, 512, 1024, 0xc624db2f +0, 109046, 109046, 512, 1024, 0x2153e20d +0, 109558, 109558, 512, 1024, 0x01dce868 +0, 110070, 110070, 512, 1024, 0xfa5fd3cd +0, 110582, 110582, 512, 1024, 0x2adef2d5 +0, 111094, 111094, 512, 1024, 0x4f48f8e2 +0, 111606, 111606, 512, 1024, 0x613feeee +0, 112118, 112118, 512, 1024, 0x3780de8a +0, 112630, 112630, 512, 1024, 0x2093eb65 +0, 113142, 113142, 512, 1024, 0x54baebbb +0, 113654, 113654, 512, 1024, 0x8686dd7c +0, 114166, 114166, 512, 1024, 0x7f8ae80c +0, 114678, 114678, 512, 1024, 0x7aede972 +0, 115190, 115190, 512, 1024, 0x971bebc0 +0, 115702, 115702, 512, 1024, 0x2dd5fd4b +0, 116214, 116214, 512, 1024, 0xb1b3e4a3 +0, 116726, 116726, 512, 1024, 0x192defc6 +0, 117238, 117238, 512, 1024, 0x5e46ec44 +0, 117750, 117750, 512, 1024, 0xe6d8e05a +0, 118262, 118262, 512, 1024, 0x7e2fe2b0 +0, 118774, 118774, 512, 1024, 0x9e3bdf80 +0, 119286, 119286, 512, 1024, 0xa98cd85e +0, 119798, 119798, 512, 1024, 0x6061e0c4 +0, 120310, 120310, 512, 1024, 0x6112f3fc +0, 120822, 120822, 512, 1024, 0x99bdfb01 +0, 121334, 121334, 512, 1024, 0x3f5df3ca +0, 121846, 121846, 512, 1024, 0xf5ebeb05 +0, 122358, 122358, 512, 1024, 0x8498e565 +0, 122870, 122870, 512, 1024, 0x0497f0b7 +0, 123382, 123382, 512, 1024, 0x626ae800 +0, 123894, 123894, 512, 1024, 0xfb71eec4 +0, 124406, 124406, 512, 1024, 0xa86ee739 +0, 124918, 124918, 512, 1024, 0x25c0e050 +0, 125430, 125430, 512, 1024, 0x6027e91e +0, 125942, 125942, 512, 1024, 0x6772df6e +0, 126454, 126454, 512, 1024, 0xfefff844 +0, 126966, 126966, 512, 1024, 0x547be862 +0, 127478, 127478, 512, 1024, 0xca84e795 0, 127990, 127990, 512, 1024, 0xd124db3e -0, 128507, 128507, 512, 1024, 0xcaf3deb5 -0, 129019, 129019, 512, 1024, 0x487ce92d -0, 129531, 129531, 512, 1024, 0x117feb95 -0, 130040, 130040, 512, 1024, 0x7b63de3d -0, 130558, 130558, 512, 1024, 0xa529d8e1 -0, 131070, 131070, 512, 1024, 0x56f6da26 -0, 131582, 131582, 512, 1024, 0xffb8d5af -0, 132091, 132091, 512, 1024, 0xeecbdc04 +0, 128502, 128502, 512, 1024, 0xcaf3deb5 +0, 129014, 129014, 512, 1024, 0x487ce92d +0, 129526, 129526, 512, 1024, 0x117feb95 +0, 130038, 130038, 512, 1024, 0x7b63de3d +0, 130550, 130550, 512, 1024, 0xa529d8e1 +0, 131062, 131062, 512, 1024, 0x56f6da26 +0, 131574, 131574, 512, 1024, 0xffb8d5af +0, 132086, 132086, 512, 1024, 0xeecbdc04 0, 132598, 132598, 512, 1024, 0xfc59d2d2 -0, 133116, 133116, 512, 1024, 0xaf7acef7 -0, 133628, 133628, 512, 1024, 0x3f9bf258 -0, 134140, 134140, 512, 1024, 0xcf54e9d6 -0, 134649, 134649, 512, 1024, 0x680cd0aa -0, 135167, 135167, 512, 1024, 0x3c1bdc1f -0, 135679, 135679, 512, 1024, 0x8c8ffe22 -0, 136191, 136191, 512, 1024, 0xf415d362 -0, 136699, 136699, 512, 1024, 0x8c8cdaa9 -0, 137207, 137207, 512, 1024, 0x9531e9f1 -0, 137724, 137724, 512, 1024, 0x223ce536 -0, 138236, 138236, 512, 1024, 0xdfbce5f9 -0, 138748, 138748, 512, 1024, 0x20b6ed7d -0, 139257, 139257, 512, 1024, 0x1a17e109 -0, 139775, 139775, 512, 1024, 0xc672eaea -0, 140287, 140287, 512, 1024, 0x12a7dc5e -0, 140799, 140799, 512, 1024, 0x4497f342 -0, 141308, 141308, 512, 1024, 0xdfb5db4b -0, 141815, 141815, 512, 1024, 0xde48ef6c -0, 142333, 142333, 512, 1024, 0x1d98e316 -0, 142845, 142845, 512, 1024, 0xbd2ad72f -0, 143357, 143357, 512, 1024, 0xf1aad776 -0, 143866, 143866, 512, 1024, 0x4db3e3c0 -0, 144383, 144383, 512, 1024, 0x832de0a0 -0, 144895, 144895, 512, 1024, 0xc5f0ef25 -0, 145407, 145407, 512, 1024, 0x419bda6e -0, 145916, 145916, 512, 1024, 0x5de7f77e -0, 146424, 146424, 512, 1024, 0x0063ec9a -0, 146941, 146941, 512, 1024, 0x10c3d470 -0, 147453, 147453, 512, 1024, 0xba66d226 -0, 147965, 147965, 512, 1024, 0xea47ded3 -0, 148474, 148474, 512, 1024, 0x6202d67b -0, 148992, 148992, 512, 1024, 0x3f80e7cf -0, 149504, 149504, 512, 1024, 0x4e64eaae -0, 150016, 150016, 512, 1024, 0x2108e83d -0, 150525, 150525, 512, 1024, 0x38c3dec1 -0, 151032, 151032, 512, 1024, 0x46d3f77a -0, 151550, 151550, 512, 1024, 0x4838e787 -0, 152062, 152062, 512, 1024, 0xc71df16d -0, 152574, 152574, 512, 1024, 0xdbe4ebbd -0, 153083, 153083, 512, 1024, 0xa156d07b +0, 133110, 133110, 512, 1024, 0xaf7acef7 +0, 133622, 133622, 512, 1024, 0x3f9bf258 +0, 134134, 134134, 512, 1024, 0xcf54e9d6 +0, 134646, 134646, 512, 1024, 0x680cd0aa +0, 135158, 135158, 512, 1024, 0x3c1bdc1f +0, 135670, 135670, 512, 1024, 0x8c8ffe22 +0, 136182, 136182, 512, 1024, 0xf415d362 +0, 136694, 136694, 512, 1024, 0x8c8cdaa9 +0, 137206, 137206, 512, 1024, 0x9531e9f1 +0, 137718, 137718, 512, 1024, 0x223ce536 +0, 138230, 138230, 512, 1024, 0xdfbce5f9 +0, 138742, 138742, 512, 1024, 0x20b6ed7d +0, 139254, 139254, 512, 1024, 0x1a17e109 +0, 139766, 139766, 512, 1024, 0xc672eaea +0, 140278, 140278, 512, 1024, 0x12a7dc5e +0, 140790, 140790, 512, 1024, 0x4497f342 +0, 141302, 141302, 512, 1024, 0xdfb5db4b +0, 141814, 141814, 512, 1024, 0xde48ef6c +0, 142326, 142326, 512, 1024, 0x1d98e316 +0, 142838, 142838, 512, 1024, 0xbd2ad72f +0, 143350, 143350, 512, 1024, 0xf1aad776 +0, 143862, 143862, 512, 1024, 0x4db3e3c0 +0, 144374, 144374, 512, 1024, 0x832de0a0 +0, 144886, 144886, 512, 1024, 0xc5f0ef25 +0, 145398, 145398, 512, 1024, 0x419bda6e +0, 145910, 145910, 512, 1024, 0x5de7f77e +0, 146422, 146422, 512, 1024, 0x0063ec9a +0, 146934, 146934, 512, 1024, 0x10c3d470 +0, 147446, 147446, 512, 1024, 0xba66d226 +0, 147958, 147958, 512, 1024, 0xea47ded3 +0, 148470, 148470, 512, 1024, 0x6202d67b +0, 148982, 148982, 512, 1024, 0x3f80e7cf +0, 149494, 149494, 512, 1024, 0x4e64eaae +0, 150006, 150006, 512, 1024, 0x2108e83d +0, 150518, 150518, 512, 1024, 0x38c3dec1 +0, 151030, 151030, 512, 1024, 0x46d3f77a +0, 151542, 151542, 512, 1024, 0x4838e787 +0, 152054, 152054, 512, 1024, 0xc71df16d +0, 152566, 152566, 512, 1024, 0xdbe4ebbd +0, 153078, 153078, 512, 1024, 0xa156d07b 0, 153590, 153590, 512, 1024, 0x34eddc80 -0, 154107, 154107, 512, 1024, 0xe840e87c -0, 154619, 154619, 512, 1024, 0x6accf8f5 -0, 155131, 155131, 512, 1024, 0xa1dbebb9 -0, 155640, 155640, 512, 1024, 0x6d07d98c -0, 156158, 156158, 512, 1024, 0x94c7e805 -0, 156670, 156670, 512, 1024, 0x5199e586 -0, 157182, 157182, 512, 1024, 0xe797e1aa -0, 157691, 157691, 512, 1024, 0xff19eda7 +0, 154102, 154102, 512, 1024, 0xe840e87c +0, 154614, 154614, 512, 1024, 0x6accf8f5 +0, 155126, 155126, 512, 1024, 0xa1dbebb9 +0, 155638, 155638, 512, 1024, 0x6d07d98c +0, 156150, 156150, 512, 1024, 0x94c7e805 +0, 156662, 156662, 512, 1024, 0x5199e586 +0, 157174, 157174, 512, 1024, 0xe797e1aa +0, 157686, 157686, 512, 1024, 0xff19eda7 0, 158198, 158198, 512, 1024, 0x9cb9d040 -0, 158716, 158716, 512, 1024, 0xaeedd325 -0, 159228, 159228, 512, 1024, 0xf5ade306 -0, 159740, 159740, 512, 1024, 0x54a5e129 -0, 160249, 160249, 512, 1024, 0x6665ddeb -0, 160767, 160767, 512, 1024, 0x9d18e033 -0, 161279, 161279, 512, 1024, 0x7f23df74 -0, 161791, 161791, 512, 1024, 0x7c34f158 -0, 162300, 162300, 512, 1024, 0x47f6dae2 -0, 162807, 162807, 512, 1024, 0x5ffdd903 -0, 163324, 163324, 512, 1024, 0x8233d108 -0, 163836, 163836, 512, 1024, 0x45c6e20d -0, 164348, 164348, 512, 1024, 0xae11fa6e -0, 164857, 164857, 512, 1024, 0xa30defd2 -0, 165375, 165375, 512, 1024, 0xfc1ecccf -0, 165887, 165887, 512, 1024, 0x920edc94 -0, 166399, 166399, 512, 1024, 0xd7f3dc58 -0, 166908, 166908, 512, 1024, 0x4972d37d -0, 167415, 167415, 512, 1024, 0xfefef358 -0, 167933, 167933, 512, 1024, 0x3648e473 -0, 168445, 168445, 512, 1024, 0x58dee6c3 -0, 168957, 168957, 512, 1024, 0x9cc6df27 -0, 169466, 169466, 512, 1024, 0x6adfe99c -0, 169983, 169983, 512, 1024, 0x6a56e11f -0, 170495, 170495, 512, 1024, 0x4860edf1 -0, 171007, 171007, 512, 1024, 0x9132f10a -0, 171516, 171516, 512, 1024, 0x3e09d209 -0, 172024, 172024, 512, 1024, 0x4b6bf4d8 -0, 172541, 172541, 512, 1024, 0x0cd5e838 -0, 173053, 173053, 512, 1024, 0x080be078 -0, 173565, 173565, 512, 1024, 0xfdb0e31c -0, 174074, 174074, 512, 1024, 0xced5e7bd -0, 174592, 174592, 512, 1024, 0x65b3e435 -0, 175104, 175104, 512, 1024, 0x5b5bfe2e -0, 175616, 175616, 512, 1024, 0xa8bde3cb -0, 176125, 176125, 512, 1024, 0xfd0fdefa -0, 176632, 176632, 512, 1024, 0xbec4ef95 -0, 177150, 177150, 512, 1024, 0x683ad8dd -0, 177662, 177662, 512, 1024, 0x8eefeb77 -0, 178174, 178174, 512, 1024, 0x84fc5878 -0, 178683, 178683, 512, 1024, 0x9a0ded60 +0, 158710, 158710, 512, 1024, 0xaeedd325 +0, 159222, 159222, 512, 1024, 0xf5ade306 +0, 159734, 159734, 512, 1024, 0x54a5e129 +0, 160246, 160246, 512, 1024, 0x6665ddeb +0, 160758, 160758, 512, 1024, 0x9d18e033 +0, 161270, 161270, 512, 1024, 0x7f23df74 +0, 161782, 161782, 512, 1024, 0x7c34f158 +0, 162294, 162294, 512, 1024, 0x47f6dae2 +0, 162806, 162806, 512, 1024, 0x5ffdd903 +0, 163318, 163318, 512, 1024, 0x8233d108 +0, 163830, 163830, 512, 1024, 0x45c6e20d +0, 164342, 164342, 512, 1024, 0xae11fa6e +0, 164854, 164854, 512, 1024, 0xa30defd2 +0, 165366, 165366, 512, 1024, 0xfc1ecccf +0, 165878, 165878, 512, 1024, 0x920edc94 +0, 166390, 166390, 512, 1024, 0xd7f3dc58 +0, 166902, 166902, 512, 1024, 0x4972d37d +0, 167414, 167414, 512, 1024, 0xfefef358 +0, 167926, 167926, 512, 1024, 0x3648e473 +0, 168438, 168438, 512, 1024, 0x58dee6c3 +0, 168950, 168950, 512, 1024, 0x9cc6df27 +0, 169462, 169462, 512, 1024, 0x6adfe99c +0, 169974, 169974, 512, 1024, 0x6a56e11f +0, 170486, 170486, 512, 1024, 0x4860edf1 +0, 170998, 170998, 512, 1024, 0x9132f10a +0, 171510, 171510, 512, 1024, 0x3e09d209 +0, 172022, 172022, 512, 1024, 0x4b6bf4d8 +0, 172534, 172534, 512, 1024, 0x0cd5e838 +0, 173046, 173046, 512, 1024, 0x080be078 +0, 173558, 173558, 512, 1024, 0xfdb0e31c +0, 174070, 174070, 512, 1024, 0xced5e7bd +0, 174582, 174582, 512, 1024, 0x65b3e435 +0, 175094, 175094, 512, 1024, 0x5b5bfe2e +0, 175606, 175606, 512, 1024, 0xa8bde3cb +0, 176118, 176118, 512, 1024, 0xfd0fdefa +0, 176630, 176630, 512, 1024, 0xbec4ef95 +0, 177142, 177142, 512, 1024, 0x683ad8dd +0, 177654, 177654, 512, 1024, 0x8eefeb77 +0, 178166, 178166, 512, 1024, 0x84fc5878 +0, 178678, 178678, 512, 1024, 0x9a0ded60 diff --git a/tests/ref/fate/pcm_dvd-16-5.1-96000 b/tests/ref/fate/pcm_dvd-16-5.1-96000 index 64447a9aa5..68dce2d3a6 100644 --- a/tests/ref/fate/pcm_dvd-16-5.1-96000 +++ b/tests/ref/fate/pcm_dvd-16-5.1-96000 @@ -13,7 +13,7 @@ d8e182dfa46524c28d1f78a4cc1f2719 *tests/data/fate/pcm_dvd-16-5.1-96000.vob 0, 835, 835, 167, 2004, 0x00000000 0, 1002, 1002, 167, 2004, 0x00000000 0, 1169, 1169, 167, 2004, 0x00000000 -0, 1337, 1337, 167, 2004, 0x00000000 +0, 1336, 1336, 167, 2004, 0x00000000 0, 1503, 1503, 167, 2004, 0x00000000 0, 1670, 1670, 167, 2004, 0x00000000 0, 1837, 1837, 167, 2004, 0x00000000 @@ -29,7 +29,7 @@ d8e182dfa46524c28d1f78a4cc1f2719 *tests/data/fate/pcm_dvd-16-5.1-96000.vob 0, 3507, 3507, 167, 2004, 0x00000000 0, 3674, 3674, 167, 2004, 0x00000000 0, 3841, 3841, 167, 2004, 0x00000000 -0, 4009, 4009, 167, 2004, 0x00000000 +0, 4008, 4008, 167, 2004, 0x00000000 0, 4175, 4175, 167, 2004, 0x00000000 0, 4342, 4342, 167, 2004, 0x00000000 0, 4509, 4509, 167, 2004, 0x00000000 @@ -45,7 +45,7 @@ d8e182dfa46524c28d1f78a4cc1f2719 *tests/data/fate/pcm_dvd-16-5.1-96000.vob 0, 6179, 6179, 167, 2004, 0x00000000 0, 6346, 6346, 167, 2004, 0x00000000 0, 6513, 6513, 167, 2004, 0x00000000 -0, 6681, 6681, 166, 1992, 0x00000000 -0, 6847, 6847, 167, 2004, 0x00000000 +0, 6680, 6680, 166, 1992, 0x00000000 +0, 6846, 6846, 167, 2004, 0x00000000 0, 7014, 7014, 167, 2004, 0x00000000 0, 7181, 7181, 101, 1212, 0x00000000 diff --git a/tests/ref/lavf/smjpeg b/tests/ref/lavf/smjpeg index 94172a6b1e..537c0847cb 100644 --- a/tests/ref/lavf/smjpeg +++ b/tests/ref/lavf/smjpeg @@ -1,3 +1,3 @@ 3fe90213ac4f5275eb85ad0a4e4bdb44 *tests/data/lavf/lavf.smjpeg 728642 tests/data/lavf/lavf.smjpeg -tests/data/lavf/lavf.smjpeg CRC=0x75066147 +tests/data/lavf/lavf.smjpeg CRC=0x54bf6147 From patchwork Thu Apr 27 14:25:57 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anton Khirnov X-Patchwork-Id: 41370 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:dca6:b0:f3:34fa:f187 with SMTP id ky38csp563691pzb; Thu, 27 Apr 2023 07:27:31 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ67rQueIZKEWonStX4yeNReTqbOlb1eSlrFgFc+RHKIWnFS+pcJjaP0bwnUIHzrHn3xPGp8 X-Received: by 2002:a17:907:6ea5:b0:94f:6c6c:e14c with SMTP id sh37-20020a1709076ea500b0094f6c6ce14cmr2267646ejc.57.1682605651739; Thu, 27 Apr 2023 07:27:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1682605651; cv=none; d=google.com; s=arc-20160816; b=fgfLD0tUkV5vWYwsNCbMOcLsdFabr4LeAjIyeuSBADDxdXaisLmmKfEcT3ZPEdtJrh fynnE6MDLvwh89TqcDaO1LdxtUAbWxzeeNRIHPJBeVGRQWvxrNCTYs0Ec2fpT9fpvIfK +S5rU2esmYlyuBJ5UXk5FsouooIvK3Chu0BOIB78j9sa0wRxD3d6Lx+mOpKs/KEeLY0B L4QOdJrzu6NTpxrowUuUI9RBL+b0D2Lo4bEZI/gShOMK4qm1JXeameNNizJ6+5NOFsl2 S37oEUtL12lpfOigx00ITFOc3kBHV6NX1VKoLnXWgrbQ/rmRHHhYRHdgIAllfTLUzyM8 z+lA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:reply-to:list-subscribe :list-help:list-post:list-archive:list-unsubscribe:list-id :precedence:subject:mime-version:references:in-reply-to:message-id :date:to:from:delivered-to; bh=qa6CET0pIv+UR8Uf2Cu4gfyAZubvHYW782Hfx7Xp20c=; b=ZsE/oE+4ipbHW0aBrSq5V8pwJCf1z6oKOoXlHGWDfpvFHszqwvYUYdl9b+5w7cagly 4fHPCSSUPT9useLq1MGu/8FozmGGKauoJRj0OD8Jcc7wKjsX2GUv0+RG2UsMLx/si23C gnE7pzdFOVRUjp4OksOXHfzPQBY83wPgXnGz24GahttvSCdOSjpgem7VFTM4nyO5wDkx VAt6sDAFxzxH1OseEO9O1t7lgWgsDm1lroFD5555HD7x5fdLrTGtcmcIQXDgLIW47NIG Ui1xI9zl8m39tdsYf+hwW/AnhShM/y0h3HAXAaKctp+Jtvl355agaJydmDhT/4nipYqX k3Dw== ARC-Authentication-Results: i=1; mx.google.com; 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 ia6-20020a170907a06600b0095317ae7687si12967961ejc.74.2023.04.27.07.27.31; Thu, 27 Apr 2023 07:27:31 -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; 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 4B1FF68BF88; Thu, 27 Apr 2023 17:26:22 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail0.khirnov.net (red.khirnov.net [176.97.15.12]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id B942568BEE4 for ; Thu, 27 Apr 2023 17:26:13 +0300 (EEST) Received: from localhost (localhost [IPv6:::1]) by mail0.khirnov.net (Postfix) with ESMTP id 8577D2404EC for ; Thu, 27 Apr 2023 16:26:13 +0200 (CEST) Received: from mail0.khirnov.net ([IPv6:::1]) by localhost (mail0.khirnov.net [IPv6:::1]) (amavisd-new, port 10024) with ESMTP id Gro654onv11z for ; Thu, 27 Apr 2023 16:26:13 +0200 (CEST) Received: from libav.khirnov.net (libav.khirnov.net [IPv6:2a00:c500:561:201::7]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "libav.khirnov.net", Issuer "smtp.khirnov.net SMTP CA" (verified OK)) by mail0.khirnov.net (Postfix) with ESMTPS id CAE25240706 for ; Thu, 27 Apr 2023 16:26:05 +0200 (CEST) Received: from libav.khirnov.net (libav.khirnov.net [IPv6:::1]) by libav.khirnov.net (Postfix) with ESMTP id BC7153A03E5 for ; Thu, 27 Apr 2023 16:26:05 +0200 (CEST) From: Anton Khirnov To: ffmpeg-devel@ffmpeg.org Date: Thu, 27 Apr 2023 16:25:57 +0200 Message-Id: <20230427142601.2613-17-anton@khirnov.net> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230427142601.2613-1-anton@khirnov.net> References: <20230427142601.2613-1-anton@khirnov.net> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 17/21] fftools/ffmpeg: stop using InputStream.pts for generating video timestamps 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 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: XC5PJ6psvUzt This was added in 380db569287ba99d903b7629f209b9adc7fd2723 as a temporary crutch that is not needed anymore. The only case where this code can be triggered is the very first frame, for which InputStream.pts is always equal to 0. --- fftools/ffmpeg.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/fftools/ffmpeg.c b/fftools/ffmpeg.c index d074d3e03b..a69aceec9f 100644 --- a/fftools/ffmpeg.c +++ b/fftools/ffmpeg.c @@ -1114,12 +1114,9 @@ static int decode_video(InputStream *ist, AVPacket *pkt, int *got_output, int64_ best_effort_timestamp = ist->cfr_next_pts++; // no timestamp available - extrapolate from previous frame duration - if (best_effort_timestamp == AV_NOPTS_VALUE && - ist->last_frame_pts != AV_NOPTS_VALUE) - best_effort_timestamp = ist->last_frame_pts + ist->last_frame_duration_est; - if (best_effort_timestamp == AV_NOPTS_VALUE) - best_effort_timestamp = av_rescale_q(ist->pts, AV_TIME_BASE_Q, ist->st->time_base); + best_effort_timestamp = ist->last_frame_pts == AV_NOPTS_VALUE ? 0 : + ist->last_frame_pts + ist->last_frame_duration_est; if(best_effort_timestamp != AV_NOPTS_VALUE) { int64_t ts = av_rescale_q(decoded_frame->pts = best_effort_timestamp, ist->st->time_base, AV_TIME_BASE_Q); From patchwork Thu Apr 27 14:25:58 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anton Khirnov X-Patchwork-Id: 41362 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:dca6:b0:f3:34fa:f187 with SMTP id ky38csp563779pzb; Thu, 27 Apr 2023 07:27:42 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ46Z1Jr3Uy1xj/6uY8p0O6zknamLvC7zs39lsLCMjBQ/ozeDbR6jrZw0oTyBdFcs5OfX91x X-Received: by 2002:a17:907:728d:b0:94f:3074:14fe with SMTP id dt13-20020a170907728d00b0094f307414femr2143552ejc.17.1682605662166; Thu, 27 Apr 2023 07:27:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1682605662; cv=none; d=google.com; s=arc-20160816; b=bGl1rIRTMCCeCboqY2i95X2gPXaIL9auswmxPagDT5bwdQAELnQ2F0XkFdDtsQlLY7 MaZo//b0z/c8cN3ORr676u2sJpG/Bmib8dtxFejqsnqTOQkKryAo6VeX8uozV4pAGrAH e8W6VoCVoMEkFnBB9vgx7LM0D29XEH0EiKg35cc2Ok6Hvp3MTqjd28UI+3GeYeXUFl1g G6QZc27jtwq9PTnjmrGpa1WePTTKj4/U2kjXb+dsL1D719rfyQ+dgqGTN1ctQS5FmbGt SXgdPvuLA+NqiWI2UOzRB8bVBOMd6UmFDCXQBJ/+Z63VspCMBd9PWWFcvyQPGVLfUI8O /LGg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:reply-to:list-subscribe :list-help:list-post:list-archive:list-unsubscribe:list-id :precedence:subject:mime-version:references:in-reply-to:message-id :date:to:from:delivered-to; bh=oD4AEpizdZvRBnQhn0fm/pdLCgUC//qyEeolyIDdpHg=; b=Ps51TOxTsoWcQ7QIsKY+INxePd82fSoCA3CfCJxiYbUzjNGkyFqMQnowo4hikG4kgb vC/jCoKbn8v2KIAj/Mc8b1qxN8mDg+JzHMPAL3aRGRvno6A033rsRBDM8nW412WIr+8U gTWjq5GYLSbCifPtbhQ4wXdP2nBpNw95qHSetwJFrJfK/WP44mp67zeIN2colCuld12U w0WdUu8e5pSLtKRGxpEh0Kq2R66WBZBGuy9xC8unVtjafIVvAdCxD31g5jaHnOeuqH9S 8G5rg5HjM6XCYRABIqaHuZXk4tqfA6nE6JuQccQd6c7zwycCpw/y6Pxg+rTfXJ355dW6 3//Q== ARC-Authentication-Results: i=1; mx.google.com; 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 m21-20020aa7c2d5000000b005047ee841cbsi12793459edp.250.2023.04.27.07.27.41; Thu, 27 Apr 2023 07:27:42 -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; 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 4181268BF8D; Thu, 27 Apr 2023 17:26:23 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail0.khirnov.net (red.khirnov.net [176.97.15.12]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 49B2B68BEE4 for ; Thu, 27 Apr 2023 17:26:14 +0300 (EEST) Received: from localhost (localhost [IPv6:::1]) by mail0.khirnov.net (Postfix) with ESMTP id 04E402404EC for ; Thu, 27 Apr 2023 16:26:14 +0200 (CEST) Received: from mail0.khirnov.net ([IPv6:::1]) by localhost (mail0.khirnov.net [IPv6:::1]) (amavisd-new, port 10024) with ESMTP id L08ypI1Sb1C1 for ; Thu, 27 Apr 2023 16:26:13 +0200 (CEST) Received: from libav.khirnov.net (libav.khirnov.net [IPv6:2a00:c500:561:201::7]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "libav.khirnov.net", Issuer "smtp.khirnov.net SMTP CA" (verified OK)) by mail0.khirnov.net (Postfix) with ESMTPS id D6B67240D03 for ; Thu, 27 Apr 2023 16:26:05 +0200 (CEST) Received: from libav.khirnov.net (libav.khirnov.net [IPv6:::1]) by libav.khirnov.net (Postfix) with ESMTP id C724B3A03F3 for ; Thu, 27 Apr 2023 16:26:05 +0200 (CEST) From: Anton Khirnov To: ffmpeg-devel@ffmpeg.org Date: Thu, 27 Apr 2023 16:25:58 +0200 Message-Id: <20230427142601.2613-18-anton@khirnov.net> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230427142601.2613-1-anton@khirnov.net> References: <20230427142601.2613-1-anton@khirnov.net> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 18/21] fftools/ffmpeg_filter: stop using InputStream.pts for filter EOF ts 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 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: kO6fGfzkAl40 Use InputStream.last_frame_pts/duration instead, which is more accurate. --- fftools/ffmpeg.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/fftools/ffmpeg.c b/fftools/ffmpeg.c index a69aceec9f..3ffc37729c 100644 --- a/fftools/ffmpeg.c +++ b/fftools/ffmpeg.c @@ -1374,7 +1374,9 @@ static int send_filter_eof(InputStream *ist) int i, ret; for (i = 0; i < ist->nb_filters; i++) { - ret = ifilter_send_eof(ist->filters[i], ist->pts, AV_TIME_BASE_Q); + int64_t end_pts = ist->last_frame_pts == AV_NOPTS_VALUE ? AV_NOPTS_VALUE : + ist->last_frame_pts + ist->last_frame_duration_est; + ret = ifilter_send_eof(ist->filters[i], end_pts, ist->last_frame_tb); if (ret < 0) return ret; } From patchwork Thu Apr 27 14:25:59 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anton Khirnov X-Patchwork-Id: 41374 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:dca6:b0:f3:34fa:f187 with SMTP id ky38csp564164pzb; Thu, 27 Apr 2023 07:28:22 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4N1IYjiUi4wJspSKJK0KcvuuS22EXP23Jep2UykIBlnZtrDKJHrCsNWx69vFOop3X6ZPvV X-Received: by 2002:a17:907:94cc:b0:948:b9ea:3302 with SMTP id dn12-20020a17090794cc00b00948b9ea3302mr1724814ejc.1.1682605702241; Thu, 27 Apr 2023 07:28:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1682605702; cv=none; d=google.com; s=arc-20160816; b=lu627/l3e0Yw7gTKOS9h4mDJOgVoM//Ie9c4gIQ1cTFm2Buinu2M6Py940WCnYgHiJ mzJ7JLepqbvbJjh7ACiAxcGA8U7TK1/ieNpiOyg1trISrVKAsx0wR9HGlU4tDb6vjS7k uY96W4VVTPunv8jwP2rkZEBcDcRWkGt/2EADPftDgQiSv/VkMYAU9FQDB6BQOBrzTfP4 FcR2XRQZNcJ5x9c879O1CWIB99XpzhBieYaNb98wkYn9x/wqbKHgsTuJ4V03dZoxj3He q+v9nUrZI0wmKYH9ldbZeGYEgv/rD6mDptmlCs/UuxmcpbteDB/a9Ob6pu/Q3gFrzhIq LY0w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:reply-to:list-subscribe :list-help:list-post:list-archive:list-unsubscribe:list-id :precedence:subject:mime-version:references:in-reply-to:message-id :date:to:from:delivered-to; bh=HKxdl6mDyjZh3cveKBEmbJs5qCxbiqicKVtkt3yont0=; b=Ubq0L+4XCR0jevOn10Vc3yBuLn6oxX2uhL+alaLjjUNIMPQKmymi2AkW7LEVXjdWlq 35jKTJ3ESfj0vWQNG57XQhxeRvhrw43s83db+ksVnFID7qWLsv2z94UjHeMpgto7cX7g mqwdW2a+tp8pI/uKSP86LUCB5gxI/zSrTMVRs8InSjBmrQREOwB4T6tXuFNREquVQTgn 6LOmPc4a0DsveUL/xmJzKw7CgKvAqz8mP/TR594VZONwmimIBA6cUlkiOH/EMgFnPKbK AR/wCv5MqOy09AGwbDi63RaLtPzc2JAHAreLj1DQklWgPXa1hw4BuisxJ4fyR8Eps9VL DIuw== ARC-Authentication-Results: i=1; mx.google.com; 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 s19-20020aa7d793000000b00509ee597a3fsi5271919edq.92.2023.04.27.07.28.21; Thu, 27 Apr 2023 07:28:22 -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; 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 1821D68BF13; Thu, 27 Apr 2023 17:26:31 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail0.khirnov.net (red.khirnov.net [176.97.15.12]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 9E76168BF56 for ; Thu, 27 Apr 2023 17:26:16 +0300 (EEST) Received: from localhost (localhost [IPv6:::1]) by mail0.khirnov.net (Postfix) with ESMTP id 4035B2404F5 for ; Thu, 27 Apr 2023 16:26:16 +0200 (CEST) Received: from mail0.khirnov.net ([IPv6:::1]) by localhost (mail0.khirnov.net [IPv6:::1]) (amavisd-new, port 10024) with ESMTP id EeD0_J1ssA6Y for ; Thu, 27 Apr 2023 16:26:14 +0200 (CEST) Received: from libav.khirnov.net (libav.khirnov.net [IPv6:2a00:c500:561:201::7]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "libav.khirnov.net", Issuer "smtp.khirnov.net SMTP CA" (verified OK)) by mail0.khirnov.net (Postfix) with ESMTPS id E4C05240D0E for ; Thu, 27 Apr 2023 16:26:05 +0200 (CEST) Received: from libav.khirnov.net (libav.khirnov.net [IPv6:::1]) by libav.khirnov.net (Postfix) with ESMTP id D2EFF3A031B for ; Thu, 27 Apr 2023 16:26:05 +0200 (CEST) From: Anton Khirnov To: ffmpeg-devel@ffmpeg.org Date: Thu, 27 Apr 2023 16:25:59 +0200 Message-Id: <20230427142601.2613-19-anton@khirnov.net> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230427142601.2613-1-anton@khirnov.net> References: <20230427142601.2613-1-anton@khirnov.net> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 19/21] fftools/ffmpeg: drop InputStream.[next_]pts 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 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: 7P1xrY62eV79 They are no longer used for anything. --- fftools/ffmpeg.c | 20 +------------------- fftools/ffmpeg.h | 4 ---- fftools/ffmpeg_demux.c | 1 - 3 files changed, 1 insertion(+), 24 deletions(-) diff --git a/fftools/ffmpeg.c b/fftools/ffmpeg.c index 3ffc37729c..83abc4e86e 100644 --- a/fftools/ffmpeg.c +++ b/fftools/ffmpeg.c @@ -976,8 +976,6 @@ static int decode_audio(InputStream *ist, AVPacket *pkt, int *got_output, /* increment next_dts to use for the case where the input stream does not have timestamps or there are multiple frames in the packet */ - ist->next_pts += ((int64_t)AV_TIME_BASE * decoded_frame->nb_samples) / - decoded_frame->sample_rate; ist->next_dts += ((int64_t)AV_TIME_BASE * decoded_frame->nb_samples) / decoded_frame->sample_rate; @@ -1119,10 +1117,7 @@ static int decode_video(InputStream *ist, AVPacket *pkt, int *got_output, int64_ ist->last_frame_pts + ist->last_frame_duration_est; if(best_effort_timestamp != AV_NOPTS_VALUE) { - int64_t ts = av_rescale_q(decoded_frame->pts = best_effort_timestamp, ist->st->time_base, AV_TIME_BASE_Q); - - if (ts != AV_NOPTS_VALUE) - ist->next_pts = ist->pts = ts; + decoded_frame->pts = best_effort_timestamp; } // update timestamp history @@ -1398,7 +1393,6 @@ static int process_input_packet(InputStream *ist, const AVPacket *pkt, int no_eo if (!ist->saw_first_ts) { ist->first_dts = ist->dts = ist->st->avg_frame_rate.num ? - ist->dec_ctx->has_b_frames * AV_TIME_BASE / av_q2d(ist->st->avg_frame_rate) : 0; - ist->pts = 0; if (pkt && pkt->pts != AV_NOPTS_VALUE && !ist->decoding_needed) { ist->first_dts = ist->dts += av_rescale_q(pkt->pts, pkt->time_base, AV_TIME_BASE_Q); @@ -1408,8 +1402,6 @@ static int process_input_packet(InputStream *ist, const AVPacket *pkt, int no_eo if (ist->next_dts == AV_NOPTS_VALUE) ist->next_dts = ist->dts; - if (ist->next_pts == AV_NOPTS_VALUE) - ist->next_pts = ist->pts; if (pkt) { av_packet_unref(avpkt); @@ -1420,8 +1412,6 @@ static int process_input_packet(InputStream *ist, const AVPacket *pkt, int no_eo if (pkt && pkt->dts != AV_NOPTS_VALUE) { ist->next_dts = ist->dts = av_rescale_q(pkt->dts, pkt->time_base, AV_TIME_BASE_Q); - if (par->codec_type != AVMEDIA_TYPE_VIDEO) - ist->pts = ist->dts; } // while we have more to decode or while the decoder did output something on EOF @@ -1431,7 +1421,6 @@ static int process_input_packet(InputStream *ist, const AVPacket *pkt, int no_eo int got_output = 0; int decode_failed = 0; - ist->pts = ist->next_pts; ist->dts = ist->next_dts; switch (par->codec_type) { @@ -1461,13 +1450,6 @@ static int process_input_packet(InputStream *ist, const AVPacket *pkt, int no_eo ist->next_dts = AV_NOPTS_VALUE; } - if (got_output) { - if (duration_pts > 0) { - ist->next_pts += av_rescale_q(duration_pts, ist->st->time_base, AV_TIME_BASE_Q); - } else { - ist->next_pts += duration_dts; - } - } av_packet_unref(avpkt); break; case AVMEDIA_TYPE_SUBTITLE: diff --git a/fftools/ffmpeg.h b/fftools/ffmpeg.h index c4abf89b58..b6389d7f99 100644 --- a/fftools/ffmpeg.h +++ b/fftools/ffmpeg.h @@ -366,10 +366,6 @@ typedef struct InputStream { int64_t first_dts; ///< dts of the first packet read for this stream (in AV_TIME_BASE units) int64_t dts; ///< dts of the last packet read for this stream (in AV_TIME_BASE units) - /* predicted pts of the next decoded frame, in AV_TIME_BASE */ - int64_t next_pts; - int64_t pts; ///< current pts of the decoded frame (in AV_TIME_BASE units) - // pts/estimated duration of the last decoded frame // * in decoder timebase for video, // * in last_frame_tb (may change during decoding) for audio diff --git a/fftools/ffmpeg_demux.c b/fftools/ffmpeg_demux.c index f8d95d1de6..26426c7ac1 100644 --- a/fftools/ffmpeg_demux.c +++ b/fftools/ffmpeg_demux.c @@ -744,7 +744,6 @@ static void add_input_streams(const OptionsContext *o, Demuxer *d) st->discard = AVDISCARD_ALL; ist->nb_samples = 0; ist->first_dts = AV_NOPTS_VALUE; - ist->next_pts = AV_NOPTS_VALUE; ist->next_dts = AV_NOPTS_VALUE; ds->min_pts = INT64_MAX; From patchwork Thu Apr 27 14:26:00 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anton Khirnov X-Patchwork-Id: 41371 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:dca6:b0:f3:34fa:f187 with SMTP id ky38csp563920pzb; Thu, 27 Apr 2023 07:27:57 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5zuY8Ah8ShUELMtxCUpJmJEFbOjtNRE5wtyVyJHQF5QN+GhH+Olms1dois98V1AAs5N28t X-Received: by 2002:aa7:d490:0:b0:506:adf0:ead5 with SMTP id b16-20020aa7d490000000b00506adf0ead5mr1703163edr.30.1682605677264; Thu, 27 Apr 2023 07:27:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1682605677; cv=none; d=google.com; s=arc-20160816; b=Janp826vLVSUh/pjhe6vYtJeLUgc6WcCNxESORpvMXVLF8+Sks9/CgPhOjhgeEaWHR 47MzkClB3O/rdhwJCVDp6aqsbrXYIrRxnNu9SuuNqGqy18n2O6pZAFk7E5Sevs0c8azu hpO3gSW9by4zJpilAfKP9nRYLLwMrrTT+ZOq8TpJ2GJe7MpEEZ6n7r8P8wx7VD3mcOxF qhXsOpqAJwLlqB4B7XK8YpDTR9cK+Ww71RSsnDEbrDjSo+hjHNZN6V8ktlcjo2H1wK9W UKgjubgQWm82bTjgyrgHPaDvAX0L41VE09y/3lTp0Y9+H4fkAmZVVEqHOmaohnlUo/3X kRmg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:reply-to:list-subscribe :list-help:list-post:list-archive:list-unsubscribe:list-id :precedence:subject:mime-version:references:in-reply-to:message-id :date:to:from:delivered-to; bh=2mpKbxXhPpNaSLGrJcMakwKrL2KTgYgrHwiacv8o8ek=; b=e3xwYgozqe8ZPaTvDfVCsFrsd7jIGtk0QVF5HlsFvbsnBO3w8BAM/WqAqTaTEiiLNj nylIOl6UFb5sBecqCAtErkHOtplxD/hDR/IG06QEnDDDHSgBnkVG3nvYwLToileZ/4Uc WprIvpq25Lq+EotEWrSFeNhfvlIpCFzuZvhpcv+OZQ44eGL1jtsYQeSVzG7SJx4juwu7 1udjbeKzG/GiT//J6Ou8OZWYZHfvgVkGIvZEJwHFOy4hI+nMGlF6urycOLWW5tYFdevm 5syZ+qtYutm348Wc6kjwEJ0w6W4YQFf9DYIjQCIJ4Tc8cesuIklslsRTRtKPBW3Ww3Th 4FuQ== ARC-Authentication-Results: i=1; mx.google.com; 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 d17-20020aa7c1d1000000b00506a424a281si14200125edp.323.2023.04.27.07.27.50; Thu, 27 Apr 2023 07:27:57 -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; 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 3B5CA68BFF3; Thu, 27 Apr 2023 17:26:24 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail0.khirnov.net (red.khirnov.net [176.97.15.12]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id C17F268BEE4 for ; Thu, 27 Apr 2023 17:26:14 +0300 (EEST) Received: from localhost (localhost [IPv6:::1]) by mail0.khirnov.net (Postfix) with ESMTP id 8D95E2404EC for ; Thu, 27 Apr 2023 16:26:14 +0200 (CEST) Received: from mail0.khirnov.net ([IPv6:::1]) by localhost (mail0.khirnov.net [IPv6:::1]) (amavisd-new, port 10024) with ESMTP id 8gksoxCpqdnT for ; Thu, 27 Apr 2023 16:26:14 +0200 (CEST) Received: from libav.khirnov.net (libav.khirnov.net [IPv6:2a00:c500:561:201::7]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "libav.khirnov.net", Issuer "smtp.khirnov.net SMTP CA" (verified OK)) by mail0.khirnov.net (Postfix) with ESMTPS id EB84E240D1A for ; Thu, 27 Apr 2023 16:26:05 +0200 (CEST) Received: from libav.khirnov.net (libav.khirnov.net [IPv6:::1]) by libav.khirnov.net (Postfix) with ESMTP id DDA673A03E5 for ; Thu, 27 Apr 2023 16:26:05 +0200 (CEST) From: Anton Khirnov To: ffmpeg-devel@ffmpeg.org Date: Thu, 27 Apr 2023 16:26:00 +0200 Message-Id: <20230427142601.2613-20-anton@khirnov.net> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230427142601.2613-1-anton@khirnov.net> References: <20230427142601.2613-1-anton@khirnov.net> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 20/21] fftools/ffmpeg: constify packets passed to decode*() 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 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: Gp1X8lTCJvN8 They are not modified by these functions. --- fftools/ffmpeg.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/fftools/ffmpeg.c b/fftools/ffmpeg.c index 83abc4e86e..07bd40749d 100644 --- a/fftools/ffmpeg.c +++ b/fftools/ffmpeg.c @@ -822,7 +822,7 @@ int ifilter_has_all_input_formats(FilterGraph *fg) // it again with pkt=NULL. pkt==NULL is treated differently from pkt->size==0 // (pkt==NULL means get more output, pkt->size==0 is a flush/drain packet) static int decode(InputStream *ist, AVCodecContext *avctx, - AVFrame *frame, int *got_frame, AVPacket *pkt) + AVFrame *frame, int *got_frame, const AVPacket *pkt) { int ret; @@ -952,7 +952,7 @@ static void audio_ts_process(InputStream *ist, AVFrame *frame) frame->time_base = tb_filter; } -static int decode_audio(InputStream *ist, AVPacket *pkt, int *got_output, +static int decode_audio(InputStream *ist, const AVPacket *pkt, int *got_output, int *decode_failed) { AVFrame *decoded_frame = ist->decoded_frame; @@ -1040,8 +1040,8 @@ static int64_t video_duration_estimate(const InputStream *ist, const AVFrame *fr return FFMAX(ist->last_frame_duration_est, 1); } -static int decode_video(InputStream *ist, AVPacket *pkt, int *got_output, int64_t *duration_pts, int eof, - int *decode_failed) +static int decode_video(InputStream *ist, const AVPacket *pkt, int *got_output, + int64_t *duration_pts, int eof, int *decode_failed) { AVFrame *decoded_frame = ist->decoded_frame; int ret = 0, err = 0; From patchwork Thu Apr 27 14:26:01 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Anton Khirnov X-Patchwork-Id: 41373 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:dca6:b0:f3:34fa:f187 with SMTP id ky38csp564075pzb; Thu, 27 Apr 2023 07:28:12 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4SmkPhxsoS4p0OHXJZnVjlnpVLHDjE/eh4bd+jXtn0dtvmmSZvI2gzaMEaWIT4/+MjDpXG X-Received: by 2002:a17:907:3d9f:b0:94f:3521:394 with SMTP id he31-20020a1709073d9f00b0094f35210394mr1943676ejc.51.1682605692471; Thu, 27 Apr 2023 07:28:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1682605692; cv=none; d=google.com; s=arc-20160816; b=Ro5L4TYdG3n4fAOd5ehC4w+CVNE/f6jgpGOxKAiM/nqzJ9+5mVgIfVvykjEcePDxs+ uhPPIoGer/TiA42CATQTUxM7yeCiPPRpg8K14fD3x9DOHDXcrCOnDumnzjP62AVnACQQ C5944H3OkIU3Zq15Z0zi6sntmBL04VR/r9Yryc+oJmR2oqabsqINNk0AS/oEkYDQgaAx rtsWbcLo7YqDJlEEbIex8upLw4vAbl/i9G0iUpyjiP5zkW9QafEVXLBPv60ZQdMZO+SA ZsiFdW0IfMvlHgR5hengIrU/p1CP+eeB/ZwyvR7lRHbGtq/Wkpw6EIG80yd0rArWvyXA 42xQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:reply-to:list-subscribe :list-help:list-post:list-archive:list-unsubscribe:list-id :precedence:subject:mime-version:references:in-reply-to:message-id :date:to:from:delivered-to; bh=1s7ziWMSaGqcV20w0/DnhWkLMB3n/xK772RWOWVbZhM=; b=kGofMlWcoGHlaa4mYf78xGYi/0NxrsRcvWp5ovTncTp2Sno7MSNqjwJrL5u4ODrrxn oTb9IKew/h6evAOYmtI2Klm+swf+xc5IPBfFQwH43ZRuXnEdqUt4tkzcZOYW9KFKUn3/ JtzLtcVoF7LdYzST5N1/Y4x880g96GbNoQtF/Qe4w3SD0vNuyL+WV4MjJ9CGfLiO4Ay4 v9nstIgn+XyY4gTn2DT7KT33dD+RpilpN/rWSL4XVWS92rcPmMNxZSHd0Du6TtrMBi4h fq2Z9PegI/YRrkXIuCsxAEJ3Xm3e7ud9b1Lg5d8BrZj1NydiuUWOrkypMMaMjQi0keKJ z9CA== ARC-Authentication-Results: i=1; mx.google.com; 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 br20-20020a170906d15400b0094e5ba86388si14735242ejb.831.2023.04.27.07.28.12; Thu, 27 Apr 2023 07:28:12 -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; 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 3685368BF65; Thu, 27 Apr 2023 17:26:30 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail0.khirnov.net (red.khirnov.net [176.97.15.12]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 5E19F68BF67 for ; Thu, 27 Apr 2023 17:26:16 +0300 (EEST) Received: from localhost (localhost [IPv6:::1]) by mail0.khirnov.net (Postfix) with ESMTP id 166DC2404EC for ; Thu, 27 Apr 2023 16:26:16 +0200 (CEST) Received: from mail0.khirnov.net ([IPv6:::1]) by localhost (mail0.khirnov.net [IPv6:::1]) (amavisd-new, port 10024) with ESMTP id uFDKal24eLjz for ; Thu, 27 Apr 2023 16:26:15 +0200 (CEST) Received: from libav.khirnov.net (libav.khirnov.net [IPv6:2a00:c500:561:201::7]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "libav.khirnov.net", Issuer "smtp.khirnov.net SMTP CA" (verified OK)) by mail0.khirnov.net (Postfix) with ESMTPS id 02711240D1B for ; Thu, 27 Apr 2023 16:26:06 +0200 (CEST) Received: from libav.khirnov.net (libav.khirnov.net [IPv6:::1]) by libav.khirnov.net (Postfix) with ESMTP id E87723A03F3 for ; Thu, 27 Apr 2023 16:26:05 +0200 (CEST) From: Anton Khirnov To: ffmpeg-devel@ffmpeg.org Date: Thu, 27 Apr 2023 16:26:01 +0200 Message-Id: <20230427142601.2613-21-anton@khirnov.net> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230427142601.2613-1-anton@khirnov.net> References: <20230427142601.2613-1-anton@khirnov.net> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 21/21] fftools/ffmpeg: always use the same path for setting InputStream.[next_]dts 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 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: O0qdIu9a5RBi Currently those are set in different ways depending on whether the stream is decoded or not, using some values from the decoder if it is. This is wrong, because there may be arbitrary amount of delay between input packets and output frames (depending e.g. on the thread count when frame threading is used). Always use the path that was previously used only for streamcopy. This should not cause any issues, because these values are now used only for streamcopy and discontinuity handling. This change will allow to decouple discontinuity processing from decoding and move it to ffmpeg_demux. It also makes the code simpler. Changes output in fate-cover-art-aiff-id3v2-remux and fate-cover-art-mp3-id3v2-remux, where attached pictures are now written in the correct order. This happens because InputStream.dts is no longer reset to AV_NOPTS_VALUE after decoding, so streamcopy actually sees valid dts values. --- fftools/ffmpeg.c | 34 ++++------------------- tests/ref/fate/cover-art-aiff-id3v2-remux | 34 +++++++++++------------ tests/ref/fate/cover-art-mp3-id3v2-remux | 22 +++++++-------- 3 files changed, 33 insertions(+), 57 deletions(-) diff --git a/fftools/ffmpeg.c b/fftools/ffmpeg.c index 07bd40749d..c72fc6608e 100644 --- a/fftools/ffmpeg.c +++ b/fftools/ffmpeg.c @@ -974,11 +974,6 @@ static int decode_audio(InputStream *ist, const AVPacket *pkt, int *got_output, ist->samples_decoded += decoded_frame->nb_samples; ist->frames_decoded++; - /* increment next_dts to use for the case where the input stream does not - have timestamps or there are multiple frames in the packet */ - ist->next_dts += ((int64_t)AV_TIME_BASE * decoded_frame->nb_samples) / - decoded_frame->sample_rate; - audio_ts_process(ist, decoded_frame); ist->nb_samples = decoded_frame->nb_samples; @@ -1393,7 +1388,7 @@ static int process_input_packet(InputStream *ist, const AVPacket *pkt, int no_eo if (!ist->saw_first_ts) { ist->first_dts = ist->dts = ist->st->avg_frame_rate.num ? - ist->dec_ctx->has_b_frames * AV_TIME_BASE / av_q2d(ist->st->avg_frame_rate) : 0; - if (pkt && pkt->pts != AV_NOPTS_VALUE && !ist->decoding_needed) { + if (pkt && pkt->pts != AV_NOPTS_VALUE) { ist->first_dts = ist->dts += av_rescale_q(pkt->pts, pkt->time_base, AV_TIME_BASE_Q); } @@ -1416,13 +1411,10 @@ static int process_input_packet(InputStream *ist, const AVPacket *pkt, int no_eo // while we have more to decode or while the decoder did output something on EOF while (ist->decoding_needed) { - int64_t duration_dts = 0; int64_t duration_pts = 0; int got_output = 0; int decode_failed = 0; - ist->dts = ist->next_dts; - switch (par->codec_type) { case AVMEDIA_TYPE_AUDIO: ret = decode_audio (ist, repeating ? NULL : avpkt, &got_output, @@ -1432,23 +1424,6 @@ static int process_input_packet(InputStream *ist, const AVPacket *pkt, int no_eo case AVMEDIA_TYPE_VIDEO: ret = decode_video (ist, repeating ? NULL : avpkt, &got_output, &duration_pts, !pkt, &decode_failed); - if (!repeating || !pkt || got_output) { - if (pkt && pkt->duration) { - duration_dts = av_rescale_q(pkt->duration, pkt->time_base, AV_TIME_BASE_Q); - } else if(ist->dec_ctx->framerate.num != 0 && ist->dec_ctx->framerate.den != 0) { - int ticks = ist->last_pkt_repeat_pict >= 0 ? - ist->last_pkt_repeat_pict + 1 : - ist->dec_ctx->ticks_per_frame; - duration_dts = ((int64_t)AV_TIME_BASE * - ist->dec_ctx->framerate.den * ticks) / - ist->dec_ctx->framerate.num / ist->dec_ctx->ticks_per_frame; - } - - if(ist->dts != AV_NOPTS_VALUE && duration_dts) { - ist->next_dts += duration_dts; - }else - ist->next_dts = AV_NOPTS_VALUE; - } av_packet_unref(avpkt); break; @@ -1512,8 +1487,7 @@ static int process_input_packet(InputStream *ist, const AVPacket *pkt, int no_eo } } - /* handle stream copy */ - if (!ist->decoding_needed && pkt) { + if (pkt) { ist->dts = ist->next_dts; switch (par->codec_type) { case AVMEDIA_TYPE_AUDIO: @@ -1543,7 +1517,9 @@ static int process_input_packet(InputStream *ist, const AVPacket *pkt, int no_eo } break; } - } else if (!ist->decoding_needed) + } + + if (!pkt && !ist->decoding_needed) eof_reached = 1; duration_exceeded = 0; diff --git a/tests/ref/fate/cover-art-aiff-id3v2-remux b/tests/ref/fate/cover-art-aiff-id3v2-remux index 3ca2855eb8..a59ba37c65 100644 --- a/tests/ref/fate/cover-art-aiff-id3v2-remux +++ b/tests/ref/fate/cover-art-aiff-id3v2-remux @@ -1,4 +1,4 @@ -d4a9481090a8bab1a3f072a8108a1d6a *tests/data/fate/cover-art-aiff-id3v2-remux.aiff +330ad2bf538e91a31752b38024461df1 *tests/data/fate/cover-art-aiff-id3v2-remux.aiff 608914 tests/data/fate/cover-art-aiff-id3v2-remux.aiff #tb 0: 1/44100 #media_type 0: audio @@ -12,24 +12,24 @@ d4a9481090a8bab1a3f072a8108a1d6a *tests/data/fate/cover-art-aiff-id3v2-remux.aif #sar 1: 1/1 #tb 2: 1/90000 #media_type 2: video -#codec_id 2: mjpeg +#codec_id 2: png #dimensions 2: 350x350 #sar 2: 1/1 #tb 3: 1/90000 #media_type 3: video -#codec_id 3: png +#codec_id 3: bmp #dimensions 3: 350x350 -#sar 3: 1/1 +#sar 3: 0/1 #tb 4: 1/90000 #media_type 4: video -#codec_id 4: bmp +#codec_id 4: mjpeg #dimensions 4: 350x350 -#sar 4: 0/1 +#sar 4: 1/1 0, 0, 0, 1024, 4096, 0xdac4695d 1, 0, 0, 0, 19650, 0xd5662610 -2, 0, 0, 0, 19650, 0xd5662610 -3, 0, 0, 0, 184497, 0xc33f8d44 -4, 0, 0, 0, 368254, 0xfa7f4bd8 +2, 0, 0, 0, 184497, 0xc33f8d44 +3, 0, 0, 0, 368254, 0xfa7f4bd8 +4, 0, 0, 0, 19650, 0xd5662610 0, 1024, 1024, 1024, 4096, 0xad05c909 0, 2048, 2048, 1024, 4096, 0x97e3b8f8 0, 3072, 3072, 1024, 4096, 0xb08180fa @@ -47,25 +47,25 @@ TAG:comment=Other [/STREAM] [STREAM] index=2 -codec_name=mjpeg -DISPOSITION:attached_pic=1 -TAG:title=fourth -TAG:comment=Composer -[/STREAM] -[STREAM] -index=3 codec_name=png DISPOSITION:attached_pic=1 TAG:title=second TAG:comment=Illustration [/STREAM] [STREAM] -index=4 +index=3 codec_name=bmp DISPOSITION:attached_pic=1 TAG:title=third TAG:comment=Conductor [/STREAM] +[STREAM] +index=4 +codec_name=mjpeg +DISPOSITION:attached_pic=1 +TAG:title=fourth +TAG:comment=Composer +[/STREAM] [FORMAT] TAG:artist=Мельница TAG:RATING=0 diff --git a/tests/ref/fate/cover-art-mp3-id3v2-remux b/tests/ref/fate/cover-art-mp3-id3v2-remux index 906a646799..52b7e72a56 100644 --- a/tests/ref/fate/cover-art-mp3-id3v2-remux +++ b/tests/ref/fate/cover-art-mp3-id3v2-remux @@ -1,4 +1,4 @@ -c1b55a9a92226cd72d3f53ccd830d127 *tests/data/fate/cover-art-mp3-id3v2-remux.mp3 +94946f0efd5f9bb0061ac1fbff7d731f *tests/data/fate/cover-art-mp3-id3v2-remux.mp3 399346 tests/data/fate/cover-art-mp3-id3v2-remux.mp3 #tb 0: 1/14112000 #media_type 0: audio @@ -7,22 +7,22 @@ c1b55a9a92226cd72d3f53ccd830d127 *tests/data/fate/cover-art-mp3-id3v2-remux.mp3 #channel_layout_name 0: stereo #tb 1: 1/90000 #media_type 1: video -#codec_id 1: mjpeg +#codec_id 1: bmp #dimensions 1: 263x263 -#sar 1: 96/96 +#sar 1: 0/1 #tb 2: 1/90000 #media_type 2: video -#codec_id 2: bmp +#codec_id 2: mjpeg #dimensions 2: 263x263 -#sar 2: 0/1 +#sar 2: 96/96 #tb 3: 1/90000 #media_type 3: video #codec_id 3: png #dimensions 3: 263x263 #sar 3: 1/1 0, -353590, -353590, 368640, 417, 0x15848290, S=1, 10 -1, 0, 0, 0, 15760, 0x71d5c418 -2, 0, 0, 0, 208350, 0x291b44d1 +1, 0, 0, 0, 208350, 0x291b44d1 +2, 0, 0, 0, 15760, 0x71d5c418 3, 0, 0, 0, 165671, 0x7c1c8070 0, 15050, 15050, 368640, 418, 0x46f684a4 0, 383690, 383690, 368640, 418, 0x46f684a4 @@ -36,15 +36,15 @@ TAG:encoder=Lavf [/STREAM] [STREAM] index=1 -codec_name=mjpeg +codec_name=bmp DISPOSITION:attached_pic=1 -TAG:comment=Other +TAG:comment=Band/Orchestra [/STREAM] [STREAM] index=2 -codec_name=bmp +codec_name=mjpeg DISPOSITION:attached_pic=1 -TAG:comment=Band/Orchestra +TAG:comment=Other [/STREAM] [STREAM] index=3