Changeset d95ff38 for src/spectral/mfcc.c
- Timestamp:
- Dec 4, 2009, 1:38:30 AM (14 years ago)
- Branches:
- feature/autosink, feature/cnn, feature/cnn_org, feature/constantq, feature/crepe, feature/crepe_org, feature/pitchshift, feature/pydocstrings, feature/timestretch, fix/ffmpeg5, master, pitchshift, sampler, timestretch, yinfft+
- Children:
- 741bdda
- Parents:
- 0b9a02a
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/spectral/mfcc.c
r0b9a02a rd95ff38 22 22 #include "aubio_priv.h" 23 23 #include "fvec.h" 24 #include "fmat.h" 24 25 #include "cvec.h" 25 26 #include "mathutils.h" … … 40 41 aubio_filterbank_t *fb; /** filter bank */ 41 42 fvec_t *in_dct; /** input buffer for dct * [fb->n_filters] */ 42 f vec_t *dct_coeffs; /** DCT transform n_filters * n_coeffs */43 fmat_t *dct_coeffs; /** DCT transform n_filters * n_coeffs */ 43 44 }; 44 45 … … 64 65 65 66 /* allocating buffers */ 66 mfcc->in_dct = new_fvec (n_filters , 1);67 mfcc->in_dct = new_fvec (n_filters); 67 68 68 mfcc->dct_coeffs = new_f vec(n_coefs, n_filters);69 mfcc->dct_coeffs = new_fmat (n_coefs, n_filters); 69 70 70 71 /* compute DCT transform dct_coeffs[i][j] as … … 100 101 aubio_mfcc_do (aubio_mfcc_t * mf, cvec_t * in, fvec_t * out) 101 102 { 102 uint_t i,j, k;103 uint_t j, k; 103 104 104 105 /* compute filterbank */ … … 115 116 116 117 /* compute discrete cosine transform */ 117 for (i = 0; i < out->channels; i++) { 118 for (j = 0; j < mf->n_filters; j++) { 119 for (k = 0; k < mf->n_coefs; k++) { 120 out->data[i][k] += mf->in_dct->data[i][j] 121 * mf->dct_coeffs->data[j][k]; 122 } 118 for (j = 0; j < mf->n_filters; j++) { 119 for (k = 0; k < mf->n_coefs; k++) { 120 out->data[k] += mf->in_dct->data[j] 121 * mf->dct_coeffs->data[j][k]; 123 122 } 124 123 }
Note: See TracChangeset
for help on using the changeset viewer.