Mercurial > hg > audiodb
comparison audioDB-internals.h @ 693:b1723ae7675e
begin work on sampling API
This is motivated by the need to be able to sample with arbitrary feature data
(e.g. from a feature file) against a database, for the JNMR "collections" paper
revisions or possible ISMIR paper revisions. That bit doesn't work yet, but
the C-ified version of the current functionality (sample db x db and
sample key x db) works to the level of anecdotal tests.
The general approach is to mirror the _query_spec() API, where a whole heap
of knobs and twiddles are available to the user. Unlike in the _query_spec()
API, not quite all of the knobs make sense (and even fewer are actually
implemented), but the basic idea is the same.
I pity the poor chump who will have to document all this.
author | mas01cr |
---|---|
date | Thu, 22 Apr 2010 21:03:47 +0000 |
parents | e1f7cab30701 |
children | ddf08008d45b |
comparison
equal
deleted
inserted
replaced
692:02756c5ca15a | 693:b1723ae7675e |
---|---|
4 #if !defined(WIN32) | 4 #if !defined(WIN32) |
5 #include <sys/mman.h> | 5 #include <sys/mman.h> |
6 #endif | 6 #endif |
7 #include <sys/stat.h> | 7 #include <sys/stat.h> |
8 #include <sys/types.h> | 8 #include <sys/types.h> |
9 #include <sys/time.h> | |
9 | 10 |
10 #include <stdio.h> | 11 #include <stdio.h> |
11 #include <errno.h> | 12 #include <errno.h> |
12 #include <fcntl.h> | 13 #include <fcntl.h> |
13 #if defined(WIN32) | 14 #if defined(WIN32) |
18 #include <string.h> | 19 #include <string.h> |
19 #include <unistd.h> | 20 #include <unistd.h> |
20 #if defined(WIN32) | 21 #if defined(WIN32) |
21 #include <windows.h> | 22 #include <windows.h> |
22 #endif | 23 #endif |
24 | |
25 #include <gsl/gsl_rng.h> | |
23 | 26 |
24 #include <algorithm> | 27 #include <algorithm> |
25 #include <iostream> | 28 #include <iostream> |
26 #include <map> | 29 #include <map> |
27 #include <queue> | 30 #include <queue> |
117 std::vector<std::string> *keys; | 120 std::vector<std::string> *keys; |
118 std::map<std::string,uint32_t> *keymap; | 121 std::map<std::string,uint32_t> *keymap; |
119 std::vector<uint32_t> *track_lengths; | 122 std::vector<uint32_t> *track_lengths; |
120 std::vector<off_t> *track_offsets; | 123 std::vector<off_t> *track_offsets; |
121 LSH *cached_lsh; | 124 LSH *cached_lsh; |
125 gsl_rng *rng; | |
122 }; | 126 }; |
123 | 127 |
124 typedef struct { | 128 typedef struct { |
125 bool operator() (const adb_result_t &r1, const adb_result_t &r2) { | 129 bool operator() (const adb_result_t &r1, const adb_result_t &r2) { |
126 return strcmp(r1.ikey, r2.ikey) < 0; | 130 return strcmp(r1.ikey, r2.ikey) < 0; |
372 LSH *audiodb_index_allocate(adb_t *, char *, bool); | 376 LSH *audiodb_index_allocate(adb_t *, char *, bool); |
373 vector<vector<float> > *audiodb_index_initialize_shingles(uint32_t, uint32_t, uint32_t); | 377 vector<vector<float> > *audiodb_index_initialize_shingles(uint32_t, uint32_t, uint32_t); |
374 void audiodb_index_delete_shingles(vector<vector<float> > *); | 378 void audiodb_index_delete_shingles(vector<vector<float> > *); |
375 void audiodb_index_make_shingle(vector<vector<float> > *, uint32_t, double *, uint32_t, uint32_t); | 379 void audiodb_index_make_shingle(vector<vector<float> > *, uint32_t, double *, uint32_t, uint32_t); |
376 int audiodb_index_norm_shingles(vector<vector<float> > *, double *, double *, uint32_t, uint32_t, double, bool, bool, float); | 380 int audiodb_index_norm_shingles(vector<vector<float> > *, double *, double *, uint32_t, uint32_t, double, bool, bool, float); |
381 int audiodb_sample_loop(adb_t *, const adb_query_spec_t *, adb_qstate_internal_t *); | |
377 | 382 |
378 #define ADB_MAXSTR (512U) | 383 #define ADB_MAXSTR (512U) |
379 #define ADB_FILETABLE_ENTRY_SIZE (256U) | 384 #define ADB_FILETABLE_ENTRY_SIZE (256U) |
380 #define ADB_TRACKTABLE_ENTRY_SIZE (sizeof(uint32_t)) | 385 #define ADB_TRACKTABLE_ENTRY_SIZE (sizeof(uint32_t)) |
381 #define ADB_DISTANCE_TOLERANCE (1e-6) | 386 #define ADB_DISTANCE_TOLERANCE (1e-6) |