feature/autosinkfeature/cnnfeature/cnn_orgfeature/constantqfeature/crepefeature/crepe_orgfeature/pitchshiftfeature/pydocstringsfeature/timestretchfix/ffmpeg5
Last change
on this file since d050d02 was
d050d02,
checked in by Paul Brossier <piem@piem.org>, 6 years ago
|
[tests] do not test dct with wrong sizes
|
-
Property mode set to
100644
|
File size:
1.1 KB
|
Rev | Line | |
---|
[52c1de9] | 1 | #include <math.h> |
---|
| 2 | #include "aubio.h" |
---|
| 3 | #include "utils_tests.h" |
---|
[60583a3] | 4 | |
---|
| 5 | int main (void) |
---|
| 6 | { |
---|
| 7 | int return_code = 0; |
---|
| 8 | uint_t win_s = 32; // window size |
---|
[52c1de9] | 9 | uint_t i, j, n_iters = 10; // number of iterations |
---|
[60583a3] | 10 | // create dct object |
---|
| 11 | aubio_dct_t * dct = new_aubio_dct(win_s); |
---|
[804c8eb] | 12 | aubio_dct_t * tmp; |
---|
| 13 | |
---|
| 14 | if (new_aubio_dct(0)) return 1; |
---|
[60583a3] | 15 | |
---|
| 16 | fvec_t * in = new_fvec (win_s); // input buffer |
---|
| 17 | fvec_t * dctout = new_fvec (win_s); // output buffer |
---|
[52c1de9] | 18 | fvec_t * out = new_fvec (win_s); // input buffer |
---|
[60583a3] | 19 | |
---|
[804c8eb] | 20 | if ((tmp = new_aubio_dct(1)) == 0) return 1; |
---|
[d050d02] | 21 | //aubio_dct_do(tmp, dctout, out); |
---|
| 22 | //aubio_dct_rdo(tmp, dctout, out); |
---|
[804c8eb] | 23 | del_aubio_dct(tmp); |
---|
| 24 | |
---|
[60583a3] | 25 | if (!dct || !in || !dctout) { |
---|
| 26 | return_code = 1; |
---|
| 27 | return return_code; |
---|
| 28 | } |
---|
| 29 | |
---|
| 30 | in->data[0] = 1.; |
---|
| 31 | for (i = 0; i < n_iters; i++) { |
---|
| 32 | aubio_dct_do (dct, in, dctout); |
---|
[52c1de9] | 33 | aubio_dct_rdo (dct, dctout, out); |
---|
| 34 | for (j = 0; j < in->length; j++) { |
---|
| 35 | if (fabsf(in->data[j] - out->data[j]) > 10.e-4) { |
---|
| 36 | fprintf(stderr, "dct reconstruction failed\n"); |
---|
| 37 | } |
---|
| 38 | } |
---|
[60583a3] | 39 | } |
---|
[52c1de9] | 40 | |
---|
[60583a3] | 41 | fvec_print(in); |
---|
[52c1de9] | 42 | fvec_print(dctout); |
---|
| 43 | fvec_print(out); |
---|
| 44 | |
---|
[60583a3] | 45 | del_fvec(dctout); |
---|
| 46 | del_fvec(in); |
---|
[52c1de9] | 47 | del_fvec(out); |
---|
[60583a3] | 48 | del_aubio_dct(dct); |
---|
[52c1de9] | 49 | |
---|
[60583a3] | 50 | return return_code; |
---|
| 51 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.