From 26270db8aec749fe7ca223a1272881f8598c90f8 Mon Sep 17 00:00:00 2001 From: Robin Gareus Date: Thu, 2 Feb 2023 17:57:02 +0100 Subject: [PATCH] Fix EBU-R128 loudness analysis for mono signals This removes the special case which assumed unity gain when reproducing mono files on a stereo system. ITU-R BS.1770 however specifies a channel weight of 0dB for left, right and centre, regardless of the total channel count. Tech 3344 6.16 mentions a 3dB attenuation to maintain the loudness level of a mono audio signal in multi-channel signals, and Tech 3343-2016 further specifies that "Ideally, a downmix operation should be loudness-agnostic". --- libs/vamp-plugins/ebu_r128_proc.cc | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/libs/vamp-plugins/ebu_r128_proc.cc b/libs/vamp-plugins/ebu_r128_proc.cc index 0c6678682a..8114dacdb9 100644 --- a/libs/vamp-plugins/ebu_r128_proc.cc +++ b/libs/vamp-plugins/ebu_r128_proc.cc @@ -349,11 +349,9 @@ Ebu_r128_proc::detect_process (int nfram) z3 += y; sj += y * y; } - if (_nchan == 1) { - si = 2 * sj; - } else { - si += _chan_gain[i] * sj; - } + + si += _chan_gain[i] * sj; + S->_z1 = !isfinite_local (z1) ? 0 : z1; S->_z2 = !isfinite_local (z2) ? 0 : z2; S->_z3 = !isfinite_local (z3) ? 0 : z3;