shithub: aubio

Download patch

ref: fc2d7fbd5751aa753609938e2dfe92a929d94f00
parent: a7348ca5826c3a21980793ed4412306e08ffdff8
author: Paul Brossier <piem@piem.org>
date: Tue Feb 16 16:48:32 EST 2016

src/spectral/filterbank.c: use fmat_vecmul

--- a/src/spectral/filterbank.c
+++ b/src/spectral/filterbank.c
@@ -58,22 +58,16 @@
 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);
+  //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);
+  // view cvec->norm as fvec->data
+  fvec_t tmp;
+  tmp.length = in->length;
+  tmp.data = in->norm;
 
-  /* 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];
-    }
-  }
+  fmat_vecmul(f->filters, &tmp, out);
 
   return;
 }