# HG changeset patch # User mas01cr # Date 1190287824 0 # Node ID 67de6f2c5f7d94f4efb72162179a3f3a400670da # Parent c02b5a6104a9dcc19f5c1ae697b1aa350aeea817 Fix a couple of off-by-one errors, including one which was preventing a sequence match of the length of the track from matching, and one which was causing the threshold computation to yield NaN for one-frame tracks. Mark a couple more off-by-one errors as needing to be fixed. diff -r c02b5a6104a9 -r 67de6f2c5f7d audioDB.cpp --- a/audioDB.cpp Thu Sep 20 11:29:15 2007 +0000 +++ b/audioDB.cpp Thu Sep 20 11:30:24 2007 +0000 @@ -1520,13 +1520,13 @@ unsigned processedTracks=0; for(i=0; inumFiles; i++){ if(trackTable[i]>sequenceLength-1){ - w = trackTable[i]-sequenceLength; + w = trackTable[i]-sequenceLength+1; pn = sMeanL2+i; *pn=0; while(w--) if(*ps>0) *pn+=*ps++; - *pn/=trackTable[i]-sequenceLength; + *pn/=trackTable[i]-sequenceLength+1; SILENCE_THRESH+=*pn; processedTracks++; } @@ -1699,7 +1699,7 @@ trackOffset=trackOffsetTable[track]; // numDoubles offset trackIndexOffset=trackOffset/dbH->dim; // numVectors offset - if(sequenceLength7) cerr << track << "." << trackIndexOffset << "." << trackTable[track] << " | ";cerr.flush(); @@ -1801,7 +1801,7 @@ thisDist=1000000.0; // k-NN match algorithm - m=pointNN; + m=pointNN; /* FIXME: -1? distances[pointNN] */ while(m--){ if(thisDist<=distances[m]) if(m==0 || thisDist>=distances[m-1]){ @@ -1835,7 +1835,7 @@ // All the track stuff goes here - n=trackNN; + n=trackNN; /* FIXME: trackNN-1 */ while(n--){ if(thisDist<=trackDistances[n]){ if((n==0 || thisDist>=trackDistances[n-1])){