- Timestamp:
- Aug 22, 2018, 3:56:50 PM (6 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
- Children:
- 49b19d4
- Parents:
- 3beacb3
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
tests/src/spectral/test-dct.c
r3beacb3 r52c1de9 1 #include <aubio.h> 1 #include <math.h> 2 #include "aubio.h" 3 #include "utils_tests.h" 2 4 3 5 int main (void) … … 5 7 int return_code = 0; 6 8 uint_t win_s = 32; // window size 7 uint_t i, n_iters = 10; // number of iterations9 uint_t i, j, n_iters = 10; // number of iterations 8 10 // create dct object 9 11 aubio_dct_t * dct = new_aubio_dct(win_s); … … 11 13 fvec_t * in = new_fvec (win_s); // input buffer 12 14 fvec_t * dctout = new_fvec (win_s); // output buffer 15 fvec_t * out = new_fvec (win_s); // input buffer 13 16 14 17 if (!dct || !in || !dctout) { … … 20 23 for (i = 0; i < n_iters; i++) { 21 24 aubio_dct_do (dct, in, dctout); 22 aubio_dct_rdo (dct, dctout, in); 25 aubio_dct_rdo (dct, dctout, out); 26 for (j = 0; j < in->length; j++) { 27 if (fabsf(in->data[j] - out->data[j]) > 10.e-4) { 28 fprintf(stderr, "dct reconstruction failed\n"); 29 } 30 } 23 31 } 32 33 fvec_print(in); 24 34 fvec_print(dctout); 25 fvec_print(in); 35 fvec_print(out); 36 26 37 del_fvec(dctout); 27 38 del_fvec(in); 39 del_fvec(out); 40 del_aubio_dct(dct); 28 41 29 del_aubio_dct(dct);30 42 return return_code; 31 43 }
Note: See TracChangeset
for help on using the changeset viewer.