Changes in / [c59e693:f45dd12]
- Location:
- src
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
src/fvec.c
rc59e693 rf45dd12 28 28 #define aubio_vDSP_vmul vDSP_vmul 29 29 #define aubio_vDSP_vfill vDSP_vfill 30 #define aubio_catlas_set catlas_sset31 30 #else /* HAVE_AUBIO_DOUBLE */ 32 31 #define aubio_vDSP_mmov vDSP_mmovD 33 32 #define aubio_vDSP_vmul vDSP_vmulD 34 33 #define aubio_vDSP_vfill vDSP_vfillD 35 #define aubio_catlas_set catlas_dset36 34 #endif /* HAVE_AUBIO_DOUBLE */ 37 35 #endif … … 82 80 } 83 81 #else 84 //aubio_catlas_set(s->length, val, s->data, 1);85 82 aubio_vDSP_vfill(&val, s->data, 1, s->length); 86 83 #endif … … 122 119 } 123 120 124 void fvec_weighted_copy(fvec_t *in, fvec_t *weight, fvec_t *out) {125 #ifndef HAVE_ACCELERATE126 uint_t j;127 uint_t length = MIN(s->length, weight->length);128 for (j=0; j< length; j++) {129 out->data[j] = in->data[j] * weight->data[j];130 }131 #else132 aubio_vDSP_vmul(in->data, 1, weight->data, 1, out->data, 1, out->length);133 #endif /* HAVE_ACCELERATE */134 }135 136 121 void fvec_copy(fvec_t *s, fvec_t *t) { 137 122 if (s->length != t->length) { -
src/fvec.h
rc59e693 rf45dd12 163 163 void fvec_copy(fvec_t *s, fvec_t *t); 164 164 165 /** make a copy of a vector, applying weights to each element166 167 \param in input vector168 \param weight weights vector169 \param out output vector170 171 */172 void fvec_weighted_copy(fvec_t *in, fvec_t *weight, fvec_t *out);173 174 165 #ifdef __cplusplus 175 166 } -
src/mathutils.c
rc59e693 rf45dd12 29 29 #ifdef HAVE_ACCELERATE 30 30 #include <Accelerate/Accelerate.h> 31 #endif32 33 #if !HAVE_AUBIO_DOUBLE34 #define aubio_cblas_xswap cblas_sswap35 #define aubio_cblas_dot cblas_sdot36 #else37 #define aubio_cblas_xswap cblas_dswap38 #define aubio_cblas_dot cblas_ddot39 31 #endif 40 32 … … 290 282 fvec_shift (fvec_t * s) 291 283 { 292 #ifndef HAVE_ACCELERATE293 284 uint_t j; 294 285 for (j = 0; j < s->length / 2; j++) { 295 286 ELEM_SWAP (s->data[j], s->data[j + s->length / 2]); 296 287 } 297 #else298 uint_t half = s->length / 2;299 aubio_cblas_xswap(half, s->data, 1, s->data + half, 1);300 #endif301 288 } 302 289 … … 305 292 { 306 293 smpl_t energy = 0.; 307 #ifndef HAVE_ACCELERATE308 294 uint_t j; 309 295 for (j = 0; j < f->length; j++) { 310 296 energy += SQR (f->data[j]); 311 297 } 312 #else313 energy = aubio_cblas_dot(f->length, f->data, 1, f->data, 1);314 #endif315 298 return energy / f->length; 316 299 } -
src/pitch/pitch.c
rc59e693 rf45dd12 240 240 aubio_pitch_slideblock (aubio_pitch_t * p, fvec_t * ibuf) 241 241 { 242 uint_t overlap_size = p->buf->length - ibuf->length; 243 #if !HAVE_MEMCPY_HACKS 244 uint_t j; 242 uint_t j = 0, overlap_size = 0; 243 overlap_size = p->buf->length - ibuf->length; 245 244 for (j = 0; j < overlap_size; j++) { 246 245 p->buf->data[j] = p->buf->data[j + ibuf->length]; … … 249 248 p->buf->data[j + overlap_size] = ibuf->data[j]; 250 249 } 251 #else252 smpl_t *data = p->buf->data;253 smpl_t *newdata = ibuf->data;254 memmove(data, data + ibuf->length, overlap_size);255 memcpy(data + overlap_size, newdata, ibuf->length);256 #endif257 250 } 258 251 -
src/pitch/pitchyinfft.c
rc59e693 rf45dd12 108 108 smpl_t tmp = 0., sum = 0.; 109 109 // window the input 110 fvec_weighted_copy(input, p->win, p->winput); 110 for (l = 0; l < input->length; l++) { 111 p->winput->data[l] = p->win->data[l] * input->data[l]; 112 } 111 113 // get the real / imag parts of its fft 112 114 aubio_fft_do_complex (p->fft, p->winput, fftout);
Note: See TracChangeset
for help on using the changeset viewer.