# HG changeset patch # User Chris Cannam # Date 1465814643 -3600 # Node ID 00891cfaa4d3a489e0cbd21359de0808c871f294 # Parent 5e5873c24142d72cc37253bc9a444848d06e396b Make normalise-hybrid logic the same in both draw methods diff -r 5e5873c24142 -r 00891cfaa4d3 layer/SpectrogramLayer.cpp --- a/layer/SpectrogramLayer.cpp Mon Jun 13 11:42:51 2016 +0100 +++ b/layer/SpectrogramLayer.cpp Mon Jun 13 11:44:03 2016 +0100 @@ -2265,12 +2265,11 @@ } else if (m_normalization == NormalizeColumns) { fft->getNormalizedMagnitudesAt(sx, values, minbin, maxbin - minbin + 1); } else if (m_normalization == NormalizeHybrid) { - float max = fft->getNormalizedMagnitudesAt(sx, values, minbin, maxbin - minbin + 1); - if (max > 0.f) { - for (int i = minbin; i <= maxbin; ++i) { - values[i - minbin] = float(values[i - minbin] * - log10f(max)); - } + float max = fft->getNormalizedMagnitudesAt + (sx, values, minbin, maxbin - minbin + 1); + float scale = log10f(max + 1.f); + for (int i = minbin; i <= maxbin; ++i) { + values[i - minbin] *= scale; } } else { fft->getMagnitudesAt(sx, values, minbin, maxbin - minbin + 1);