Mercurial > hg > match-vamp
comparison src/Matcher.cpp @ 214:97cc0b9135e7
Refer to distances rather than path costs for availability (in case we deem old path costs surplus to requirement for live tracking)
author | Chris Cannam |
---|---|
date | Thu, 05 Mar 2015 09:47:15 +0000 |
parents | 827176d3b6ec |
children | aa795f660b2b |
comparison
equal
deleted
inserted
replaced
213:2fcd1c14f0f6 | 214:97cc0b9135e7 |
---|---|
79 bool | 79 bool |
80 Matcher::isAvailable(int i, int j) | 80 Matcher::isAvailable(int i, int j) |
81 { | 81 { |
82 if (m_firstPM) { | 82 if (m_firstPM) { |
83 if (isInRange(i, j)) { | 83 if (isInRange(i, j)) { |
84 return (m_bestPathCost[i][j - m_first[i]] != INVALID_PATHCOST); | 84 return (m_distance[i][j - m_first[i]] != INVALID_DISTANCE); |
85 } else { | 85 } else { |
86 return false; | 86 return false; |
87 } | 87 } |
88 } else { | 88 } else { |
89 return m_otherMatcher->isAvailable(j, i); | 89 return m_otherMatcher->isAvailable(j, i); |
94 Matcher::isRowAvailable(int i) | 94 Matcher::isRowAvailable(int i) |
95 { | 95 { |
96 if (m_firstPM) { | 96 if (m_firstPM) { |
97 | 97 |
98 if (i < 0 || i >= int(m_first.size())) return false; | 98 if (i < 0 || i >= int(m_first.size())) return false; |
99 for (auto c: m_bestPathCost[i]) { | 99 for (auto c: m_distance[i]) { |
100 if (c != INVALID_PATHCOST) return true; | 100 if (c != INVALID_DISTANCE) return true; |
101 } | 101 } |
102 return false; | 102 return false; |
103 | 103 |
104 } else { | 104 } else { |
105 return m_otherMatcher->isColAvailable(i); | 105 return m_otherMatcher->isColAvailable(i); |
110 Matcher::isColAvailable(int j) | 110 Matcher::isColAvailable(int j) |
111 { | 111 { |
112 if (m_firstPM) { | 112 if (m_firstPM) { |
113 for (int i = 0; i < int(m_first.size()); ++i) { | 113 for (int i = 0; i < int(m_first.size()); ++i) { |
114 if (j >= m_first[i] && j < m_last[i]) { | 114 if (j >= m_first[i] && j < m_last[i]) { |
115 if (m_bestPathCost[i][j - m_first[i]] != INVALID_PATHCOST) { | 115 if (m_distance[i][j - m_first[i]] != INVALID_DISTANCE) { |
116 return true; | 116 return true; |
117 } | 117 } |
118 } | 118 } |
119 } | 119 } |
120 return false; | 120 return false; |
128 { | 128 { |
129 if (m_firstPM) { | 129 if (m_firstPM) { |
130 return ((i >= 0) && | 130 return ((i >= 0) && |
131 (i < int(m_first.size())) && | 131 (i < int(m_first.size())) && |
132 (j >= m_first[i]) && | 132 (j >= m_first[i]) && |
133 (j < int(m_first[i] + m_bestPathCost[i].size()))); | 133 (j < int(m_first[i] + m_distance[i].size()))); |
134 } else { | 134 } else { |
135 return m_otherMatcher->isInRange(j, i); | 135 return m_otherMatcher->isInRange(j, i); |
136 } | 136 } |
137 } | 137 } |
138 | 138 |