Created
February 8, 2013 20:12
-
-
Save justinruggles/4741614 to your computer and use it in GitHub Desktop.
lavr: fix mixing matrix reduction when normalization is disabled
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
From c315796cd31782b98720faff17830bc1f9b76209 Mon Sep 17 00:00:00 2001 | |
From: Justin Ruggles <[email protected]> | |
Date: Sun, 27 Jan 2013 14:47:54 -0500 | |
Subject: [PATCH] lavr: fix mixing matrix reduction when normalization is disabled | |
In some cases when an input contributes fully to the corresponding | |
output, other inputs may also contribute to the same output. This is the | |
case, for example, for the default 5.1 to stereo downmix matrix without | |
normalization. | |
--- | |
libavresample/audio_mix.c | 11 +++++++++++ | |
1 files changed, 11 insertions(+), 0 deletions(-) | |
diff --git a/libavresample/audio_mix.c b/libavresample/audio_mix.c | |
index 9a5ffcc..806abe3 100644 | |
--- a/libavresample/audio_mix.c | |
+++ b/libavresample/audio_mix.c | |
@@ -568,11 +568,22 @@ static void reduce_matrix(AudioMix *am, const double *matrix, int stride) | |
int skip = 1; | |
for (o = 0; o < am->out_channels; o++) { | |
+ int i0; | |
if ((o != i && matrix[o * stride + i] != 0.0) || | |
(o == i && matrix[o * stride + i] != 1.0)) { | |
skip = 0; | |
break; | |
} | |
+ /* if the input contributes fully to the output, also check that no | |
+ other inputs contribute to this output */ | |
+ if (o == i) { | |
+ for (i0 = 0; i0 < am->in_channels; i0++) { | |
+ if (i0 != i && matrix[o * stride + i0] != 0.0) { | |
+ skip = 0; | |
+ break; | |
+ } | |
+ } | |
+ } | |
} | |
if (skip) { | |
am->input_skip[i] = 1; | |
-- | |
1.7.1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment