Changeset d95ff38 for src/spectral/filterbank.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/filterbank.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 "spectral/filterbank.h" … … 31 32 uint_t win_s; 32 33 uint_t n_filters; 33 f vec_t *filters;34 fmat_t *filters; 34 35 }; 35 36 … … 42 43 fb->n_filters = n_filters; 43 44 44 /* allocate filter tables, a n fvec of length win_s and of filter_cnt channel*/45 fb->filters = new_f vec(win_s / 2 + 1, n_filters);45 /* allocate filter tables, a matrix of length win_s and of height n_filters */ 46 fb->filters = new_fmat (win_s / 2 + 1, n_filters); 46 47 47 48 return fb; … … 51 52 del_aubio_filterbank (aubio_filterbank_t * fb) 52 53 { 53 del_f vec(fb->filters);54 del_fmat (fb->filters); 54 55 AUBIO_FREE (fb); 55 56 } … … 58 59 aubio_filterbank_do (aubio_filterbank_t * f, cvec_t * in, fvec_t * out) 59 60 { 60 uint_t i,j, fn;61 uint_t j, fn; 61 62 62 63 /* apply filter to all input channel, provided out has enough channels */ 63 uint_t max_channels = MIN (in->channels, out->channels);64 64 uint_t max_filters = MIN (f->n_filters, out->length); 65 65 uint_t max_length = MIN (in->length, f->filters->length); … … 68 68 fvec_zeros (out); 69 69 70 /* apply filters on all channels*/71 for ( i = 0; i < max_channels; i++) {70 /* for each filter */ 71 for (fn = 0; fn < max_filters; fn++) { 72 72 73 /* for each filter */ 74 for (fn = 0; fn < max_filters; fn++) { 75 76 /* for each sample */ 77 for (j = 0; j < max_length; j++) { 78 out->data[i][fn] += in->norm[i][j] * f->filters->data[fn][j]; 79 } 73 /* for each sample */ 74 for (j = 0; j < max_length; j++) { 75 out->data[fn] += in->norm[j] * f->filters->data[fn][j]; 80 76 } 81 77 } … … 84 80 } 85 81 86 f vec_t *82 fmat_t * 87 83 aubio_filterbank_get_coeffs (aubio_filterbank_t * f) 88 84 { … … 91 87 92 88 uint_t 93 aubio_filterbank_set_coeffs (aubio_filterbank_t * f, f vec_t * filters)89 aubio_filterbank_set_coeffs (aubio_filterbank_t * f, fmat_t * filter_coeffs) 94 90 { 95 f vec_copy(filters, f->filters);91 fmat_copy(filter_coeffs, f->filters); 96 92 return 0; 97 93 }
Note: See TracChangeset
for help on using the changeset viewer.