Mercurial > hg > svcore
comparison data/model/FFTModel.cpp @ 1270:bac86d3fc6c9 bqfft
Branch to use bqfft code and remove FFTapi
author | Chris Cannam |
---|---|
date | Mon, 21 Nov 2016 15:05:57 +0000 |
parents | 200c60de27ca |
children | 6463046bd21d |
comparison
equal
deleted
inserted
replaced
1269:f50c0bbe9096 | 1270:bac86d3fc6c9 |
---|---|
50 cerr << "ERROR: FFTModel::FFTModel: window size (" << m_windowSize | 50 cerr << "ERROR: FFTModel::FFTModel: window size (" << m_windowSize |
51 << ") must be at least FFT size (" << m_fftSize << ")" << endl; | 51 << ") must be at least FFT size (" << m_fftSize << ")" << endl; |
52 throw invalid_argument("FFTModel window size must be at least FFT size"); | 52 throw invalid_argument("FFTModel window size must be at least FFT size"); |
53 } | 53 } |
54 | 54 |
55 m_fft.initFloat(); | |
56 | |
55 connect(model, SIGNAL(modelChanged()), this, SIGNAL(modelChanged())); | 57 connect(model, SIGNAL(modelChanged()), this, SIGNAL(modelChanged())); |
56 connect(model, SIGNAL(modelChangedWithin(sv_frame_t, sv_frame_t)), | 58 connect(model, SIGNAL(modelChangedWithin(sv_frame_t, sv_frame_t)), |
57 this, SIGNAL(modelChangedWithin(sv_frame_t, sv_frame_t))); | 59 this, SIGNAL(modelChangedWithin(sv_frame_t, sv_frame_t))); |
58 } | 60 } |
59 | 61 |
221 if (m_savedData.range == range) { | 223 if (m_savedData.range == range) { |
222 inSourceCache.hit(); | 224 inSourceCache.hit(); |
223 return m_savedData.data; | 225 return m_savedData.data; |
224 } | 226 } |
225 | 227 |
228 Profiler profiler("FFTModel::getSourceData (cache miss)"); | |
229 | |
226 if (range.first < m_savedData.range.second && | 230 if (range.first < m_savedData.range.second && |
227 range.first >= m_savedData.range.first && | 231 range.first >= m_savedData.range.first && |
228 range.second > m_savedData.range.second) { | 232 range.second > m_savedData.range.second) { |
229 | 233 |
230 inSourceCache.partial(); | 234 inSourceCache.partial(); |
307 | 311 |
308 Profiler profiler("FFTModel::getFFTColumn (cache miss)"); | 312 Profiler profiler("FFTModel::getFFTColumn (cache miss)"); |
309 | 313 |
310 auto samples = getSourceSamples(n); | 314 auto samples = getSourceSamples(n); |
311 m_windower.cut(samples.data()); | 315 m_windower.cut(samples.data()); |
312 auto col = m_fft.process(samples); | 316 breakfastquay::v_fftshift(samples.data(), m_fftSize); |
317 | |
318 vector<complex<float>> col(m_fftSize/2 + 1); | |
319 | |
320 m_fft.forwardInterleaved(samples.data(), | |
321 reinterpret_cast<float *>(col.data())); | |
313 | 322 |
314 SavedColumn sc { n, col }; | 323 SavedColumn sc { n, col }; |
315 if (m_cached.size() >= m_cacheSize) { | 324 if (m_cached.size() >= m_cacheSize) { |
316 m_cached.pop_front(); | 325 m_cached.pop_front(); |
317 } | 326 } |