# HG changeset patch # User Chris Cannam # Date 1445342087 -3600 # Node ID 2f8340c22e8af2454f6e0f6e1d44d38ac75aa1cc # Parent 7347cf34f538d81eb45cd0ca783a96018c6d74d4 Use max value returned directly from api call diff -r 7347cf34f538 -r 2f8340c22e8a layer/SpectrogramLayer.cpp --- 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) {