Mercurial > hg > match-vamp
diff src/Matcher.cpp @ 183:24ddab06aace re-minimise
Toward allowing types to be small again. Doesn't currently build
author | Chris Cannam |
---|---|
date | Thu, 19 Feb 2015 17:17:20 +0000 |
parents | a67663dc698d |
children | 487261a22b18 |
line wrap: on
line diff
--- a/src/Matcher.cpp Thu Feb 19 16:57:19 2015 +0000 +++ b/src/Matcher.cpp Thu Feb 19 17:17:20 2015 +0000 @@ -150,7 +150,7 @@ throw "Distance not available"; } distance_t dist = m_distance[i][j - m_first[i]]; - if (dist < 0) { + if (dist == InvalidDistance) { cerr << "ERROR: Matcher::getDistance(" << i << ", " << j << "): " << "Location is in range, but distance (" << dist << ") is invalid or has not been set" << endl; @@ -233,8 +233,8 @@ Matcher::size() { int distSize = (m_params.maxRunCount + 1) * m_blockSize; - m_bestPathCost.resize(m_distXSize, pathcostvec_t(distSize, -1)); - m_distance.resize(m_distXSize, distancevec_t(distSize, -1)); + 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); @@ -270,10 +270,10 @@ // Same for bestPathCost. distancevec_t dOld(m_distance[m_frameCount - m_blockSize]); - distancevec_t dNew(len, -1.f); + distancevec_t dNew(len, InvalidDistance); pathcostvec_t bpcOld(m_bestPathCost[m_frameCount - m_blockSize]); - pathcostvec_t bpcNew(len, -1.0); + pathcostvec_t bpcNew(len, InvalidPathCost); advancevec_t adOld(m_advance[m_frameCount - m_blockSize]); advancevec_t adNew(len, AdvanceNone); @@ -307,7 +307,7 @@ (m_features[frameIndex], m_otherMatcher->m_features[index % m_blockSize]); - distance_t diagDistance = distance * m_params.diagonalWeight; + distance_t diagDistance = distance_t(distance * m_params.diagonalWeight); if ((m_frameCount == 0) && (index == 0)) { // first element @@ -410,7 +410,7 @@ { distance_t weighted = distance; if (dir == AdvanceBoth) { - weighted *= m_params.diagonalWeight; + weighted = distance_t(weighted * m_params.diagonalWeight); } if (m_firstPM) { @@ -430,8 +430,8 @@ // pauses in either direction, and arbitrary lengths at // end, it is better than a segmentation fault. cerr << "Emergency resize: " << idx << " -> " << idx * 2 << endl; - m_otherMatcher->m_bestPathCost[j].resize(idx * 2, -1); - m_otherMatcher->m_distance[j].resize(idx * 2, -1); + m_otherMatcher->m_bestPathCost[j].resize(idx * 2, InvalidPathCost); + m_otherMatcher->m_distance[j].resize(idx * 2, InvalidDistance); m_otherMatcher->m_advance[j].resize(idx * 2, AdvanceNone); }