changeset 126:b9f1c375f28a audiodb-debian

Merge trunk changes -r143:145 to audiodb-debian branch (+ new debian/changelog version)
author mas01cr
date Wed, 17 Oct 2007 14:52:39 +0000
parents 8d0942525fab
children 5bac833c41b5
files audioDB.cpp debian/changelog tests/0023/run-test.sh tests/0023/short-description
diffstat 4 files changed, 77 insertions(+), 20 deletions(-) [+]
line wrap: on
line diff
--- 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; i<dbH->numFiles; 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(thisDist<minSample)
@@ -1699,13 +1700,13 @@
 	      logSampleSum+=log(thisDist);
 	    }
 
-	    // diffL2 = fabs(qNorm[j] - sNorm[trackIndexOffset+k]);
+	    // diffL2 = fabs(qnPtr[j] - sNorm[trackIndexOffset+k]);
 	    // Power test
 	    if(!USE_THRESH || 
 	       // Threshold on mean L2 of Q and S sequences
-	       (USE_THRESH && qNorm[j]>SILENCE_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; i<dbH->numFiles; 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(thisDist<minSample)
@@ -2202,13 +2204,13 @@
 	      logSampleSum+=log(thisDist);
 	    }
 
-	    // diffL2 = fabs(qNorm[j] - sNorm[trackIndexOffset+k]);
+	    // diffL2 = fabs(qnPtr[j] - sNorm[trackIndexOffset+k]);
 	    // Power test
 	    if(!USE_THRESH || 
 	       // Threshold on mean L2 of Q and S sequences
-	       (USE_THRESH && qNorm[j]>SILENCE_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;
--- 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 <c.rhodes@gold.ac.uk>  Wed, 17 Oct 2007 15:48:33 +0100
+
 audiodb (1.0-11) unstable; urgency=low
 
   * Updated to svn version #142
--- /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 <<EOF
+testfeature01
+testfeature10
+EOF
+
+${AUDIODB} -d testdb -B -F testfeaturefiles
+
+# sequence queries require L2NORM
+${AUDIODB} -d testdb -L
+
+echo "query point (0.0,0.5)"
+intstring 2 > 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
--- /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