comparison layer/SpectrogramLayer.cpp @ 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
comparison
equal deleted inserted replaced
1007:7347cf34f538 1008:2f8340c22e8a
2399 if (m_colourScale == PhaseColourScale) { 2399 if (m_colourScale == PhaseColourScale) {
2400 fft->getPhasesAt(sx, values, minbin, maxbin - minbin + 1); 2400 fft->getPhasesAt(sx, values, minbin, maxbin - minbin + 1);
2401 } else if (m_normalization == NormalizeColumns) { 2401 } else if (m_normalization == NormalizeColumns) {
2402 fft->getNormalizedMagnitudesAt(sx, values, minbin, maxbin - minbin + 1); 2402 fft->getNormalizedMagnitudesAt(sx, values, minbin, maxbin - minbin + 1);
2403 } else if (m_normalization == NormalizeHybrid) { 2403 } else if (m_normalization == NormalizeHybrid) {
2404 fft->getNormalizedMagnitudesAt(sx, values, minbin, maxbin - minbin + 1); 2404 float max = fft->getNormalizedMagnitudesAt(sx, values, minbin, maxbin - minbin + 1);
2405 double max = fft->getMaximumMagnitudeAt(sx);
2406 if (max > 0.f) { 2405 if (max > 0.f) {
2407 for (int i = minbin; i <= maxbin; ++i) { 2406 for (int i = minbin; i <= maxbin; ++i) {
2408 values[i - minbin] = float(values[i - minbin] * log10(max)); 2407 values[i - minbin] = float(values[i - minbin] *
2408 log10f(max));
2409 } 2409 }
2410 } 2410 }
2411 } else { 2411 } else {
2412 fft->getMagnitudesAt(sx, values, minbin, maxbin - minbin + 1); 2412 fft->getMagnitudesAt(sx, values, minbin, maxbin - minbin + 1);
2413 } 2413 }
2566 if (m_colourScale == PhaseColourScale) { 2566 if (m_colourScale == PhaseColourScale) {
2567 fft->getPhasesAt(sx, autoarray, minbin, maxbin - minbin + 1); 2567 fft->getPhasesAt(sx, autoarray, minbin, maxbin - minbin + 1);
2568 } else if (m_normalization == NormalizeColumns) { 2568 } else if (m_normalization == NormalizeColumns) {
2569 fft->getNormalizedMagnitudesAt(sx, autoarray, minbin, maxbin - minbin + 1); 2569 fft->getNormalizedMagnitudesAt(sx, autoarray, minbin, maxbin - minbin + 1);
2570 } else if (m_normalization == NormalizeHybrid) { 2570 } else if (m_normalization == NormalizeHybrid) {
2571 fft->getNormalizedMagnitudesAt(sx, autoarray, minbin, maxbin - minbin + 1); 2571 float max = fft->getNormalizedMagnitudesAt(sx, autoarray, minbin, maxbin - minbin + 1);
2572 float max = fft->getMaximumMagnitudeAt(sx);
2573 float scale = log10f(max + 1.f); 2572 float scale = log10f(max + 1.f);
2574 // cout << "sx = " << sx << ", max = " << max << ", log10(max) = " << log10(max) << ", scale = " << scale << endl; 2573 // cout << "sx = " << sx << ", max = " << max << ", log10(max) = " << log10(max) << ", scale = " << scale << endl;
2575 for (int i = minbin; i <= maxbin; ++i) { 2574 for (int i = minbin; i <= maxbin; ++i) {
2576 autoarray[i - minbin] *= scale; 2575 autoarray[i - minbin] *= scale;
2577 } 2576 }