summaryrefslogtreecommitdiff
authorJustin Ruggles <justin.ruggles@gmail.com>2013-01-18 18:44:10 (GMT)
committer Justin Ruggles <justin.ruggles@gmail.com>2013-02-12 18:41:13 (GMT)
commit600b4c973fb98f07ec3c5837112865048fb8a607 (patch)
tree0fb9727a32aaa6499b04d154ad9957935dcd489d
parenta3735bb92a6b65eeed0f646336dba9776a9479dc (diff)
downloadffmpeg-600b4c973fb98f07ec3c5837112865048fb8a607.zip
ffmpeg-600b4c973fb98f07ec3c5837112865048fb8a607.tar.gz
ffmpeg-600b4c973fb98f07ec3c5837112865048fb8a607.tar.bz2
lavr: fix matrix reduction for upmixing in certain cases
Do not skip an output if the corresponding input contributes to other output channels.
Diffstat
-rw-r--r--libavresample/audio_mix.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/libavresample/audio_mix.c b/libavresample/audio_mix.c
index 096bcf3..487bddf 100644
--- a/libavresample/audio_mix.c
+++ b/libavresample/audio_mix.c
@@ -607,6 +607,7 @@ static void reduce_matrix(AudioMix *am, const double *matrix, int stride)
corresponding input channel */
for (o = 0; o < FFMIN(am->in_channels, am->out_channels); o++) {
int skip = 1;
+ int o0;
for (i = 0; i < am->in_channels; i++) {
if ((o != i && matrix[o * stride + i] != 0.0) ||
@@ -615,6 +616,15 @@ static void reduce_matrix(AudioMix *am, const double *matrix, int stride)
break;
}
}
+ /* check if the corresponding input channel makes a contribution to
+ any other output channel */
+ i = o;
+ for (o0 = 0; o0 < am->out_channels; o0++) {
+ if (o0 != i && matrix[o0 * stride + i] != 0.0) {
+ skip = 0;
+ break;
+ }
+ }
if (skip) {
am->output_skip[o] = 1;
am->out_matrix_channels--;