ref: c02a1cc58a1b936059d7acb72c6e070b6406ec75
parent: fc2d7fbd5751aa753609938e2dfe92a929d94f00
author: Paul Brossier <piem@piem.org>
date: Tue Feb 16 16:50:08 EST 2016
src/spectral/mfcc.c: swap dct_coeffs matrix to prepare for fmat_vecmul
--- a/src/spectral/mfcc.c
+++ b/src/spectral/mfcc.c
@@ -67,17 +67,17 @@
/* allocating buffers */
mfcc->in_dct = new_fvec (n_filters);
- mfcc->dct_coeffs = new_fmat (n_filters, n_coefs);
+ mfcc->dct_coeffs = new_fmat (n_coefs, n_filters);
- /* compute DCT transform dct_coeffs[i][j] as
+ /* compute DCT transform dct_coeffs[j][i] as
cos ( j * (i+.5) * PI / n_filters ) */
scaling = 1. / SQRT (n_filters / 2.);
for (i = 0; i < n_filters; i++) {
for (j = 0; j < n_coefs; j++) {
- mfcc->dct_coeffs->data[i][j] =
+ mfcc->dct_coeffs->data[j][i] =
scaling * COS (j * (i + 0.5) * PI / n_filters);
}
- mfcc->dct_coeffs->data[i][0] *= SQRT (2.) / 2.;
+ mfcc->dct_coeffs->data[0][i] *= SQRT (2.) / 2.;
}
return mfcc;
@@ -120,7 +120,7 @@
for (j = 0; j < mf->n_filters; j++) {
for (k = 0; k < mf->n_coefs; k++) {
out->data[k] += mf->in_dct->data[j]
- * mf->dct_coeffs->data[j][k];
+ * mf->dct_coeffs->data[k][j];
}
}