From patchwork Sun Oct 7 16:02:29 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Molkentin X-Patchwork-Id: 10557 Delivered-To: ffmpegpatchwork@gmail.com Received: by 2002:ab0:73d2:0:0:0:0:0 with SMTP id m18csp2672871uaq; Sun, 7 Oct 2018 09:03:38 -0700 (PDT) X-Google-Smtp-Source: ACcGV60r6NaPtCybyWkuKDObZ4tDjOPxeCxXPd9bWje+gmhxZpReYq9ojstyJI6NbHlWbkf4snJV X-Received: by 2002:adf:cd0c:: with SMTP id w12-v6mr14481587wrm.67.1538928218475; Sun, 07 Oct 2018 09:03:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1538928218; cv=none; d=google.com; s=arc-20160816; b=AIOKpAZKOEvFm5KFZOEywI/iu/8XGYOja9kGhURESn+hPQJlRb0JAkaHxFj1pkfpf1 XLfcuGotfDTyOahc55kYjr8Q0uNG+B0Gb3Ns+KY4IoDr3xMhxQzI5QOo6szX35tyCjY6 bfrch/yznGpkXF3mS4jRh8Hs0rSbJhORZyCv/4ZJd/N4cz5ZEXxl9vLQrZyHQbFVYmqX djvrsha+/BI64aioB5RbAKThzTghiESXuJghatxm738tHh3JVO8/e65obm22vX2oIP2W JryBMrsf3gqpr+KP3afSMdz4Z3tvL4UUxeIx/ooQF0zUyx3kpfjxky8VAT+2lQbBIeuu ubvw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version:cc:reply-to :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:references:in-reply-to:message-id:date :to:from:delivered-to; bh=Y2Xly8cmA78NTPXRcbMxUTzLf5A4do48/iAKjQhO/8Y=; b=aDd4nJMV+KnVB8NN3DH0lakIJGPgkS5rB/EQK6+Moo+KEyLrcO7ZlN/SjUNa/C6eVa hhT/v7+8ZUeYMLjuwPAMnieaEq62a0S4Onpk98vmF09hZkbKYJjHdzqm6SHnXKyCnh0l 1CNsNyQxJjRHY88Uyd4kSRzQkLLrOTAOTJGU3jibWhzj1NhXOMb+BbVsoW6LEfjc3fzi ipM3R+LJt6Dwr2Uk3KwWTDT4O/bhbSFoALgOz/QxGira1qZi91BKBVKnNvlVsFiqgGWz 8PvfNnUwHD/8+9bXYkMGsk42tkVsNBOHQqsDDFa/xn0gEFFBNJpF0958cRR+XL684awc Se5g== 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 b13-v6si13087755wrh.12.2018.10.07.09.03.38; Sun, 07 Oct 2018 09:03:38 -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 6CCF868A1DB; Sun, 7 Oct 2018 19:02:34 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail.molkentin.net (mail.molkentin.net [138.201.121.149]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id AC14B68A18E for ; Sun, 7 Oct 2018 19:02:26 +0300 (EEST) Received: from localhost (localhost4.localdomain4 [127.0.0.1]) by mail.molkentin.net (Postfix) with ESMTP id F2010D0397; Sun, 7 Oct 2018 18:02:47 +0200 (CEST) X-Virus-Scanned: amavisd-new at example.com Received: from mail.molkentin.net ([127.0.0.1]) by localhost (mail.molkentin.net [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id aAm05ywz-e7x; Sun, 7 Oct 2018 18:02:47 +0200 (CEST) Received: from oldnewthing.club.berlin.ccc.de (dancefloor-nat.fuckup.club.berlin.ccc.de [195.160.172.42]) (using TLSv1.2 with cipher DHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: daniel@molkentin.de) by mail.molkentin.net (Postfix) with ESMTPSA id 09E40D0396; Sun, 7 Oct 2018 18:02:45 +0200 (CEST) From: Daniel Molkentin To: ffmpeg-devel@ffmpeg.org Date: Sun, 7 Oct 2018 18:02:29 +0200 Message-Id: <20181007160229.18250-6-daniel@molkentin.de> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20181007160229.18250-1-daniel@molkentin.de> References: <20181007160229.18250-1-daniel@molkentin.de> Subject: [FFmpeg-devel] [PATCH 5/5] libavfilter/ebur128: add mabsolute parameter X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: FFmpeg development discussions and patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: FFmpeg development discussions and patches Cc: Conrad Zelck , Daniel Molkentin MIME-Version: 1.0 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" This allows switching between absolute (LUFS) and relativ (LU) display in the status line. Signed-off-by: Daniel Molkentin Signed-off-by: Conrad Zelck --- doc/filters.texi | 4 ++++ libavfilter/f_ebur128.c | 34 +++++++++++++++++++++++++--------- 2 files changed, 29 insertions(+), 9 deletions(-) diff --git a/doc/filters.texi b/doc/filters.texi index 601cbda17c..dc01c805b2 100644 --- a/doc/filters.texi +++ b/doc/filters.texi @@ -19371,6 +19371,10 @@ by EBU R128. However, material published online may prefer a level of -16LUFS Set the value displayed by the gauge. Valid values are m (momentary) and s (short-term). By default the momentary value will be used, but in certain scenarios it may be more useful to observe the short term value instead (e.g. live mixing). + +@item mabsolute +Sets whether to display the loudness in LUFS (1, the default) LU relative to the target (0). +This only affects the video output, not the summary or continous log output. @end table @subsection Examples diff --git a/libavfilter/f_ebur128.c b/libavfilter/f_ebur128.c index 182e0cbe98..5d58abc741 100644 --- a/libavfilter/f_ebur128.c +++ b/libavfilter/f_ebur128.c @@ -146,6 +146,7 @@ typedef struct EBUR128Context { double pan_law; ///< pan law value used to calculate dual-mono measurements int target; ///< target level in LUFS used to set relative zero LU in visualization char *gauge_type; ///< whether gauge shows momentary or short + int mabsolute; ///< whether to display the statistics in LUFS or LU } EBUR128Context; enum { @@ -174,6 +175,7 @@ static const AVOption ebur128_options[] = { { "panlaw", "set a specific pan law for dual-mono files", OFFSET(pan_law), AV_OPT_TYPE_DOUBLE, {.dbl = -3.01029995663978}, -10.0, 0.0, A|F }, { "target", "set a specific target level in LUFS (-23 to 0)", OFFSET(target), AV_OPT_TYPE_INT, {.i64 = -23}, -23, 0, V|F }, { "gaugetype", "sets whether the gauge shows momentrary (m) or short-term (s)", OFFSET(gauge_type), AV_OPT_TYPE_STRING, {.str = "m"}, CHAR_MIN, CHAR_MAX, V|F }, + { "mabsolute", "sets whether the stats should be displayed absolute (LUFS, default) or relative (LU) ", OFFSET(mabsolute), AV_OPT_TYPE_BOOL, {.i64 = 1}, 0, 1, V|F }, { NULL }, }; @@ -755,7 +757,7 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *insamples) loudness_3000 -= ebur128->pan_law; } -#define LOG_FMT "TARGET:%d M:%6.1f S:%6.1f I:%6.1f LUFS LRA:%6.1f LU" +#define LOG_FMT "TARGET:%d LUFS M:%6.1f S:%6.1f I:%6.1f %s LRA:%6.1f LU" /* push one video frame */ if (ebur128->do_video) { @@ -793,10 +795,17 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *insamples) } /* draw textual info */ - drawtext(pic, PAD, PAD - PAD/2, FONT16, font_colors, - LOG_FMT " ", // padding to erase trailing characters - ebur128->target, loudness_400, loudness_3000, - ebur128->integrated_loudness, ebur128->loudness_range); + if (ebur128->mabsolute) { + drawtext(pic, PAD, PAD - PAD/2, FONT16, font_colors, + LOG_FMT " ", // padding to erase trailing characters + ebur128->target, loudness_400, loudness_3000, + ebur128->integrated_loudness, "LUFS", ebur128->loudness_range); + } else { + drawtext(pic, PAD, PAD - PAD/2, FONT16, font_colors, + LOG_FMT " ", // padding to erase trailing characters + ebur128->target, loudness_400-ebur128->target, loudness_3000-ebur128->target, + ebur128->integrated_loudness-ebur128->target, "LU", ebur128->loudness_range); + } /* set pts and push frame */ pic->pts = pts; @@ -836,10 +845,17 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *insamples) SET_META_PEAK(true, TRUE); } - av_log(ctx, ebur128->loglevel, "t: %-10s " LOG_FMT, - av_ts2timestr(pts, &outlink->time_base), - ebur128->target, loudness_400, loudness_3000, - ebur128->integrated_loudness, ebur128->loudness_range); + if (ebur128->mabsolute) { + av_log(ctx, ebur128->loglevel, "t: %-10s " LOG_FMT, + av_ts2timestr(pts, &outlink->time_base), + ebur128->target, loudness_400, loudness_3000, + ebur128->integrated_loudness, "LUFS", ebur128->loudness_range); + } else { + av_log(ctx, ebur128->loglevel, "t: %-10s " LOG_FMT, + av_ts2timestr(pts, &outlink->time_base), + ebur128->target, loudness_400-ebur128->target, loudness_3000-ebur128->target, + ebur128->integrated_loudness-ebur128->target, "LU", ebur128->loudness_range); + } #define PRINT_PEAKS(str, sp, ptype) do { \ if (ebur128->peak_mode & PEAK_MODE_ ## ptype ## _PEAKS) { \