From 8542f9c4f17125d483c40c0c5723842f1c982f81 Mon Sep 17 00:00:00 2001 From: Alessandro Ghedini Date: Fri, 4 Apr 2014 11:50:44 +0200 Subject: replaygain: correctly parse peak values According to the ReplayGain spec, the peak amplitude may overflow and may result in peak amplitude values greater than 1.0 with psychoacoustically coded audio, such as MP3. Fully compliant decoders must allow peak overflows. Additionally, having peak values in the 0<->UINT32_MAX scale makes it more difficult for applications to actually use the peak values (e.g. when implementing clipping prevention) since values have to be rescaled down. This patch corrects the peak parsing by removing the rescaling of the decoded values between 0 and UINT32_MAX and the 1.0 upper limit. Signed-off-by: Anton Khirnov --- libavutil/replaygain.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'libavutil/replaygain.h') diff --git a/libavutil/replaygain.h b/libavutil/replaygain.h index 8447703fbf..7871d2c762 100644 --- a/libavutil/replaygain.h +++ b/libavutil/replaygain.h @@ -34,8 +34,8 @@ typedef struct AVReplayGain { */ int32_t track_gain; /** - * Peak track amplitude, with UINT32_MAX representing full scale. 0 when - * unknown. + * Peak track amplitude, with 100000 representing full scale (but values + * may overflow). 0 when unknown. */ uint32_t track_peak; /** -- cgit v1.2.3