shithub: aubio

Download patch

ref: 4aa18e3dbc0f8101887c9511538f4c5fe2cc8ce7
parent: c59e6935d6b56a067b7a7b882d649dcfe1ba2ec7
parent: b8c50c37a7599e51f3d935ce9fbfd2513fc0ee92
author: Paul Brossier <piem@piem.org>
date: Sun Sep 6 05:45:22 EDT 2015

Merge branch 'develop' into accelerate

--- a/src/aubio_priv.h
+++ b/src/aubio_priv.h
@@ -64,6 +64,45 @@
 #include <limits.h> // for CHAR_BIT, in C99 standard
 #endif
 
+#ifdef HAVE_ACCELERATE
+#define HAVE_ATLAS 1
+#include <Accelerate/Accelerate.h>
+#elif HAVE_ATLAS_CBLAS_H
+#define HAVE_ATLAS 1
+#include <atlas/cblas.h>
+#else
+#undef HAVE_ATLAS
+#endif
+
+#ifdef HAVE_ACCELERATE
+#include <Accelerate/Accelerate.h>
+#if !HAVE_AUBIO_DOUBLE
+#define aubio_vDSP_mmov       vDSP_mmov
+#define aubio_vDSP_vmul       vDSP_vmul
+#define aubio_vDSP_vfill      vDSP_vfill
+#else /* HAVE_AUBIO_DOUBLE */
+#define aubio_vDSP_mmov       vDSP_mmovD
+#define aubio_vDSP_vmul       vDSP_vmulD
+#define aubio_vDSP_vfill      vDSP_vfillD
+#endif /* HAVE_AUBIO_DOUBLE */
+#endif /* HAVE_ACCELERATE */
+
+#ifdef HAVE_ATLAS
+#if !HAVE_AUBIO_DOUBLE
+#define aubio_catlas_set      catlas_sset
+#define aubio_cblas_copy      cblas_scopy
+#else /* HAVE_AUBIO_DOUBLE */
+#define aubio_catlas_set      catlas_dset
+#define aubio_cblas_copy      cblas_dcopy
+#endif /* HAVE_AUBIO_DOUBLE */
+#endif /* HAVE_ATLAS */
+
+#if !defined(HAVE_MEMCPY_HACKS) && !defined(HAVE_ACCELERATE) && !defined(HAVE_ATLAS)
+#define HAVE_NOOPT 1
+#else
+#undef HAVE_NOOPT
+#endif
+
 #include "types.h"
 
 #define AUBIO_UNSTABLE 1
--- a/src/fvec.c
+++ b/src/fvec.c
@@ -21,21 +21,6 @@
 #include "aubio_priv.h"
 #include "fvec.h"
 
-#ifdef HAVE_ACCELERATE
-#include <Accelerate/Accelerate.h>
-#if !HAVE_AUBIO_DOUBLE
-#define aubio_vDSP_mmov       vDSP_mmov
-#define aubio_vDSP_vmul       vDSP_vmul
-#define aubio_vDSP_vfill      vDSP_vfill
-#define aubio_catlas_set      catlas_sset
-#else /* HAVE_AUBIO_DOUBLE */
-#define aubio_vDSP_mmov       vDSP_mmovD
-#define aubio_vDSP_vmul       vDSP_vmulD
-#define aubio_vDSP_vfill      vDSP_vfillD
-#define aubio_catlas_set      catlas_dset
-#endif /* HAVE_AUBIO_DOUBLE */
-#endif
-
 fvec_t * new_fvec( uint_t length) {
   fvec_t * s;
   if ((sint_t)length <= 0) {
@@ -75,13 +60,14 @@
 }
 
 void fvec_set_all (fvec_t *s, smpl_t val) {
-#ifndef HAVE_ACCELERATE
+#if !defined(HAVE_ACCELERATE) && !defined(HAVE_ATLAS)
   uint_t j;
   for (j=0; j< s->length; j++) {
     s->data[j] = val;
   }
-#else
-  //aubio_catlas_set(s->length, val, s->data, 1);
+#elif defined(HAVE_ATLAS)
+  aubio_catlas_set(s->length, val, s->data, 1);
+#elif defined(HAVE_ACCELERATE)
   aubio_vDSP_vfill(&val, s->data, 1, s->length);
 #endif
 }
@@ -139,16 +125,16 @@
         s->length, t->length);
     return;
   }
-#if !defined(HAVE_MEMCPY_HACKS) && !defined(HAVE_ACCELERATE)
+#if HAVE_NOOPT
   uint_t j;
   for (j=0; j< t->length; j++) {
     t->data[j] = s->data[j];
   }
-#else
-#if defined(HAVE_MEMCPY_HACKS)
+#elif defined(HAVE_MEMCPY_HACKS)
   memcpy(t->data, s->data, t->length * sizeof(smpl_t));
-#else
+#elif defined(HAVE_ATLAS)
+  aubio_cblas_copy(s->length, s->data, 1, t->data, 1);
+#elif defined(HAVE_ACCELERATE)
   aubio_vDSP_mmov(s->data, t->data, 1, s->length, 1, 1);
-#endif
 #endif
 }