mas01mc@292
|
1 #ifndef __AUDIODB_H_
|
mas01mc@292
|
2 #define __AUDIODB_H_
|
mas01mc@292
|
3
|
mas01cr@0
|
4 #include <stdio.h>
|
mas01cr@0
|
5 #include <stdlib.h>
|
mas01cr@0
|
6 #include <sys/types.h>
|
mas01cr@0
|
7 #include <sys/stat.h>
|
mas01cr@0
|
8 #include <sys/mman.h>
|
mas01cr@0
|
9 #include <fcntl.h>
|
mas01cr@0
|
10 #include <string.h>
|
mas01cr@0
|
11 #include <iostream>
|
mas01cr@0
|
12 #include <fstream>
|
mas01cr@302
|
13 #include <set>
|
mas01cr@498
|
14 #include <map>
|
mas01cr@302
|
15 #include <string>
|
mas01cr@0
|
16 #include <math.h>
|
mas01cr@0
|
17 #include <sys/time.h>
|
mas01cr@0
|
18 #include <assert.h>
|
mas01cr@62
|
19 #include <float.h>
|
mas01cr@104
|
20 #include <signal.h>
|
mas01cr@280
|
21 #include <gsl/gsl_rng.h>
|
mas01cr@0
|
22
|
mas01mc@292
|
23 // includes for LSH indexing
|
mas01cr@498
|
24 extern "C" {
|
mas01cr@498
|
25 #include "audioDB_API.h"
|
mas01cr@498
|
26 }
|
mas01mc@292
|
27 #include "ReporterBase.h"
|
mas01cr@498
|
28 #include "accumulator.h"
|
mas01mc@292
|
29 #include "lshlib.h"
|
mas01mc@292
|
30
|
mas01cr@0
|
31 // includes for web services
|
mas01cr@0
|
32 #include "soapH.h"
|
mas01cr@0
|
33 #include "cmdline.h"
|
mas01cr@0
|
34
|
mas01cr@498
|
35 // should probably be rewritten
|
mas01cr@498
|
36 class PointPair{
|
mas01cr@498
|
37 public:
|
mas01cr@498
|
38 Uns32T trackID;
|
mas01cr@498
|
39 Uns32T qpos;
|
mas01cr@498
|
40 Uns32T spos;
|
mas01cr@498
|
41 PointPair(Uns32T a, Uns32T b, Uns32T c);
|
mas01cr@498
|
42 };
|
mas01cr@498
|
43 bool operator<(const PointPair& a, const PointPair& b);
|
mas01cr@498
|
44
|
mas01cr@0
|
45 #define MAXSTR 512
|
mas01cr@0
|
46
|
mas01cr@0
|
47 // Databse PRIMARY commands
|
mas01cr@0
|
48 #define COM_CREATE "--NEW"
|
mas01cr@0
|
49 #define COM_INSERT "--INSERT"
|
mas01cr@0
|
50 #define COM_BATCHINSERT "--BATCHINSERT"
|
mas01cr@0
|
51 #define COM_QUERY "--QUERY"
|
mas01cr@0
|
52 #define COM_STATUS "--STATUS"
|
mas01cr@0
|
53 #define COM_L2NORM "--L2NORM"
|
mas01cr@193
|
54 #define COM_POWER "--POWER"
|
mas01cr@0
|
55 #define COM_DUMP "--DUMP"
|
mas01cr@0
|
56 #define COM_SERVER "--SERVER"
|
mas01mc@292
|
57 #define COM_INDEX "--INDEX"
|
mas01cr@280
|
58 #define COM_SAMPLE "--SAMPLE"
|
mas01mc@334
|
59 #define COM_LISZT "--LISZT"
|
mas01cr@0
|
60
|
mas01cr@0
|
61 // parameters
|
mas01cr@0
|
62 #define COM_CLIENT "--client"
|
mas01cr@0
|
63 #define COM_DATABASE "--database"
|
mas01cr@0
|
64 #define COM_QTYPE "--qtype"
|
mas01cr@0
|
65 #define COM_SEQLEN "--sequencelength"
|
mas01cr@0
|
66 #define COM_SEQHOP "--sequencehop"
|
mas01cr@0
|
67 #define COM_POINTNN "--pointnn"
|
mas01mc@307
|
68 #define COM_RADIUS "--radius"
|
mas01mc@18
|
69 #define COM_TRACKNN "--resultlength"
|
mas01cr@0
|
70 #define COM_QPOINT "--qpoint"
|
mas01cr@0
|
71 #define COM_FEATURES "--features"
|
mas01cr@0
|
72 #define COM_QUERYKEY "--key"
|
mas01cr@0
|
73 #define COM_KEYLIST "--keyList"
|
mas01cr@0
|
74 #define COM_TIMES "--times"
|
mas01cr@193
|
75 #define COM_QUERYPOWER "--power"
|
mas01cr@193
|
76 #define COM_RELATIVE_THRESH "--relative-threshold"
|
mas01cr@193
|
77 #define COM_ABSOLUTE_THRESH "--absolute-threshold"
|
mas01mc@310
|
78 #define COM_EXHAUSTIVE "--exhaustive"
|
mas01mc@310
|
79 #define COM_LSH_EXACT "--lsh_exact"
|
mas01mc@471
|
80 #define COM_NO_UNIT_NORMING "--no_unit_norming"
|
mas01cr@0
|
81
|
mas01cr@108
|
82 #define O2_OLD_MAGIC ('O'|'2'<<8|'D'<<16|'B'<<24)
|
mas01cr@108
|
83 #define O2_MAGIC ('o'|'2'<<8|'d'<<16|'b'<<24)
|
mas01cr@210
|
84 #define O2_FORMAT_VERSION (4U)
|
mas01cr@0
|
85
|
mas01cr@0
|
86 #define O2_DEFAULT_POINTNN (10U)
|
mas01mc@18
|
87 #define O2_DEFAULT_TRACKNN (10U)
|
mas01cr@0
|
88
|
mas01mc@248
|
89 //#define O2_DEFAULTDBSIZE (4000000000) // 4GB table size
|
mas01mc@7
|
90 #define O2_DEFAULTDBSIZE (2000000000) // 2GB table size
|
mas01cr@0
|
91
|
mas01mc@295
|
92 // Bit masks for packing (trackID,pointID) into 32-bit unsigned int
|
mas01mc@324
|
93 // This can be controlled at compile time
|
mas01mc@324
|
94 #define O2_DEFAULT_LSH_N_POINT_BITS 14
|
mas01mc@324
|
95
|
mas01mc@324
|
96 // Override the default point bit width for large database support
|
mas01mc@324
|
97 #ifndef LSH_N_POINT_BITS
|
mas01mc@324
|
98 #define LSH_N_POINT_BITS O2_DEFAULT_LSH_N_POINT_BITS
|
mas01mc@324
|
99 #endif
|
mas01mc@295
|
100
|
mas01mc@295
|
101 // LIMIT PARAMETERS
|
mas01cr@256
|
102 #define O2_DEFAULT_DATASIZE (1355U) // in MB
|
mas01cr@256
|
103 #define O2_DEFAULT_NTRACKS (20000U)
|
mas01cr@256
|
104 #define O2_DEFAULT_DATADIM (9U)
|
mas01mc@292
|
105 #define O2_REALTYPE (double)
|
mas01mc@324
|
106 #define O2_MAXFILES (1000000U)
|
mas01cr@0
|
107 #define O2_MAXFILESTR (256U)
|
mas01cr@256
|
108 #define O2_FILETABLE_ENTRY_SIZE (O2_MAXFILESTR)
|
mas01cr@256
|
109 #define O2_TRACKTABLE_ENTRY_SIZE (sizeof(unsigned))
|
mas01cr@0
|
110 #define O2_HEADERSIZE (sizeof(dbTableHeaderT))
|
mas01cr@0
|
111 #define O2_MEANNUMVECTORS (1000U)
|
mas01mc@464
|
112 #define O2_MAXDIM (20000U)
|
mas01mc@263
|
113 #define O2_MAXNN (1000000U)
|
mas01mc@292
|
114 #define O2_MAXSEQLEN (8000U) // maximum feature vectors in a sequence
|
mas01mc@324
|
115 #define O2_MAXTRACKS (1000000U) // maximum number of tracks
|
mas01mc@324
|
116 #define O2_MAXTRACKLEN (1<<LSH_N_POINT_BITS) // maximum shingles in a track
|
mas01mc@292
|
117 #define O2_MAXDOTPRODUCTMEMORY (sizeof(O2_REALTYPE)*O2_MAXSEQLEN*O2_MAXSEQLEN) // 512MB
|
mas01mc@292
|
118 #define O2_DISTANCE_TOLERANCE (1e-6)
|
mas01mc@324
|
119 #define O2_SERIAL_MAX_TRACKBATCH (1000000)
|
mas01mc@324
|
120 #define O2_LARGE_ADB_SIZE (O2_DEFAULT_DATASIZE+1) // datasize at which features are kept externally (in Mbytes)
|
mas01mc@324
|
121 #define O2_LARGE_ADB_NTRACKS (O2_DEFAULT_NTRACKS+1) // ntracks at which features are kept externally
|
mas01mc@324
|
122 #define O2_MAX_VECTORS ( O2_MEANNUMVECTORS * O2_MAXTRACKS )
|
mas01cr@0
|
123
|
mas01cr@0
|
124 // Flags
|
mas01cr@0
|
125 #define O2_FLAG_L2NORM (0x1U)
|
mas01cr@0
|
126 #define O2_FLAG_MINMAX (0x2U)
|
mas01cr@193
|
127 #define O2_FLAG_POWER (0x4U)
|
mas01cr@0
|
128 #define O2_FLAG_TIMES (0x20U)
|
mas01mc@324
|
129 #define O2_FLAG_LARGE_ADB (0x40U)
|
mas01mc@301
|
130 #define DISPLAY_FLAG(x) (x?"on":"off")
|
mas01cr@0
|
131
|
mas01cr@105
|
132 // Query types
|
mas01cr@105
|
133 #define O2_POINT_QUERY (0x4U)
|
mas01cr@105
|
134 #define O2_SEQUENCE_QUERY (0x8U)
|
mas01cr@105
|
135 #define O2_TRACK_QUERY (0x10U)
|
mas01mc@248
|
136 #define O2_N_SEQUENCE_QUERY (0x20U)
|
mas01mc@263
|
137 #define O2_ONE_TO_ONE_N_SEQUENCE_QUERY (0x40U)
|
mas01mc@248
|
138
|
mas01cr@0
|
139 // Error Codes
|
mas01cr@0
|
140 #define O2_ERR_KEYNOTFOUND (0xFFFFFF00)
|
mas01cr@0
|
141
|
mas01cr@0
|
142 // Macros
|
mas01cr@0
|
143 #define O2_ACTION(a) (strcmp(command,a)==0)
|
mas01cr@0
|
144
|
mas01cr@370
|
145 #define ALIGN_UP(x,w) (((x) + ((1<<w)-1)) & ~((1<<w)-1))
|
mas01cr@108
|
146 #define ALIGN_DOWN(x,w) ((x) & ~((1<<w)-1))
|
mas01cr@108
|
147
|
mas01cr@370
|
148 #define ALIGN_PAGE_UP(x) (((x) + (getpagesize()-1)) & ~(getpagesize()-1))
|
mas01cr@196
|
149 #define ALIGN_PAGE_DOWN(x) ((x) & ~(getpagesize()-1))
|
mas01cr@196
|
150
|
mas01cr@166
|
151 #define ENSURE_STRING(x) ((x) ? (x) : "")
|
mas01cr@166
|
152
|
mas01cr@239
|
153 #define CHECKED_MMAP(type, var, start, length) \
|
mas01cr@239
|
154 { void *tmp = mmap(0, length, (PROT_READ | (forWrite ? PROT_WRITE : 0)), MAP_SHARED, dbfid, (start)); \
|
mas01cr@239
|
155 if(tmp == (void *) -1) { \
|
mas01cr@239
|
156 error("mmap error for db table", #var, "mmap"); \
|
mas01cr@239
|
157 } \
|
mas01cr@239
|
158 var = (type) tmp; \
|
mas01cr@239
|
159 }
|
mas01cr@239
|
160
|
mas01cr@370
|
161 #define CHECKED_READ(fd, buf, count) \
|
mas01cr@370
|
162 { size_t tmpcount = count; \
|
mas01cr@370
|
163 ssize_t tmp = read(fd, buf, tmpcount); \
|
mas01cr@370
|
164 if(tmp == -1) { \
|
mas01cr@370
|
165 error("read error", "", "read"); \
|
mas01cr@370
|
166 } else if((size_t) tmp != tmpcount) { \
|
mas01cr@370
|
167 error("short read", ""); \
|
mas01cr@370
|
168 } \
|
mas01cr@370
|
169 }
|
mas01cr@370
|
170
|
mas01cr@370
|
171 #define CHECKED_WRITE(fd, buf, count) \
|
mas01cr@370
|
172 { size_t tmpcount = count; \
|
mas01cr@370
|
173 ssize_t tmp = write(fd, buf, tmpcount); \
|
mas01cr@370
|
174 if(tmp == -1) { \
|
mas01cr@370
|
175 error("write error", "", "write"); \
|
mas01cr@370
|
176 } else if((size_t) tmp != tmpcount) { \
|
mas01cr@370
|
177 error("short write", ""); \
|
mas01cr@370
|
178 } \
|
mas01cr@370
|
179 }
|
mas01cr@370
|
180
|
mas01cr@239
|
181 #define VERB_LOG(vv, ...) \
|
mas01cr@239
|
182 if(verbosity > vv) { \
|
mas01cr@239
|
183 fprintf(stderr, __VA_ARGS__); \
|
mas01cr@239
|
184 fflush(stderr); \
|
mas01cr@239
|
185 }
|
mas01cr@0
|
186
|
mas01mc@324
|
187 // We will only use this in a 32-bit address space
|
mas01mc@324
|
188 // So map the off_t down to 32-bits first
|
mas01mc@324
|
189 #define INSERT_FILETABLE_STRING(TABLE, STR) \
|
mas01mc@324
|
190 strncpy(TABLE + dbH->numFiles*O2_FILETABLE_ENTRY_SIZE, STR, strlen(STR));
|
mas01mc@324
|
191
|
mas01mc@324
|
192 #define SAFE_DELETE(PTR) delete PTR; PTR=0;
|
mas01mc@324
|
193 #define SAFE_DELETE_ARRAY(PTR) delete[] PTR; PTR=0;
|
mas01mc@324
|
194
|
mas01mc@324
|
195 extern char* SERVER_ADB_ROOT;
|
mas01mc@324
|
196 extern char* SERVER_ADB_FEATURE_ROOT;
|
mas01mc@308
|
197
|
mas01cr@210
|
198 typedef struct dbTableHeader {
|
mas01cr@114
|
199 uint32_t magic;
|
mas01cr@114
|
200 uint32_t version;
|
mas01cr@114
|
201 uint32_t numFiles;
|
mas01cr@114
|
202 uint32_t dim;
|
mas01cr@114
|
203 uint32_t flags;
|
mas01cr@210
|
204 uint32_t headerSize;
|
mas01cr@196
|
205 off_t length;
|
mas01cr@196
|
206 off_t fileTableOffset;
|
mas01cr@196
|
207 off_t trackTableOffset;
|
mas01cr@196
|
208 off_t dataOffset;
|
mas01cr@196
|
209 off_t l2normTableOffset;
|
mas01cr@196
|
210 off_t timesTableOffset;
|
mas01cr@196
|
211 off_t powerTableOffset;
|
mas01cr@196
|
212 off_t dbSize;
|
mas01cr@0
|
213 } dbTableHeaderT, *dbTableHeaderPtr;
|
mas01cr@0
|
214
|
mas01mc@308
|
215 class audioDB{
|
mas01cr@0
|
216 private:
|
mas01cr@0
|
217 gengetopt_args_info args_info;
|
mas01cr@0
|
218 unsigned dim;
|
mas01cr@0
|
219 const char *dbName;
|
mas01cr@0
|
220 const char *inFile;
|
mas01cr@0
|
221 const char *hostport;
|
mas01cr@0
|
222 const char *key;
|
mas01mc@18
|
223 const char* trackFileName;
|
mas01cr@239
|
224 std::ifstream *trackFile;
|
mas01cr@0
|
225 const char *command;
|
mas01cr@131
|
226 const char *output;
|
mas01cr@0
|
227 const char *timesFileName;
|
mas01cr@239
|
228 std::ifstream *timesFile;
|
mas01cr@193
|
229 const char *powerFileName;
|
mas01cr@239
|
230 std::ifstream *powerFile;
|
mas01mc@324
|
231 const char* adb_root;
|
mas01mc@324
|
232 const char* adb_feature_root;
|
mas01mc@324
|
233
|
mas01cr@193
|
234 int powerfd;
|
mas01cr@0
|
235 int dbfid;
|
mas01mc@292
|
236 int lshfid;
|
mas01cr@196
|
237 bool forWrite;
|
mas01cr@0
|
238 int infid;
|
mas01cr@0
|
239 struct stat statbuf;
|
mas01cr@0
|
240 dbTableHeaderPtr dbH;
|
mas01cr@498
|
241 struct adb *adb;
|
mas01cr@284
|
242
|
mas01cr@284
|
243 gsl_rng *rng;
|
mas01cr@0
|
244
|
mas01mc@324
|
245 char* fileTable;
|
mas01mc@18
|
246 unsigned* trackTable;
|
mas01cr@0
|
247 double* l2normTable;
|
mas01cr@196
|
248 double* timesTable;
|
mas01cr@193
|
249 double* powerTable;
|
mas01cr@0
|
250
|
mas01mc@324
|
251 char* featureFileNameTable;
|
mas01mc@324
|
252 char* timesFileNameTable;
|
mas01mc@324
|
253 char* powerFileNameTable;
|
mas01mc@324
|
254
|
mas01cr@196
|
255 size_t fileTableLength;
|
mas01cr@196
|
256 size_t trackTableLength;
|
mas01cr@196
|
257 size_t timesTableLength;
|
mas01cr@196
|
258 size_t powerTableLength;
|
mas01cr@196
|
259 size_t l2normTableLength;
|
mas01cr@196
|
260
|
mas01cr@0
|
261 // Flags and parameters
|
mas01cr@0
|
262 unsigned verbosity; // how much do we want to know?
|
mas01cr@256
|
263
|
mas01cr@280
|
264 unsigned nsamples;
|
mas01cr@280
|
265
|
mas01cr@256
|
266 //off_t size; // given size (for creation)
|
mas01cr@256
|
267 unsigned datasize; // size in MB
|
mas01cr@256
|
268 unsigned ntracks;
|
mas01cr@256
|
269 unsigned datadim;
|
mas01cr@256
|
270
|
mas01cr@0
|
271 unsigned queryType; // point queries default
|
mas01cr@0
|
272 unsigned pointNN; // how many point NNs ?
|
mas01mc@18
|
273 unsigned trackNN; // how many track NNs ?
|
mas01cr@0
|
274 unsigned sequenceLength;
|
mas01cr@0
|
275 unsigned sequenceHop;
|
mas01cr@239
|
276 bool normalizedDistance;
|
mas01mc@292
|
277 bool no_unit_norming;
|
mas01cr@0
|
278 unsigned queryPoint;
|
mas01cr@0
|
279 unsigned usingQueryPoint;
|
mas01cr@0
|
280 unsigned usingTimes;
|
mas01cr@193
|
281 unsigned usingPower;
|
mas01cr@0
|
282 unsigned isClient;
|
mas01cr@0
|
283 unsigned isServer;
|
mas01cr@0
|
284 unsigned port;
|
mas01cr@0
|
285 double timesTol;
|
mas01mc@17
|
286 double radius;
|
mas01mc@292
|
287 bool query_from_key;
|
mas01mc@292
|
288 Uns32T query_from_key_index;
|
mas01cr@193
|
289 bool use_absolute_threshold;
|
mas01cr@193
|
290 double absolute_threshold;
|
mas01cr@193
|
291 bool use_relative_threshold;
|
mas01cr@193
|
292 double relative_threshold;
|
mas01mc@334
|
293
|
mas01mc@292
|
294 ReporterBase* reporter; // track/point reporter
|
mas01mc@414
|
295 set<Uns32T> * allowed_keys; // search restrict list by key
|
mas01mc@292
|
296
|
mas01mc@334
|
297 // LISZT parameters
|
mas01mc@334
|
298 unsigned lisztOffset;
|
mas01mc@334
|
299 unsigned lisztLength;
|
mas01mc@334
|
300
|
mas01cr@0
|
301 // private methods
|
mas01cr@32
|
302 void error(const char* a, const char* b = "", const char *sysFunc = 0);
|
mas01cr@193
|
303
|
mas01cr@498
|
304 void insertTimeStamps(unsigned n, std::ifstream* timesFile, double* timesdata);
|
mas01cr@284
|
305 void initRNG();
|
mas01cr@196
|
306 void initDBHeader(const char *dbName);
|
mas01cr@498
|
307 void initInputFile(const char *inFile);
|
mas01mc@292
|
308 void initTables(const char* dbName, const char* inFile = 0);
|
mas01mc@292
|
309 void initTablesFromKey(const char* dbName, const Uns32T queryIndex);
|
mas01mc@324
|
310 void prefix_name(char** const name, const char* prefix);
|
mas01mc@324
|
311
|
mas01cr@0
|
312 public:
|
mas01cr@370
|
313 audioDB(const unsigned argc, const char *argv[]);
|
mas01cr@370
|
314 audioDB(const unsigned argc, const char *argv[], adb__queryResponse *adbQueryResponse);
|
mas01cr@370
|
315 audioDB(const unsigned argc, const char *argv[], adb__statusResponse *adbStatusResponse);
|
mas01cr@370
|
316 audioDB(const unsigned argc, const char *argv[], adb__lisztResponse *adbLisztResponse);
|
mas01mc@334
|
317
|
mas01cr@97
|
318 void cleanup();
|
mas01cr@0
|
319 ~audioDB();
|
mas01cr@370
|
320 int processArgs(const unsigned argc, const char* argv[]);
|
mas01cr@30
|
321 void get_lock(int fd, bool exclusive);
|
mas01cr@30
|
322 void release_lock(int fd);
|
mas01cr@0
|
323 void create(const char* dbName);
|
mas01cr@0
|
324 void insert(const char* dbName, const char* inFile);
|
mas01cr@0
|
325 void batchinsert(const char* dbName, const char* inFile);
|
mas01cr@133
|
326 void query(const char* dbName, const char* inFile, adb__queryResponse *adbQueryResponse=0);
|
mas01cr@133
|
327 void status(const char* dbName, adb__statusResponse *adbStatusResponse=0);
|
mas01ik@355
|
328
|
mas01cr@284
|
329 unsigned random_track(unsigned *propTable, unsigned total);
|
mas01cr@280
|
330 void sample(const char *dbName);
|
mas01cr@0
|
331 void l2norm(const char* dbName);
|
mas01cr@193
|
332 void power_flag(const char *dbName);
|
mas01cr@0
|
333 void dump(const char* dbName);
|
mas01mc@334
|
334 void liszt(const char* dbName, unsigned offset, unsigned numLines, adb__lisztResponse* adbLisztResponse=0);
|
mas01cr@0
|
335
|
mas01mc@292
|
336 // LSH indexing parameters and data structures
|
mas01mc@292
|
337 LSH* lsh;
|
mas01mc@292
|
338 bool lsh_in_core; // load LSH tables for query into core (true) or keep on disk (false)
|
mas01mc@292
|
339 bool lsh_use_u_functions;
|
mas01mc@292
|
340 bool lsh_exact; // flag to indicate use exact evaluation of points returned by LSH
|
mas01mc@308
|
341 bool WS_load_index; // flag to indicate that we want to make a Web Services index memory resident
|
mas01mc@292
|
342 double lsh_param_w; // Width of LSH hash-function bins
|
mas01mc@292
|
343 Uns32T lsh_param_k; // Number of independent hash functions
|
mas01mc@292
|
344 Uns32T lsh_param_m; // Combinatorial parameter for m(m-1)/2 hash tables
|
mas01mc@292
|
345 Uns32T lsh_param_N; // Number of rows per hash table
|
mas01mc@292
|
346 Uns32T lsh_param_b; // Batch size, in number of tracks, per indexing iteration
|
mas01mc@292
|
347 Uns32T lsh_param_ncols; // Maximum number of collision in a hash-table row
|
mas01mc@292
|
348
|
mas01mc@292
|
349 // LSH indexing and retrieval methods
|
mas01mc@292
|
350 void index_index_db(const char* dbName);
|
mas01mc@292
|
351 void index_initialize(double**,double**,double**,double**,unsigned int*);
|
mas01mc@292
|
352 void index_insert_tracks(Uns32T start_track, Uns32T end_track, double** fvpp, double** sNormpp,double** snPtrp, double** sPowerp, double** spPtrp);
|
mas01mc@292
|
353 int index_insert_track(Uns32T trackID, double** fvpp, double** snpp, double** sppp);
|
mas01mc@292
|
354 Uns32T index_insert_shingles(vector<vector<float> >*, Uns32T trackID, double* spp);
|
mas01cr@498
|
355 void insertPowerData(unsigned n, int powerfd, double *powerdata);
|
mas01mc@324
|
356 void init_track_aux_data(Uns32T trackID, double* fvp, double** sNormpp,double** snPtrp, double** sPowerp, double** spPtrp);
|
mas01mc@414
|
357 void initialize_allowed_keys(std::ifstream*); // implementation of restrict lists using STL "set" class
|
mas01mc@414
|
358 int is_in_allowed_keys(Uns32T trackID); // test method for allowed_keys used during search
|
mas01mc@324
|
359
|
mas01mc@292
|
360 // Web Services
|
mas01cr@0
|
361 void startServer();
|
mas01ik@355
|
362
|
mas01mc@308
|
363 void ws_status(const char*dbName, char* hostport);
|
mas01mc@308
|
364 void ws_query(const char*dbName, const char *featureFileName, const char* hostport);
|
mas01mc@328
|
365 void ws_query_by_key(const char*dbName, const char *trackKey, const char* featureFileName, const char* hostport);
|
mas01mc@334
|
366 void ws_liszt(const char* dbName, char* hostport);
|
mas01mc@334
|
367
|
mas01cr@0
|
368 };
|
mas01mc@17
|
369
|
mas01mc@292
|
370 #define O2_AUDIODB_INITIALIZERS \
|
mas01mc@292
|
371 dim(0), \
|
mas01mc@292
|
372 dbName(0), \
|
mas01mc@292
|
373 inFile(0), \
|
mas01mc@292
|
374 key(0), \
|
mas01mc@292
|
375 trackFileName(0), \
|
mas01mc@292
|
376 trackFile(0), \
|
mas01mc@292
|
377 command(0), \
|
mas01mc@292
|
378 output(0), \
|
mas01mc@292
|
379 timesFileName(0), \
|
mas01mc@292
|
380 timesFile(0), \
|
mas01mc@292
|
381 powerFileName(0), \
|
mas01mc@292
|
382 powerFile(0), \
|
mas01mc@324
|
383 adb_root(0), \
|
mas01mc@324
|
384 adb_feature_root(0), \
|
mas01mc@324
|
385 powerfd(0), \
|
mas01mc@292
|
386 dbfid(0), \
|
mas01mc@292
|
387 lshfid(0), \
|
mas01mc@292
|
388 forWrite(false), \
|
mas01mc@292
|
389 infid(0), \
|
mas01mc@292
|
390 dbH(0), \
|
mas01cr@498
|
391 adb(0), \
|
mas01mc@292
|
392 rng(0), \
|
mas01mc@292
|
393 fileTable(0), \
|
mas01mc@292
|
394 trackTable(0), \
|
mas01mc@292
|
395 l2normTable(0), \
|
mas01mc@292
|
396 timesTable(0), \
|
mas01mc@314
|
397 powerTable(0), \
|
mas01mc@324
|
398 featureFileNameTable(0), \
|
mas01mc@324
|
399 timesFileNameTable(0), \
|
mas01mc@324
|
400 powerFileNameTable(0), \
|
mas01mc@292
|
401 fileTableLength(0), \
|
mas01mc@292
|
402 trackTableLength(0), \
|
mas01mc@292
|
403 timesTableLength(0), \
|
mas01mc@292
|
404 powerTableLength(0), \
|
mas01mc@292
|
405 l2normTableLength(0), \
|
mas01mc@292
|
406 verbosity(1), \
|
mas01mc@292
|
407 nsamples(2000), \
|
mas01mc@292
|
408 datasize(O2_DEFAULT_DATASIZE), \
|
mas01mc@292
|
409 ntracks(O2_DEFAULT_NTRACKS), \
|
mas01mc@292
|
410 datadim(O2_DEFAULT_DATADIM), \
|
mas01mc@292
|
411 queryType(O2_POINT_QUERY), \
|
mas01mc@292
|
412 pointNN(O2_DEFAULT_POINTNN), \
|
mas01mc@292
|
413 trackNN(O2_DEFAULT_TRACKNN), \
|
mas01mc@292
|
414 sequenceLength(16), \
|
mas01mc@292
|
415 sequenceHop(1), \
|
mas01mc@292
|
416 normalizedDistance(true), \
|
mas01mc@292
|
417 no_unit_norming(false), \
|
mas01mc@292
|
418 queryPoint(0), \
|
mas01mc@292
|
419 usingQueryPoint(0), \
|
mas01mc@292
|
420 usingTimes(0), \
|
mas01mc@292
|
421 usingPower(0), \
|
mas01mc@292
|
422 isClient(0), \
|
mas01mc@292
|
423 isServer(0), \
|
mas01mc@292
|
424 port(0), \
|
mas01mc@292
|
425 timesTol(0.1), \
|
mas01mc@292
|
426 radius(0), \
|
mas01mc@292
|
427 query_from_key(false), \
|
mas01cr@498
|
428 query_from_key_index((uint32_t) -1), \
|
mas01mc@292
|
429 use_absolute_threshold(false), \
|
mas01mc@292
|
430 absolute_threshold(0.0), \
|
mas01mc@292
|
431 use_relative_threshold(false), \
|
mas01mc@292
|
432 relative_threshold(0.0), \
|
mas01mc@292
|
433 reporter(0), \
|
mas01mc@414
|
434 allowed_keys(0), \
|
mas01mc@334
|
435 lisztOffset(0), \
|
mas01mc@334
|
436 lisztLength(0), \
|
mas01mc@292
|
437 lsh(0), \
|
mas01mc@292
|
438 lsh_in_core(false), \
|
mas01mc@292
|
439 lsh_use_u_functions(false), \
|
mas01mc@292
|
440 lsh_exact(false), \
|
mas01mc@308
|
441 WS_load_index(false), \
|
mas01mc@292
|
442 lsh_param_k(0), \
|
mas01mc@292
|
443 lsh_param_m(0), \
|
mas01mc@292
|
444 lsh_param_N(0), \
|
mas01mc@292
|
445 lsh_param_b(0), \
|
mas01cr@498
|
446 lsh_param_ncols(0)
|
mas01mc@292
|
447 #endif
|