Changes in / [ee6ca74:50961b9]
- Location:
- src
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
src/fvec.c
ree6ca74 r50961b9 108 108 } 109 109 110 void fvec_weighted_copy(fvec_t *in, fvec_t *weight, fvec_t *out) { 111 #ifndef HAVE_ACCELERATE 112 uint_t j; 113 uint_t length = MIN(s->length, weight->length); 114 for (j=0; j< length; j++) { 115 out->data[j] = in->data[j] * weight->data[j]; 116 } 117 #else 118 aubio_vDSP_vmul(in->data, 1, weight->data, 1, out->data, 1, out->length); 119 #endif /* HAVE_ACCELERATE */ 120 } 121 110 122 void fvec_copy(fvec_t *s, fvec_t *t) { 111 123 if (s->length != t->length) { -
src/fvec.h
ree6ca74 r50961b9 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
ree6ca74 r50961b9 254 254 fvec_shift (fvec_t * s) 255 255 { 256 #ifndef HAVE_ACCELERATE 256 257 uint_t j; 257 258 for (j = 0; j < s->length / 2; j++) { 258 259 ELEM_SWAP (s->data[j], s->data[j + s->length / 2]); 259 260 } 261 #else 262 uint_t half = s->length / 2; 263 aubio_cblas_xswap(half, s->data, 1, s->data + half, 1); 264 #endif 260 265 } 261 266 … … 264 269 { 265 270 smpl_t energy = 0.; 271 #ifndef HAVE_ACCELERATE 266 272 uint_t j; 267 273 for (j = 0; j < f->length; j++) { 268 274 energy += SQR (f->data[j]); 269 275 } 276 #else 277 energy = aubio_cblas_dot(f->length, f->data, 1, f->data, 1); 278 #endif 270 279 return energy / f->length; 271 280 } -
src/pitch/pitch.c
ree6ca74 r50961b9 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
ree6ca74 r50961b9 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.