# HG changeset patch # User mas01mc # Date 1231617713 0 # Node ID fbcc1303dfeb6f23093cead909e67e40cb0380c9 # Parent 920919d625421f50da5d658587b6e0ab9a96ddf0 Fixed bug in LSH_N_POINT_BITS coding when using AudioDB with LSH indexes diff -r 920919d62542 -r fbcc1303dfeb audioDB.h --- 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) diff -r 920919d62542 -r fbcc1303dfeb common.cpp --- 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; } diff -r 920919d62542 -r fbcc1303dfeb create.cpp --- 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