Changeset 5b896e0


Ignore:
Timestamp:
Sep 2, 2015, 2:44:22 PM (4 years ago)
Author:
Paul Brossier <piem@piem.org>
Branches:
feature/autosink, feature/constantq, feature/pitchshift, feature/pydocstrings, feature/timestretch, master, pitchshift, sampler, timestretch, yinfft+
Children:
1dd95c7
Parents:
98d8d2b
Message:

src/fvec.c: Accelerate fvec_set_all, fvec_zeros, fvec_weight, fvec_copy

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/fvec.c

    r98d8d2b r5b896e0  
    2121#include "aubio_priv.h"
    2222#include "fvec.h"
     23
     24#ifdef HAVE_ACCELERATE
     25#include <Accelerate/Accelerate.h>
     26#endif
    2327
    2428fvec_t * new_fvec( uint_t length) {
     
    6165
    6266void fvec_set_all (fvec_t *s, smpl_t val) {
     67#ifndef HAVE_ACCELERATE
    6368  uint_t j;
    6469  for (j=0; j< s->length; j++) {
    6570    s->data[j] = val;
    6671  }
     72#else
     73#if !HAVE_AUBIO_DOUBLE
     74  vDSP_vfill(&val, s->data, 1, s->length);
     75#else /* HAVE_AUBIO_DOUBLE */
     76  vDSP_vfillD(&val, s->data, 1, s->length);
     77#endif /* HAVE_AUBIO_DOUBLE */
     78#endif
    6779}
    6880
    6981void fvec_zeros(fvec_t *s) {
     82#ifndef HAVE_ACCELERATE
    7083#if HAVE_MEMCPY_HACKS
    7184  memset(s->data, 0, s->length * sizeof(smpl_t));
    7285#else
    7386  fvec_set_all (s, 0.);
     87#endif
     88#else
     89#if !HAVE_AUBIO_DOUBLE
     90  vDSP_vclr(s->data, 1, s->length);
     91#else /* HAVE_AUBIO_DOUBLE */
     92  vDSP_vclrD(s->data, 1, s->length);
     93#endif /* HAVE_AUBIO_DOUBLE */
    7494#endif
    7595}
     
    87107
    88108void fvec_weight(fvec_t *s, fvec_t *weight) {
     109#ifndef HAVE_ACCELERATE
    89110  uint_t j;
    90111  uint_t length = MIN(s->length, weight->length);
     
    92113    s->data[j] *= weight->data[j];
    93114  }
     115#else
     116#if !HAVE_AUBIO_DOUBLE
     117  vDSP_vmul(s->data, 1, weight->data, 1, s->data, 1, s->length);
     118#else /* HAVE_AUBIO_DOUBLE */
     119  vDSP_vmulD(s->data, 1, weight->data, 1, s->data, 1, s->length);
     120#endif /* HAVE_AUBIO_DOUBLE */
     121#endif /* HAVE_ACCELERATE */
    94122}
    95123
     
    100128    return;
    101129  }
     130#ifndef HAVE_ACCELERATE
    102131#if HAVE_MEMCPY_HACKS
    103132  memcpy(t->data, s->data, t->length * sizeof(smpl_t));
     
    108137  }
    109138#endif
     139#else
     140#if !HAVE_AUBIO_DOUBLE
     141  vDSP_mmov(s->data, t->data, 1, s->length, 1, 1);
     142#else /* HAVE_AUBIO_DOUBLE */
     143  vDSP_mmovD(s->data, t->data, 1, s->length, 1, 1);
     144#endif /* HAVE_AUBIO_DOUBLE */
     145#endif /* HAVE_ACCELERATE */
    110146}
Note: See TracChangeset for help on using the changeset viewer.