Changeset bfbfafa for src/fvec.c


Ignore:
Timestamp:
Oct 3, 2017, 10:31:12 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:
2e5c52e
Parents:
7b7a58e (diff), 25db68c (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 'master' into dct

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/fvec.c

    r7b7a58e rbfbfafa  
    6161
    6262void 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   }
     63#if defined(HAVE_INTEL_IPP)
     64  aubio_ippsSet(val, s->data, (int)s->length);
    6865#elif defined(HAVE_ATLAS)
    6966  aubio_catlas_set(s->length, val, s->data, 1);
    7067#elif defined(HAVE_ACCELERATE)
    7168  aubio_vDSP_vfill(&val, s->data, 1, s->length);
     69#else
     70  uint_t j;
     71  for ( j = 0; j< s->length; j++ )
     72  {
     73    s->data[j] = val;
     74  }
    7275#endif
    7376}
    7477
    7578void 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)
     79#if defined(HAVE_INTEL_IPP)
     80  aubio_ippsZero(s->data, (int)s->length);
     81#elif defined(HAVE_ACCELERATE)
     82  aubio_vDSP_vclr(s->data, 1, s->length);
     83#elif defined(HAVE_MEMCPY_HACKS)
    8084  memset(s->data, 0, s->length * sizeof(smpl_t));
    8185#else
    82   aubio_vDSP_vclr(s->data, 1, s->length);
    83 #endif
     86  fvec_set_all(s, 0.);
    8487#endif
    8588}
     
    97100
    98101void fvec_weight(fvec_t *s, const fvec_t *weight) {
    99 #ifndef HAVE_ACCELERATE
     102  uint_t length = MIN(s->length, weight->length);
     103#if defined(HAVE_INTEL_IPP)
     104  aubio_ippsMul(s->data, weight->data, s->data, (int)length);
     105#elif defined(HAVE_ACCELERATE)
     106  aubio_vDSP_vmul( s->data, 1, weight->data, 1, s->data, 1, length );
     107#else
    100108  uint_t j;
    101   uint_t length = MIN(s->length, weight->length);
    102   for (j=0; j< length; j++) {
     109  for (j = 0; j < length; j++) {
    103110    s->data[j] *= weight->data[j];
    104111  }
    105 #else
    106   aubio_vDSP_vmul(s->data, 1, weight->data, 1, s->data, 1, s->length);
    107112#endif /* HAVE_ACCELERATE */
    108113}
    109114
    110115void fvec_weighted_copy(const fvec_t *in, const fvec_t *weight, fvec_t *out) {
    111 #ifndef HAVE_ACCELERATE
     116  uint_t length = MIN(in->length, MIN(out->length, weight->length));
     117#if defined(HAVE_INTEL_IPP)
     118  aubio_ippsMul(in->data, weight->data, out->data, (int)length);
     119#elif defined(HAVE_ACCELERATE)
     120  aubio_vDSP_vmul(in->data, 1, weight->data, 1, out->data, 1, length);
     121#else
    112122  uint_t j;
    113   uint_t length = MIN(out->length, weight->length);
    114   for (j=0; j< length; j++) {
     123  for (j = 0; j < length; j++) {
    115124    out->data[j] = in->data[j] * weight->data[j];
    116125  }
    117 #else
    118   aubio_vDSP_vmul(in->data, 1, weight->data, 1, out->data, 1, out->length);
    119 #endif /* HAVE_ACCELERATE */
     126#endif
    120127}
    121128
     
    126133    return;
    127134  }
    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));
     135#if defined(HAVE_INTEL_IPP)
     136  aubio_ippsCopy(s->data, t->data, (int)s->length);
    135137#elif defined(HAVE_ATLAS)
    136138  aubio_cblas_copy(s->length, s->data, 1, t->data, 1);
    137139#elif defined(HAVE_ACCELERATE)
    138140  aubio_vDSP_mmov(s->data, t->data, 1, s->length, 1, 1);
     141#elif defined(HAVE_MEMCPY_HACKS)
     142  memcpy(t->data, s->data, t->length * sizeof(smpl_t));
     143#else
     144  uint_t j;
     145  for (j = 0; j < t->length; j++) {
     146    t->data[j] = s->data[j];
     147  }
    139148#endif
    140149}
Note: See TracChangeset for help on using the changeset viewer.