comparison src/Matcher.cpp @ 83:10e76188c846 refactors

Expose diagonal weight as a parameter
author Chris Cannam
date Thu, 27 Nov 2014 10:49:11 +0000
parents b9aa663a607b
children de7034e93dd0
comparison
equal deleted inserted replaced
82:3616d541d69e 83:10e76188c846
337 } 337 }
338 338
339 void 339 void
340 Matcher::updateValue(int i, int j, Advance dir, double value, float dMN) 340 Matcher::updateValue(int i, int j, Advance dir, double value, float dMN)
341 { 341 {
342 float weighted = dMN;
343 if (dir == AdvanceBoth) {
344 weighted *= m_params.diagonalWeight;
345 }
346
342 if (m_firstPM) { 347 if (m_firstPM) {
343 348
344 m_distance[i][j - m_first[i]] = dMN; 349 m_distance[i][j - m_first[i]] = dMN;
345 setPathCost(i, j, dir, value + (dir == AdvanceBoth ? dMN*2: dMN)); 350
351 setPathCost(i, j, dir, value + weighted);
346 352
347 } else { 353 } else {
348 354
349 int idx = i - m_otherMatcher->m_first[j]; 355 int idx = i - m_otherMatcher->m_first[j];
350 356
357 m_otherMatcher->m_distance[j].resize(idx * 2, -1); 363 m_otherMatcher->m_distance[j].resize(idx * 2, -1);
358 m_otherMatcher->m_advance[j].resize(idx * 2, AdvanceNone); 364 m_otherMatcher->m_advance[j].resize(idx * 2, AdvanceNone);
359 } 365 }
360 366
361 m_otherMatcher->m_distance[j][idx] = dMN; 367 m_otherMatcher->m_distance[j][idx] = dMN;
362 m_otherMatcher->setPathCost(j, i, dir, value + (dir == AdvanceBoth ? dMN*2: dMN)); 368 m_otherMatcher->setPathCost(j, i, dir, value + weighted);
363 } 369 }
364 } 370 }
365 371
366 Matcher::Advance 372 Matcher::Advance
367 Matcher::getAdvance(int i, int j) 373 Matcher::getAdvance(int i, int j)