Mercurial > hg > match-vamp
diff src/Finder.cpp @ 60:faa523be20f9 refactors_no_float
Update both Feeders so as to recognise the end of one input before the other has ended. MatchFeeder does this by detecting trailing silence (as both its inputs are technically the same length since the shorter is zero-padded) and reporting that to Finder. MatchFeatureFeeder simply recognises missing features at the end and won't queue them.
author | Chris Cannam |
---|---|
date | Fri, 14 Nov 2014 13:53:58 +0000 |
parents | 47f7649ab9d5 |
children | 19a93b15fcc3 ad417dd05e0b 61c7d11ba86d |
line wrap: on
line diff
--- a/src/Finder.cpp Fri Nov 14 10:25:57 2014 +0000 +++ b/src/Finder.cpp Fri Nov 14 13:53:58 2014 +0000 @@ -31,6 +31,8 @@ index2 = 0; rowRange = new int[2]; colRange = new int[2]; + duration1 = -1; + duration2 = -1; } // constructor Finder::~Finder() @@ -39,6 +41,13 @@ delete[] colRange; } +void +Finder::setDurations(int d1, int d2) +{ + duration1 = d1; + duration2 = d2; +} + bool Finder::find(int i1, int i2) { @@ -252,6 +261,13 @@ int x = pm2->getFrameCount() - 1; int y = pm1->getFrameCount() - 1; + if (duration2 > 0 && duration2 < pm2->getFrameCount()) { + x = duration2 - 1; + } + if (duration1 > 0 && duration1 < pm1->getFrameCount()) { + y = duration1 - 1; + } + recalculatePathCostMatrix(0, 0, y, x); pathx.clear();