Mercurial > hg > audiodb
comparison query.cpp @ 545:bf89c80ec4cc multiprobeLSH
Expanded interface to audiodb_insert_create_datum() and audiodb_track_id_datum() to include _offset versions of both. Default cache is NULL, but offset and size parameters required.
author | mas01mc |
---|---|
date | Sun, 08 Feb 2009 15:53:57 +0000 |
parents | 6afeb2c76957 |
children | e8193805ce42 1731a6c457d7 |
comparison
equal
deleted
inserted
replaced
544:283b412083db | 545:bf89c80ec4cc |
---|---|
196 | 196 |
197 error: | 197 error: |
198 return 1; | 198 return 1; |
199 } | 199 } |
200 | 200 |
201 int audiodb_track_id_datum(adb_t *adb, uint32_t track_id, adb_datum_t *d, off_t vector_offset=0, size_t num_vectors=0, adb_fd_cache_t* cache=0){ | 201 int audiodb_track_id_datum(adb_t * adb, uint32_t track_id, adb_datum_t *datum){ |
202 return audiodb_track_id_datum_offset(adb, track_id , datum, 0, 0, 0); | |
203 } | |
204 | |
205 int audiodb_track_id_datum_offset(adb_t *adb, uint32_t track_id, adb_datum_t *d, off_t vector_offset, size_t num_vectors, adb_fd_cache_t* cache){ | |
202 off_t track_offset = (*adb->track_offsets)[track_id]; | 206 off_t track_offset = (*adb->track_offsets)[track_id]; |
203 | 207 |
204 if(adb->header->flags & ADB_HEADER_FLAG_REFERENCES) { | 208 if(adb->header->flags & ADB_HEADER_FLAG_REFERENCES) { |
205 /* create a reference/insert, then use adb_insert_create_datum() */ | 209 /* create a reference/insert, then use adb_insert_create_datum() */ |
206 adb_reference_t *reference = NULL; | 210 adb_reference_t *reference = NULL; |
234 lseek(adb->fd, adb->header->timesTableOffset + track_id * ADB_FILETABLE_ENTRY_SIZE, SEEK_SET); | 238 lseek(adb->fd, adb->header->timesTableOffset + track_id * ADB_FILETABLE_ENTRY_SIZE, SEEK_SET); |
235 read_or_goto_error(adb->fd, (void *)reference->times, ADB_MAXSTR); | 239 read_or_goto_error(adb->fd, (void *)reference->times, ADB_MAXSTR); |
236 } | 240 } |
237 } | 241 } |
238 | 242 |
239 int retval = audiodb_insert_create_datum(reference, d, vector_offset*adb->header->dim*sizeof(double), num_vectors*adb->header->dim*sizeof(double), cache); | 243 int retval = audiodb_insert_create_datum_offset(reference, d, vector_offset*adb->header->dim*sizeof(double), num_vectors*adb->header->dim*sizeof(double), cache); |
240 if(!cache){ | 244 if(!cache){ |
241 audiodb_free_datum_reference(reference); | 245 audiodb_free_datum_reference(reference); |
242 free(reference); | 246 free(reference); |
243 } | 247 } |
244 return retval; | 248 return retval; |
522 if(pp.trackID != currentTrack){ | 526 if(pp.trackID != currentTrack){ |
523 audiodb_free_datum(&d); | 527 audiodb_free_datum(&d); |
524 currentTrack = pp.trackID; | 528 currentTrack = pp.trackID; |
525 } | 529 } |
526 maybe_delete_array(dbpointers.mean_duration); | 530 maybe_delete_array(dbpointers.mean_duration); |
527 if(audiodb_track_id_datum(adb, pp.trackID, &d, pp.spos, sequence_length, &c)) { | 531 if(audiodb_track_id_datum_offset(adb, pp.trackID, &d, pp.spos, sequence_length, &c)) { |
528 delete qstate->exact_evaluation_queue; | 532 delete qstate->exact_evaluation_queue; |
529 delete qstate->set; | 533 delete qstate->set; |
530 audiodb_free_datum(&d); | 534 audiodb_free_datum(&d); |
531 audiodb_free_datum_cache(&c); | 535 audiodb_free_datum_cache(&c); |
532 return 1; | 536 return 1; |