Mercurial > hg > match-vamp
comparison src/Matcher.cpp @ 181:8e7f96432570 types
Introduce (though don't use properly) types header; get to build
author | Chris Cannam |
---|---|
date | Thu, 19 Feb 2015 16:45:42 +0000 |
parents | d1bc89794cd4 |
children | a67663dc698d |
comparison
equal
deleted
inserted
replaced
180:d1bc89794cd4 | 181:8e7f96432570 |
---|---|
205 return m_otherMatcher->getPathCost(j, i); | 205 return m_otherMatcher->getPathCost(j, i); |
206 } | 206 } |
207 } | 207 } |
208 | 208 |
209 void | 209 void |
210 Matcher::setPathCost(int i, int j, Advance dir, double pathCost) | 210 Matcher::setPathCost(int i, int j, advance_t dir, double pathCost) |
211 { | 211 { |
212 if (m_firstPM) { | 212 if (m_firstPM) { |
213 if (!isInRange(i, j)) { | 213 if (!isInRange(i, j)) { |
214 cerr << "ERROR: Matcher::setPathCost(" << i << ", " << j << ", " | 214 cerr << "ERROR: Matcher::setPathCost(" << i << ", " << j << ", " |
215 << dir << ", " << pathCost | 215 << dir << ", " << pathCost |
233 Matcher::size() | 233 Matcher::size() |
234 { | 234 { |
235 int distSize = (m_params.maxRunCount + 1) * m_blockSize; | 235 int distSize = (m_params.maxRunCount + 1) * m_blockSize; |
236 m_bestPathCost.resize(m_distXSize, vector<double>(distSize, -1)); | 236 m_bestPathCost.resize(m_distXSize, vector<double>(distSize, -1)); |
237 m_distance.resize(m_distXSize, vector<float>(distSize, -1)); | 237 m_distance.resize(m_distXSize, vector<float>(distSize, -1)); |
238 m_advance.resize(m_distXSize, vector<Advance>(distSize, AdvanceNone)); | 238 m_advance.resize(m_distXSize, vector<advance_t>(distSize, AdvanceNone)); |
239 m_first.resize(m_distXSize, 0); | 239 m_first.resize(m_distXSize, 0); |
240 m_last.resize(m_distXSize, 0); | 240 m_last.resize(m_distXSize, 0); |
241 } | 241 } |
242 | 242 |
243 void | 243 void |
273 vector<float> dNew(len, -1.f); | 273 vector<float> dNew(len, -1.f); |
274 | 274 |
275 vector<double> bpcOld = m_bestPathCost[m_frameCount - m_blockSize]; | 275 vector<double> bpcOld = m_bestPathCost[m_frameCount - m_blockSize]; |
276 vector<double> bpcNew(len, -1.0); | 276 vector<double> bpcNew(len, -1.0); |
277 | 277 |
278 vector<Advance> adOld = m_advance[m_frameCount - m_blockSize]; | 278 vector<advance_t> adOld = m_advance[m_frameCount - m_blockSize]; |
279 vector<Advance> adNew(len, AdvanceNone); | 279 vector<advance_t> adNew(len, AdvanceNone); |
280 | 280 |
281 for (int i = 0; i < len; ++i) { | 281 for (int i = 0; i < len; ++i) { |
282 dNew[i] = dOld[i]; | 282 dNew[i] = dOld[i]; |
283 bpcNew[i] = bpcOld[i]; | 283 bpcNew[i] = bpcOld[i]; |
284 adNew[i] = adOld[i]; | 284 adNew[i] = adOld[i]; |
404 | 404 |
405 m_otherMatcher->m_runCount = 0; | 405 m_otherMatcher->m_runCount = 0; |
406 } | 406 } |
407 | 407 |
408 void | 408 void |
409 Matcher::updateValue(int i, int j, Advance dir, double value, float distance) | 409 Matcher::updateValue(int i, int j, advance_t dir, double value, float distance) |
410 { | 410 { |
411 float weighted = distance; | 411 float weighted = distance; |
412 if (dir == AdvanceBoth) { | 412 if (dir == AdvanceBoth) { |
413 weighted *= m_params.diagonalWeight; | 413 weighted *= m_params.diagonalWeight; |
414 } | 414 } |
438 m_otherMatcher->setDistance(j, i, distance); | 438 m_otherMatcher->setDistance(j, i, distance); |
439 m_otherMatcher->setPathCost(j, i, dir, value + weighted); | 439 m_otherMatcher->setPathCost(j, i, dir, value + weighted); |
440 } | 440 } |
441 } | 441 } |
442 | 442 |
443 Matcher::Advance | 443 advance_t |
444 Matcher::getAdvance(int i, int j) | 444 Matcher::getAdvance(int i, int j) |
445 { | 445 { |
446 if (m_firstPM) { | 446 if (m_firstPM) { |
447 if (!isInRange(i, j)) { | 447 if (!isInRange(i, j)) { |
448 cerr << "ERROR: Matcher::getAdvance(" << i << ", " << j << "): " | 448 cerr << "ERROR: Matcher::getAdvance(" << i << ", " << j << "): " |