Mercurial > hg > match-vamp
changeset 206:fb799a1aabd8 memory
Don't create matrices in other matcher, now they aren't referred to
author | Chris Cannam |
---|---|
date | Fri, 27 Feb 2015 12:35:02 +0000 |
parents | 010b91e44098 |
children | 0159aff8c4c5 |
files | src/Matcher.cpp |
diffstat | 1 files changed, 14 insertions(+), 19 deletions(-) [+] |
line wrap: on
line diff
--- a/src/Matcher.cpp Fri Feb 27 12:21:58 2015 +0000 +++ b/src/Matcher.cpp Fri Feb 27 12:35:02 2015 +0000 @@ -142,7 +142,7 @@ { if (m_firstPM) { if (i < 0 || i >= int(m_first.size())) { - cerr << "ERROR: Matcher::getColRange(" << i << "): Index out of range" + cerr << "ERROR: Matcher::getColRangeForRow(" << i << "): Index out of range" << endl; throw "Index out of range"; } else { @@ -154,29 +154,21 @@ } pair<int, int> -Matcher::getRowRangeForCol(int j) +Matcher::getRowRangeForCol(int i) { if (m_firstPM) { - //!!! tedious, examine uses (& consider restoring use of - //!!! first/last in "other" matcher) - int a = -1, b = -1; - for (int i = 0; i < int(m_first.size()); ++i) { - if (j >= m_first[i] && j < m_last[i]) { - if (a == -1) a = i; - b = i; - } - } - if (a == -1) { - cerr << "ERROR: Matcher::getRowRange(" << j << "): Index out of range" + if (i < 0 || i >= int(m_otherMatcher->m_first.size())) { + cerr << "ERROR: Matcher::getRowRangeForCol(" << i << "): Index out of range" << endl; throw "Index out of range"; } else { - return pair<int, int>(a, b + 1); + return pair<int, int>(m_otherMatcher->m_first[i], + m_otherMatcher->m_last[i]); } } else { - return m_otherMatcher->getColRangeForRow(j); + return m_otherMatcher->getColRangeForRow(i); } } @@ -275,12 +267,15 @@ void Matcher::size() { - int distSize = (m_params.maxRunCount + 1) * m_blockSize; - m_bestPathCost.resize(m_distXSize, pathcostvec_t(distSize, InvalidPathCost)); - m_distance.resize(m_distXSize, distancevec_t(distSize, InvalidDistance)); - m_advance.resize(m_distXSize, advancevec_t(distSize, AdvanceNone)); m_first.resize(m_distXSize, 0); m_last.resize(m_distXSize, 0); + + if (m_firstPM) { + int distSize = (m_params.maxRunCount + 1) * m_blockSize; + m_bestPathCost.resize(m_distXSize, pathcostvec_t(distSize, InvalidPathCost)); + m_distance.resize(m_distXSize, distancevec_t(distSize, InvalidDistance)); + m_advance.resize(m_distXSize, advancevec_t(distSize, AdvanceNone)); + } } void