source: src/vecutils.c @ 8c43bf7

feature/autosinkfeature/cnnfeature/cnn_orgfeature/constantqfeature/crepefeature/crepe_orgfeature/pitchshiftfeature/pydocstringsfeature/timestretchfix/ffmpeg5pitchshiftsamplertimestretchyinfft+
Last change on this file since 8c43bf7 was c17a0ee, checked in by Paul Brossier <piem@piem.org>, 15 years ago

src/vecutils.c: switch to mono

  • Property mode set to 100644
File size: 1020 bytes
Line 
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) \
9void TYPE ## _ ## OPNAME (TYPE ## _t *o) \
10{ \
11  uint_t j; \
12  for (j = 0; j < o->length; j++) { \
13    o->OBJ[j] = OP (o->OBJ[j]); \
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
21AUBIO_OP_C_AND_F(exp, EXP)
22AUBIO_OP_C_AND_F(cos, COS)
23AUBIO_OP_C_AND_F(sin, SIN)
24AUBIO_OP_C_AND_F(abs, ABS)
25AUBIO_OP_C_AND_F(sqrt, SQRT)
26AUBIO_OP_C_AND_F(log10, SAFE_LOG10)
27AUBIO_OP_C_AND_F(log, SAFE_LOG)
28AUBIO_OP_C_AND_F(floor, FLOOR)
29AUBIO_OP_C_AND_F(ceil, CEIL)
30AUBIO_OP_C_AND_F(round, ROUND)
31
32//AUBIO_OP_C_AND_F(pow, POW)
33void fvec_pow (fvec_t *s, smpl_t power)
34{
35  uint_t j;
36  for (j = 0; j < s->length; j++) {
37    s->data[j] = POW(s->data[j], power);
38  }
39}
40
41void cvec_pow (cvec_t *s, smpl_t power)
42{
43  uint_t j;
44  for (j = 0; j < s->length; j++) {
45    s->norm[j] = POW(s->norm[j], power);
46  }
47}
48
Note: See TracBrowser for help on using the repository browser.