Changes in / [95e3cba:3aac194]
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/spectral/mfcc.c
r95e3cba r3aac194 29 29 #include "spectral/filterbank.h" 30 30 #include "spectral/filterbank_mel.h" 31 #include "spectral/dct.h" 31 32 #include "spectral/mfcc.h" 33 34 #undef HAVE_SLOW_DCT 32 35 33 36 /** Internal structure for mfcc object */ … … 41 44 aubio_filterbank_t *fb; /** filter bank */ 42 45 fvec_t *in_dct; /** input buffer for dct * [fb->n_filters] */ 46 #if defined(HAVE_SLOW_DCT) 43 47 fmat_t *dct_coeffs; /** DCT transform n_filters * n_coeffs */ 48 #else 49 aubio_dct_t *dct; 50 fvec_t *output; 51 #endif 44 52 }; 45 53 … … 52 60 /* allocate space for mfcc object */ 53 61 aubio_mfcc_t *mfcc = AUBIO_NEW (aubio_mfcc_t); 62 #if defined(HAVE_SLOW_DCT) 54 63 smpl_t scaling; 55 64 56 65 uint_t i, j; 66 #endif 57 67 58 68 mfcc->win_s = win_s; … … 68 78 mfcc->in_dct = new_fvec (n_filters); 69 79 80 #if defined(HAVE_SLOW_DCT) 70 81 mfcc->dct_coeffs = new_fmat (n_coefs, n_filters); 71 82 … … 80 91 mfcc->dct_coeffs->data[0][i] *= SQRT (2.) / 2.; 81 92 } 93 #else 94 mfcc->dct = new_aubio_dct (n_filters); 95 mfcc->output = new_fvec (n_filters); 96 #endif 82 97 83 98 return mfcc; … … 93 108 /* delete buffers */ 94 109 del_fvec (mf->in_dct); 110 #if defined(HAVE_SLOW_DCT) 95 111 del_fmat (mf->dct_coeffs); 112 #else 113 del_aubio_dct (mf->dct); 114 del_fvec (mf->output); 115 #endif 96 116 97 117 /* delete mfcc object */ … … 113 133 114 134 /* compute mfccs */ 135 #if defined(HAVE_SLOW_DCT) 115 136 fmat_vecmul(mf->dct_coeffs, mf->in_dct, out); 137 #else 138 aubio_dct_do(mf->dct, mf->in_dct, mf->output); 139 // copy only first n_coeffs elements 140 // TODO assert mf->output->length == n_coeffs 141 fvec_t tmp; 142 tmp.data = mf->output->data; 143 tmp.length = out->length; 144 fvec_copy(&tmp, out); 145 #endif 116 146 117 147 return;
Note: See TracChangeset
for help on using the changeset viewer.