Changeset 20c8769 for src/mathutils.c
- Timestamp:
- Oct 1, 2017, 8:04:30 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:
- f080cbf
- Parents:
- 25cf957 (diff), 799d992 (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/mathutils.c
r25cf957 r20c8769 160 160 { 161 161 smpl_t tmp = 0.0; 162 #ifndef HAVE_ACCELERATE 162 #if defined(HAVE_INTEL_IPP) 163 aubio_ippsMean(s->data, (int)s->length, &tmp); 164 return tmp; 165 #elif defined(HAVE_ACCELERATE) 166 aubio_vDSP_meanv(s->data, 1, &tmp, s->length); 167 return tmp; 168 #else 163 169 uint_t j; 164 170 for (j = 0; j < s->length; j++) { 165 171 tmp += s->data[j]; 166 172 } 167 return tmp / (smpl_t) (s->length); 168 #else 169 aubio_vDSP_meanv(s->data, 1, &tmp, s->length); 170 return tmp; 171 #endif /* HAVE_ACCELERATE */ 173 return tmp / (smpl_t)(s->length); 174 #endif 172 175 } 173 176 … … 176 179 { 177 180 smpl_t tmp = 0.0; 178 #ifndef HAVE_ACCELERATE 181 #if defined(HAVE_INTEL_IPP) 182 aubio_ippsSum(s->data, (int)s->length, &tmp); 183 #elif defined(HAVE_ACCELERATE) 184 aubio_vDSP_sve(s->data, 1, &tmp, s->length); 185 #else 179 186 uint_t j; 180 187 for (j = 0; j < s->length; j++) { 181 188 tmp += s->data[j]; 182 189 } 183 #else 184 aubio_vDSP_sve(s->data, 1, &tmp, s->length); 185 #endif /* HAVE_ACCELERATE */ 190 #endif 186 191 return tmp; 187 192 } … … 190 195 fvec_max (fvec_t * s) 191 196 { 192 #ifndef HAVE_ACCELERATE 193 uint_t j; 194 smpl_t tmp = 0.0; 195 for (j = 0; j < s->length; j++) { 197 #if defined(HAVE_INTEL_IPP) 198 smpl_t tmp = 0.; 199 aubio_ippsMax( s->data, (int)s->length, &tmp); 200 #elif defined(HAVE_ACCELERATE) 201 smpl_t tmp = 0.; 202 aubio_vDSP_maxv( s->data, 1, &tmp, s->length ); 203 #else 204 uint_t j; 205 smpl_t tmp = s->data[0]; 206 for (j = 1; j < s->length; j++) { 196 207 tmp = (tmp > s->data[j]) ? tmp : s->data[j]; 197 208 } 198 #else 209 #endif 210 return tmp; 211 } 212 213 smpl_t 214 fvec_min (fvec_t * s) 215 { 216 #if defined(HAVE_INTEL_IPP) 199 217 smpl_t tmp = 0.; 200 aubio_vDSP_maxv(s->data, 1, &tmp, s->length); 201 #endif 202 return tmp; 203 } 204 205 smpl_t 206 fvec_min (fvec_t * s) 207 { 208 #ifndef HAVE_ACCELERATE 209 uint_t j; 210 smpl_t tmp = s->data[0]; 211 for (j = 0; j < s->length; j++) { 212 tmp = (tmp < s->data[j]) ? tmp : s->data[j]; 213 } 214 #else 218 aubio_ippsMin(s->data, (int)s->length, &tmp); 219 #elif defined(HAVE_ACCELERATE) 215 220 smpl_t tmp = 0.; 216 221 aubio_vDSP_minv(s->data, 1, &tmp, s->length); 222 #else 223 uint_t j; 224 smpl_t tmp = s->data[0]; 225 for (j = 1; j < s->length; j++) { 226 tmp = (tmp < s->data[j]) ? tmp : s->data[j]; 227 } 217 228 #endif 218 229 return tmp; … … 575 586 } 576 587 588 uint_t 589 aubio_power_of_two_order (uint_t a) 590 { 591 int order = 0; 592 int temp = aubio_next_power_of_two(a); 593 while (temp >>= 1) { 594 ++order; 595 } 596 return order; 597 } 598 577 599 smpl_t 578 600 aubio_db_spl (const fvec_t * o)
Note: See TracChangeset
for help on using the changeset viewer.