Mercurial > hg > match-vamp
comparison src/Finder.cpp @ 66:61c7d11ba86d refactors_no_float
Fix handling of path lookup in case where the expected end point (end of silence in both files) is not available
author | Chris Cannam |
---|---|
date | Tue, 18 Nov 2014 10:31:37 +0000 |
parents | faa523be20f9 |
children | a3efb15e7faf 7aa1ab3db7c9 |
comparison
equal
deleted
inserted
replaced
63:a540137d393b | 66:61c7d11ba86d |
---|---|
256 } // recalculatePathCostMatrix() | 256 } // recalculatePathCostMatrix() |
257 | 257 |
258 int | 258 int |
259 Finder::retrievePath(bool smooth, vector<int> &pathx, vector<int> &pathy) | 259 Finder::retrievePath(bool smooth, vector<int> &pathx, vector<int> &pathy) |
260 { | 260 { |
261 int x = pm2->getFrameCount() - 1; | 261 int ex = pm2->getFrameCount() - 1; |
262 int y = pm1->getFrameCount() - 1; | 262 int ey = pm1->getFrameCount() - 1; |
263 | |
264 int x = ex; | |
265 int y = ey; | |
266 | |
267 // cerr << "before: x = " << x << ", y = " << y << endl; | |
263 | 268 |
264 if (duration2 > 0 && duration2 < pm2->getFrameCount()) { | 269 if (duration2 > 0 && duration2 < pm2->getFrameCount()) { |
265 x = duration2 - 1; | 270 x = duration2 - 1; |
266 } | 271 } |
267 if (duration1 > 0 && duration1 < pm1->getFrameCount()) { | 272 if (duration1 > 0 && duration1 < pm1->getFrameCount()) { |
268 y = duration1 - 1; | 273 y = duration1 - 1; |
269 } | 274 } |
270 | 275 |
276 if (!find(y, x)) { | |
277 // Path did not pass through the expected end point -- | |
278 // probably means the pieces are substantially different in | |
279 // the later bits. Reset the expected end point to the end of | |
280 // both files including any trailing silence. | |
281 cerr << "NOTE: Path did not pass through expected end point, inputs are probably significantly different" << endl; | |
282 x = ex; | |
283 y = ey; | |
284 } | |
285 | |
271 recalculatePathCostMatrix(0, 0, y, x); | 286 recalculatePathCostMatrix(0, 0, y, x); |
272 | 287 |
273 pathx.clear(); | 288 pathx.clear(); |
274 pathy.clear(); | 289 pathy.clear(); |
275 | 290 |
291 // cerr << "start: x = " << x << ", y = " << y << endl; | |
292 | |
276 while (find(y, x) && ((x > 0) || (y > 0))) { | 293 while (find(y, x) && ((x > 0) || (y > 0))) { |
277 | 294 |
278 // cerr << "x = " << x << ", y = " << y; | 295 // cerr << "x = " << x << ", y = " << y; |
279 | 296 |
280 pathx.push_back(x); | 297 pathx.push_back(x); |