comparison data/model/Dense3DModelPeakCache.cpp @ 1156:2dc27f0f97ad 3.0-integration

Small possible speedup
author Chris Cannam
date Fri, 22 Jan 2016 18:12:06 +0000
parents 546d4e417346
children f6998e304b36
comparison
equal deleted inserted replaced
1155:546d4e417346 1156:2dc27f0f97ad
92 if (m_coverage.size() > 0) m_coverage[m_coverage.size()-1] = false; 92 if (m_coverage.size() > 0) m_coverage[m_coverage.size()-1] = false;
93 m_coverage.resize(column + 1, false); 93 m_coverage.resize(column + 1, false);
94 } 94 }
95 95
96 Column peak; 96 Column peak;
97 int n = 0;
97 for (int i = 0; i < m_resolution; ++i) { 98 for (int i = 0; i < m_resolution; ++i) {
98 Column here = m_source->getColumn(column * m_resolution + i); 99 Column here = m_source->getColumn(column * m_resolution + i);
99 if (i == 0) { 100 if (i == 0) {
100 peak = here; 101 peak = here;
102 n = int(peak.size());
101 } else { 103 } else {
102 for (int j = 0; in_range_for(peak, j) && in_range_for(here, j); ++j) { 104 int m = std::min(n, int(here.size()));
103 if (here[j] > peak[j]) peak[j] = here[j]; 105 for (int j = 0; j < m; ++j) {
106 peak[j] = std::max(here[j], peak[j]);
104 } 107 }
105 } 108 }
106 } 109 }
107 110
108 m_cache->setColumn(column, peak); 111 m_cache->setColumn(column, peak);