shithub: aubio

Download patch

ref: 6c8ef5833b56fa8ed2fb0a8200b8c36fea4a4dd0
parent: 6bb268b1f41c1a8275b6da56f88630f4aa4cb5b6
author: Paul Brossier <piem@piem.org>
date: Sat Sep 5 05:50:59 EDT 2015

src/pitch/pitch.c: variant for aubio_pitch_slideblock using memmove/memcpy

--- a/src/pitch/pitch.c
+++ b/src/pitch/pitch.c
@@ -239,8 +239,9 @@
 void
 aubio_pitch_slideblock (aubio_pitch_t * p, fvec_t * ibuf)
 {
-  uint_t j = 0, overlap_size = 0;
-  overlap_size = p->buf->length - ibuf->length;
+  uint_t overlap_size = p->buf->length - ibuf->length;
+#if !HAVE_MEMCPY_HACKS
+  uint_t j;
   for (j = 0; j < overlap_size; j++) {
     p->buf->data[j] = p->buf->data[j + ibuf->length];
   }
@@ -247,6 +248,12 @@
   for (j = 0; j < ibuf->length; j++) {
     p->buf->data[j + overlap_size] = ibuf->data[j];
   }
+#else
+  smpl_t *data = p->buf->data;
+  smpl_t *newdata = ibuf->data;
+  memmove(data, data + ibuf->length, overlap_size);
+  memcpy(data + overlap_size, newdata, ibuf->length);
+#endif
 }
 
 uint_t