Mercurial > hg > svcore
diff data/model/FFTModel.cpp @ 1575:054bbf17ac17 spectrogramparam
Slightly simplify median-window size calculation - but this is not the best way to do this for spectrum views, need to reconsider
author | Chris Cannam |
---|---|
date | Mon, 12 Nov 2018 14:48:15 +0000 |
parents | f04038819c26 |
children | 0f62bce0f0be |
line wrap: on
line diff
--- a/data/model/FFTModel.cpp Fri Nov 09 15:22:01 2018 +0000 +++ b/data/model/FFTModel.cpp Mon Nov 12 14:48:15 2018 +0000 @@ -389,7 +389,7 @@ FFTModel::getPeaks(PeakPickType type, int x, int ymin, int ymax) const { Profiler profiler("FFTModel::getPeaks"); - + FFTModel::PeakLocationSet peaks; if (!isOK()) return peaks; @@ -518,10 +518,19 @@ int hibin = int(lrint((hifreq * m_fftSize) / sampleRate)); int medianWinSize = hibin - bin; - if (medianWinSize < 3) medianWinSize = 3; + if (medianWinSize < 3) { + medianWinSize = 3; + } + if (medianWinSize > 20) { + medianWinSize = (1 + medianWinSize / 10) * 10; + } + if (medianWinSize > 500) { + medianWinSize = 500; + } percentile = 0.5f + float(binfreq / sampleRate); - + if (percentile > 0.9f) percentile = 0.9f; + return medianWinSize; }