shithub: aubio

Download patch

ref: 630191c2b765328fa1597c2c097e769ada02acdb
parent: 5447a2686c14dc1441c670fe0015b62abe9e3e38
author: Paul Brossier <piem@piem.org>
date: Fri Sep 21 13:50:03 EDT 2018

src/aubio_priv.h: split BLAS and ATLAS support

--- a/src/aubio_priv.h
+++ b/src/aubio_priv.h
@@ -70,13 +70,21 @@
 #include <stdarg.h>
 #endif
 
-#ifdef HAVE_ACCELERATE
+#if defined(HAVE_ACCELERATE)
 #define HAVE_ATLAS 1
+#define HAVE_BLAS 1
 #include <Accelerate/Accelerate.h>
 #elif defined(HAVE_ATLAS_CBLAS_H)
+#elif defined(HAVE_BLAS)
+#if defined(HAVE_ATLAS_CBLAS_H)
 #define HAVE_ATLAS 1
 #include <atlas/cblas.h>
+#elif defined(HAVE_OPENBLAS_CBLAS_H)
+#include <openblas/cblas.h>
+#elif defined(HAVE_CBLAS_H)
+#include <cblas.h>
 #endif
+#endif
 
 #ifdef HAVE_ACCELERATE
 #include <Accelerate/Accelerate.h>
@@ -111,19 +119,23 @@
 #endif /* HAVE_AUBIO_DOUBLE */
 #endif /* HAVE_ACCELERATE */
 
-#ifdef HAVE_ATLAS
+#if defined(HAVE_BLAS)
 #ifndef HAVE_AUBIO_DOUBLE
+#ifdef HAVE_ATLAS
 #define aubio_catlas_set      catlas_sset
+#endif /* HAVE_ATLAS */
 #define aubio_cblas_copy      cblas_scopy
 #define aubio_cblas_swap      cblas_sswap
 #define aubio_cblas_dot       cblas_sdot
 #else /* HAVE_AUBIO_DOUBLE */
+#ifdef HAVE_ATLAS
 #define aubio_catlas_set      catlas_dset
+#endif /* HAVE_ATLAS */
 #define aubio_cblas_copy      cblas_dcopy
 #define aubio_cblas_swap      cblas_dswap
 #define aubio_cblas_dot       cblas_ddot
 #endif /* HAVE_AUBIO_DOUBLE */
-#endif /* HAVE_ATLAS */
+#endif /* HAVE_BLAS */
 
 #if defined HAVE_INTEL_IPP
 #include <ippcore.h>
--- a/src/fmat.c
+++ b/src/fmat.c
@@ -160,7 +160,7 @@
   assert(s->height == output->length);
   assert(s->length == scale->length);
 #endif
-#if !defined(HAVE_ACCELERATE) && !defined(HAVE_ATLAS)
+#if !defined(HAVE_ACCELERATE) && !defined(HAVE_BLAS)
   uint_t j;
   fvec_zeros(output);
   for (j = 0; j < s->length; j++) {
--- a/src/fvec.c
+++ b/src/fvec.c
@@ -134,7 +134,7 @@
   }
 #if defined(HAVE_INTEL_IPP)
   aubio_ippsCopy(s->data, t->data, (int)s->length);
-#elif defined(HAVE_ATLAS)
+#elif defined(HAVE_BLAS)
   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);
--- a/src/mathutils.c
+++ b/src/mathutils.c
@@ -271,7 +271,7 @@
   uint_t half = s->length / 2, start = half, j;
   // if length is odd, middle element is moved to the end
   if (2 * half < s->length) start ++;
-#ifndef HAVE_ATLAS
+#ifndef HAVE_BLAS
   for (j = 0; j < half; j++) {
     ELEM_SWAP (s->data[j], s->data[j + start]);
   }
@@ -291,7 +291,7 @@
   uint_t half = s->length / 2, start = half, j;
   // if length is odd, middle element is moved to the beginning
   if (2 * half < s->length) start ++;
-#ifndef HAVE_ATLAS
+#ifndef HAVE_BLAS
   for (j = 0; j < half; j++) {
     ELEM_SWAP (s->data[j], s->data[j + start]);
   }
@@ -328,7 +328,7 @@
 aubio_level_lin (const fvec_t * f)
 {
   smpl_t energy = 0.;
-#ifndef HAVE_ATLAS
+#ifndef HAVE_BLAS
   uint_t j;
   for (j = 0; j < f->length; j++) {
     energy += SQR (f->data[j]);