From 2f7afa510fbdd29ee8874db970d47646d4c88da2 Mon Sep 17 00:00:00 2001 From: "Matthias P. Braendli" Date: Sun, 27 Sep 2015 21:14:51 +0200 Subject: Fix Non-SSE GainControl compile error --- src/GainControl.cpp | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'src/GainControl.cpp') 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; -- cgit v1.2.3