Mercurial > hg > audiodb
comparison query-indexed.cpp @ 529:e532666226bc multiprobeLSH
Fixed a problem with inserting into exact_evaluation_queue, duplicate pairs were being inserted when querying multiple hashtables. That is now fixed by adding a unique constraint using set<PointPair> inserts and testing. This should speed things up quite a bit (like, 10-fold with default num tables).
author | mas01mc |
---|---|
date | Fri, 30 Jan 2009 14:58:35 +0000 |
parents | 561339c7fd26 |
children | aa715b3e18db |
comparison
equal
deleted
inserted
replaced
528:561339c7fd26 | 529:e532666226bc |
---|---|
68 uint32_t trackID = audiodb_index_to_track_id(pointID, nbits); | 68 uint32_t trackID = audiodb_index_to_track_id(pointID, nbits); |
69 uint32_t spos = audiodb_index_to_track_pos(pointID, nbits); | 69 uint32_t spos = audiodb_index_to_track_pos(pointID, nbits); |
70 std::set<std::string>::iterator keys_end = qstate->allowed_keys->end(); | 70 std::set<std::string>::iterator keys_end = qstate->allowed_keys->end(); |
71 if(qstate->allowed_keys->find((*adb->keys)[trackID]) != keys_end) { | 71 if(qstate->allowed_keys->find((*adb->keys)[trackID]) != keys_end) { |
72 PointPair p(trackID, qpos, spos); | 72 PointPair p(trackID, qpos, spos); |
73 qstate->exact_evaluation_queue->push(p); | 73 if(qstate->set->find(p)==qstate->set->end()){ |
74 qstate->set->insert(p); | |
75 qstate->exact_evaluation_queue->push(p); | |
76 } | |
74 } | 77 } |
75 } | 78 } |
76 | 79 |
77 // return -1 on error | 80 // return -1 on error |
78 // return 0: if index does not exist | 81 // return 0: if index does not exist |
96 | 99 |
97 if(spec->qid.flags & ADB_QID_FLAG_ALLOW_FALSE_POSITIVES) { | 100 if(spec->qid.flags & ADB_QID_FLAG_ALLOW_FALSE_POSITIVES) { |
98 add_point_func = &audiodb_index_add_point_approximate; | 101 add_point_func = &audiodb_index_add_point_approximate; |
99 } else { | 102 } else { |
100 qstate->exact_evaluation_queue = new std::priority_queue<PointPair>; | 103 qstate->exact_evaluation_queue = new std::priority_queue<PointPair>; |
104 qstate->set = new std::set<PointPair, less<PointPair> >; | |
101 add_point_func = &audiodb_index_add_point_exact; | 105 add_point_func = &audiodb_index_add_point_exact; |
102 } | 106 } |
103 | 107 |
104 /* FIXME: this hardwired lsh_in_core is here to allow for a | 108 /* FIXME: this hardwired lsh_in_core is here to allow for a |
105 * transition period while the need for the argument is worked | 109 * transition period while the need for the argument is worked |