From patchwork Sun Apr 9 14:08: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: 41053 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:4645:b0:e3:3194:9d20 with SMTP id eb5csp1591311pzb; Sun, 9 Apr 2023 07:10:36 -0700 (PDT) X-Google-Smtp-Source: AKy350ZL2me8JeFITX+PisFYh4DF80NIIE/jAkv04UBvjFscvOJBtua9BGwrk07ahAGs9HsyouKc X-Received: by 2002:a17:907:171e:b0:94a:5625:c29c with SMTP id le30-20020a170907171e00b0094a5625c29cmr2788220ejc.53.1681049436603; Sun, 09 Apr 2023 07:10:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1681049436; cv=none; d=google.com; s=arc-20160816; b=XoJZpCYCzBKMgZl+7DDJqvBRMI+YhNv2xyGh7RPbSXrZdzDyFY2DlMxFDwVO3IsR39 1qlLFMyfimqS2BC+DLLo5Rwigvyg2x+RBTC4i1bm9fRoIy4pYuUcxBt2BZAKzUBU9cAU 3PUs2AMr/EdwsY7P+ndlvfeDHih4usbyeeZeG5waGv4twZuKnFL7WHA2UIYiOQQTHkRW fyGHWzmHQ3V/mYVrm3MfzhOx+iptH1PHsMpAGMoZOWudmG3d2PO+lnkIyAiBSqXaf0XA Gt29t0BLUIQkMC3a/ATWDUgzmAoNZ2RIE+ea/2ykzgqIXTrzXjJUqQ3/2kYKW3CNGv7A m/eA== 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=rsa0qxOSvdTk2DG3YgeM1x5q+aB27DXzAn7yIEFbvt4=; b=z7ZVW9zNGHDdtgSdMA/hOjwhneUqc95VCLJQQPzGdlSJEQELSj/lgNhRWerg/FzR17 0TfhFzZstGiRx0y1v2NQhYMhkuwLKHdPME+ByUk7BdGmZ6QjYEkm/e0ybcMx6Wb7CUlf MTSEJJDBkc6+J0eZpgcFGqZsVN+27/4eceYdlRjThhvVcEql7x2mGOTi+MKCBNj9zNs4 rbjYlKfTghNQuFtdGQAKsBEE9IapC58cl3B34P8cH/SmFzgtBqlkMAsVDvtYO/YboHZ+ TRKcYDdbpGQ8Mz3e7zXFc80jL/XRymvS1JqRHNI+m2qvpg4NyCDPeuZGepIcPMLOiZa9 /Qxw== 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 ck7-20020a170906c44700b0094a78827f1dsi938557ejb.447.2023.04.09.07.10.36; Sun, 09 Apr 2023 07:10:36 -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 D5C9068BA58; Sun, 9 Apr 2023 17:09:26 +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 5041F68BBFD for ; Sun, 9 Apr 2023 17:09:18 +0300 (EEST) Received: from localhost (localhost [IPv6:::1]) by mail0.khirnov.net (Postfix) with ESMTP id DBFFF2404F8 for ; Sun, 9 Apr 2023 16:09:16 +0200 (CEST) Received: from mail0.khirnov.net ([IPv6:::1]) by localhost (mail0.khirnov.net [IPv6:::1]) (amavisd-new, port 10024) with ESMTP id TXkXFY3pBLA8 for ; Sun, 9 Apr 2023 16:09:16 +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 A5BB4240D0E for ; Sun, 9 Apr 2023 16:09:10 +0200 (CEST) Received: from libav.khirnov.net (libav.khirnov.net [IPv6:::1]) by libav.khirnov.net (Postfix) with ESMTP id 90FBC3A038E for ; Sun, 9 Apr 2023 16:09:10 +0200 (CEST) From: Anton Khirnov To: ffmpeg-devel@ffmpeg.org Date: Sun, 9 Apr 2023 16:08:43 +0200 Message-Id: <20230409140853.28858-19-anton@khirnov.net> X-Mailer: git-send-email 2.39.1 In-Reply-To: <20230409140853.28858-1-anton@khirnov.net> References: <20230409140853.28858-1-anton@khirnov.net> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 19/29] fftools/ffmpeg: disable and deprecate -qphist 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: kkl9PvsLa8Tu This option adds a long string of numbers to the progress line, where i-th number contains the base-2 logarithm of the number of times a frame with this QP value was seen by print_report(). There are multiple problems with this feature: * despite this existing since 2005, web search shows no indication that it was ever useful for any meaningful purpose; * the format of what is printed is entirely undocumented, one has to find it out from the source code; * QP values above 31 are silently ignored; * it only works with one video stream; * as it relies on global state, it is in conflict with ongoing architectural changes. It then seems that the nontrivial cost of maintaining this option is not worth its negligible (or possibly negative - since it pollutes the already large option space) value. Users who really need similar functionality can also implement it themselves using -vstats. --- doc/ffmpeg.texi | 2 -- fftools/ffmpeg.c | 10 ---------- fftools/ffmpeg.h | 2 +- fftools/ffmpeg_opt.c | 15 ++++++++++++--- 4 files changed, 13 insertions(+), 16 deletions(-) diff --git a/doc/ffmpeg.texi b/doc/ffmpeg.texi index d433d60ce9..cb8aa13df2 100644 --- a/doc/ffmpeg.texi +++ b/doc/ffmpeg.texi @@ -1051,8 +1051,6 @@ Specify which version of the vstats format to use. Default is @code{2}. See the top=1/bottom=0/auto=-1 field first @item -vtag @var{fourcc/tag} (@emph{output}) Force video tag/fourcc. This is an alias for @code{-tag:v}. -@item -qphist (@emph{global}) -Show QP histogram @item -vbsf @var{bitstream_filter} Deprecated see -bsf diff --git a/fftools/ffmpeg.c b/fftools/ffmpeg.c index 02a7f20554..74aba28a9b 100644 --- a/fftools/ffmpeg.c +++ b/fftools/ffmpeg.c @@ -748,7 +748,6 @@ static void print_report(int is_last_report, int64_t timer_start, int64_t cur_ti int64_t pts = INT64_MIN + 1; static int64_t last_time = -1; static int first_report = 1; - static int qp_histogram[52]; int hours, mins, secs, us; const char *hours_sign; int ret; @@ -794,14 +793,6 @@ static void print_report(int is_last_report, int64_t timer_start, int64_t cur_ti ost->file_index, ost->index, q); if (is_last_report) av_bprintf(&buf, "L"); - if (qp_hist) { - int j; - int qp = lrintf(q); - if (qp >= 0 && qp < FF_ARRAY_ELEMS(qp_histogram)) - qp_histogram[qp]++; - for (j = 0; j < 32; j++) - av_bprintf(&buf, "%X", av_log2(qp_histogram[j] + 1)); - } if (enc && (enc->flags & AV_CODEC_FLAG_PSNR) && (ost->pict_type != AV_PICTURE_TYPE_NONE || is_last_report)) { @@ -2321,7 +2312,6 @@ static int check_keyboard_interaction(int64_t cur_time) } if (key == '+') av_log_set_level(av_log_get_level()+10); if (key == '-') av_log_set_level(av_log_get_level()-10); - if (key == 's') qp_hist ^= 1; if (key == 'c' || key == 'C'){ char buf[4096], target[64], command[256], arg[256] = {0}; double time; diff --git a/fftools/ffmpeg.h b/fftools/ffmpeg.h index bbcbf1aa80..80a1192ed0 100644 --- a/fftools/ffmpeg.h +++ b/fftools/ffmpeg.h @@ -54,6 +54,7 @@ #define FFMPEG_OPT_MAP_CHANNEL 1 #define FFMPEG_OPT_MAP_SYNC 1 #define FFMPEG_ROTATION_METADATA 1 +#define FFMPEG_OPT_QPHIST 1 enum VideoSyncMethod { VSYNC_AUTO = -1, @@ -738,7 +739,6 @@ extern int exit_on_error; extern int abort_on_flags; extern int print_stats; extern int64_t stats_period; -extern int qp_hist; extern int stdin_interaction; extern AVIOContext *progress_avio; extern float max_error_rate; diff --git a/fftools/ffmpeg_opt.c b/fftools/ffmpeg_opt.c index 055275d813..aa9aa0e9b4 100644 --- a/fftools/ffmpeg_opt.c +++ b/fftools/ffmpeg_opt.c @@ -80,7 +80,6 @@ int debug_ts = 0; int exit_on_error = 0; int abort_on_flags = 0; int print_stats = -1; -int qp_hist = 0; int stdin_interaction = 1; float max_error_rate = 2.0/3; char *filter_nbthreads; @@ -1344,6 +1343,14 @@ int opt_timelimit(void *optctx, const char *opt, const char *arg) return 0; } +#if FFMPEG_OPT_QPHIST +static int opt_qphist(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 */ @@ -1627,8 +1634,10 @@ const OptionDef options[] = { { "vtag", OPT_VIDEO | HAS_ARG | OPT_EXPERT | OPT_PERFILE | OPT_INPUT | OPT_OUTPUT, { .func_arg = opt_old2new }, "force video tag/fourcc", "fourcc/tag" }, - { "qphist", OPT_VIDEO | OPT_BOOL | OPT_EXPERT , { &qp_hist }, - "show QP histogram" }, +#if FFMPEG_OPT_QPHIST + { "qphist", OPT_VIDEO | OPT_EXPERT , { .func_arg = opt_qphist }, + "deprecated, does nothing" }, +#endif { "fps_mode", OPT_VIDEO | HAS_ARG | OPT_STRING | OPT_EXPERT | OPT_SPEC | OPT_OUTPUT, { .off = OFFSET(fps_mode) }, "set framerate mode for matching video streams; overrides vsync" },