comparison index.cpp @ 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 9b13ea44e302
children d65410f4bb85
comparison
equal deleted inserted replaced
423:b09d2eb1a2b2 424:c6046dd80570
538 assert(instancePtr); // We need an instance for this callback 538 assert(instancePtr); // We need an instance for this callback
539 audioDB* myself = (audioDB*) instancePtr; // Use explicit cast to recover "this" instance 539 audioDB* myself = (audioDB*) instancePtr; // Use explicit cast to recover "this" instance
540 Uns32T trackID = index_to_trackID(pointID, myself->lsh_n_point_bits); 540 Uns32T trackID = index_to_trackID(pointID, myself->lsh_n_point_bits);
541 Uns32T spos = index_to_trackPos(pointID, myself->lsh_n_point_bits); 541 Uns32T spos = index_to_trackPos(pointID, myself->lsh_n_point_bits);
542 // Skip identity in query_from_key 542 // Skip identity in query_from_key
543 if( !myself->query_from_key || (myself->query_from_key && ( trackID != myself->query_from_key_index )) ) 543 if( !myself->query_from_key || (myself->query_from_key && ( trackID != myself->query_from_key_index )) ) {
544 myself->reporter->add_point(trackID, qpos, spos, dist); 544 adb_result_t r;
545 r.key = myself->fileTable + trackID * O2_FILETABLE_ENTRY_SIZE;
546 r.dist = dist;
547 r.qpos = qpos;
548 r.ipos = spos;
549 myself->accumulator->add_point(&r);
550 }
545 } 551 }
546 552
547 // *Static* exact NN point reporter callback method for lshlib 553 // *Static* exact NN point reporter callback method for lshlib
548 // Maintain a queue of points to pass to query_points() for exact evaluation 554 // Maintain a queue of points to pass to query_points() for exact evaluation
549 void audioDB::index_add_point_exact(void* instancePtr, Uns32T pointID, Uns32T qpos, float dist){ 555 void audioDB::index_add_point_exact(void* instancePtr, Uns32T pointID, Uns32T qpos, float dist){