Mercurial > hg > svgui
changeset 1008:2f8340c22e8a tony-2.0-integration
Use max value returned directly from api call
author | Chris Cannam |
---|---|
date | Tue, 20 Oct 2015 12:54:47 +0100 |
parents | 7347cf34f538 |
children | 96cf499fad62 |
files | layer/SpectrogramLayer.cpp |
diffstat | 1 files changed, 4 insertions(+), 5 deletions(-) [+] |
line wrap: on
line diff
--- a/layer/SpectrogramLayer.cpp Tue Oct 20 12:53:32 2015 +0100 +++ b/layer/SpectrogramLayer.cpp Tue Oct 20 12:54:47 2015 +0100 @@ -2401,11 +2401,11 @@ } else if (m_normalization == NormalizeColumns) { fft->getNormalizedMagnitudesAt(sx, values, minbin, maxbin - minbin + 1); } else if (m_normalization == NormalizeHybrid) { - fft->getNormalizedMagnitudesAt(sx, values, minbin, maxbin - minbin + 1); - double max = fft->getMaximumMagnitudeAt(sx); + 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] * log10(max)); + values[i - minbin] = float(values[i - minbin] * + log10f(max)); } } } else { @@ -2568,8 +2568,7 @@ } else if (m_normalization == NormalizeColumns) { fft->getNormalizedMagnitudesAt(sx, autoarray, minbin, maxbin - minbin + 1); } else if (m_normalization == NormalizeHybrid) { - fft->getNormalizedMagnitudesAt(sx, autoarray, minbin, maxbin - minbin + 1); - float max = fft->getMaximumMagnitudeAt(sx); + float max = fft->getNormalizedMagnitudesAt(sx, autoarray, minbin, maxbin - minbin + 1); float scale = log10f(max + 1.f); // cout << "sx = " << sx << ", max = " << max << ", log10(max) = " << log10(max) << ", scale = " << scale << endl; for (int i = minbin; i <= maxbin; ++i) {