}
void fmat_zeros(fmat_t *s) {
+#if HAVE_MEMCPY_HACKS
+ memset(s->data, 0, s->height * s->length * sizeof(smpl_t));
+#else
fmat_set(s, 0.);
+#endif
}
void fmat_ones(fmat_t *s) {
}
void fmat_copy(fmat_t *s, fmat_t *t) {
- uint_t i,j;
- uint_t height = MIN(s->height, t->height);
- uint_t length = MIN(s->length, t->length);
if (s->height != t->height) {
- AUBIO_ERR("warning, trying to copy %d rows to %d rows \n",
+ AUBIO_ERR("trying to copy %d rows to %d rows \n",
s->height, t->height);
+ return;
}
if (s->length != t->length) {
- AUBIO_ERR("warning, trying to copy %d columns to %d columns\n",
+ AUBIO_ERR("trying to copy %d columns to %d columns\n",
s->length, t->length);
+ return;
}
- for (i=0; i< height; i++) {
- for (j=0; j< length; j++) {
+#if HAVE_MEMCPY_HACKS
+ memcpy(t->data, s->data, t->height * t->length * sizeof(smpl_t));
+#else
+ uint_t i,j;
+ for (i=0; i< t->height; i++) {
+ for (j=0; j< t->length; j++) {
t->data[i][j] = s->data[i][j];
}
}
+#endif
}
}
void fvec_zeros(fvec_t *s) {
+#if HAVE_MEMCPY_HACKS
+ memset(s->data, 0, s->length * sizeof(smpl_t));
+#else
fvec_set(s, 0.);
+#endif
}
void fvec_ones(fvec_t *s) {
}
void fvec_copy(fvec_t *s, fvec_t *t) {
- uint_t j;
- uint_t length = t->length;
if (s->length != t->length) {
- AUBIO_WRN("trying to copy %d elements to %d elements \n",
+ AUBIO_ERR("trying to copy %d elements to %d elements \n",
s->length, t->length);
- length = MIN(s->length, t->length);
+ return;
}
- for (j=0; j< length; j++) {
+#if HAVE_MEMCPY_HACKS
+ memcpy(t->data, s->data, t->length * sizeof(smpl_t));
+#else
+ uint_t j;
+ for (j=0; j< t->length; j++) {
t->data[j] = s->data[j];
}
+#endif
}
}
void lvec_zeros(lvec_t *s) {
+#if HAVE_MEMCPY_HACKS
+ memset(s->data, 0, s->length * sizeof(lsmp_t));
+#else
lvec_set(s, 0.);
+#endif
}
void lvec_ones(lvec_t *s) {
help_str = 'compile with sndfile (auto)', help_disable_str = 'disable sndfile')
add_option_enable_disable(ctx, 'samplerate', default = None,
help_str = 'compile with samplerate (auto)', help_disable_str = 'disable samplerate')
+ add_option_enable_disable(ctx, 'memcpy', default = True,
+ help_str = 'use memcpy hacks (default)',
+ help_disable_str = 'do not use memcpy hacks')
add_option_enable_disable(ctx, 'double', default = False,
help_str = 'compile aubio in double precision mode',
help_disable_str = 'compile aubio in single precision mode (default)')
else:
ctx.msg('Checking for FFT implementation', 'ooura')
+ # use memcpy hacks
+ if (ctx.options.enable_memcpy == True):
+ ctx.define('HAVE_MEMCPY_HACKS', 1)
+ else:
+ ctx.define('HAVE_MEMCPY_HACKS', 0)
+
if (ctx.options.enable_jack != False):
ctx.check_cfg(package = 'jack', atleast_version = '0.15.0',
args = '--cflags --libs', mandatory = False)