1 | #include "config.h" |
---|
2 | #include "aubio_priv.h" |
---|
3 | #include "types.h" |
---|
4 | #include "fvec.h" |
---|
5 | #include "cvec.h" |
---|
6 | #include "vecutils.h" |
---|
7 | |
---|
8 | #define AUBIO_OP(OPNAME, OP, TYPE, OBJ) \ |
---|
9 | void TYPE ## _ ## OPNAME (TYPE ## _t *o) \ |
---|
10 | { \ |
---|
11 | uint_t i,j; \ |
---|
12 | for (i = 0; i < o->channels; i++) { \ |
---|
13 | for (j = 0; j < o->length; j++) { \ |
---|
14 | o->OBJ[i][j] = OP (o->OBJ[i][j]); \ |
---|
15 | } \ |
---|
16 | } \ |
---|
17 | } |
---|
18 | |
---|
19 | #define AUBIO_OP_C_AND_F(OPNAME, OP) \ |
---|
20 | AUBIO_OP(OPNAME, OP, fvec, data) \ |
---|
21 | AUBIO_OP(OPNAME, OP, cvec, norm) |
---|
22 | |
---|
23 | AUBIO_OP_C_AND_F(exp, EXP) |
---|
24 | AUBIO_OP_C_AND_F(cos, COS) |
---|
25 | AUBIO_OP_C_AND_F(sin, SIN) |
---|
26 | AUBIO_OP_C_AND_F(abs, ABS) |
---|
27 | AUBIO_OP_C_AND_F(sqrt, SQRT) |
---|
28 | AUBIO_OP_C_AND_F(log10, SAFE_LOG10) |
---|
29 | AUBIO_OP_C_AND_F(log, SAFE_LOG) |
---|
30 | AUBIO_OP_C_AND_F(floor, FLOOR) |
---|
31 | AUBIO_OP_C_AND_F(ceil, CEIL) |
---|
32 | AUBIO_OP_C_AND_F(round, ROUND) |
---|
33 | |
---|
34 | //AUBIO_OP_C_AND_F(pow, POW) |
---|
35 | void fvec_pow (fvec_t *s, smpl_t power) |
---|
36 | { |
---|
37 | uint_t i,j; |
---|
38 | for (i = 0; i < s->channels; i++) { |
---|
39 | for (j = 0; j < s->length; j++) { |
---|
40 | s->data[i][j] = POW(s->data[i][j], power); |
---|
41 | } |
---|
42 | } |
---|
43 | } |
---|
44 | |
---|
45 | void cvec_pow (cvec_t *s, smpl_t power) |
---|
46 | { |
---|
47 | uint_t i,j; |
---|
48 | for (i = 0; i < s->channels; i++) { |
---|
49 | for (j = 0; j < s->length; j++) { |
---|
50 | s->norm[i][j] = POW(s->norm[i][j], power); |
---|
51 | } |
---|
52 | } |
---|
53 | } |
---|
54 | |
---|