Mercurial > hg > svcore
diff data/model/FFTModel.cpp @ 1095:b66734b5f806 simple-fft-model
Fix to fft cache
author | Chris Cannam |
---|---|
date | Sat, 13 Jun 2015 08:47:05 +0100 |
parents | b386363ff6c8 |
children | 4d9816ba0ebe |
line wrap: on
line diff
--- a/data/model/FFTModel.cpp Fri Jun 12 19:18:56 2015 +0100 +++ b/data/model/FFTModel.cpp Sat Jun 13 08:47:05 2015 +0100 @@ -235,14 +235,27 @@ sv_frame_t off = range.first - m_savedData.range.first; - vector<float> partial(m_savedData.data.begin() + off, m_savedData.data.end()); + vector<float> acc(m_savedData.data.begin() + off, m_savedData.data.end()); - vector<float> rest = getSourceData({ m_savedData.range.second, range.second }); + vector<float> rest = + getSourceDataUncached({ m_savedData.range.second, range.second }); - partial.insert(partial.end(), rest.begin(), rest.end()); - return partial; + acc.insert(acc.end(), rest.begin(), rest.end()); + + m_savedData = { range, acc }; + return acc; + + } else { + + auto data = getSourceDataUncached(range); + m_savedData = { range, data }; + return data; } +} +vector<float> +FFTModel::getSourceDataUncached(pair<sv_frame_t, sv_frame_t> range) const +{ vector<float> data(range.second - range.first, 0.f); decltype(range.first) pfx = 0; if (range.first < 0) { @@ -262,8 +275,6 @@ } } } - - m_savedData = { range, data }; return data; }