comparison 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
comparison
equal deleted inserted replaced
57:47f7649ab9d5 60:faa523be20f9
29 pm2 = p2; 29 pm2 = p2;
30 index1 = 0; 30 index1 = 0;
31 index2 = 0; 31 index2 = 0;
32 rowRange = new int[2]; 32 rowRange = new int[2];
33 colRange = new int[2]; 33 colRange = new int[2];
34 duration1 = -1;
35 duration2 = -1;
34 } // constructor 36 } // constructor
35 37
36 Finder::~Finder() 38 Finder::~Finder()
37 { 39 {
38 delete[] rowRange; 40 delete[] rowRange;
39 delete[] colRange; 41 delete[] colRange;
42 }
43
44 void
45 Finder::setDurations(int d1, int d2)
46 {
47 duration1 = d1;
48 duration2 = d2;
40 } 49 }
41 50
42 bool 51 bool
43 Finder::find(int i1, int i2) 52 Finder::find(int i1, int i2)
44 { 53 {
250 Finder::retrievePath(bool smooth, vector<int> &pathx, vector<int> &pathy) 259 Finder::retrievePath(bool smooth, vector<int> &pathx, vector<int> &pathy)
251 { 260 {
252 int x = pm2->getFrameCount() - 1; 261 int x = pm2->getFrameCount() - 1;
253 int y = pm1->getFrameCount() - 1; 262 int y = pm1->getFrameCount() - 1;
254 263
264 if (duration2 > 0 && duration2 < pm2->getFrameCount()) {
265 x = duration2 - 1;
266 }
267 if (duration1 > 0 && duration1 < pm1->getFrameCount()) {
268 y = duration1 - 1;
269 }
270
255 recalculatePathCostMatrix(0, 0, y, x); 271 recalculatePathCostMatrix(0, 0, y, x);
256 272
257 pathx.clear(); 273 pathx.clear();
258 pathy.clear(); 274 pathy.clear();
259 275