[916f8983] | 1 | #include "config.h" |
---|
[83963b3] | 2 | #include "aubio_priv.h" |
---|
[916f8983] | 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 | { \ |
---|
[c17a0ee] | 11 | uint_t j; \ |
---|
| 12 | for (j = 0; j < o->length; j++) { \ |
---|
| 13 | o->OBJ[j] = OP (o->OBJ[j]); \ |
---|
[916f8983] | 14 | } \ |
---|
| 15 | } |
---|
| 16 | |
---|
| 17 | #define AUBIO_OP_C_AND_F(OPNAME, OP) \ |
---|
| 18 | AUBIO_OP(OPNAME, OP, fvec, data) \ |
---|
| 19 | AUBIO_OP(OPNAME, OP, cvec, norm) |
---|
| 20 | |
---|
| 21 | AUBIO_OP_C_AND_F(exp, EXP) |
---|
| 22 | AUBIO_OP_C_AND_F(cos, COS) |
---|
| 23 | AUBIO_OP_C_AND_F(sin, SIN) |
---|
| 24 | AUBIO_OP_C_AND_F(abs, ABS) |
---|
| 25 | AUBIO_OP_C_AND_F(sqrt, SQRT) |
---|
[6940b55] | 26 | AUBIO_OP_C_AND_F(log10, SAFE_LOG10) |
---|
| 27 | AUBIO_OP_C_AND_F(log, SAFE_LOG) |
---|
[916f8983] | 28 | AUBIO_OP_C_AND_F(floor, FLOOR) |
---|
| 29 | AUBIO_OP_C_AND_F(ceil, CEIL) |
---|
| 30 | AUBIO_OP_C_AND_F(round, ROUND) |
---|
| 31 | |
---|
| 32 | //AUBIO_OP_C_AND_F(pow, POW) |
---|
| 33 | void fvec_pow (fvec_t *s, smpl_t power) |
---|
| 34 | { |
---|
[c17a0ee] | 35 | uint_t j; |
---|
| 36 | for (j = 0; j < s->length; j++) { |
---|
| 37 | s->data[j] = POW(s->data[j], power); |
---|
[916f8983] | 38 | } |
---|
| 39 | } |
---|
| 40 | |
---|
[6940b55] | 41 | void cvec_pow (cvec_t *s, smpl_t power) |
---|
| 42 | { |
---|
[c17a0ee] | 43 | uint_t j; |
---|
| 44 | for (j = 0; j < s->length; j++) { |
---|
| 45 | s->norm[j] = POW(s->norm[j], power); |
---|
[6940b55] | 46 | } |
---|
| 47 | } |
---|
| 48 | |
---|