Changeset 6203a70 for src/spectral
- Timestamp:
- Sep 15, 2018, 6:30:42 PM (6 years ago)
- Branches:
- feature/constantq
- Children:
- 45c2c5c
- Parents:
- 81fe7d30 (diff), 8c4918a (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)
links above to see all the changes relative to each parent. - Location:
- src/spectral
- Files:
-
- 7 added
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/spectral/mfcc.c
r81fe7d30 r6203a70 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 */ … … 103 123 aubio_mfcc_do (aubio_mfcc_t * mf, const cvec_t * in, fvec_t * out) 104 124 { 125 #ifndef HAVE_SLOW_DCT 126 fvec_t tmp; 127 #endif 105 128 /* compute filterbank */ 106 129 aubio_filterbank_do (mf->fb, in, mf->in_dct); … … 113 136 114 137 /* compute mfccs */ 138 #if defined(HAVE_SLOW_DCT) 115 139 fmat_vecmul(mf->dct_coeffs, mf->in_dct, out); 140 #else 141 aubio_dct_do(mf->dct, mf->in_dct, mf->output); 142 // copy only first n_coeffs elements 143 // TODO assert mf->output->length == n_coeffs 144 tmp.data = mf->output->data; 145 tmp.length = out->length; 146 fvec_copy(&tmp, out); 147 #endif 116 148 117 149 return;
Note: See TracChangeset
for help on using the changeset viewer.