Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mpc-hc/sanear.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlex Marsev <alex.marsev@gmail.com>2015-09-18 13:54:23 +0300
committerAlex Marsev <alex.marsev@gmail.com>2015-09-18 14:12:23 +0300
commit1b66e34caa4832ecddbf758d0d10fc483353bf90 (patch)
treea2ec92397b06ac01db1ee2ec3ddd8b96b965b21e
parentbf6d2bc178c2da4e75f2742139310f7699ea0e95 (diff)
Add redundancy check to DspMatrix
Removes unnecessary 5.1side<->5.1back overhead.
-rw-r--r--src/DspMatrix.cpp23
1 files changed, 22 insertions, 1 deletions
diff --git a/src/DspMatrix.cpp b/src/DspMatrix.cpp
index b118960..b81ab8b 100644
--- a/src/DspMatrix.cpp
+++ b/src/DspMatrix.cpp
@@ -243,7 +243,28 @@ namespace SaneAudioRenderer
if (inputChannels != outputChannels || inputMask != outputMask)
{
m_matrix = BuildMatrix(inputChannels, inputMask, outputChannels, outputMask);
- m_active = true;
+
+ if (inputChannels != outputChannels)
+ {
+ m_active = true;
+ }
+ else
+ {
+ // Redundancy check.
+ for (size_t y = 0; y < outputChannels; y++)
+ {
+ for (size_t x = 0; x < inputChannels; x++)
+ {
+ float d = m_matrix[y * inputChannels + x];
+
+ if ((x == y && d != 1.0f) ||
+ (x != y && d != 0.0f))
+ {
+ m_active = true;
+ }
+ }
+ }
+ }
}
m_inputChannels = inputChannels;