changeset 500:fbcc1303dfeb memory-leaks

Fixed bug in LSH_N_POINT_BITS coding when using AudioDB with LSH indexes
author mas01mc
date Sat, 10 Jan 2009 20:01:53 +0000
parents 920919d62542
children 081ced1b2da2
files audioDB.h common.cpp create.cpp
diffstat 3 files changed, 9 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/audioDB.h	Sat Jan 10 13:38:22 2009 +0000
+++ b/audioDB.h	Sat Jan 10 20:01:53 2009 +0000
@@ -88,6 +88,10 @@
 #define LSH_N_POINT_BITS O2_DEFAULT_LSH_N_POINT_BITS
 #endif
 
+#define LSH_POINT_BITS_FIELD_POSITION 27  // LSB bit position in 32-bit int for n_point_bits
+#define LSH_POINT_BITS_FIELD_MAX 31       // maximum value possible given LSH_POINT_BITS_FIELD_POSITION
+
+
 // LIMIT PARAMETERS
 #define O2_DEFAULT_DATASIZE (1355U) // in MB
 #define O2_DEFAULT_NTRACKS (20000U)
--- a/common.cpp	Sat Jan 10 13:38:22 2009 +0000
+++ b/common.cpp	Sat Jan 10 20:01:53 2009 +0000
@@ -180,7 +180,7 @@
   }
 
   // Assign correct number of point bits per track in LSH indexing / retrieval
-  lsh_n_point_bits = dbH->flags >> 28;
+  lsh_n_point_bits = dbH->flags >> LSH_POINT_BITS_FIELD_POSITION;
   if( !lsh_n_point_bits )
     lsh_n_point_bits = O2_DEFAULT_LSH_N_POINT_BITS;
 }
--- a/create.cpp	Sat Jan 10 13:38:22 2009 +0000
+++ b/create.cpp	Sat Jan 10 20:01:53 2009 +0000
@@ -55,11 +55,11 @@
   // For backward-compatibility, Record the point-encoding parameter for LSH indexing in the adb header
   // If this value is 0 then it will be set to 14
 
-  #if LSH_N_POINT_BITS > 31
-  #error "AudioDB Compile ERROR: consistency check of O2_LSH_POINT_BITS failed (>31)"
-  #endif
+#if LSH_N_POINT_BITS > LSH_POINT_BITS_FIELD_MAX
+#error "AudioDB Compile ERROR: consistency check of O2_LSH_POINT_BITS failed (>31)"
+#endif
   
-  dbH->flags |= LSH_N_POINT_BITS << 27;
+  dbH->flags |= LSH_N_POINT_BITS << LSH_POINT_BITS_FIELD_POSITION;
 
   // If database will fit in a single file the vectors are copied into the AudioDB instance
   // Else all the vectors are left on the FileSystem and we use the dataOffset as storage