# HG changeset patch # User mas01cr # Date 1192632759 0 # Node ID b9f1c375f28af4950e0d369fe3d425d3314479b8 # Parent 8d0942525fab04ed81e314389c925d37c1b29e3f Merge trunk changes -r143:145 to audiodb-debian branch (+ new debian/changelog version) diff -r 8d0942525fab -r b9f1c375f28a audioDB.cpp --- a/audioDB.cpp Wed Oct 17 14:14:02 2007 +0000 +++ b/audioDB.cpp Wed Oct 17 14:52:39 2007 +0000 @@ -1393,6 +1393,7 @@ // Copy the L2 norm values to core to avoid disk random access later on memcpy(sNorm, l2normTable, dbVectors*sizeof(double)); + double* qnPtr = qNorm; double* snPtr = sNorm; for(i=0; inumFiles; i++){ if(trackTable[i]>=sequenceLength){ @@ -1452,10 +1453,10 @@ } w=sequenceLength-1; i=1; - tmp1=*qNorm; + tmp1=*qnPtr; while(w--) - *qNorm+=qNorm[i++]; - ps = qNorm+1; + *qnPtr+=qnPtr[i++]; + ps = qnPtr+1; w=numVectors-sequenceLength; // +1 -1 while(w--){ tmp2=*ps; @@ -1463,7 +1464,7 @@ tmp1=tmp2; ps++; } - ps = qNorm; + ps = qnPtr; qMeanL2 = 0; w=numVectors-sequenceLength+1; while(w--){ @@ -1554,7 +1555,7 @@ cerr << "query point: " << queryPoint << endl; cerr.flush(); } query=query+queryPoint*dbH->dim; - qNorm=qNorm+queryPoint; + qnPtr=qnPtr+queryPoint; numVectors=wL; } @@ -1684,9 +1685,9 @@ // Search for minimum distance by shingles (concatenated vectors) for(j=0;j<=numVectors-wL;j+=HOP_SIZE) for(k=0;k<=trackTable[track]-wL;k+=HOP_SIZE){ - thisDist=2-(2/(qNorm[j]*sNorm[trackIndexOffset+k]))*DD[j][k]; + thisDist=2-(2/(qnPtr[j]*sNorm[trackIndexOffset+k]))*DD[j][k]; if(verbosity>10) { - cerr << thisDist << " " << qNorm[j] << " " << sNorm[trackIndexOffset+k] << endl; + cerr << thisDist << " " << qnPtr[j] << " " << sNorm[trackIndexOffset+k] << endl; } // Gather chi^2 statistics if(thisDistSILENCE_THRESH && sNorm[trackIndexOffset+k]>SILENCE_THRESH && + (USE_THRESH && qnPtr[j]>SILENCE_THRESH && sNorm[trackIndexOffset+k]>SILENCE_THRESH && // Are both query and target windows above mean energy? - (qNorm[j]>qMeanL2*.25 && sNorm[trackIndexOffset+k]>sMeanL2[track]*.25))) // && diffL2 < DIFF_THRESH ))) + (qnPtr[j]>qMeanL2*.25 && sNorm[trackIndexOffset+k]>sMeanL2[track]*.25))) // && diffL2 < DIFF_THRESH ))) thisDist=thisDist; // Computed above else thisDist=1000000.0; @@ -1897,6 +1898,7 @@ // Copy the L2 norm values to core to avoid disk random access later on memcpy(sNorm, l2normTable, dbVectors*sizeof(double)); double* snPtr = sNorm; + double* qnPtr = qNorm; for(i=0; inumFiles; i++){ if(trackTable[i]>=sequenceLength){ tmp1=*snPtr; @@ -1955,10 +1957,10 @@ } w=sequenceLength-1; i=1; - tmp1=*qNorm; + tmp1=*qnPtr; while(w--) - *qNorm+=qNorm[i++]; - ps = qNorm+1; + *qnPtr+=qnPtr[i++]; + ps = qnPtr+1; w=numVectors-sequenceLength; // +1 -1 while(w--){ tmp2=*ps; @@ -1966,7 +1968,7 @@ tmp1=tmp2; ps++; } - ps = qNorm; + ps = qnPtr; qMeanL2 = 0; w=numVectors-sequenceLength+1; while(w--){ @@ -2057,7 +2059,7 @@ cerr << "query point: " << queryPoint << endl; cerr.flush(); } query=query+queryPoint*dbH->dim; - qNorm=qNorm+queryPoint; + qnPtr=qnPtr+queryPoint; numVectors=wL; } @@ -2187,9 +2189,9 @@ // Search for minimum distance by shingles (concatenated vectors) for(j=0;j<=numVectors-wL;j+=HOP_SIZE) for(k=0;k<=trackTable[track]-wL;k+=HOP_SIZE){ - thisDist=2-(2/(qNorm[j]*sNorm[trackIndexOffset+k]))*DD[j][k]; + thisDist=2-(2/(qnPtr[j]*sNorm[trackIndexOffset+k]))*DD[j][k]; if(verbosity>10) { - cerr << thisDist << " " << qNorm[j] << " " << sNorm[trackIndexOffset+k] << endl; + cerr << thisDist << " " << qnPtr[j] << " " << sNorm[trackIndexOffset+k] << endl; } // Gather chi^2 statistics if(thisDistSILENCE_THRESH && sNorm[trackIndexOffset+k]>SILENCE_THRESH && + (USE_THRESH && qnPtr[j]>SILENCE_THRESH && sNorm[trackIndexOffset+k]>SILENCE_THRESH && // Are both query and target windows above mean energy? - (qNorm[j]>qMeanL2*.25 && sNorm[trackIndexOffset+k]>sMeanL2[track]*.25))) // && diffL2 < DIFF_THRESH ))) + (qnPtr[j]>qMeanL2*.25 && sNorm[trackIndexOffset+k]>sMeanL2[track]*.25))) // && diffL2 < DIFF_THRESH ))) thisDist=thisDist; // Computed above else thisDist=1000000.0; diff -r 8d0942525fab -r b9f1c375f28a debian/changelog --- a/debian/changelog Wed Oct 17 14:14:02 2007 +0000 +++ b/debian/changelog Wed Oct 17 14:52:39 2007 +0000 @@ -1,3 +1,10 @@ +audiodb (1.0-12) unstable; urgency=low + + * Updated to svn version #145 + * (fixes some double-free() crashes in the server process, *sigh*) + + -- Christophe Rhodes Wed, 17 Oct 2007 15:48:33 +0100 + audiodb (1.0-11) unstable; urgency=low * Updated to svn version #142 diff -r 8d0942525fab -r b9f1c375f28a tests/0023/run-test.sh --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tests/0023/run-test.sh Wed Oct 17 14:52:39 2007 +0000 @@ -0,0 +1,47 @@ +#! /bin/sh + +. ../test-utils.sh + +if [ -f testdb ]; then rm -f testdb; fi + +${AUDIODB} -d testdb -N + +intstring 2 > testfeature01 +floatstring 0 1 >> testfeature01 +intstring 2 > testfeature10 +floatstring 1 0 >> testfeature10 + +cat > testfeaturefiles < testquery +floatstring 0 0.5 >> testquery +floatstring 0.5 0 >> testquery + +${AUDIODB} -d testdb -Q sequence -l 1 -f testquery -p 0 > testoutput +echo testfeature01 0 0 0 > test-expected-output +echo testfeature10 2 0 0 >> test-expected-output +cmp testoutput test-expected-output +${AUDIODB} -d testdb -Q sequence -l 1 -f testquery -r 1 -p 0 > testoutput +echo testfeature01 0 0 0 > test-expected-output +cmp testoutput test-expected-output + +echo "query point (0.5,0.0)" + +${AUDIODB} -d testdb -Q sequence -l 1 -f testquery -p 1 > testoutput +echo testfeature10 0 1 0 > test-expected-output +echo testfeature01 2 1 0 >> test-expected-output +cmp testoutput test-expected-output +${AUDIODB} -d testdb -Q sequence -l 1 -f testquery -r 1 -p 1 > testoutput +echo testfeature10 0 1 0 > test-expected-output +cmp testoutput test-expected-output + +exit 104 diff -r 8d0942525fab -r b9f1c375f28a tests/0023/short-description --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tests/0023/short-description Wed Oct 17 14:52:39 2007 +0000 @@ -0,0 +1,1 @@ +as 0022 but with -p \ No newline at end of file