From efbc37a757d6b41af1a5752ff810db1dcf3fe78c Mon Sep 17 00:00:00 2001 From: Moritz Barsnick Date: Sun, 9 Oct 2016 03:49:15 +0200 Subject: 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 Reviewed-by: Nicolas George Signed-off-by: Michael Niedermayer --- libavfilter/af_pan.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'libavfilter/af_pan.c') diff --git a/libavfilter/af_pan.c b/libavfilter/af_pan.c index 7c02f6720d..fbd79a5a42 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) -- cgit v1.2.3