Changeset 81b3910 for src/fvec.c
- Timestamp:
- Oct 1, 2017, 12:50:15 PM (7 years ago)
- 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. - File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/fvec.c
r16c12a1 r81b3910 21 21 #include "aubio_priv.h" 22 22 #include "fvec.h" 23 24 #if defined HAVE_INTEL_IPP 25 #include <ippcore.h> 26 #include <ippvm.h> 27 #include <ipps.h> 28 #endif 23 29 24 30 fvec_t * new_fvec(uint_t length) { … … 61 67 62 68 void 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 68 75 #elif defined(HAVE_ATLAS) 69 76 aubio_catlas_set(s->length, val, s->data, 1); 70 77 #elif defined(HAVE_ACCELERATE) 71 78 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 } 72 85 #endif 73 86 } 74 87 75 88 void 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) 80 98 memset(s->data, 0, s->length * sizeof(smpl_t)); 81 99 #else 82 aubio_vDSP_vclr(s->data, 1, s->length); 83 #endif 100 fvec_set_all(s, 0.); 84 101 #endif 85 102 } … … 97 114 98 115 void 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 100 126 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++) { 103 128 s->data[j] *= weight->data[j]; 104 129 } 105 #else106 aubio_vDSP_vmul(s->data, 1, weight->data, 1, s->data, 1, s->length);107 130 #endif /* HAVE_ACCELERATE */ 108 131 } 109 132 110 133 void 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 112 144 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++) { 115 146 out->data[j] = in->data[j] * weight->data[j]; 116 147 } 117 #else 118 aubio_vDSP_vmul(in->data, 1, weight->data, 1, out->data, 1, out->length); 119 #endif /* HAVE_ACCELERATE */ 148 #endif 120 149 } 121 150 … … 126 155 return; 127 156 } 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 135 163 #elif defined(HAVE_ATLAS) 136 164 aubio_cblas_copy(s->length, s->data, 1, t->data, 1); 137 165 #elif defined(HAVE_ACCELERATE) 138 166 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 } 139 174 #endif 140 175 }
Note: See TracChangeset
for help on using the changeset viewer.