Mercurial > hg > match-vamp
comparison src/Finder.cpp @ 70:a130ec8e5eef refactors
Minor float fixes
author | Chris Cannam |
---|---|
date | Tue, 18 Nov 2014 17:20:37 +0000 |
parents | 696f6e7f2f31 |
children | c3c50d5e05b7 |
comparison
equal
deleted
inserted
replaced
69:696f6e7f2f31 | 70:a130ec8e5eef |
---|---|
247 } | 247 } |
248 if ((c >= prevRowStart) && (c < prevRowStop)) { | 248 if ((c >= prevRowStart) && (c < prevRowStop)) { |
249 // vertical from (r-1,c) | 249 // vertical from (r-1,c) |
250 double cost = pm1->m_bestPathCost[r-1][c-pm1->m_first[r-1]] + | 250 double cost = pm1->m_bestPathCost[r-1][c-pm1->m_first[r-1]] + |
251 newCost; | 251 newCost; |
252 if ((min == -1) || (cost < min)) { | 252 if ((min < 0) || (cost < min)) { |
253 min = cost; | 253 min = cost; |
254 dir = Matcher::AdvanceThis; | 254 dir = Matcher::AdvanceThis; |
255 } | 255 } |
256 } | 256 } |
257 if (c > thisRowStart) { | 257 if (c > thisRowStart) { |
258 // horizontal from (r,c-1) | 258 // horizontal from (r,c-1) |
259 double cost =pm1->m_bestPathCost[r][i2-1]+newCost; | 259 double cost = pm1->m_bestPathCost[r][i2-1]+newCost; |
260 if ((min == -1) || (cost < min)) { | 260 if ((min < 0) || (cost < min)) { |
261 min = cost; | 261 min = cost; |
262 dir = Matcher::AdvanceOther; | 262 dir = Matcher::AdvanceOther; |
263 } | 263 } |
264 } | 264 } |
265 pm1->m_bestPathCost[r][i2] = min; | 265 pm1->m_bestPathCost[r][i2] = min; |
324 pathx.push_back(x); | 324 pathx.push_back(x); |
325 pathy.push_back(y); | 325 pathy.push_back(y); |
326 | 326 |
327 switch (getAdvance()) { | 327 switch (getAdvance()) { |
328 case Matcher::AdvanceThis: | 328 case Matcher::AdvanceThis: |
329 // cerr << ", going down (dist = " << (int)getDistance() << ")" << endl; | 329 // cerr << ", going down (dist = " << getDistance() << ")" << endl; |
330 y--; | 330 y--; |
331 break; | 331 break; |
332 case Matcher::AdvanceOther: | 332 case Matcher::AdvanceOther: |
333 // cerr << ", going left (dist = " << (int)getDistance() << ")" << endl; | 333 // cerr << ", going left (dist = " << getDistance() << ")" << endl; |
334 x--; | 334 x--; |
335 break; | 335 break; |
336 case Matcher::AdvanceBoth: | 336 case Matcher::AdvanceBoth: |
337 // cerr << ", going diag (dist = " << (int)getDistance() << ")" << endl; | 337 // cerr << ", going diag (dist = " << getDistance() << ")" << endl; |
338 x--; | 338 x--; |
339 y--; | 339 y--; |
340 break; | 340 break; |
341 case Matcher::AdvanceNone: // this would indicate a bug, but we wouldn't want to hang | 341 case Matcher::AdvanceNone: // this would indicate a bug, but we wouldn't want to hang |
342 cerr << "WARNING: Neither matcher advanced in path backtrack at (" << x << "," << y << ")" << endl; | 342 cerr << "WARNING: Neither matcher advanced in path backtrack at (" << x << "," << y << ")" << endl; |