Mercurial > hg > audiodb
changeset 424:c6046dd80570 api-inversion
Accumulators everywhere!
Now all codepaths go through accumulators, and the reporter is only used
right at the very end.
author | mas01cr |
---|---|
date | Wed, 24 Dec 2008 10:55:12 +0000 |
parents | b09d2eb1a2b2 |
children | d65410f4bb85 |
files | index.cpp query.cpp |
diffstat | 2 files changed, 16 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/index.cpp Wed Dec 24 10:55:08 2008 +0000 +++ b/index.cpp Wed Dec 24 10:55:12 2008 +0000 @@ -540,8 +540,14 @@ Uns32T trackID = index_to_trackID(pointID, myself->lsh_n_point_bits); Uns32T spos = index_to_trackPos(pointID, myself->lsh_n_point_bits); // Skip identity in query_from_key - if( !myself->query_from_key || (myself->query_from_key && ( trackID != myself->query_from_key_index )) ) - myself->reporter->add_point(trackID, qpos, spos, dist); + if( !myself->query_from_key || (myself->query_from_key && ( trackID != myself->query_from_key_index )) ) { + adb_result_t r; + r.key = myself->fileTable + trackID * O2_FILETABLE_ENTRY_SIZE; + r.dist = dist; + r.qpos = qpos; + r.ipos = spos; + myself->accumulator->add_point(&r); + } } // *Static* exact NN point reporter callback method for lshlib
--- a/query.cpp Wed Dec 24 10:55:08 2008 +0000 +++ b/query.cpp Wed Dec 24 10:55:12 2008 +0000 @@ -639,8 +639,14 @@ dist = qn*qn + sn*sn - 2*dist; // else // dist = dist; - if((!radius) || dist <= (O2_LSH_EXACT_MULT*radius+O2_DISTANCE_TOLERANCE)) - reporter->add_point(pp.trackID, pp.qpos, pp.spos, dist); + if((!radius) || dist <= (O2_LSH_EXACT_MULT*radius+O2_DISTANCE_TOLERANCE)) { + adb_result_t r; + r.key = fileTable + pp.trackID * O2_FILETABLE_ENTRY_SIZE; + r.dist = dist; + r.qpos = pp.qpos; + r.ipos = pp.spos; + accumulator->add_point(&r); + } } exact_evaluation_queue->pop(); }