[FFmpeg-cvslog] avfilter/af_sidechaincompress: fix output gain for rms(default) detection

Paul B Mahol git at videolan.org
Sun Nov 29 19:20:55 CET 2015


ffmpeg | branch: master | Paul B Mahol <onemda at gmail.com> | Sun Nov 29 19:15:43 2015 +0100| [337b6d3b365a5be352841b0f2b57bd63afe6bff0] | committer: Paul B Mahol

avfilter/af_sidechaincompress: fix output gain for rms(default) detection

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

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

 libavfilter/af_sidechaincompress.c |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/libavfilter/af_sidechaincompress.c b/libavfilter/af_sidechaincompress.c
index 1dce1c0..3af49ad 100644
--- a/libavfilter/af_sidechaincompress.c
+++ b/libavfilter/af_sidechaincompress.c
@@ -50,6 +50,7 @@ typedef struct SidechainCompressContext {
     double knee_start;
     double knee_stop;
     double lin_knee_start;
+    double adj_knee_start;
     double compressed_knee_stop;
     int link;
     int detection;
@@ -87,6 +88,7 @@ static av_cold int init(AVFilterContext *ctx)
 
     s->thres = log(s->threshold);
     s->lin_knee_start = s->threshold / sqrt(s->knee);
+    s->adj_knee_start = s->lin_knee_start * s->lin_knee_start;
     s->knee_start = log(s->lin_knee_start);
     s->knee_stop = log(s->threshold * sqrt(s->knee));
     s->compressed_knee_stop = (s->knee_stop - s->thres) / s->ratio + s->thres;
@@ -166,7 +168,7 @@ static void compressor(SidechainCompressContext *s,
 
         s->lin_slope += (abs_sample - s->lin_slope) * (abs_sample > s->lin_slope ? s->attack_coeff : s->release_coeff);
 
-        if (s->lin_slope > 0.0 && s->lin_slope > s->lin_knee_start)
+        if (s->lin_slope > 0.0 && s->lin_slope > (s->detection ? s->adj_knee_start : s->lin_knee_start))
             gain = output_gain(s->lin_slope, s->ratio, s->thres, s->knee,
                                s->knee_start, s->knee_stop,
                                s->compressed_knee_stop, s->detection);



More information about the ffmpeg-cvslog mailing list