Mercurial > hg > svgui
comparison layer/SpectrogramLayer.cpp @ 1056:b4fd6c67fce5 3.0-integration
Comments and minor tidy
author | Chris Cannam |
---|---|
date | Mon, 13 Jun 2016 11:44:08 +0100 |
parents | 00891cfaa4d3 |
children | 9a13bc339fa9 |
comparison
equal
deleted
inserted
replaced
1055:00891cfaa4d3 | 1056:b4fd6c67fce5 |
---|---|
2434 | 2434 |
2435 int columnCount = 0; | 2435 int columnCount = 0; |
2436 | 2436 |
2437 for (int x = start; x != finish; x += step) { | 2437 for (int x = start; x != finish; x += step) { |
2438 | 2438 |
2439 // x is the on-canvas pixel coord; sx (later) will be the | |
2440 // source column index | |
2441 | |
2439 ++columnCount; | 2442 ++columnCount; |
2440 | 2443 |
2441 if (binforx[x] < 0) continue; | 2444 if (binforx[x] < 0) continue; |
2442 | 2445 |
2443 // float columnGain = m_gain; | |
2444 float columnMax = 0.f; | 2446 float columnMax = 0.f; |
2445 | 2447 |
2446 int sx0 = binforx[x] / divisor; | 2448 int sx0 = binforx[x] / divisor; |
2447 int sx1 = sx0; | 2449 int sx1 = sx0; |
2448 if (x+1 < w) sx1 = binforx[x+1] / divisor; | 2450 if (x+1 < w) sx1 = binforx[x+1] / divisor; |
2470 if (m_colourScale == PhaseColourScale) { | 2472 if (m_colourScale == PhaseColourScale) { |
2471 fft->getPhasesAt(sx, autoarray, minbin, maxbin - minbin + 1); | 2473 fft->getPhasesAt(sx, autoarray, minbin, maxbin - minbin + 1); |
2472 } else if (m_normalization == NormalizeColumns) { | 2474 } else if (m_normalization == NormalizeColumns) { |
2473 fft->getNormalizedMagnitudesAt(sx, autoarray, minbin, maxbin - minbin + 1); | 2475 fft->getNormalizedMagnitudesAt(sx, autoarray, minbin, maxbin - minbin + 1); |
2474 } else if (m_normalization == NormalizeHybrid) { | 2476 } else if (m_normalization == NormalizeHybrid) { |
2475 float max = fft->getNormalizedMagnitudesAt(sx, autoarray, minbin, maxbin - minbin + 1); | 2477 float max = fft->getNormalizedMagnitudesAt |
2478 (sx, autoarray, minbin, maxbin - minbin + 1); | |
2476 float scale = log10f(max + 1.f); | 2479 float scale = log10f(max + 1.f); |
2477 // cout << "sx = " << sx << ", max = " << max << ", log10(max) = " << log10(max) << ", scale = " << scale << endl; | |
2478 for (int i = minbin; i <= maxbin; ++i) { | 2480 for (int i = minbin; i <= maxbin; ++i) { |
2479 autoarray[i - minbin] *= scale; | 2481 autoarray[i - minbin] *= scale; |
2480 } | 2482 } |
2481 } else { | 2483 } else { |
2482 fft->getMagnitudesAt(sx, autoarray, minbin, maxbin - minbin + 1); | 2484 fft->getMagnitudesAt(sx, autoarray, minbin, maxbin - minbin + 1); |
2584 if (overallMag.sample(mag)) overallMagChanged = true; | 2586 if (overallMag.sample(mag)) overallMagChanged = true; |
2585 } | 2587 } |
2586 } | 2588 } |
2587 } | 2589 } |
2588 | 2590 |
2591 // at this point we have updated m_columnMags and overallMag | |
2592 // -- used elsewhere for calculating the overall view range | |
2593 // for NormalizeVisibleArea mode -- and calculated "peaks" | |
2594 // (the possibly scaled and interpolated value array from | |
2595 // which we actually draw the column) and "columnMax" (maximum | |
2596 // value used for normalisation) | |
2597 | |
2589 for (int y = 0; y < h; ++y) { | 2598 for (int y = 0; y < h; ++y) { |
2590 | 2599 |
2591 double peak = peaks[y]; | 2600 double peak = peaks[y]; |
2592 | 2601 |
2593 if (m_colourScale != PhaseColourScale && | 2602 if (m_colourScale != PhaseColourScale && |