Mercurial > hg > match-vamp
changeset 68:7aa1ab3db7c9 cheap_diagonals
Merge from branch refactors_no_float
author | Chris Cannam |
---|---|
date | Tue, 18 Nov 2014 10:33:12 +0000 |
parents | a1ff2d45548c (current diff) 61c7d11ba86d (diff) |
children | e1a5f3095ba6 |
files | src/Finder.cpp |
diffstat | 1 files changed, 19 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/src/Finder.cpp Tue Nov 18 10:10:11 2014 +0000 +++ b/src/Finder.cpp Tue Nov 18 10:33:12 2014 +0000 @@ -280,8 +280,13 @@ int Finder::retrievePath(bool smooth, vector<int> &pathx, vector<int> &pathy) { - int x = pm2->getFrameCount() - 1; - int y = pm1->getFrameCount() - 1; + int ex = pm2->getFrameCount() - 1; + int ey = pm1->getFrameCount() - 1; + + int x = ex; + int y = ey; + +// cerr << "before: x = " << x << ", y = " << y << endl; if (duration2 > 0 && duration2 < pm2->getFrameCount()) { x = duration2 - 1; @@ -290,11 +295,23 @@ y = duration1 - 1; } + if (!find(y, x)) { + // Path did not pass through the expected end point -- + // probably means the pieces are substantially different in + // the later bits. Reset the expected end point to the end of + // both files including any trailing silence. + cerr << "NOTE: Path did not pass through expected end point, inputs are probably significantly different" << endl; + x = ex; + y = ey; + } + recalculatePathCostMatrix(0, 0, y, x); pathx.clear(); pathy.clear(); +// cerr << "start: x = " << x << ", y = " << y << endl; + while (find(y, x) && ((x > 0) || (y > 0))) { // cerr << "x = " << x << ", y = " << y;