Mercurial > hg > svgui
changeset 1055:00891cfaa4d3 3.0-integration
Make normalise-hybrid logic the same in both draw methods
author | Chris Cannam |
---|---|
date | Mon, 13 Jun 2016 11:44:03 +0100 |
parents | 5e5873c24142 |
children | b4fd6c67fce5 |
files | layer/SpectrogramLayer.cpp |
diffstat | 1 files changed, 5 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
--- 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);