Mercurial > hg > svapp
comparison align/TransformDTWAligner.cpp @ 780:8fa98f89eda8
Add subsequence DTW (not yet in use)
author | Chris Cannam |
---|---|
date | Wed, 01 Jul 2020 15:34:46 +0100 |
parents | 699b5b130ea2 |
children | b651dc5ff555 |
comparison
equal
deleted
inserted
replaced
779:5de2b710cfae | 780:8fa98f89eda8 |
---|---|
295 | 295 |
296 path.add(PathPoint(0, 0)); | 296 path.add(PathPoint(0, 0)); |
297 | 297 |
298 for (int i = 0; in_range_for(alignment, i); ++i) { | 298 for (int i = 0; in_range_for(alignment, i); ++i) { |
299 | 299 |
300 // DTW returns "the index into s2 for each element in s1" | 300 // DTW returns "the index into s1 for each element in s2" |
301 sv_frame_t refFrame = refFrames[i]; | 301 sv_frame_t alignedFrame = otherFrames[i]; |
302 | 302 |
303 if (!in_range_for(otherFrames, alignment[i])) { | 303 if (!in_range_for(refFrames, alignment[i])) { |
304 SVCERR << "TransformDTWAligner::makePath: Internal error: " | 304 SVCERR << "TransformDTWAligner::makePath: Internal error: " |
305 << "DTW maps index " << i << " in reference frame vector " | 305 << "DTW maps index " << i << " in other frame vector " |
306 << "(size " << refFrames.size() << ") onto index " | 306 << "(size " << otherFrames.size() << ") onto index " |
307 << alignment[i] << " in other frame vector " | 307 << alignment[i] << " in ref frame vector " |
308 << "(only size " << otherFrames.size() << ")" << endl; | 308 << "(only size " << refFrames.size() << ")" << endl; |
309 continue; | 309 continue; |
310 } | 310 } |
311 | 311 |
312 sv_frame_t alignedFrame = otherFrames[alignment[i]]; | 312 sv_frame_t refFrame = refFrames[alignment[i]]; |
313 path.add(PathPoint(alignedFrame, refFrame)); | 313 path.add(PathPoint(alignedFrame, refFrame)); |
314 } | 314 } |
315 | 315 |
316 return path; | 316 return path; |
317 } | 317 } |
359 #ifdef DEBUG_TRANSFORM_DTW_ALIGNER | 359 #ifdef DEBUG_TRANSFORM_DTW_ALIGNER |
360 SVCERR << "TransformDTWAligner[" << this | 360 SVCERR << "TransformDTWAligner[" << this |
361 << "]: serialising DTW to avoid over-allocation" << endl; | 361 << "]: serialising DTW to avoid over-allocation" << endl; |
362 #endif | 362 #endif |
363 QMutexLocker locker(&m_dtwMutex); | 363 QMutexLocker locker(&m_dtwMutex); |
364 alignment = dtw.alignSeries(s1, s2); | 364 alignment = dtw.alignSequences(s1, s2); |
365 } | 365 } |
366 | 366 |
367 #ifdef DEBUG_TRANSFORM_DTW_ALIGNER | 367 #ifdef DEBUG_TRANSFORM_DTW_ALIGNER |
368 SVCERR << "TransformDTWAligner[" << this << "]: performAlignmentMagnitude: " | 368 SVCERR << "TransformDTWAligner[" << this << "]: performAlignmentMagnitude: " |
369 << "DTW produced " << alignment.size() << " points:" << endl; | 369 << "DTW produced " << alignment.size() << " points:" << endl; |
448 #ifdef DEBUG_TRANSFORM_DTW_ALIGNER | 448 #ifdef DEBUG_TRANSFORM_DTW_ALIGNER |
449 SVCERR << "TransformDTWAligner[" << this | 449 SVCERR << "TransformDTWAligner[" << this |
450 << "]: serialising DTW to avoid over-allocation" << endl; | 450 << "]: serialising DTW to avoid over-allocation" << endl; |
451 #endif | 451 #endif |
452 QMutexLocker locker(&m_dtwMutex); | 452 QMutexLocker locker(&m_dtwMutex); |
453 alignment = dtw.alignSeries(s1, s2); | 453 alignment = dtw.alignSequences(s1, s2); |
454 } | 454 } |
455 | 455 |
456 #ifdef DEBUG_TRANSFORM_DTW_ALIGNER | 456 #ifdef DEBUG_TRANSFORM_DTW_ALIGNER |
457 SVCERR << "TransformDTWAligner[" << this << "]: performAlignmentRiseFall: " | 457 SVCERR << "TransformDTWAligner[" << this << "]: performAlignmentRiseFall: " |
458 << "DTW produced " << alignment.size() << " points:" << endl; | 458 << "DTW produced " << alignment.size() << " points:" << endl; |