Changes in / [f8340e1:0969113]
- Location:
- src
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
src/fvec.c
rf8340e1 r0969113 28 28 #define aubio_vDSP_vmul vDSP_vmul 29 29 #define aubio_vDSP_vfill vDSP_vfill 30 #define aubio_catlas_set catlas_sset 30 31 #else /* HAVE_AUBIO_DOUBLE */ 31 32 #define aubio_vDSP_mmov vDSP_mmovD 32 33 #define aubio_vDSP_vmul vDSP_vmulD 33 34 #define aubio_vDSP_vfill vDSP_vfillD 35 #define aubio_catlas_set catlas_dset 34 36 #endif /* HAVE_AUBIO_DOUBLE */ 35 37 #endif … … 80 82 } 81 83 #else 84 //aubio_catlas_set(s->length, val, s->data, 1); 82 85 aubio_vDSP_vfill(&val, s->data, 1, s->length); 83 86 #endif … … 119 122 } 120 123 124 void fvec_weighted_copy(fvec_t *in, fvec_t *weight, fvec_t *out) { 125 #ifndef HAVE_ACCELERATE 126 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 #else 132 aubio_vDSP_vmul(in->data, 1, weight->data, 1, out->data, 1, out->length); 133 #endif /* HAVE_ACCELERATE */ 134 } 135 121 136 void fvec_copy(fvec_t *s, fvec_t *t) { 122 137 if (s->length != t->length) { -
src/fvec.h
rf8340e1 r0969113 163 163 void fvec_copy(fvec_t *s, fvec_t *t); 164 164 165 /** make a copy of a vector, applying weights to each element 166 167 \param in input vector 168 \param weight weights vector 169 \param out output vector 170 171 */ 172 void fvec_weighted_copy(fvec_t *in, fvec_t *weight, fvec_t *out); 173 165 174 #ifdef __cplusplus 166 175 } -
src/mathutils.c
rf8340e1 r0969113 29 29 #ifdef HAVE_ACCELERATE 30 30 #include <Accelerate/Accelerate.h> 31 #endif 32 33 #if !HAVE_AUBIO_DOUBLE 34 #define aubio_cblas_xswap cblas_sswap 35 #define aubio_cblas_dot cblas_sdot 36 #else 37 #define aubio_cblas_xswap cblas_dswap 38 #define aubio_cblas_dot cblas_ddot 31 39 #endif 32 40 … … 282 290 fvec_shift (fvec_t * s) 283 291 { 292 #ifndef HAVE_ACCELERATE 284 293 uint_t j; 285 294 for (j = 0; j < s->length / 2; j++) { 286 295 ELEM_SWAP (s->data[j], s->data[j + s->length / 2]); 287 296 } 297 #else 298 uint_t half = s->length / 2; 299 aubio_cblas_xswap(half, s->data, 1, s->data + half, 1); 300 #endif 288 301 } 289 302 … … 292 305 { 293 306 smpl_t energy = 0.; 307 #ifndef HAVE_ACCELERATE 294 308 uint_t j; 295 309 for (j = 0; j < f->length; j++) { 296 310 energy += SQR (f->data[j]); 297 311 } 312 #else 313 energy = aubio_cblas_dot(f->length, f->data, 1, f->data, 1); 314 #endif 298 315 return energy / f->length; 299 316 } -
src/pitch/pitch.c
rf8340e1 r0969113 240 240 aubio_pitch_slideblock (aubio_pitch_t * p, fvec_t * ibuf) 241 241 { 242 uint_t j = 0, overlap_size = 0; 243 overlap_size = p->buf->length - ibuf->length; 242 uint_t overlap_size = p->buf->length - ibuf->length; 243 #if !HAVE_MEMCPY_HACKS 244 uint_t j; 244 245 for (j = 0; j < overlap_size; j++) { 245 246 p->buf->data[j] = p->buf->data[j + ibuf->length]; … … 248 249 p->buf->data[j + overlap_size] = ibuf->data[j]; 249 250 } 251 #else 252 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 #endif 250 257 } 251 258 -
src/pitch/pitchyinfft.c
rf8340e1 r0969113 108 108 smpl_t tmp = 0., sum = 0.; 109 109 // window the input 110 for (l = 0; l < input->length; l++) { 111 p->winput->data[l] = p->win->data[l] * input->data[l]; 112 } 110 fvec_weighted_copy(input, p->win, p->winput); 113 111 // get the real / imag parts of its fft 114 112 aubio_fft_do_complex (p->fft, p->winput, fftout);
Note: See TracChangeset
for help on using the changeset viewer.