feature/autosinkfeature/cnnfeature/cnn_orgfeature/constantqfeature/crepefeature/crepe_orgfeature/pitchshiftfeature/pydocstringsfeature/timestretchfix/ffmpeg5
Last change
on this file since abe67e1 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
|
Line | |
---|
1 | #include <math.h> |
---|
2 | #include "aubio.h" |
---|
3 | #include "utils_tests.h" |
---|
4 | |
---|
5 | int main (void) |
---|
6 | { |
---|
7 | int return_code = 0; |
---|
8 | uint_t win_s = 32; // window size |
---|
9 | uint_t i, j, n_iters = 10; // number of iterations |
---|
10 | // create dct object |
---|
11 | aubio_dct_t * dct = new_aubio_dct(win_s); |
---|
12 | aubio_dct_t * tmp; |
---|
13 | |
---|
14 | if (new_aubio_dct(0)) return 1; |
---|
15 | |
---|
16 | fvec_t * in = new_fvec (win_s); // input buffer |
---|
17 | fvec_t * dctout = new_fvec (win_s); // output buffer |
---|
18 | fvec_t * out = new_fvec (win_s); // input buffer |
---|
19 | |
---|
20 | if ((tmp = new_aubio_dct(1)) == 0) return 1; |
---|
21 | //aubio_dct_do(tmp, dctout, out); |
---|
22 | //aubio_dct_rdo(tmp, dctout, out); |
---|
23 | del_aubio_dct(tmp); |
---|
24 | |
---|
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); |
---|
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 | } |
---|
39 | } |
---|
40 | |
---|
41 | fvec_print(in); |
---|
42 | fvec_print(dctout); |
---|
43 | fvec_print(out); |
---|
44 | |
---|
45 | del_fvec(dctout); |
---|
46 | del_fvec(in); |
---|
47 | del_fvec(out); |
---|
48 | del_aubio_dct(dct); |
---|
49 | |
---|
50 | return return_code; |
---|
51 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.