Mercurial > hg > audiodb
changeset 57:67de6f2c5f7d
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.
author | mas01cr |
---|---|
date | Thu, 20 Sep 2007 11:30:24 +0000 |
parents | c02b5a6104a9 |
children | 7e18b5adce8c |
files | audioDB.cpp |
diffstat | 1 files changed, 5 insertions(+), 5 deletions(-) [+] |
line wrap: on
line diff
--- 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; i<dbH->numFiles; 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(sequenceLength<trackTable[track]){ // test for short sequences + if(sequenceLength<=trackTable[track]){ // test for short sequences if(verbosity>7) 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])){