diff options
author | Matthias P. Braendli <matthias.braendli@mpb.li> | 2015-09-27 21:14:51 +0200 |
---|---|---|
committer | Matthias P. Braendli <matthias.braendli@mpb.li> | 2015-09-27 21:14:51 +0200 |
commit | 2f7afa510fbdd29ee8874db970d47646d4c88da2 (patch) | |
tree | d8512ad625036ed6d1b4efe7fb23e940ecb2c967 /src | |
parent | fe67d875852b009780f78f0613721a8d9837f7e5 (diff) | |
download | dabmod-2f7afa510fbdd29ee8874db970d47646d4c88da2.tar.gz dabmod-2f7afa510fbdd29ee8874db970d47646d4c88da2.tar.bz2 dabmod-2f7afa510fbdd29ee8874db970d47646d4c88da2.zip |
Fix Non-SSE GainControl compile error
Diffstat (limited to 'src')
-rw-r--r-- | src/GainControl.cpp | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/src/GainControl.cpp b/src/GainControl.cpp index e68ce99..f575133 100644 --- a/src/GainControl.cpp +++ b/src/GainControl.cpp @@ -368,7 +368,6 @@ float GainControl::computeGainMax(const complexf* in, size_t sizeIn) float GainControl::computeGainVar(const complexf* in, size_t sizeIn) { - float gain; complexf mean; /* The variance calculation is a bit strange, because we @@ -454,16 +453,18 @@ float GainControl::computeGainVar(const complexf* in, size_t sizeIn) //////////////////////////////////////////////////////////////////////////// // Computing gain //////////////////////////////////////////////////////////////////////////// + float gain = var.real(); // gain = factor128 / max(real, imag) - if (var.imag() > var.real()) { - var.real() = var.imag(); + if (var.imag() > gain) { + gain = var.imag(); } - // Detect NULL - if ((int)var.real() == 0) { + + // Ignore zero variance samples and apply no gain + if ((int)gain == 0) { gain = 1.0f; } else { - gain = factor / var.real(); + gain = factor / gain; } return gain; |