Skip to content
This repository has been archived by the owner on Jun 4, 2023. It is now read-only.

Commit

Permalink
lavfi/pan: renormalize negative gain coefficients properly
Browse files Browse the repository at this point in the history
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 <[email protected]>
Reviewed-by: Nicolas George <[email protected]>
Signed-off-by: Michael Niedermayer <[email protected]>
  • Loading branch information
barsnick authored and michaelni committed Oct 11, 2016
1 parent 50eee35 commit efbc37a
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion libavfilter/af_pan.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit efbc37a

Please sign in to comment.