[FFmpeg-cvslog] lavfi/pan: renormalize negative gain coefficients properly

Moritz Barsnick git at videolan.org
Tue Oct 11 04:46:54 EEST 2016


ffmpeg | branch: master | Moritz Barsnick <barsnick at gmx.net> | Sun Oct  9 03:49:15 2016 +0200| [efbc37a757d6b41af1a5752ff810db1dcf3fe78c] | committer: Michael Niedermayer

lavfi/pan: renormalize negative gain coefficients properly

The parser for the outdef will accept a negative value for the first
named channel's gain. As negative values effectively only invert the
phase of the signal, and not negate the level, the gains' absolute
values must be used to correctly accumulate the levels.

Signed-off-by: Moritz Barsnick <barsnick at gmx.net>
Reviewed-by: Nicolas George <george at nsup.org>
Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>

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

 libavfilter/af_pan.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavfilter/af_pan.c b/libavfilter/af_pan.c
index 7c02f67..fbd79a5 100644
--- a/libavfilter/af_pan.c
+++ b/libavfilter/af_pan.c
@@ -322,7 +322,7 @@ static int config_props(AVFilterLink *link)
                 continue;
             t = 0;
             for (j = 0; j < link->channels; j++)
-                t += pan->gain[i][j];
+                t += fabs(pan->gain[i][j]);
             if (t > -1E-5 && t < 1E-5) {
                 // t is almost 0 but not exactly, this is probably a mistake
                 if (t)



More information about the ffmpeg-cvslog mailing list