Mercurial > hg > audiodb
diff index.cpp @ 311:cac5b3465318
Added sequencehop on Indexing to optionally reduce size of large indexes. Added cleanup() call on WS query exit to fix MMAP memory leak
author | mas01mc |
---|---|
date | Sat, 09 Aug 2008 15:04:16 +0000 |
parents | 896679d8cc39 |
children | b9eff6896943 c93be2f3a674 |
line wrap: on
line diff
--- a/index.cpp Fri Aug 08 14:01:33 2008 +0000 +++ b/index.cpp Sat Aug 09 15:04:16 2008 +0000 @@ -285,9 +285,11 @@ Uns32T audioDB::index_insert_shingles(vector<vector<float> >* vv, Uns32T trackID, double* spp){ Uns32T collisionCount = 0; cout << "[" << trackID << "]" << fileTable+trackID*O2_FILETABLE_ENTRY_SIZE; - for( Uns32T pointID=0 ; pointID < (*vv).size(); pointID++) - if(!use_absolute_threshold || (use_absolute_threshold && (*spp++ >= absolute_threshold))) + for( Uns32T pointID=0 ; pointID < (*vv).size(); pointID+=sequenceHop) + if(!use_absolute_threshold || (use_absolute_threshold && (*spp >= absolute_threshold))){ collisionCount += lsh->insert_point((*vv)[pointID], index_from_trackInfo(trackID, pointID)); + spp+=sequenceHop; + } return collisionCount; } @@ -381,7 +383,7 @@ lsh = index_allocate(indexName, false); // Get the header only here sequenceLength = lsh->get_lshHeader()->dataDim / dbH->dim; // shingleDim / vectorDim - if(!SERVER_LSH_INDEX_SINGLETON){ + if(lsh!=SERVER_LSH_INDEX_SINGLETON){ if( fabs(radius - lsh->get_radius())>fabs(O2_DISTANCE_TOLERANCE)) printf("*** Warning: adb_radius (%f) != lsh_radius (%f) ***\n", radius, lsh->get_radius()); printf("INDEX: dim %d\n", dbH->dim);