Mercurial > hg > svcore
diff 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 |
line wrap: on
line diff
--- a/data/model/Dense3DModelPeakCache.cpp Fri Jan 22 17:08:02 2016 +0000 +++ b/data/model/Dense3DModelPeakCache.cpp Fri Jan 22 18:12:06 2016 +0000 @@ -94,13 +94,16 @@ } Column peak; + int n = 0; for (int i = 0; i < m_resolution; ++i) { Column here = m_source->getColumn(column * m_resolution + i); if (i == 0) { peak = here; + n = int(peak.size()); } else { - for (int j = 0; in_range_for(peak, j) && in_range_for(here, j); ++j) { - if (here[j] > peak[j]) peak[j] = here[j]; + int m = std::min(n, int(here.size())); + for (int j = 0; j < m; ++j) { + peak[j] = std::max(here[j], peak[j]); } } }