source: src/vecutils.c @ aa033c2

feature/autosinkfeature/constantqfeature/pitchshiftfeature/pydocstringsfeature/timestretchpitchshiftsamplertimestretchyinfft+
Last change on this file since aa033c2 was aa033c2, checked in by Paul Brossier <piem@piem.org>, 6 years ago

src/vecutils.*: update for history

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