feature/crepe_org
Last change
on this file since e2010b3 was
92c85b12,
checked in by Paul Brossier <piem@piem.org>, 6 years ago
|
[tests] fail dct tests if reconstruction failed
|
-
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 | return_code += (fabsf(in->data[j] - out->data[j]) > 10.e-4); |
---|
36 | } |
---|
37 | } |
---|
38 | |
---|
39 | fvec_print(in); |
---|
40 | fvec_print(dctout); |
---|
41 | fvec_print(out); |
---|
42 | |
---|
43 | del_fvec(dctout); |
---|
44 | del_fvec(in); |
---|
45 | del_fvec(out); |
---|
46 | del_aubio_dct(dct); |
---|
47 | |
---|
48 | return return_code; |
---|
49 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.