Mercurial > hg > match-vamp
comparison src/Matcher.cpp @ 209:d46be43c0738 memory
Grow matrix less enthusiastically, call shrink_to_fit() on vectors
author | Chris Cannam |
---|---|
date | Fri, 27 Feb 2015 13:57:07 +0000 |
parents | 9a8fc47d4f93 |
children | 6373d14deace |
comparison
equal
deleted
inserted
replaced
208:9a8fc47d4f93 | 209:d46be43c0738 |
---|---|
298 Matcher::calcAdvance() | 298 Matcher::calcAdvance() |
299 { | 299 { |
300 int frameIndex = m_frameCount % m_blockSize; | 300 int frameIndex = m_frameCount % m_blockSize; |
301 | 301 |
302 if (m_frameCount >= m_distXSize) { | 302 if (m_frameCount >= m_distXSize) { |
303 m_distXSize *= 2; | 303 m_distXSize *= 1.2; |
304 size(); | 304 size(); |
305 } | 305 } |
306 | 306 |
307 if (m_firstPM && (m_frameCount >= m_blockSize)) { | 307 if (m_firstPM && (m_frameCount >= m_blockSize)) { |
308 // Memory reduction for old rows | 308 // Memory reduction for old rows |
309 int oldidx = m_frameCount - m_blockSize; | 309 int oldidx = m_frameCount - m_blockSize; |
310 int len = m_last[oldidx] - m_first[oldidx]; | 310 int len = m_last[oldidx] - m_first[oldidx]; |
311 m_distance[oldidx].resize(len); | 311 m_distance[oldidx].resize(len); |
312 m_distance[oldidx].shrink_to_fit(); | |
312 m_bestPathCost[oldidx].resize(len); | 313 m_bestPathCost[oldidx].resize(len); |
314 m_bestPathCost[oldidx].shrink_to_fit(); | |
313 m_advance[oldidx].resize(len); | 315 m_advance[oldidx].resize(len); |
316 m_advance[oldidx].shrink_to_fit(); | |
314 } | 317 } |
315 | 318 |
316 int stop = m_otherMatcher->m_frameCount; | 319 int stop = m_otherMatcher->m_frameCount; |
317 int index = stop - m_blockSize; | 320 int index = stop - m_blockSize; |
318 if (index < 0) index = 0; | 321 if (index < 0) index = 0; |