comparison data/model/FFTModel.cpp @ 1258:200c60de27ca 3.0-integration

More timings and cache hit counts
author Chris Cannam
date Thu, 10 Nov 2016 09:58:28 +0000
parents 5236543343c3
children bac86d3fc6c9
comparison
equal deleted inserted replaced
1257:5236543343c3 1258:200c60de27ca
289 } 289 }
290 290
291 vector<complex<float>> 291 vector<complex<float>>
292 FFTModel::getFFTColumn(int n) const 292 FFTModel::getFFTColumn(int n) const
293 { 293 {
294 // The small cache (i.e. the m_cached deque) is for peak-frequency 294 // The small cache (i.e. the m_cached deque) is for cases where
295 // spectrograms, where values from two consecutive columns are 295 // values are looked up individually, and for e.g. peak-frequency
296 // spectrograms where values from two consecutive columns are
296 // needed at once. This cache gets essentially no hits when 297 // needed at once. This cache gets essentially no hits when
297 // scrolling through a magnitude spectrogram but 95%+ hits with a 298 // scrolling through a magnitude spectrogram, but 95%+ hits with a
298 // peak-frequency spectrogram. Since it costs very little, it's 299 // peak-frequency spectrogram.
299 // well worth having.
300 for (const auto &incache : m_cached) { 300 for (const auto &incache : m_cached) {
301 if (incache.n == n) { 301 if (incache.n == n) {
302 inSmallCache.hit(); 302 inSmallCache.hit();
303 return incache.col; 303 return incache.col;
304 } 304 }
305 } 305 }
306 inSmallCache.miss(); 306 inSmallCache.miss();
307
308 Profiler profiler("FFTModel::getFFTColumn (cache miss)");
307 309
308 auto samples = getSourceSamples(n); 310 auto samples = getSourceSamples(n);
309 m_windower.cut(samples.data()); 311 m_windower.cut(samples.data());
310 auto col = m_fft.process(samples); 312 auto col = m_fft.process(samples);
311 313