Changeset 81b3910 for src/cvec.c
- Timestamp:
- Oct 1, 2017, 12:50:15 PM (6 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/cvec.c
r16c12a1 r81b3910 21 21 #include "aubio_priv.h" 22 22 #include "cvec.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 cvec_t * new_cvec(uint_t length) { … … 86 92 return; 87 93 } 88 #ifdef HAVE_MEMCPY_HACKS 94 #if defined(HAVE_INTEL_IPP) 95 #if HAVE_AUBIO_DOUBLE 96 ippsCopy_64f(s->phas, t->phas, (int)s->length); 97 ippsCopy_64f(s->norm, t->norm, (int)s->length); 98 #else 99 ippsCopy_32f(s->phas, t->phas, (int)s->length); 100 ippsCopy_32f(s->norm, t->norm, (int)s->length); 101 #endif 102 #elif defined(HAVE_MEMCPY_HACKS) 89 103 memcpy(t->norm, s->norm, t->length * sizeof(smpl_t)); 90 104 memcpy(t->phas, s->phas, t->length * sizeof(smpl_t)); 91 #else /* HAVE_MEMCPY_HACKS */105 #else 92 106 uint_t j; 93 107 for (j=0; j< t->length; j++) { … … 95 109 t->phas[j] = s->phas[j]; 96 110 } 97 #endif /* HAVE_MEMCPY_HACKS */ 98 } 99 100 void cvec_norm_set_all (cvec_t *s, smpl_t val) { 111 #endif 112 } 113 114 void cvec_norm_set_all(cvec_t *s, smpl_t val) { 115 #if defined(HAVE_INTEL_IPP) 116 #if HAVE_AUBIO_DOUBLE 117 ippsSet_64f(val, s->norm, (int)s->length); 118 #else 119 ippsSet_32f(val, s->norm, (int)s->length); 120 #endif 121 #else 101 122 uint_t j; 102 123 for (j=0; j< s->length; j++) { 103 124 s->norm[j] = val; 104 125 } 126 #endif 105 127 } 106 128 107 129 void cvec_norm_zeros(cvec_t *s) { 108 #ifdef HAVE_MEMCPY_HACKS 130 #if defined(HAVE_INTEL_IPP) 131 #if HAVE_AUBIO_DOUBLE 132 ippsZero_64f(s->norm, (int)s->length); 133 #else 134 ippsZero_32f(s->norm, (int)s->length); 135 #endif 136 #elif defined(HAVE_MEMCPY_HACKS) 109 137 memset(s->norm, 0, s->length * sizeof(smpl_t)); 110 #else /* HAVE_MEMCPY_HACKS */138 #else 111 139 cvec_norm_set_all (s, 0.); 112 #endif /* HAVE_MEMCPY_HACKS */140 #endif 113 141 } 114 142 … … 118 146 119 147 void cvec_phas_set_all (cvec_t *s, smpl_t val) { 148 #if defined(HAVE_INTEL_IPP) 149 #if HAVE_AUBIO_DOUBLE 150 ippsSet_64f(val, s->phas, (int)s->length); 151 #else 152 ippsSet_32f(val, s->phas, (int)s->length); 153 #endif 154 #else 120 155 uint_t j; 121 156 for (j=0; j< s->length; j++) { 122 157 s->phas[j] = val; 123 158 } 159 #endif 124 160 } 125 161 126 162 void cvec_phas_zeros(cvec_t *s) { 127 #ifdef HAVE_MEMCPY_HACKS 163 #if defined(HAVE_INTEL_IPP) 164 #if HAVE_AUBIO_DOUBLE 165 ippsZero_64f(s->phas, (int)s->length); 166 #else 167 ippsZero_32f(s->phas, (int)s->length); 168 #endif 169 #elif defined(HAVE_MEMCPY_HACKS) 128 170 memset(s->phas, 0, s->length * sizeof(smpl_t)); 129 171 #else … … 142 184 143 185 void cvec_logmag(cvec_t *s, smpl_t lambda) { 144 uint_t j; 145 for (j=0; j< s->length; j++) { 146 s->norm[j] = LOG(lambda * s->norm[j] + 1); 147 } 148 } 186 #if defined(HAVE_INTEL_IPP) 187 #if HAVE_AUBIO_DOUBLE 188 ippsMulC_64f(s->norm, lambda, s->norm, (int)s->length); 189 ippsAddC_64f(s->norm, 1.0, s->norm, (int)s->length); 190 ippsLn_64f_A26(s->norm, s->norm, (int)s->length); 191 #else 192 ippsMulC_32f(s->norm, lambda, s->norm, (int)s->length); 193 ippsAddC_32f(s->norm, 1.0, s->norm, (int)s->length); 194 ippsLn_32f_A21(s->norm, s->norm, (int)s->length); 195 #endif 196 #else 197 uint_t j; 198 for (j=0; j< s->length; j++) { 199 s->norm[j] = LOG(lambda * s->norm[j] + 1); 200 } 201 #endif 202 }
Note: See TracChangeset
for help on using the changeset viewer.