Mercurial > hg > svcore
comparison data/fft/FFTFileCache.cpp @ 183:146eb9e35baa
* Improve output from Profiler class and make it incur less (no) overhead in
release builds with NO_TIMING defined
* Fix a lock contention issue in spectrogram
* Marginal optimisations elsewhere
author | Chris Cannam |
---|---|
date | Tue, 10 Oct 2006 14:51:17 +0000 |
parents | b23eea68357e |
children | 91fdc752e540 |
comparison
equal
deleted
inserted
replaced
182:f75f8a1cd7b1 | 183:146eb9e35baa |
---|---|
87 } | 87 } |
88 | 88 |
89 float | 89 float |
90 FFTFileCache::getMagnitudeAt(size_t x, size_t y) const | 90 FFTFileCache::getMagnitudeAt(size_t x, size_t y) const |
91 { | 91 { |
92 Profiler profiler("FFTFileCache::getMagnitudeAt", false); | |
93 | |
92 float value = 0.f; | 94 float value = 0.f; |
93 | 95 |
94 switch (m_storageType) { | 96 switch (m_storageType) { |
95 | 97 |
96 case Compact: | 98 case Compact: |
292 return (height * 2 + 1) * width * | 294 return (height * 2 + 1) * width * |
293 (type == Compact ? sizeof(uint16_t) : sizeof(float)) + | 295 (type == Compact ? sizeof(uint16_t) : sizeof(float)) + |
294 2 * sizeof(size_t); // matrix file header size | 296 2 * sizeof(size_t); // matrix file header size |
295 } | 297 } |
296 | 298 |
299 void | |
300 FFTFileCache::populateReadBuf(size_t x) const | |
301 { | |
302 Profiler profiler("FFTFileCache::populateReadBuf", false); | |
303 | |
304 if (!m_readbuf) { | |
305 m_readbuf = new char[m_mfc->getHeight() * 2 * m_mfc->getCellSize()]; | |
306 } | |
307 m_mfc->getColumnAt(x, m_readbuf); | |
308 if (m_mfc->haveSetColumnAt(x + 1)) { | |
309 m_mfc->getColumnAt | |
310 (x + 1, m_readbuf + m_mfc->getCellSize() * m_mfc->getHeight()); | |
311 m_readbufWidth = 2; | |
312 } else { | |
313 m_readbufWidth = 1; | |
314 } | |
315 m_readbufCol = x; | |
316 } | |
317 |