]> git.sesse.net Git - ffmpeg/commitdiff
avfilter/af_dynaudnorm: do not clip audio
authorPaul B Mahol <onemda@gmail.com>
Sat, 4 Jan 2020 09:27:46 +0000 (10:27 +0100)
committerPaul B Mahol <onemda@gmail.com>
Sat, 4 Jan 2020 09:27:46 +0000 (10:27 +0100)
Clipping can happen when smoothed gain is higher than maximum
allowed gain factor for current frame and peak value option is
set to enough low value.

libavfilter/af_dynaudnorm.c

index 4b9153e41890d05f16e7d40795dbcfa82e4a5c71..09d2aeb816436c133146714bd8e5a7d863857497 100644 (file)
@@ -490,6 +490,7 @@ static void update_gain_history(DynamicAudioNormalizerContext *s, int channel,
         double smoothed;
         av_assert0(cqueue_size(s->gain_history_minimum[channel]) == s->filter_size);
         smoothed = gaussian_filter(s, s->gain_history_minimum[channel]);
+        smoothed = FFMIN(smoothed, cqueue_peek(s->gain_history_minimum[channel], s->filter_size / 2));
 
         cqueue_enqueue(s->gain_history_smoothed[channel], smoothed);