Mercurial > hg > svapp
changeset 783:4d10365aa6a9
Pull across a fix from the MATCH code
author | Chris Cannam |
---|---|
date | Fri, 17 Jul 2020 18:02:59 +0100 |
parents | 700fc9e4852d |
children | ee430e9ffccc |
files | align/DTW.h |
diffstat | 1 files changed, 15 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/align/DTW.h Fri Jul 17 14:24:30 2020 +0100 +++ b/align/DTW.h Fri Jul 17 18:02:59 2020 +0100 @@ -144,10 +144,24 @@ #endif } - while (i > 0 && (j > 0 || subsequence)) { + while (i > 0 || j > 0) { alignment[i] = j; + if (i == 0) { + if (subsequence) { + break; + } else { + --j; + continue; + } + } + + if (j == 0) { + --i; + continue; + } + cost_t a = costs[j-1][i]; cost_t b = costs[j][i-1]; cost_t both = costs[j-1][i-1];