comparison data/model/Dense3DModelPeakCache.cpp @ 551:408e56d30f58

* Re-enable peak frequencies display in spectrogram
author Chris Cannam
date Thu, 05 Feb 2009 17:33:21 +0000
parents 1469caaa8e67
children bbe503e368a9
comparison
equal deleted inserted replaced
550:107d3f3705c9 551:408e56d30f58
12 License, or (at your option) any later version. See the file 12 License, or (at your option) any later version. See the file
13 COPYING included with this distribution for more information. 13 COPYING included with this distribution for more information.
14 */ 14 */
15 15
16 #include "Dense3DModelPeakCache.h" 16 #include "Dense3DModelPeakCache.h"
17
18 #include "base/Profiler.h"
17 19
18 Dense3DModelPeakCache::Dense3DModelPeakCache(DenseThreeDimensionalModel *source, 20 Dense3DModelPeakCache::Dense3DModelPeakCache(DenseThreeDimensionalModel *source,
19 size_t columnsPerPeak) : 21 size_t columnsPerPeak) :
20 m_source(source), 22 m_source(source),
21 m_resolution(columnsPerPeak) 23 m_resolution(columnsPerPeak)
55 } 57 }
56 58
57 Dense3DModelPeakCache::Column 59 Dense3DModelPeakCache::Column
58 Dense3DModelPeakCache::getColumn(size_t column) const 60 Dense3DModelPeakCache::getColumn(size_t column) const
59 { 61 {
62 Profiler profiler("Dense3DModelPeakCache::getColumn");
60 if (!m_source) return Column(); 63 if (!m_source) return Column();
61 if (!haveColumn(column)) fillColumn(column); 64 if (!haveColumn(column)) fillColumn(column);
62 return m_cache->getColumn(column); 65 return m_cache->getColumn(column);
63 } 66 }
64 67
95 } 98 }
96 99
97 void 100 void
98 Dense3DModelPeakCache::fillColumn(size_t column) const 101 Dense3DModelPeakCache::fillColumn(size_t column) const
99 { 102 {
100 if (column >= m_coverage.size()) m_coverage.resize(column + 1); 103 Profiler profiler("Dense3DModelPeakCache::fillColumn");
104
105 if (column >= m_coverage.size()) {
106 // see note in sourceModelChanged
107 if (m_coverage.size() > 0) m_coverage.reset(m_coverage.size()-1);
108 m_coverage.resize(column + 1);
109 }
101 110
102 Column peak; 111 Column peak;
103 for (int i = 0; i < m_resolution; ++i) { 112 for (int i = 0; i < m_resolution; ++i) {
104 Column here = m_source->getColumn(column * m_resolution + i); 113 Column here = m_source->getColumn(column * m_resolution + i);
105 if (i == 0) { 114 if (i == 0) {