From patchwork Sat Jul 23 14:09:34 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anton Khirnov X-Patchwork-Id: 36915 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a21:1649:b0:8b:613a:194d with SMTP id no9csp1047632pzb; Sat, 23 Jul 2022 07:12:46 -0700 (PDT) X-Google-Smtp-Source: AGRyM1s0mMLrWjsZ0tQO13mHri2da1MSfZvI1g/9WG7HZyA50hVaAWtvrkSd+Shjr8ry/KbjZXRl X-Received: by 2002:a05:6402:28a1:b0:43b:a0d5:d30a with SMTP id eg33-20020a05640228a100b0043ba0d5d30amr4562770edb.278.1658585566369; Sat, 23 Jul 2022 07:12:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1658585566; cv=none; d=google.com; s=arc-20160816; b=uWhPVOX2gOVyTC4X6v01pVRrZeHUCrRV9h3F9j5xCR+WO4WPShYScdDBMck5FS+sJE CqK2H2srUSSjBmD8JTxcFNrUwqGaK6MuvAG2N1Ra2wZojLIhODXARvZSwxpQnjLZMfx9 oSr8qr5dVlMc2CCRkC9dwFNiEUrVW1SjY4Ysr3d3wNZomDQ7xzcex1WeexSkx0SmJZx2 FnKNg3F1IWANL++O1fLCgvC5mACowyjyJVsiVAv0SwcK++UEoqAFKpdetIP94qF+SQaa kCTCzthkqQpyM3eCToJHqcv/A6bvOHbXY/l021R2KRIU9w/DLchlz3ZBiClRZnbkTTvs Bz5w== 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=BRhLEwReSzKIHZxNhqDRPMcO116lEq0tUtKeOmiWhWQ=; b=gvH8H5t/yEHNoxeL97AonQTZygK1DYfNoMMzl25Vwj4B316Goxy5H6Ht37gWkapPDX oBvIrz9pDlUo6NEdbxewVwhBItSBX150DCBl26t8xpMYKPYhML6b99rLW8biXPKEMnfF uuZM3AMde8IEv8C2TxPDR2cLNbY7KmPjrrqbQ+lt/JtMjnZkIYcSVMK2RDllr5EHvWZD SsjE1ugMi2jD/j2yyG0Qx0sYjzwU9UnLnuypYXZ/j+MYu6m6QM3i7ZjSOotpb6Ghb0MO OHL+wn/rJ+qMwWunNPvbK1fZowH7VLhrtfNM6DMnxaI4hhnvyiHdjTgv6ZS37KaIyLvK ovmQ== 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 w9-20020a056402070900b0043a67b8dc66si7451879edx.267.2022.07.23.07.12.46; Sat, 23 Jul 2022 07:12:46 -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 068A068B8B7; Sat, 23 Jul 2022 17:10:43 +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 91B5068B7DF for ; Sat, 23 Jul 2022 17:10:28 +0300 (EEST) Received: from localhost (localhost [IPv6:::1]) by mail0.khirnov.net (Postfix) with ESMTP id 8C67F24017C for ; Sat, 23 Jul 2022 16:10:27 +0200 (CEST) Received: from mail0.khirnov.net ([IPv6:::1]) by localhost (mail0.khirnov.net [IPv6:::1]) (amavisd-new, port 10024) with ESMTP id rxnXSZ03OdPe for ; Sat, 23 Jul 2022 16:10:27 +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 BEC6B240685 for ; Sat, 23 Jul 2022 16:10:19 +0200 (CEST) Received: by libav.khirnov.net (Postfix, from userid 1000) id 75F773A0451; Sat, 23 Jul 2022 16:10:19 +0200 (CEST) From: Anton Khirnov To: ffmpeg-devel@ffmpeg.org Date: Sat, 23 Jul 2022 16:09:34 +0200 Message-Id: <20220723140952.31814-9-anton@khirnov.net> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220723140952.31814-1-anton@khirnov.net> References: <20220723140952.31814-1-anton@khirnov.net> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 09/27] fftools/ffmpeg: deprecate -psnr 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: vShESs0YEi1V It is entirely redundant with -flags +psnr. --- doc/ffmpeg.texi | 3 ++- fftools/ffmpeg.h | 3 +++ fftools/ffmpeg_opt.c | 12 ++++++++++-- 3 files changed, 15 insertions(+), 3 deletions(-) diff --git a/doc/ffmpeg.texi b/doc/ffmpeg.texi index 0e657b0138..974d1c108f 100644 --- a/doc/ffmpeg.texi +++ b/doc/ffmpeg.texi @@ -992,7 +992,8 @@ to keep the interlaced format for minimum losses. The alternative is to deinterlace the input stream by use of a filter such as @code{yadif} or @code{bwdif}, but deinterlacing introduces losses. @item -psnr -Calculate PSNR of compressed frames. +Calculate PSNR of compressed frames. This option is deprecated, pass the +PSNR flag to the encoder instead, using @code{-flags +psnr}. @item -vstats Dump video coding statistics to @file{vstats_HHMMSS.log}. @item -vstats_file @var{file} diff --git a/fftools/ffmpeg.h b/fftools/ffmpeg.h index 59c2f47a66..0795a380f8 100644 --- a/fftools/ffmpeg.h +++ b/fftools/ffmpeg.h @@ -49,6 +49,9 @@ #include "libswresample/swresample.h" +// deprecated features +#define FFMPEG_OPT_PSNR 1 + enum VideoSyncMethod { VSYNC_AUTO = -1, VSYNC_PASSTHROUGH, diff --git a/fftools/ffmpeg_opt.c b/fftools/ffmpeg_opt.c index 32e0d9a7ff..716b53d81f 100644 --- a/fftools/ffmpeg_opt.c +++ b/fftools/ffmpeg_opt.c @@ -183,7 +183,9 @@ int64_t stats_period = 500000; static int file_overwrite = 0; static int no_file_overwrite = 0; +#if FFMPEG_OPT_PSNR static int do_psnr = 0; +#endif static int input_stream_potentially_available = 0; static int ignore_unknown_streams = 0; static int copy_unknown_streams = 0; @@ -1926,8 +1928,12 @@ static OutputStream *new_video_stream(OptionsContext *o, AVFormatContext *oc, in } video_enc->rc_override_count = i; - if (do_psnr) +#if FFMPEG_OPT_PSNR + if (do_psnr) { + av_log(NULL, AV_LOG_WARNING, "The -psnr option is deprecated, use -flags +psnr\n"); video_enc->flags|= AV_CODEC_FLAG_PSNR; + } +#endif /* two pass mode */ MATCH_PER_STREAM_OPT(pass, i, do_pass, oc, st); @@ -3942,8 +3948,10 @@ const OptionDef options[] = { { "passlogfile", OPT_VIDEO | HAS_ARG | OPT_STRING | OPT_EXPERT | OPT_SPEC | OPT_OUTPUT, { .off = OFFSET(passlogfiles) }, "select two pass log file name prefix", "prefix" }, +#if FFMPEG_OPT_PSNR { "psnr", OPT_VIDEO | OPT_BOOL | OPT_EXPERT, { &do_psnr }, - "calculate PSNR of compressed frames" }, + "calculate PSNR of compressed frames (deprecated, use -flags +psnr)" }, +#endif { "vstats", OPT_VIDEO | OPT_EXPERT , { .func_arg = opt_vstats }, "dump video coding statistics to file" }, { "vstats_file", OPT_VIDEO | HAS_ARG | OPT_EXPERT , { .func_arg = opt_vstats_file },