changeset 439:5294ea1b1bf2 api-inversion

audioDB::initialize_arrays no longer depends on anything in the C++ class. static void audiodb_initialize_arrays() it is.
author mas01cr
date Wed, 24 Dec 2008 10:56:16 +0000
parents 8c1d8a40db91
children 91addb6ce4c4
files audioDB.h query.cpp
diffstat 2 files changed, 9 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- a/audioDB.h	Wed Dec 24 10:56:12 2008 +0000
+++ b/audioDB.h	Wed Dec 24 10:56:16 2008 +0000
@@ -329,7 +329,6 @@
   // private methods
   void error(const char* a, const char* b = "", const char *sysFunc = 0);
 
-  void initialize_arrays(adb_t *adb, adb_query_spec_t *spec, int track, unsigned int numVectors, double *query, double *data_buffer, double **D, double **DD);
   void insertTimeStamps(unsigned n, std::ifstream* timesFile, double* timesdata);
   void set_up_query(adb_query_spec_t *spec, double **qp, double **vqp, adb_qpointers_internal_t *qpointers);
   void set_up_query_from_key(adb_query_spec_t *spec, double **qp, double **vqp, adb_qpointers_internal_t *qpointers, Uns32T queryIndex);
--- a/query.cpp	Wed Dec 24 10:56:12 2008 +0000
+++ b/query.cpp	Wed Dec 24 10:56:16 2008 +0000
@@ -46,10 +46,11 @@
     qspec.refine.flags |= ADB_REFINE_DURATION_RATIO;
     qspec.refine.duration_ratio = timesTol;
   }
-  /* FIXME: not sure about this any more; maybe it belongs in query_id */
+  /* FIXME: not sure about this any more; maybe it belongs in
+     query_id?  Or maybe we just don't need a flag for it? */
+  qspec.refine.hopsize = sequenceHop;
   if(sequenceHop != 1) {
     qspec.refine.flags |= ADB_REFINE_HOP_SIZE;
-    qspec.refine.hopsize = sequenceHop;
   }
 
   /* FIXME qspec.qid.datum */
@@ -176,11 +177,11 @@
   reporter->report(fileTable, adbQueryResponse);
 }
 
-void audioDB::initialize_arrays(adb_t *adb, adb_query_spec_t *spec, int track, unsigned int numVectors, double *query, double *data_buffer, double **D, double **DD) {
+static void audiodb_initialize_arrays(adb_t *adb, adb_query_spec_t *spec, int track, unsigned int numVectors, double *query, double *data_buffer, double **D, double **DD) {
   unsigned int j, k, l, w;
   double *dp, *qp, *sp;
 
-  const unsigned HOP_SIZE = sequenceHop;
+  const unsigned HOP_SIZE = spec->refine.hopsize;
   const unsigned wL = spec->qid.sequence_length;
 
   for(j = 0; j < numVectors; j++) {
@@ -195,12 +196,12 @@
   // Dot product
   for(j = 0; j < numVectors; j++)
     for(k = 0; k < (*adb->track_lengths)[track]; k++){
-      qp = query + j * dbH->dim;
-      sp = data_buffer + k * dbH->dim;
+      qp = query + j * adb->header->dim;
+      sp = data_buffer + k * adb->header->dim;
       DD[j][k] = 0.0; // Initialize matched filter array
       dp = &D[j][k];  // point to correlation cell j,k
       *dp = 0.0;      // initialize correlation cell
-      l = dbH->dim;         // size of vectors
+      l = adb->header->dim;         // size of vectors
       while(l--)
         *dp += *qp++ * *sp++;
     }
@@ -796,7 +797,7 @@
       
       VERB_LOG(7,"%u.%jd.%u | ", track, (intmax_t) trackIndexOffset, trackTable[track]);
       
-      initialize_arrays(adb, spec, track, qpointers.nvectors, query, data_buffer, D, DD);
+      audiodb_initialize_arrays(adb, spec, track, qpointers.nvectors, query, data_buffer, D, DD);
 
       if(spec->refine.flags & ADB_REFINE_DURATION_RATIO) {
         VERB_LOG(3,"meanQdur=%f meanDBdur=%f\n", qpointers.mean_duration[0], dbpointers.mean_duration[track]);