From: Paul Brossier Date: Tue, 16 Feb 2016 20:50:08 +0000 (+0100) Subject: src/spectral/mfcc.c: swap dct_coeffs matrix to prepare for fmat_vecmul X-Git-Tag: 0.4.4~300^2~331 X-Git-Url: https://git.aubio.org/?a=commitdiff_plain;h=c02a1cc58a1b936059d7acb72c6e070b6406ec75;p=aubio.git src/spectral/mfcc.c: swap dct_coeffs matrix to prepare for fmat_vecmul --- diff --git a/src/spectral/mfcc.c b/src/spectral/mfcc.c index a0e35bed..ed998117 100644 --- a/src/spectral/mfcc.c +++ b/src/spectral/mfcc.c @@ -67,17 +67,17 @@ new_aubio_mfcc (uint_t win_s, uint_t n_filters, uint_t n_coefs, /* 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 @@ aubio_mfcc_do (aubio_mfcc_t * mf, cvec_t * in, fvec_t * out) 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]; } }