From patchwork Sun Oct 7 21:19:55 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Molkentin X-Patchwork-Id: 10541 Delivered-To: ffmpegpatchwork@gmail.com Received: by 2002:ab0:73d2:0:0:0:0:0 with SMTP id m18csp2901128uaq; Sun, 7 Oct 2018 14:20:53 -0700 (PDT) X-Google-Smtp-Source: ACcGV60f6KG6AN2CqWjw000o/G+64HY653pelMT+Mfhvqd3WUQahVMfC1bh0b2wTkVJWJm68qVhZ X-Received: by 2002:a1c:91cd:: with SMTP id t196-v6mr12650485wmd.63.1538947253596; Sun, 07 Oct 2018 14:20:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1538947253; cv=none; d=google.com; s=arc-20160816; b=eWBxs18mhA75tuuag7m0+9sMyjOePJZZsHuyaWkXdp62I9T3+FrD0kA613wKxdFQvZ 4SZX4ktdGMEpoZSV6VrfEA6LitMTPUGMxgpFRCe/gp9Yq7fBpq8jmZOqyLDHTa+2od9v oJyAQzJeTW/nGWne9dcAzypbH16BplZgUDHBZmoxpwKSVkyVNoB9z88zxqBc2Qt/Oic1 xm7ylnxjzE+EsCfPiAQ7j0QHpx66L3L1Coe04Q45wYrtHT+PqsaJ4s/0Awt2ccnXmnfW KiNV5q0s6j2HRJ8V3vYBFKsxQwVI9vFnD/gZXOMjtADRCCYp514IjO4dCMR4/+XQzM2o 0P+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: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=L+wWtiDezf84r2tU3/9G4EUkx9yY941zs2DMA58kogg=; b=ZZ9oztE8jfPH5cFvdK7HgtlFpJ4V1CnYzlvQ1aqYluxn9cPLOo664nbftSSUPC2R4e adni6oyBgujHk+x3wniQqzDdPVAp8god0ObfNAjISt8Zlinn8Q7zkRpB1duOeXZG2M5g AuTIPmfsE8NskBBVDyaBGHQZ/IrYvOumCBEd2x/u/RM49CMDRuLb+jT8Lm94/BQafv/p leu+w2Io9EPsoi++tsshCvYcZYd2C++ljKs0xOTOKDTHL0hXqg9+cRK8K5RQrPPts8g2 HoRlPHR8Kf6UBRbG5y+rc9iM3UDft1oh96ze6sClJoC/NXCNMdib42ZNHPG9jatPu6G/ MWSA== 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 v15-v6si6074510wmc.79.2018.10.07.14.20.53; Sun, 07 Oct 2018 14:20:53 -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 8A20768A335; Mon, 8 Oct 2018 00:20:06 +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 C2B7668A1AC for ; Mon, 8 Oct 2018 00:19:58 +0300 (EEST) Received: from localhost (localhost4.localdomain4 [127.0.0.1]) by mail.molkentin.net (Postfix) with ESMTP id 2CC31E345D; Sun, 7 Oct 2018 23:20:20 +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 QjlJog3HNtC7; Sun, 7 Oct 2018 23:20:19 +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 E97B7E35C9; Sun, 7 Oct 2018 23:20:17 +0200 (CEST) From: Daniel Molkentin To: ffmpeg-devel@ffmpeg.org Date: Sun, 7 Oct 2018 23:19:55 +0200 Message-Id: <20181007211956.17615-5-daniel@molkentin.de> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20181007211956.17615-1-daniel@molkentin.de> References: <20181007211956.17615-1-daniel@molkentin.de> Subject: [FFmpeg-devel] [PATCH 4/5] libavfilter/ebur128: introduce target range 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 eases meeting the target level during live mixing. Signed-off-by: Daniel Molkentin Signed-off-by: Conrad Zelck --- doc/filters.texi | 8 ++++++++ libavfilter/f_ebur128.c | 33 +++++++++++++++++++++++---------- 2 files changed, 31 insertions(+), 10 deletions(-) diff --git a/doc/filters.texi b/doc/filters.texi index 7f2baed9b5..875b412f41 100644 --- a/doc/filters.texi +++ b/doc/filters.texi @@ -19284,6 +19284,9 @@ short-term loudness (3 seconds of analysis), and the gauge on the right is for the momentary loudness (400 milliseconds), but can optionally be configured to instead display short-term loudness (see @var{gauge}). +The green area marks a +/- 1LU target range around the target loudness +(-23LUFS by default, unless modified through @var{target}). + More information about the Loudness Recommendation EBU R128 on @url{http://tech.ebu.ch/loudness}. @@ -19371,6 +19374,11 @@ Set the value displayed by the gauge. Valid values are @code{momentary} and s @code{shortterm}. 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 10dc717960..53f21c9d14 100644 --- a/libavfilter/f_ebur128.c +++ b/libavfilter/f_ebur128.c @@ -114,6 +114,8 @@ typedef struct EBUR128Context { int meter; ///< select a EBU mode between +9 and +18 int scale_range; ///< the range of LU values according to the meter int y_zero_lu; ///< the y value (pixel position) for 0 LU + int y_opt_max; ///< the y value (pixel position) for 1 LU + int y_opt_min; ///< the y value (pixel position) for -1 LU int *y_line_ref; ///< y reference values for drawing the LU lines in the graph and the gauge /* audio */ @@ -186,22 +188,31 @@ static const AVOption ebur128_options[] = { AVFILTER_DEFINE_CLASS(ebur128); static const uint8_t graph_colors[] = { - 0xdd, 0x66, 0x66, // value above 0LU non reached - 0x66, 0x66, 0xdd, // value below 0LU non reached - 0x96, 0x33, 0x33, // value above 0LU reached - 0x33, 0x33, 0x96, // value below 0LU reached - 0xdd, 0x96, 0x96, // value above 0LU line non reached - 0x96, 0x96, 0xdd, // value below 0LU line non reached - 0xdd, 0x33, 0x33, // value above 0LU line reached - 0x33, 0x33, 0xdd, // value below 0LU line reached + 0xdd, 0x66, 0x66, // value above 1LU non reached below -1LU (impossible) + 0x66, 0x66, 0xdd, // value below 1LU non reached below -1LU + 0x96, 0x33, 0x33, // value above 1LU reached below -1LU (impossible) + 0x33, 0x33, 0x96, // value below 1LU reached below -1LU + 0xdd, 0x96, 0x96, // value above 1LU line non reached below -1LU (impossible) + 0x96, 0x96, 0xdd, // value below 1LU line non reached below -1LU + 0xdd, 0x33, 0x33, // value above 1LU line reached below -1LU (impossible) + 0x33, 0x33, 0xdd, // value below 1LU line reached below -1LU + 0xdd, 0x66, 0x66, // value above 1LU non reached above -1LU + 0x66, 0xdd, 0x66, // value below 1LU non reached above -1LU + 0x96, 0x33, 0x33, // value above 1LU reached above -1LU + 0x33, 0x96, 0x33, // value below 1LU reached above -1LU + 0xdd, 0x96, 0x96, // value above 1LU line non reached above -1LU + 0x96, 0xdd, 0x96, // value below 1LU line non reached above -1LU + 0xdd, 0x33, 0x33, // value above 1LU line reached above -1LU + 0x33, 0xdd, 0x33, // value below 1LU line reached above -1LU }; static const uint8_t *get_graph_color(const EBUR128Context *ebur128, int v, int y) { - const int below0 = y > ebur128->y_zero_lu; + const int above_opt_max = y > ebur128->y_opt_max; + const int below_opt_min = y < ebur128->y_opt_min; const int reached = y >= v; const int line = ebur128->y_line_ref[y] || y == ebur128->y_zero_lu; - const int colorid = 4*line + 2*reached + below0; + const int colorid = 8*below_opt_min+ 4*line + 2*reached + above_opt_max; return graph_colors + 3*colorid; } @@ -335,6 +346,8 @@ static int config_video_output(AVFilterLink *outlink) /* draw graph */ ebur128->y_zero_lu = lu_to_y(ebur128, 0); + ebur128->y_opt_max = lu_to_y(ebur128, 1); + ebur128->y_opt_min = lu_to_y(ebur128, -1); p = outpicref->data[0] + ebur128->graph.y * outpicref->linesize[0] + ebur128->graph.x * 3; for (y = 0; y < ebur128->graph.h; y++) {