Changeset 633400d for src/fvec.c
- Timestamp:
- Dec 5, 2018, 10:34:39 PM (5 years ago)
- Branches:
- feature/cnn, feature/crepe, feature/pitchshift, feature/timestretch, fix/ffmpeg5, master
- Children:
- 283a619a
- Parents:
- 5b46bc3 (diff), f19db54 (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
r5b46bc3 r633400d 61 61 62 62 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 } 63 #if defined(HAVE_INTEL_IPP) 64 aubio_ippsSet(val, s->data, (int)s->length); 68 65 #elif defined(HAVE_ATLAS) 69 66 aubio_catlas_set(s->length, val, s->data, 1); 70 67 #elif defined(HAVE_ACCELERATE) 71 68 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 } 72 75 #endif 73 76 } 74 77 75 78 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) 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) 80 84 memset(s->data, 0, s->length * sizeof(smpl_t)); 81 85 #else 82 aubio_vDSP_vclr(s->data, 1, s->length); 83 #endif 86 fvec_set_all(s, 0.); 84 87 #endif 85 88 } … … 91 94 void fvec_rev(fvec_t *s) { 92 95 uint_t j; 93 for (j=0; j< FLOOR( s->length/2); j++) {96 for (j=0; j< FLOOR((smpl_t)s->length/2); j++) { 94 97 ELEM_SWAP(s->data[j], s->data[s->length-1-j]); 95 98 } … … 97 100 98 101 void 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 100 108 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++) { 103 110 s->data[j] *= weight->data[j]; 104 111 } 105 #else106 aubio_vDSP_vmul(s->data, 1, weight->data, 1, s->data, 1, s->length);107 112 #endif /* HAVE_ACCELERATE */ 108 113 } 109 114 110 115 void 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 112 122 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++) { 115 124 out->data[j] = in->data[j] * weight->data[j]; 116 125 } 117 #else 118 aubio_vDSP_vmul(in->data, 1, weight->data, 1, out->data, 1, out->length); 119 #endif /* HAVE_ACCELERATE */ 126 #endif 120 127 } 121 128 … … 126 133 return; 127 134 } 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 #elif defined(HAVE_ATLAS) 135 #if defined(HAVE_INTEL_IPP) 136 aubio_ippsCopy(s->data, t->data, (int)s->length); 137 #elif defined(HAVE_BLAS) 136 138 aubio_cblas_copy(s->length, s->data, 1, t->data, 1); 137 139 #elif defined(HAVE_ACCELERATE) 138 140 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 } 139 148 #endif 140 149 }
Note: See TracChangeset
for help on using the changeset viewer.