Changeset 81b3910 for src/fvec.c


Ignore:
Timestamp:
Oct 1, 2017, 12:50:15 PM (7 years ago)
Author:
Paul Brossier <piem@piem.org>
Branches:
feature/autosink, feature/cnn, feature/cnn_org, feature/constantq, feature/crepe, feature/crepe_org, feature/pitchshift, feature/pydocstrings, feature/timestretch, fix/ffmpeg5, master
Children:
a6b5bf1
Parents:
16c12a1 (diff), faeec7c (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge branch 'intel_ipp_pull' of https://github.com/emuell/aubio into emuell-intel_ipp_pull

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/fvec.c

    r16c12a1 r81b3910  
    2121#include "aubio_priv.h"
    2222#include "fvec.h"
     23
     24#if defined HAVE_INTEL_IPP
     25#include <ippcore.h>
     26#include <ippvm.h>
     27#include <ipps.h>
     28#endif
    2329
    2430fvec_t * new_fvec(uint_t length) {
     
    6167
    6268void fvec_set_all (fvec_t *s, smpl_t val) {
    63 #if !defined(HAVE_ACCELERATE) && !defined(HAVE_ATLAS)
    64   uint_t j;
    65   for (j=0; j< s->length; j++) {
    66     s->data[j] = val;
    67   }
     69#if defined(HAVE_INTEL_IPP)
     70  #if HAVE_AUBIO_DOUBLE
     71    ippsSet_64f(val, s->data, (int)s->length);
     72  #else
     73    ippsSet_32f(val, s->data, (int)s->length);
     74  #endif
    6875#elif defined(HAVE_ATLAS)
    6976  aubio_catlas_set(s->length, val, s->data, 1);
    7077#elif defined(HAVE_ACCELERATE)
    7178  aubio_vDSP_vfill(&val, s->data, 1, s->length);
     79#else
     80  uint_t j;
     81  for ( j = 0; j< s->length; j++ )
     82  {
     83    s->data[j] = val;
     84  }
    7285#endif
    7386}
    7487
    7588void fvec_zeros(fvec_t *s) {
    76 #if !defined(HAVE_MEMCPY_HACKS) && !defined(HAVE_ACCELERATE)
    77   fvec_set_all (s, 0.);
    78 #else
    79 #if defined(HAVE_MEMCPY_HACKS)
     89#if defined(HAVE_INTEL_IPP)
     90  #if HAVE_AUBIO_DOUBLE
     91    ippsZero_64f(s->data, (int)s->length);
     92  #else
     93    ippsZero_32f(s->data, (int)s->length);
     94  #endif
     95#elif defined(HAVE_ACCELERATE)
     96  aubio_vDSP_vclr(s->data, 1, s->length);
     97#elif defined(HAVE_MEMCPY_HACKS)
    8098  memset(s->data, 0, s->length * sizeof(smpl_t));
    8199#else
    82   aubio_vDSP_vclr(s->data, 1, s->length);
    83 #endif
     100  fvec_set_all(s, 0.);
    84101#endif
    85102}
     
    97114
    98115void fvec_weight(fvec_t *s, const fvec_t *weight) {
    99 #ifndef HAVE_ACCELERATE
     116  uint_t length = MIN(s->length, weight->length);
     117#if defined(HAVE_INTEL_IPP)
     118  #if HAVE_AUBIO_DOUBLE
     119    ippsMul_64f(s->data, weight->data, s->data, (int)length);
     120  #else
     121    ippsMul_32f(s->data, weight->data, s->data, (int)length);
     122  #endif
     123#elif defined(HAVE_ACCELERATE)
     124  aubio_vDSP_vmul( s->data, 1, weight->data, 1, s->data, 1, length );
     125#else
    100126  uint_t j;
    101   uint_t length = MIN(s->length, weight->length);
    102   for (j=0; j< length; j++) {
     127  for (j = 0; j < length; j++) {
    103128    s->data[j] *= weight->data[j];
    104129  }
    105 #else
    106   aubio_vDSP_vmul(s->data, 1, weight->data, 1, s->data, 1, s->length);
    107130#endif /* HAVE_ACCELERATE */
    108131}
    109132
    110133void fvec_weighted_copy(const fvec_t *in, const fvec_t *weight, fvec_t *out) {
    111 #ifndef HAVE_ACCELERATE
     134  uint_t length = MIN(in->length, MIN(out->length, weight->length));
     135#if defined(HAVE_INTEL_IPP)
     136  #if HAVE_AUBIO_DOUBLE
     137    ippsMul_64f(in->data, weight->data, out->data, (int)length);
     138  #else
     139    ippsMul_32f(in->data, weight->data, out->data, (int)length);
     140  #endif
     141#elif defined(HAVE_ACCELERATE)
     142  aubio_vDSP_vmul(in->data, 1, weight->data, 1, out->data, 1, length);
     143#else
    112144  uint_t j;
    113   uint_t length = MIN(out->length, weight->length);
    114   for (j=0; j< length; j++) {
     145  for (j = 0; j < length; j++) {
    115146    out->data[j] = in->data[j] * weight->data[j];
    116147  }
    117 #else
    118   aubio_vDSP_vmul(in->data, 1, weight->data, 1, out->data, 1, out->length);
    119 #endif /* HAVE_ACCELERATE */
     148#endif
    120149}
    121150
     
    126155    return;
    127156  }
    128 #ifdef HAVE_NOOPT
    129   uint_t j;
    130   for (j=0; j< t->length; j++) {
    131     t->data[j] = s->data[j];
    132   }
    133 #elif defined(HAVE_MEMCPY_HACKS)
    134   memcpy(t->data, s->data, t->length * sizeof(smpl_t));
     157#if defined(HAVE_INTEL_IPP)
     158  #if HAVE_AUBIO_DOUBLE
     159    ippsCopy_64f(s->data, t->data, (int)s->length);
     160  #else
     161    ippsCopy_32f(s->data, t->data, (int)s->length);
     162  #endif
    135163#elif defined(HAVE_ATLAS)
    136164  aubio_cblas_copy(s->length, s->data, 1, t->data, 1);
    137165#elif defined(HAVE_ACCELERATE)
    138166  aubio_vDSP_mmov(s->data, t->data, 1, s->length, 1, 1);
     167#elif defined(HAVE_MEMCPY_HACKS)
     168  memcpy(t->data, s->data, t->length * sizeof(smpl_t));
     169#else
     170  uint_t j;
     171  for (j = 0; j < t->length; j++) {
     172    t->data[j] = s->data[j];
     173  }
    139174#endif
    140175}
Note: See TracChangeset for help on using the changeset viewer.