[FFmpeg-cvslog] avfilter/af_compand: fix clipping with default options

Paul B Mahol git at videolan.org
Fri Jul 17 13:31:25 CEST 2015


ffmpeg | branch: master | Paul B Mahol <onemda at gmail.com> | Fri Jul 17 11:23:45 2015 +0000| [297df52f303529fd3c326bc8f398a5b3cbf71c0b] | committer: Paul B Mahol

avfilter/af_compand: fix clipping with default options

Decays and attacks where by default set only for first channel
which caused poor defaults to be used which produced clipping
on any higher channel.

Reported-by: lachs0r
Signed-off-by: Paul B Mahol <onemda at gmail.com>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=297df52f303529fd3c326bc8f398a5b3cbf71c0b
---

 doc/filters.texi         |    2 ++
 libavfilter/af_compand.c |    5 +++++
 2 files changed, 7 insertions(+)

diff --git a/doc/filters.texi b/doc/filters.texi
index 518aef8..1bef836 100644
--- a/doc/filters.texi
+++ b/doc/filters.texi
@@ -1462,6 +1462,8 @@ situations, the attack time (response to the audio getting louder) should be
 shorter than the decay time, because the human ear is more sensitive to sudden
 loud audio than sudden soft audio. A typical value for attack is 0.3 seconds and
 a typical value for decay is 0.8 seconds.
+If specified number of attacks & decays is lower than number of channels, the last
+set attack/decay will be used for all remaining channels.
 
 @item points
 A list of points for the transfer function, specified in dB relative to the
diff --git a/libavfilter/af_compand.c b/libavfilter/af_compand.c
index 55ad98a..610787f 100644
--- a/libavfilter/af_compand.c
+++ b/libavfilter/af_compand.c
@@ -398,6 +398,11 @@ static int config_output(AVFilterLink *outlink)
         return AVERROR(EINVAL);
     }
 
+    for (i = nb_decays; i < channels; i++) {
+        s->channels[i].attack = s->channels[nb_decays - 1].attack;
+        s->channels[i].decay = s->channels[nb_decays - 1].decay;
+    }
+
 #define S(x) s->segments[2 * ((x) + 1)]
     p = s->points;
     for (i = 0, new_nb_items = 0; i < nb_points; i++) {



More information about the ffmpeg-cvslog mailing list