src/spectral/filterbank.c: use fmat_vecmul
authorPaul Brossier <piem@piem.org>
Tue, 16 Feb 2016 20:48:32 +0000 (21:48 +0100)
committerPaul Brossier <piem@piem.org>
Tue, 16 Feb 2016 20:48:32 +0000 (21:48 +0100)
src/spectral/filterbank.c

index f8678e5..4f6ac99 100644 (file)
@@ -58,22 +58,16 @@ del_aubio_filterbank (aubio_filterbank_t * fb)
 void
 aubio_filterbank_do (aubio_filterbank_t * f, cvec_t * in, fvec_t * out)
 {
-  uint_t j, fn;
-
   /* apply filter to all input channel, provided out has enough channels */
-  uint_t max_filters = MIN (f->n_filters, out->length);
-  uint_t max_length = MIN (in->length, f->filters->length);
-
-  /* reset all values in output vector */
-  fvec_zeros (out);
-
-  /* for each filter */
-  for (fn = 0; fn < max_filters; fn++) {
-    /* for each sample */
-    for (j = 0; j < max_length; j++) {
-      out->data[fn] += in->norm[j] * f->filters->data[fn][j];
-    }
-  }
+  //uint_t max_filters = MIN (f->n_filters, out->length);
+  //uint_t max_length = MIN (in->length, f->filters->length);
+
+  // view cvec->norm as fvec->data
+  fvec_t tmp;
+  tmp.length = in->length;
+  tmp.data = in->norm;
+
+  fmat_vecmul(f->filters, &tmp, out);
 
   return;
 }