comparison query.cpp @ 448:ac9bf14f7071 api-inversion

audiodb_set_up_dbpointers() is a better name than audiodb_set_up_db().
author mas01cr
date Wed, 24 Dec 2008 10:56:53 +0000
parents b75c1e826058
children bc5a69e81036
comparison
equal deleted inserted replaced
447:b75c1e826058 448:ac9bf14f7071
479 } 479 }
480 480
481 return 0; 481 return 0;
482 } 482 }
483 483
484 // FIXME: this is not the right name; we're not actually setting up 484 static int audiodb_set_up_dbpointers(adb_t *adb, adb_query_spec_t *spec, adb_qpointers_internal_t *dbpointers) {
485 // the database, but copying various bits of it out of mmap()ed tables
486 // in order to reduce seeks.
487 static int audiodb_set_up_db(adb_t *adb, adb_query_spec_t *spec, adb_qpointers_internal_t *dbpointers) {
488 uint32_t nvectors = adb->header->length / (adb->header->dim * sizeof(double)); 485 uint32_t nvectors = adb->header->length / (adb->header->dim * sizeof(double));
489 uint32_t sequence_length = spec->qid.sequence_length; 486 uint32_t sequence_length = spec->qid.sequence_length;
490 487
491 bool using_power = spec->refine.flags & (ADB_REFINE_ABSOLUTE_THRESHOLD|ADB_REFINE_RELATIVE_THRESHOLD); 488 bool using_power = spec->refine.flags & (ADB_REFINE_ABSOLUTE_THRESHOLD|ADB_REFINE_RELATIVE_THRESHOLD);
492 bool using_times = spec->refine.flags & ADB_REFINE_DURATION_RATIO; 489 bool using_times = spec->refine.flags & ADB_REFINE_DURATION_RATIO;
601 598
602 // Compute database info 599 // Compute database info
603 // FIXME: we more than likely don't need very much of the database 600 // FIXME: we more than likely don't need very much of the database
604 // so make a new method to build these values per-track or, even better, per-point 601 // so make a new method to build these values per-track or, even better, per-point
605 if( !( dbH->flags & O2_FLAG_LARGE_ADB) ) 602 if( !( dbH->flags & O2_FLAG_LARGE_ADB) )
606 if(audiodb_set_up_db(adb, spec, &dbpointers)) { 603 if(audiodb_set_up_dbpointers(adb, spec, &dbpointers)) {
607 error("failed to set up db"); 604 error("failed to set up db");
608 } 605 }
609 606
610 // We are guaranteed that the order of points is sorted by: 607 // We are guaranteed that the order of points is sorted by:
611 // trackID, spos, qpos 608 // trackID, spos, qpos
707 704
708 if(audiodb_query_spec_qpointers(adb, spec, &query_data, &query, &qpointers)) { 705 if(audiodb_query_spec_qpointers(adb, spec, &query_data, &query, &qpointers)) {
709 error("failed to set up qpointers"); 706 error("failed to set up qpointers");
710 } 707 }
711 708
712 if(audiodb_set_up_db(adb, spec, &dbpointers)) { 709 if(audiodb_set_up_dbpointers(adb, spec, &dbpointers)) {
713 error("failed to set up db"); 710 error("failed to set up db");
714 } 711 }
715 712
716 unsigned j,k,track,trackOffset=0, HOP_SIZE=sequenceHop; 713 unsigned j,k,track,trackOffset=0, HOP_SIZE=sequenceHop;
717 unsigned wL = spec->qid.sequence_length; 714 unsigned wL = spec->qid.sequence_length;