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