Changeset 98d8d2b


Ignore:
Timestamp:
Sep 2, 2015, 2:27:52 PM (9 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, pitchshift, sampler, timestretch, yinfft+
Children:
5b896e0
Parents:
e06ac8f
Message:

src/mathutils.c: Accelerate fvec_sum and fvec_mean

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/mathutils.c

    re06ac8f r98d8d2b  
    159159fvec_mean (fvec_t * s)
    160160{
    161   uint_t j;
    162161  smpl_t tmp = 0.0;
     162#ifndef HAVE_ACCELERATE
     163  uint_t j;
    163164  for (j = 0; j < s->length; j++) {
    164165    tmp += s->data[j];
    165166  }
    166167  return tmp / (smpl_t) (s->length);
     168#else
     169#if !HAVE_AUBIO_DOUBLE
     170  vDSP_meanv(s->data, 1, &tmp, s->length);
     171#else /* HAVE_AUBIO_DOUBLE */
     172  vDSP_meanvD(s->data, 1, &tmp, s->length);
     173#endif /* HAVE_AUBIO_DOUBLE */
     174  return tmp;
     175#endif /* HAVE_ACCELERATE */
    167176}
    168177
     
    170179fvec_sum (fvec_t * s)
    171180{
    172   uint_t j;
    173181  smpl_t tmp = 0.0;
     182#ifndef HAVE_ACCELERATE
     183  uint_t j;
    174184  for (j = 0; j < s->length; j++) {
    175185    tmp += s->data[j];
    176186  }
     187#else
     188#if !HAVE_AUBIO_DOUBLE
     189  vDSP_sve(s->data, 1, &tmp, s->length);
     190#else /* HAVE_AUBIO_DOUBLE */
     191  vDSP_sveD(s->data, 1, &tmp, s->length);
     192#endif /* HAVE_AUBIO_DOUBLE */
     193#endif /* HAVE_ACCELERATE */
    177194  return tmp;
    178195}
Note: See TracChangeset for help on using the changeset viewer.