Mercurial > hg > svcore
comparison data/model/FFTModel.h @ 1371:fad8f533ca13
Reduce amount of copying in FFTModel
author | Chris Cannam |
---|---|
date | Thu, 26 Jan 2017 14:11:20 +0000 |
parents | 54af1e21705c |
children | 0f62bce0f0be |
comparison
equal
deleted
inserted
replaced
1370:54fabf5aceb8 | 1371:fad8f533ca13 |
---|---|
25 #include <bqvec/Allocators.h> | 25 #include <bqvec/Allocators.h> |
26 | 26 |
27 #include <set> | 27 #include <set> |
28 #include <vector> | 28 #include <vector> |
29 #include <complex> | 29 #include <complex> |
30 #include <deque> | |
31 | 30 |
32 /** | 31 /** |
33 * An implementation of DenseThreeDimensionalModel that makes FFT data | 32 * An implementation of DenseThreeDimensionalModel that makes FFT data |
34 * derived from a DenseTimeValueModel available as a generic data | 33 * derived from a DenseTimeValueModel available as a generic data |
35 * grid. | 34 * grid. |
170 | 169 |
171 typedef std::vector<float, breakfastquay::StlAllocator<float>> fvec; | 170 typedef std::vector<float, breakfastquay::StlAllocator<float>> fvec; |
172 typedef std::vector<std::complex<float>, | 171 typedef std::vector<std::complex<float>, |
173 breakfastquay::StlAllocator<std::complex<float>>> cvec; | 172 breakfastquay::StlAllocator<std::complex<float>>> cvec; |
174 | 173 |
175 cvec getFFTColumn(int column) const; | 174 const cvec &getFFTColumn(int column) const; // returns ref for immediate use only |
176 fvec getSourceSamples(int column) const; | 175 fvec getSourceSamples(int column) const; |
177 fvec getSourceData(std::pair<sv_frame_t, sv_frame_t>) const; | 176 fvec getSourceData(std::pair<sv_frame_t, sv_frame_t>) const; |
178 fvec getSourceDataUncached(std::pair<sv_frame_t, sv_frame_t>) const; | 177 fvec getSourceDataUncached(std::pair<sv_frame_t, sv_frame_t>) const; |
179 | 178 |
180 struct SavedSourceData { | 179 struct SavedSourceData { |
181 std::pair<sv_frame_t, sv_frame_t> range; | 180 std::pair<sv_frame_t, sv_frame_t> range; |
182 fvec data; | 181 fvec data; |
183 }; | 182 }; |
184 mutable SavedSourceData m_savedData; | 183 mutable SavedSourceData m_savedData; |
185 | 184 |
186 struct SavedColumn { | 185 struct SavedColumn { |
187 int n; | 186 int n; |
188 cvec col; | 187 cvec col; |
189 }; | 188 }; |
190 mutable std::deque<SavedColumn> m_cached; | 189 mutable std::vector<SavedColumn> m_cached; |
190 mutable size_t m_cacheWriteIndex; | |
191 size_t m_cacheSize; | 191 size_t m_cacheSize; |
192 }; | 192 }; |
193 | 193 |
194 #endif | 194 #endif |