Changeset 986131d
- Timestamp:
- Jul 29, 2017, 5:55:35 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:
- 7100895
- Parents:
- 34ce715
- Files:
-
- 60 edited
Legend:
- Unmodified
- Added
- Removed
-
examples/utils.c
r34ce715 r986131d 87 87 void examples_common_init (int argc, char **argv) 88 88 { 89 /* initialize statics */ 90 aubio_init(); 89 91 90 92 /* parse command line arguments */ -
src/cvec.c
r34ce715 r986131d 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 } -
src/fvec.c
r34ce715 r986131d 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 } -
src/mathutils.c
r34ce715 r986131d 25 25 #include "mathutils.h" 26 26 #include "musicutils.h" 27 28 #if defined HAVE_INTEL_IPP 29 #include <ippcore.h> 30 #include <ippvm.h> 31 #include <ipps.h> 32 #endif 27 33 28 34 /** Window types */ … … 155 161 { 156 162 smpl_t tmp = 0.0; 157 #ifndef HAVE_ACCELERATE 163 #if defined(HAVE_INTEL_IPP) 164 #if HAVE_AUBIO_DOUBLE 165 ippsMean_64f(s->data, (int)s->length, &tmp); 166 #else 167 ippsMean_32f(s->data, (int)s->length, &tmp, ippAlgHintFast); 168 #endif 169 return tmp; 170 #elif defined(HAVE_ACCELERATE) 171 aubio_vDSP_meanv(s->data, 1, &tmp, s->length); 172 return tmp; 173 #else 158 174 uint_t j; 159 175 for (j = 0; j < s->length; j++) { 160 176 tmp += s->data[j]; 161 177 } 162 return tmp / (smpl_t) (s->length); 163 #else 164 aubio_vDSP_meanv(s->data, 1, &tmp, s->length); 165 return tmp; 166 #endif /* HAVE_ACCELERATE */ 178 return tmp / (smpl_t)(s->length); 179 #endif 167 180 } 168 181 … … 171 184 { 172 185 smpl_t tmp = 0.0; 173 #ifndef HAVE_ACCELERATE 186 #if defined(HAVE_INTEL_IPP) 187 #if HAVE_AUBIO_DOUBLE 188 ippsSum_64f(s->data, (int)s->length, &tmp); 189 #else 190 ippsSum_32f(s->data, (int)s->length, &tmp, ippAlgHintFast); 191 #endif 192 #elif defined(HAVE_ACCELERATE) 193 aubio_vDSP_sve(s->data, 1, &tmp, s->length); 194 #else 174 195 uint_t j; 175 196 for (j = 0; j < s->length; j++) { 176 197 tmp += s->data[j]; 177 198 } 178 #else 179 aubio_vDSP_sve(s->data, 1, &tmp, s->length); 180 #endif /* HAVE_ACCELERATE */ 199 #endif 181 200 return tmp; 182 201 } … … 185 204 fvec_max (fvec_t * s) 186 205 { 187 #ifndef HAVE_ACCELERATE 188 uint_t j; 189 smpl_t tmp = 0.0; 190 for (j = 0; j < s->length; j++) { 206 #if defined(HAVE_INTEL_IPP) 207 smpl_t tmp = 0.; 208 #if HAVE_AUBIO_DOUBLE 209 ippsMax_64f( s->data, (int)s->length, &tmp); 210 #else 211 ippsMax_32f( s->data, (int)s->length, &tmp); 212 #endif 213 #elif defined(HAVE_ACCELERATE) 214 smpl_t tmp = 0.; 215 aubio_vDSP_maxv( s->data, 1, &tmp, s->length ); 216 #else 217 uint_t j; 218 smpl_t tmp = s->data[0]; 219 for (j = 1; j < s->length; j++) { 191 220 tmp = (tmp > s->data[j]) ? tmp : s->data[j]; 192 221 } 193 #else 222 #endif 223 return tmp; 224 } 225 226 smpl_t 227 fvec_min (fvec_t * s) 228 { 229 #if defined(HAVE_INTEL_IPP) 194 230 smpl_t tmp = 0.; 195 aubio_vDSP_maxv(s->data, 1, &tmp, s->length); 196 #endif 197 return tmp; 198 } 199 200 smpl_t 201 fvec_min (fvec_t * s) 202 { 203 #ifndef HAVE_ACCELERATE 204 uint_t j; 205 smpl_t tmp = s->data[0]; 206 for (j = 0; j < s->length; j++) { 207 tmp = (tmp < s->data[j]) ? tmp : s->data[j]; 208 } 209 #else 231 #if HAVE_AUBIO_DOUBLE 232 ippsMin_64f(s->data, (int)s->length, &tmp); 233 #else 234 ippsMin_32f(s->data, (int)s->length, &tmp); 235 #endif 236 #elif defined(HAVE_ACCELERATE) 210 237 smpl_t tmp = 0.; 211 238 aubio_vDSP_minv(s->data, 1, &tmp, s->length); 239 #else 240 uint_t j; 241 smpl_t tmp = s->data[0]; 242 for (j = 1; j < s->length; j++) { 243 tmp = (tmp < s->data[j]) ? tmp : s->data[j]; 244 } 212 245 #endif 213 246 return tmp; … … 570 603 } 571 604 605 uint_t 606 aubio_power_of_two_order (uint_t a) 607 { 608 int order = 0; 609 int temp = aubio_next_power_of_two(a); 610 while (temp >>= 1) { 611 ++order; 612 } 613 return order; 614 } 615 572 616 smpl_t 573 617 aubio_db_spl (const fvec_t * o) … … 634 678 635 679 void 680 aubio_init (void) 681 { 682 /* initialize intel IPP */ 683 #ifdef HAVE_INTEL_IPP 684 IppStatus status = ippInit(); 685 if (status != ippStsNoErr) { 686 fprintf (stderr, "Error: failed to initialize Intel IPP - status %d\n", status); 687 } 688 #endif 689 } 690 691 void 636 692 aubio_cleanup (void) 637 693 { -
src/mathutils.h
r34ce715 r986131d 313 313 uint_t aubio_next_power_of_two(uint_t a); 314 314 315 /** return the log2 factor of the given power of 2 value a */ 316 uint_t aubio_power_of_two_order(uint_t a); 317 315 318 /** compute normalised autocorrelation function 316 319 -
src/musicutils.h
r34ce715 r986131d 93 93 smpl_t aubio_miditofreq (smpl_t midi); 94 94 95 /** initialize global status at beginning of program 96 97 This function should be used before doing anything else in aubio. 98 So far it is only used to initialize the Intel IPP library, when it's used. 99 */ 100 void aubio_init (void); 101 95 102 /** clean up cached memory at the end of program 96 103 -
src/spectral/fft.c
r34ce715 r986131d 78 78 pthread_mutex_t aubio_fftw_mutex = PTHREAD_MUTEX_INITIALIZER; 79 79 80 #else 81 #ifdef HAVE_ACCELERATE // using ACCELERATE 80 #elif defined HAVE_ACCELERATE // using ACCELERATE 82 81 // https://developer.apple.com/library/mac/#documentation/Accelerate/Reference/vDSPRef/Reference/reference.html 83 82 #include <Accelerate/Accelerate.h> … … 113 112 #endif /* HAVE_AUBIO_DOUBLE */ 114 113 115 #else // using OOURA 114 #elif defined HAVE_INTEL_IPP // using INTEL IPP 115 116 #include <ippcore.h> 117 #include <ippvm.h> 118 #include <ipps.h> 119 120 #else // using OOURA 116 121 // let's use ooura instead 117 122 extern void aubio_ooura_rdft(int, int, smpl_t *, int *, smpl_t *); 118 123 119 #endif /* HAVE_ACCELERATE */ 120 #endif /* HAVE_FFTW3 */ 124 #endif 121 125 122 126 struct _aubio_fft_t { 123 127 uint_t winsize; 124 128 uint_t fft_size; 129 125 130 #ifdef HAVE_FFTW3 // using FFTW3 126 131 real_t *in, *out; 127 132 fftw_plan pfw, pbw; 128 fft_data_t * specdata; 129 #else 130 # ifdef HAVE_ACCELERATE// using ACCELERATE133 fft_data_t * specdata; /* complex spectral data */ 134 135 #elif defined HAVE_ACCELERATE // using ACCELERATE 131 136 int log2fftsize; 132 137 aubio_FFTSetup fftSetup; 133 138 aubio_DSPSplitComplex spec; 134 139 smpl_t *in, *out; 140 141 #elif defined HAVE_INTEL_IPP // using Intel IPP 142 // mark FFT impl as Intel IPP 143 #define INTEL_IPP_FFT 1 144 smpl_t *in, *out; 145 Ipp8u* memSpec; 146 Ipp8u* memInit; 147 Ipp8u* memBuffer; 148 #if HAVE_AUBIO_DOUBLE 149 struct FFTSpec_R_64f* fftSpec; 150 Ipp64fc* complexOut; 151 #else 152 struct FFTSpec_R_32f* fftSpec; 153 Ipp32fc* complexOut; 154 #endif 135 155 #else // using OOURA 136 156 smpl_t *in, *out; 137 157 smpl_t *w; 138 158 int *ip; 139 #endif /* HAVE_ACCELERATE*/140 #endif /* HAVE_FFTW3 */ 159 #endif /* using OOURA */ 160 141 161 fvec_t * compspec; 142 162 }; … … 148 168 goto beach; 149 169 } 170 150 171 #ifdef HAVE_FFTW3 151 172 uint_t i; … … 176 197 s->specdata[i] = 0.; 177 198 } 178 #else 179 # ifdef HAVE_ACCELERATE// using ACCELERATE199 200 #elif defined HAVE_ACCELERATE // using ACCELERATE 180 201 s->winsize = winsize; 181 202 s->fft_size = winsize; 182 203 s->compspec = new_fvec(winsize); 183 s->log2fftsize = (uint_t)log2f(s->fft_size);204 s->log2fftsize = aubio_power_of_two_order(s->fft_size); 184 205 s->in = AUBIO_ARRAY(smpl_t, s->fft_size); 185 206 s->out = AUBIO_ARRAY(smpl_t, s->fft_size); … … 187 208 s->spec.imagp = AUBIO_ARRAY(smpl_t, s->fft_size/2); 188 209 s->fftSetup = aubio_vDSP_create_fftsetup(s->log2fftsize, FFT_RADIX2); 210 211 #elif defined HAVE_INTEL_IPP // using Intel IPP 212 const IppHintAlgorithm qualityHint = ippAlgHintAccurate; // OR ippAlgHintFast; 213 const int flags = IPP_FFT_NODIV_BY_ANY; // we're scaling manually afterwards 214 int order = aubio_power_of_two_order(winsize); 215 int sizeSpec, sizeInit, sizeBuffer; 216 IppStatus status; 217 218 if (winsize <= 4 || aubio_is_power_of_two(winsize) != 1) 219 { 220 AUBIO_ERR("intel IPP fft: can only create with sizes > 4 and power of two, requested %d," 221 " try recompiling aubio with --enable-fftw3\n", winsize); 222 goto beach; 223 } 224 225 #if HAVE_AUBIO_DOUBLE 226 status = ippsFFTGetSize_R_64f(order, flags, qualityHint, 227 &sizeSpec, &sizeInit, &sizeBuffer); 228 #else 229 status = ippsFFTGetSize_R_32f(order, flags, qualityHint, 230 &sizeSpec, &sizeInit, &sizeBuffer); 231 #endif 232 if (status != ippStsNoErr) { 233 AUBIO_ERR("fft: failed to initialize fft. IPP error: %d\n", status); 234 goto beach; 235 } 236 s->fft_size = s->winsize = winsize; 237 s->compspec = new_fvec(winsize); 238 s->in = AUBIO_ARRAY(smpl_t, s->winsize); 239 s->out = AUBIO_ARRAY(smpl_t, s->winsize); 240 s->memSpec = ippsMalloc_8u(sizeSpec); 241 s->memBuffer = ippsMalloc_8u(sizeBuffer); 242 if (sizeInit > 0 ) { 243 s->memInit = ippsMalloc_8u(sizeInit); 244 } 245 #if HAVE_AUBIO_DOUBLE 246 s->complexOut = ippsMalloc_64fc(s->fft_size / 2 + 1); 247 status = ippsFFTInit_R_64f( 248 &s->fftSpec, order, flags, qualityHint, s->memSpec, s->memInit); 249 #else 250 s->complexOut = ippsMalloc_32fc(s->fft_size / 2 + 1); 251 status = ippsFFTInit_R_32f( 252 &s->fftSpec, order, flags, qualityHint, s->memSpec, s->memInit); 253 #endif 254 if (status != ippStsNoErr) { 255 AUBIO_ERR("fft: failed to initialize. IPP error: %d\n", status); 256 goto beach; 257 } 258 189 259 #else // using OOURA 190 260 if (aubio_is_power_of_two(winsize) != 1) { … … 201 271 s->w = AUBIO_ARRAY(smpl_t, s->fft_size); 202 272 s->ip[0] = 0; 203 #endif /* HAVE_ACCELERATE*/204 #endif /* HAVE_FFTW3 */ 273 #endif /* using OOURA */ 274 205 275 return s; 276 206 277 beach: 207 278 AUBIO_FREE(s); … … 211 282 void del_aubio_fft(aubio_fft_t * s) { 212 283 /* destroy data */ 213 del_fvec(s->compspec);214 284 #ifdef HAVE_FFTW3 // using FFTW3 215 285 pthread_mutex_lock(&aubio_fftw_mutex); … … 218 288 fftw_free(s->specdata); 219 289 pthread_mutex_unlock(&aubio_fftw_mutex); 220 #else /* HAVE_FFTW3 */ 221 # ifdef HAVE_ACCELERATE// using ACCELERATE290 291 #elif defined HAVE_ACCELERATE // using ACCELERATE 222 292 AUBIO_FREE(s->spec.realp); 223 293 AUBIO_FREE(s->spec.imagp); 224 294 aubio_vDSP_destroy_fftsetup(s->fftSetup); 295 296 #elif defined HAVE_INTEL_IPP // using Intel IPP 297 ippFree(s->memSpec); 298 ippFree(s->memInit); 299 ippFree(s->memBuffer); 300 ippFree(s->complexOut); 301 225 302 #else // using OOURA 226 303 AUBIO_FREE(s->w); 227 304 AUBIO_FREE(s->ip); 228 #endif /* HAVE_ACCELERATE */ 229 #endif /* HAVE_FFTW3 */ 305 #endif 306 307 del_fvec(s->compspec); 308 AUBIO_FREE(s->in); 230 309 AUBIO_FREE(s->out); 231 AUBIO_FREE(s->in);232 310 AUBIO_FREE(s); 233 311 } … … 235 313 void aubio_fft_do(aubio_fft_t * s, const fvec_t * input, cvec_t * spectrum) { 236 314 aubio_fft_do_complex(s, input, s->compspec); 237 aubio_fft_get_spectrum(s ->compspec, spectrum);315 aubio_fft_get_spectrum(s, s->compspec, spectrum); 238 316 } 239 317 240 318 void aubio_fft_rdo(aubio_fft_t * s, const cvec_t * spectrum, fvec_t * output) { 241 aubio_fft_get_realimag(s pectrum, s->compspec);319 aubio_fft_get_realimag(s, spectrum, s->compspec); 242 320 aubio_fft_rdo_complex(s, s->compspec, output); 243 321 } … … 252 330 memcpy(s->in, input->data, s->winsize * sizeof(smpl_t)); 253 331 #endif /* HAVE_MEMCPY_HACKS */ 332 254 333 #ifdef HAVE_FFTW3 // using FFTW3 255 334 fftw_execute(s->pfw); … … 266 345 } 267 346 #endif /* HAVE_COMPLEX_H */ 268 #else /* HAVE_FFTW3 */ 269 # ifdef HAVE_ACCELERATE// using ACCELERATE347 348 #elif defined HAVE_ACCELERATE // using ACCELERATE 270 349 // convert real data to even/odd format used in vDSP 271 350 aubio_vDSP_ctoz((aubio_DSPComplex*)s->in, 2, &s->spec, 1, s->fft_size/2); … … 282 361 smpl_t scale = 1./2.; 283 362 aubio_vDSP_vsmul(compspec->data, 1, &scale, compspec->data, 1, s->fft_size); 363 364 #elif defined HAVE_INTEL_IPP // using Intel IPP 365 366 // apply fft 367 #if HAVE_AUBIO_DOUBLE 368 ippsFFTFwd_RToCCS_64f(s->in, (Ipp64f*)s->complexOut, s->fftSpec, s->memBuffer); 369 #else 370 ippsFFTFwd_RToCCS_32f(s->in, (Ipp32f*)s->complexOut, s->fftSpec, s->memBuffer); 371 #endif 372 // convert complex buffer to [ r0, r1, ..., rN, iN-1, .., i2, i1] 373 compspec->data[0] = s->complexOut[0].re; 374 compspec->data[s->fft_size / 2] = s->complexOut[s->fft_size / 2].re; 375 for (i = 1; i < s->fft_size / 2; i++) { 376 compspec->data[i] = s->complexOut[i].re; 377 compspec->data[s->fft_size - i] = s->complexOut[i].im; 378 } 379 // apply scaling 380 #if HAVE_AUBIO_DOUBLE 381 ippsMulC_64f(compspec->data, 1.0 / 2.0, compspec->data, s->fft_size); 382 #else 383 ippsMulC_32f(compspec->data, 1.0 / 2.0, compspec->data, s->fft_size); 384 #endif 385 284 386 #else // using OOURA 285 387 aubio_ooura_rdft(s->winsize, 1, s->in, s->ip, s->w); … … 290 392 compspec->data[s->winsize - i] = - s->in[2 * i + 1]; 291 393 } 292 #endif /* HAVE_ACCELERATE */ 293 #endif /* HAVE_FFTW3 */ 394 #endif /* using OOURA */ 294 395 } 295 396 … … 314 415 output->data[i] = s->out[i]*renorm; 315 416 } 316 #else /* HAVE_FFTW3 */ 317 # ifdef HAVE_ACCELERATE// using ACCELERATE417 418 #elif defined HAVE_ACCELERATE // using ACCELERATE 318 419 // convert from real imag [ r0, r1, ..., rN, iN-1, .., i2, i1] 319 420 // to vDSP packed format [ r0, rN, r1, i1, ..., rN-1, iN-1 ] … … 333 434 smpl_t scale = 1.0 / s->winsize; 334 435 aubio_vDSP_vsmul(output->data, 1, &scale, output->data, 1, s->fft_size); 436 437 #elif defined HAVE_INTEL_IPP // using Intel IPP 438 439 // convert from real imag [ r0, 0, ..., rN, iN-1, .., i2, i1, iN-1] to complex format 440 s->complexOut[0].re = compspec->data[0]; 441 s->complexOut[0].im = 0; 442 s->complexOut[s->fft_size / 2].re = compspec->data[s->fft_size / 2]; 443 s->complexOut[s->fft_size / 2].im = 0.0; 444 for (i = 1; i < s->fft_size / 2; i++) { 445 s->complexOut[i].re = compspec->data[i]; 446 s->complexOut[i].im = compspec->data[s->fft_size - i]; 447 } 448 #if HAVE_AUBIO_DOUBLE 449 // apply fft 450 ippsFFTInv_CCSToR_64f((const Ipp64f *)s->complexOut, output->data, s->fftSpec, s->memBuffer); 451 // apply scaling 452 ippsMulC_64f(output->data, 1.0 / s->winsize, output->data, s->fft_size); 453 #else 454 // apply fft 455 ippsFFTInv_CCSToR_32f((const Ipp32f *)s->complexOut, output->data, s->fftSpec, s->memBuffer); 456 // apply scaling 457 ippsMulC_32f(output->data, 1.0f / s->winsize, output->data, s->fft_size); 458 #endif /* HAVE_AUBIO_DOUBLE */ 459 335 460 #else // using OOURA 336 smpl_t scale = 2.0 / s->winsize;461 smpl_t scale = 1.0 / s->winsize; 337 462 s->out[0] = compspec->data[0]; 338 463 s->out[1] = compspec->data[s->winsize / 2]; … … 345 470 output->data[i] = s->out[i] * scale; 346 471 } 347 #endif /* HAVE_ACCELERATE */ 348 #endif /* HAVE_FFTW3 */ 349 } 350 351 void aubio_fft_get_spectrum(const fvec_t * compspec, cvec_t * spectrum) { 352 aubio_fft_get_phas(compspec, spectrum); 353 aubio_fft_get_norm(compspec, spectrum); 354 } 355 356 void aubio_fft_get_realimag(const cvec_t * spectrum, fvec_t * compspec) { 357 aubio_fft_get_imag(spectrum, compspec); 358 aubio_fft_get_real(spectrum, compspec); 359 } 360 361 void aubio_fft_get_phas(const fvec_t * compspec, cvec_t * spectrum) { 472 #endif 473 } 474 475 void aubio_fft_get_spectrum(aubio_fft_t *s, const fvec_t * compspec, cvec_t * spectrum) { 476 aubio_fft_get_phas(s, compspec, spectrum); 477 aubio_fft_get_norm(s, compspec, spectrum); 478 } 479 480 void aubio_fft_get_realimag(aubio_fft_t *s, const cvec_t * spectrum, fvec_t * compspec) { 481 aubio_fft_get_imag(s, spectrum, compspec); 482 aubio_fft_get_real(s, spectrum, compspec); 483 } 484 485 void aubio_fft_get_phas(aubio_fft_t *s, const fvec_t * compspec, cvec_t * spectrum) { 486 487 #ifdef INTEL_IPP_FFT // using Intel IPP FFT 488 uint_t i; 489 490 // convert from real imag [ r0, 0, ..., rN, iN-1, .., i2, i1, iN-1] to complex format 491 s->complexOut[0].re = compspec->data[0]; 492 s->complexOut[0].im = 0; 493 s->complexOut[s->fft_size / 2].re = compspec->data[s->fft_size / 2]; 494 s->complexOut[s->fft_size / 2].im = 0.0; 495 for (i = 1; i < spectrum->length - 1; i++) { 496 s->complexOut[i].re = compspec->data[i]; 497 s->complexOut[i].im = compspec->data[compspec->length - i]; 498 } 499 500 #if HAVE_AUBIO_DOUBLE 501 IppStatus status = ippsPhase_64fc(s->complexOut, spectrum->phas, spectrum->length); 502 #else 503 IppStatus status = ippsPhase_32fc(s->complexOut, spectrum->phas, spectrum->length); 504 #endif 505 if (status != ippStsNoErr) { 506 AUBIO_ERR("fft: failed to extract phase from fft. IPP error: %d\n", status); 507 } 508 509 #else // NOT using Intel IPP 362 510 uint_t i; 363 511 if (compspec->data[0] < 0) { … … 375 523 spectrum->phas[spectrum->length - 1] = 0.; 376 524 } 377 } 378 379 void aubio_fft_get_norm(const fvec_t * compspec, cvec_t * spectrum) { 525 #endif 526 } 527 528 void aubio_fft_get_norm(aubio_fft_t *s, const fvec_t * compspec, cvec_t * spectrum) { 380 529 uint_t i = 0; 381 530 spectrum->norm[0] = ABS(compspec->data[0]); … … 388 537 } 389 538 390 void aubio_fft_get_imag( const cvec_t * spectrum, fvec_t * compspec) {539 void aubio_fft_get_imag(aubio_fft_t *s, const cvec_t * spectrum, fvec_t * compspec) { 391 540 uint_t i; 392 541 for (i = 1; i < ( compspec->length + 1 ) / 2 /*- 1 + 1*/; i++) { … … 396 545 } 397 546 398 void aubio_fft_get_real( const cvec_t * spectrum, fvec_t * compspec) {547 void aubio_fft_get_real(aubio_fft_t *s, const cvec_t * spectrum, fvec_t * compspec) { 399 548 uint_t i; 400 549 for (i = 0; i < compspec->length / 2 + 1; i++) { -
src/spectral/fft.h
r34ce715 r986131d 99 99 100 100 */ 101 void aubio_fft_get_spectrum( const fvec_t * compspec, cvec_t * spectrum);101 void aubio_fft_get_spectrum(aubio_fft_t *s, const fvec_t * compspec, cvec_t * spectrum); 102 102 /** convert real/imag spectrum to norm/phas spectrum 103 103 … … 106 106 107 107 */ 108 void aubio_fft_get_realimag( const cvec_t * spectrum, fvec_t * compspec);108 void aubio_fft_get_realimag(aubio_fft_t *s, const cvec_t * spectrum, fvec_t * compspec); 109 109 110 110 /** compute phas spectrum from real/imag parts … … 114 114 115 115 */ 116 void aubio_fft_get_phas( const fvec_t * compspec, cvec_t * spectrum);116 void aubio_fft_get_phas(aubio_fft_t *s, const fvec_t * compspec, cvec_t * spectrum); 117 117 /** compute imaginary part from the norm/phas cvec 118 118 … … 121 121 122 122 */ 123 void aubio_fft_get_imag( const cvec_t * spectrum, fvec_t * compspec);123 void aubio_fft_get_imag(aubio_fft_t *s, const cvec_t * spectrum, fvec_t * compspec); 124 124 125 125 /** compute norm component from real/imag parts … … 129 129 130 130 */ 131 void aubio_fft_get_norm( const fvec_t * compspec, cvec_t * spectrum);131 void aubio_fft_get_norm(aubio_fft_t *s, const fvec_t * compspec, cvec_t * spectrum); 132 132 /** compute real part from norm/phas components 133 133 … … 136 136 137 137 */ 138 void aubio_fft_get_real( const cvec_t * spectrum, fvec_t * compspec);138 void aubio_fft_get_real(aubio_fft_t *s, const cvec_t * spectrum, fvec_t * compspec); 139 139 140 140 #ifdef __cplusplus -
tests/src/io/test-sink-multi.c
r34ce715 r986131d 8 8 int main (int argc, char **argv) 9 9 { 10 aubio_init(); 11 10 12 sint_t err = 0; 11 13 … … 70 72 del_aubio_source(i); 71 73 beach_source: 74 75 aubio_cleanup(); 76 72 77 return err; 73 78 } -
tests/src/io/test-sink.c
r34ce715 r986131d 4 4 int main (int argc, char **argv) 5 5 { 6 aubio_init(); 7 6 8 sint_t err = 0; 7 9 … … 55 57 del_fvec(vec); 56 58 beach_fvec: 59 60 aubio_cleanup(); 61 57 62 return err; 58 63 } -
tests/src/io/test-sink_apple_audio-multi.c
r34ce715 r986131d 8 8 int main (int argc, char **argv) 9 9 { 10 aubio_init(); 11 10 12 sint_t err = 0; 11 13 … … 75 77 PRINT_ERR("aubio was not compiled with aubio_sink_apple_audio\n"); 76 78 #endif /* HAVE_SINK_APPLE_AUDIO */ 79 80 aubio_cleanup(); 81 77 82 return err; 78 83 } -
tests/src/io/test-sink_apple_audio.c
r34ce715 r986131d 8 8 int main (int argc, char **argv) 9 9 { 10 aubio_init(); 11 10 12 sint_t err = 0; 11 13 … … 64 66 PRINT_ERR("aubio was not compiled with aubio_source_apple_audio\n"); 65 67 #endif /* HAVE_SINK_APPLE_AUDIO */ 68 69 aubio_cleanup(); 70 66 71 return err; 67 72 } -
tests/src/io/test-sink_sndfile-multi.c
r34ce715 r986131d 8 8 int main (int argc, char **argv) 9 9 { 10 aubio_init(); 11 10 12 sint_t err = 0; 11 13 … … 75 77 PRINT_ERR("aubio was not compiled with aubio_sink_sndfile\n"); 76 78 #endif /* HAVE_SNDFILE */ 79 80 aubio_cleanup(); 81 77 82 return err; 78 83 } -
tests/src/io/test-sink_sndfile.c
r34ce715 r986131d 8 8 int main (int argc, char **argv) 9 9 { 10 aubio_init(); 11 10 12 sint_t err = 0; 11 13 … … 64 66 PRINT_ERR("aubio was not compiled with aubio_source_sndfile\n"); 65 67 #endif /* HAVE_SNDFILE */ 68 69 aubio_cleanup(); 70 66 71 return err; 67 72 } -
tests/src/io/test-sink_wavwrite-multi.c
r34ce715 r986131d 8 8 int main (int argc, char **argv) 9 9 { 10 aubio_init(); 11 10 12 sint_t err = 0; 11 13 … … 75 77 PRINT_ERR("aubio was not compiled with aubio_sink_wavwrite\n"); 76 78 #endif /* HAVE_WAVWRITE */ 79 80 aubio_cleanup(); 81 77 82 return err; 78 83 } -
tests/src/io/test-sink_wavwrite.c
r34ce715 r986131d 8 8 int main (int argc, char **argv) 9 9 { 10 aubio_init(); 11 10 12 sint_t err = 0; 11 13 … … 64 66 PRINT_ERR("aubio was not compiled with aubio_sink_wavwrite\n"); 65 67 #endif /* HAVE_WAVWRITE */ 68 69 aubio_cleanup(); 70 66 71 return err; 67 72 } -
tests/src/io/test-source.c
r34ce715 r986131d 4 4 int main (int argc, char **argv) 5 5 { 6 aubio_init(); 7 6 8 uint_t err = 0; 7 9 if (argc < 2) { … … 56 58 del_aubio_source (s); 57 59 beach: 60 aubio_cleanup(); 58 61 return err; 59 62 } -
tests/src/io/test-source_apple_audio.c
r34ce715 r986131d 8 8 int main (int argc, char **argv) 9 9 { 10 aubio_init(); 11 10 12 uint_t err = 0; 11 13 if (argc < 2) { … … 60 62 PRINT_ERR("aubio was not compiled with aubio_source_apple_audio\n"); 61 63 #endif /* HAVE_SOURCE_APPLE_AUDIO */ 64 65 aubio_cleanup(); 66 62 67 return err; 63 68 } -
tests/src/io/test-source_avcodec.c
r34ce715 r986131d 8 8 int main (int argc, char **argv) 9 9 { 10 aubio_init(); 11 10 12 uint_t err = 0; 11 13 if (argc < 2) { … … 60 62 PRINT_ERR("aubio was not compiled with aubio_source_avcodec\n"); 61 63 #endif /* HAVE_LIBAV */ 64 65 aubio_cleanup(); 66 62 67 return err; 63 68 } -
tests/src/io/test-source_multi.c
r34ce715 r986131d 4 4 int main (int argc, char **argv) 5 5 { 6 aubio_init(); 7 6 8 sint_t err = 0; 7 9 if (argc < 2) { … … 54 56 beach: 55 57 58 aubio_cleanup(); 59 56 60 return err; 57 61 } -
tests/src/io/test-source_seek.c
r34ce715 r986131d 4 4 int main (int argc, char **argv) 5 5 { 6 aubio_init(); 7 6 8 uint_t err = 0; 7 9 if (argc < 2) { … … 89 91 // check that we got about half the frames, with 3 decimals 90 92 assert ( roundf(1.e3 * old_n_frames_1 / old_n_frames_3) / 1.e3 == 2.); 93 94 aubio_cleanup(); 95 91 96 return err; 92 97 } -
tests/src/io/test-source_sndfile.c
r34ce715 r986131d 8 8 int main (int argc, char **argv) 9 9 { 10 aubio_init(); 11 10 12 uint_t err = 0; 11 13 if (argc < 2) { … … 60 62 PRINT_ERR("aubio was not compiled with aubio_source_sndfile\n"); 61 63 #endif /* HAVE_SNDFILE */ 64 65 aubio_cleanup(); 66 62 67 return err; 63 68 } -
tests/src/io/test-source_wavread.c
r34ce715 r986131d 8 8 int main (int argc, char **argv) 9 9 { 10 aubio_init(); 11 10 12 uint_t err = 0; 11 13 if (argc < 2) { … … 61 63 PRINT_ERR("aubio was not compiled with aubio_source_wavread\n"); 62 64 #endif /* HAVE_WAVREAD */ 65 66 aubio_cleanup(); 67 63 68 return err; 64 69 } -
tests/src/onset/test-onset.c
r34ce715 r986131d 4 4 int main (int argc, char **argv) 5 5 { 6 aubio_init(); 7 6 8 uint_t err = 0; 7 9 if (argc < 2) { -
tests/src/pitch/test-pitch.c
r34ce715 r986131d 3 3 int main (void) 4 4 { 5 aubio_init(); 6 5 7 // 1. allocate some memory 6 8 uint_t n = 0; // frame counter -
tests/src/pitch/test-pitchfcomb.c
r34ce715 r986131d 8 8 int main (void) 9 9 { 10 aubio_init(); 10 11 uint_t i = 0; 11 12 uint_t win_s = 1024; // window size -
tests/src/pitch/test-pitchmcomb.c
r34ce715 r986131d 8 8 int main (void) 9 9 { 10 aubio_init(); 11 10 12 uint_t n = 10; // compute n times 11 13 uint_t win_s = 1024; // window size -
tests/src/pitch/test-pitchschmitt.c
r34ce715 r986131d 8 8 int main (void) 9 9 { 10 aubio_init(); 10 11 uint_t n = 10; // compute n times 11 12 uint_t win_s = 1024; // window size -
tests/src/pitch/test-pitchspecacf.c
r34ce715 r986131d 8 8 int main (void) 9 9 { 10 aubio_init(); 11 10 12 uint_t n = 10; // compute n times 11 13 uint_t win_s = 1024; // window size -
tests/src/pitch/test-pitchyin.c
r34ce715 r986131d 8 8 int main (void) 9 9 { 10 aubio_init(); 11 10 12 uint_t n = 10; // compute n times 11 13 uint_t win_s = 1024; // window size -
tests/src/pitch/test-pitchyinfft.c
r34ce715 r986131d 8 8 int main (void) 9 9 { 10 aubio_init(); 11 10 12 uint_t n = 10; // compute n times 11 13 uint_t win_s = 1024; // window size -
tests/src/spectral/test-awhitening.c
r34ce715 r986131d 4 4 int main (int argc, char **argv) 5 5 { 6 aubio_init(); 7 6 8 sint_t err = 0; 7 9 … … 80 82 del_fvec(vec); 81 83 beach_fvec: 84 aubio_cleanup(); 82 85 return err; 83 86 } -
tests/src/spectral/test-fft.c
r34ce715 r986131d 3 3 int main (void) 4 4 { 5 aubio_init(); 6 5 7 int return_code = 0; 6 8 uint_t i, n_iters = 100; // number of iterations … … 44 46 del_cvec(fftgrain); 45 47 del_fvec(out); 48 46 49 aubio_cleanup(); 50 47 51 return return_code; 48 52 } -
tests/src/spectral/test-filterbank.c
r34ce715 r986131d 3 3 int main (void) 4 4 { 5 aubio_init(); 6 5 7 uint_t win_s = 1024; // window size 6 8 uint_t n_filters = 13; // number of filters … … 34 36 del_cvec (in_spec); 35 37 del_fvec (out_filters); 38 36 39 aubio_cleanup (); 37 40 -
tests/src/spectral/test-filterbank_mel.c
r34ce715 r986131d 3 3 int main (void) 4 4 { 5 aubio_init(); 6 5 7 uint_t samplerate = 16000; // samplerate of signal to filter 6 8 uint_t win_s = 512; // fft size … … 33 35 del_cvec (in_spec); 34 36 del_fvec (out_filters); 37 35 38 aubio_cleanup (); 36 39 -
tests/src/spectral/test-mfcc.c
r34ce715 r986131d 3 3 int main (void) 4 4 { 5 aubio_init(); 6 5 7 uint_t win_s = 512; // fft size 6 8 uint_t n_filters = 40; // number of filters … … 25 27 del_cvec (in); 26 28 del_fvec (out); 29 27 30 aubio_cleanup (); 28 31 -
tests/src/spectral/test-phasevoc.c
r34ce715 r986131d 3 3 int main (void) 4 4 { 5 aubio_init(); 6 5 7 uint_t n = 6; // compute n times 6 8 uint_t win_s = 32; // window size … … 42 44 del_fvec(out); 43 45 del_aubio_pvoc(pv); 46 44 47 aubio_cleanup(); 45 48 -
tests/src/spectral/test-specdesc.c
r34ce715 r986131d 3 3 int main (void) 4 4 { 5 aubio_init(); 6 5 7 uint_t win_s = 1024; // window size 6 8 cvec_t *in = new_cvec (win_s); // input buffer … … 39 41 del_cvec (in); 40 42 del_fvec (out); 43 41 44 aubio_cleanup (); 42 45 -
tests/src/spectral/test-tss.c
r34ce715 r986131d 3 3 int main (void) 4 4 { 5 aubio_init(); 6 5 7 uint_t n = 10; // compute n times 6 8 uint_t win_s = 1024; // window size -
tests/src/synth/test-sampler.c
r34ce715 r986131d 4 4 int main (int argc, char **argv) 5 5 { 6 aubio_init(); 7 6 8 sint_t err = 0; 7 9 … … 54 56 del_aubio_sink(sink); 55 57 del_fvec(vec); 58 56 59 aubio_cleanup(); 57 60 -
tests/src/synth/test-wavetable.c
r34ce715 r986131d 4 4 int main (int argc, char **argv) 5 5 { 6 aubio_init(); 7 6 8 sint_t err = 0; 7 9 … … 63 65 del_aubio_sink(sink); 64 66 del_fvec(vec); 67 65 68 aubio_cleanup(); 66 69 -
tests/src/tempo/test-beattracking.c
r34ce715 r986131d 6 6 int main (void) 7 7 { 8 aubio_init(); 9 8 10 uint_t i = 0; 9 11 uint_t win_s = 1024; // window size … … 34 36 del_fvec(in); 35 37 del_fvec(out); 38 36 39 aubio_cleanup(); 37 40 -
tests/src/tempo/test-tempo.c
r34ce715 r986131d 4 4 int main (int argc, char **argv) 5 5 { 6 aubio_init(); 7 6 8 uint_t err = 0; 7 9 if (argc < 2) { … … 57 59 del_fvec(out); 58 60 del_aubio_source(source); 61 59 62 beach: 60 63 aubio_cleanup(); -
tests/src/temporal/test-a_weighting.c
r34ce715 r986131d 3 3 int main (void) 4 4 { 5 5 aubio_init(); 6 6 7 aubio_filter_t * f; 7 8 … … 39 40 del_aubio_filter (f); 40 41 42 aubio_cleanup(); 43 41 44 return 0; 42 45 } -
tests/src/temporal/test-biquad.c
r34ce715 r986131d 3 3 int main (void) 4 4 { 5 aubio_init(); 6 5 7 uint_t win_s = 64; // window size 6 8 … … 29 31 del_fvec(out_vec); 30 32 33 aubio_cleanup(); 34 31 35 return 0; 32 36 } -
tests/src/temporal/test-c_weighting.c
r34ce715 r986131d 3 3 int main (void) 4 4 { 5 aubio_init(); 6 5 7 aubio_filter_t * f; 6 8 … … 38 40 del_aubio_filter (f); 39 41 42 aubio_cleanup(); 43 40 44 return 0; 41 45 } -
tests/src/temporal/test-filter.c
r34ce715 r986131d 3 3 int main (void) 4 4 { 5 aubio_init(); 6 5 7 uint_t win_s = 16; // window size 6 8 uint_t impulse_at = win_s / 2; … … 30 32 del_fvec (out); 31 33 del_aubio_filter (o); 34 32 35 aubio_cleanup (); 33 36 -
tests/src/temporal/test-resampler.c
r34ce715 r986131d 3 3 int main (void) 4 4 { 5 aubio_init(); 6 5 7 uint_t win_s = 1024; // window size 6 8 smpl_t ratio = 0.5; … … 19 21 del_fvec (out); 20 22 23 aubio_cleanup(); 24 21 25 return 0; 22 26 } -
tests/src/test-cvec.c
r34ce715 r986131d 4 4 int main (void) 5 5 { 6 aubio_init(); 7 6 8 uint_t i, window_size = 16; // window size 7 9 cvec_t * complex_vector = new_cvec (window_size); // input buffer … … 45 47 // destroy it 46 48 del_cvec(complex_vector); 49 50 aubio_cleanup(); 51 47 52 return 0; 48 53 } -
tests/src/test-delnull.c
r34ce715 r986131d 7 7 int main (void) 8 8 { 9 aubio_init(); 10 9 11 uint_t return_code = 0; 10 12 fvec_t *f = new_fvec(-12); … … 21 23 return_code = 3; 22 24 } 25 26 aubio_cleanup(); 27 23 28 return return_code; 24 29 } -
tests/src/test-fmat.c
r34ce715 r986131d 7 7 int main (void) 8 8 { 9 aubio_init(); 10 9 11 uint_t height = 3, length = 9, i, j; 10 12 // create fmat_t object … … 26 28 // destroy it 27 29 del_fmat(mat); 30 31 aubio_cleanup(); 32 28 33 return 0; 29 34 } -
tests/src/test-fvec.c
r34ce715 r986131d 4 4 int main (void) 5 5 { 6 aubio_init(); 7 6 8 uint_t vec_size = 10, i; 7 9 fvec_t * vec = new_fvec (vec_size); … … 39 41 del_fvec(vec); 40 42 43 aubio_cleanup(); 44 41 45 return 0; 42 46 } -
tests/src/test-lvec.c
r34ce715 r986131d 4 4 int main (void) 5 5 { 6 aubio_init(); 7 6 8 uint_t win_s = 32; // window size 7 9 lvec_t * sp = new_lvec (win_s); // input buffer … … 14 16 lvec_print (sp); 15 17 del_lvec(sp); 18 19 aubio_cleanup(); 20 16 21 return 0; 17 22 } -
tests/src/test-mathutils-window.c
r34ce715 r986131d 4 4 int main (void) 5 5 { 6 aubio_init(); 7 6 8 uint_t length = 0; 7 9 uint_t n_length = 4, n_types = 10, i, t; … … 27 29 } 28 30 } 31 32 aubio_cleanup(); 33 29 34 return 0; 30 35 } -
tests/src/test-mathutils.c
r34ce715 r986131d 114 114 int main (void) 115 115 { 116 aubio_init(); 117 116 118 test_next_power_of_two(); 117 119 test_miditofreq(); 118 120 test_freqtomidi(); 121 122 aubio_cleanup(); 123 119 124 return 0; 120 125 } -
tests/src/utils/test-hist.c
r34ce715 r986131d 5 5 int main (void) 6 6 { 7 aubio_init(); 8 7 9 uint_t length; 8 10 for (length = 1; length < 10; length ++ ) { … … 26 28 del_fvec(t); 27 29 } 30 31 aubio_cleanup(); 32 28 33 return 0; 29 34 } -
tests/src/utils/test-log.c
r34ce715 r986131d 24 24 int main (void) 25 25 { 26 aubio_init(); 27 26 28 fprintf(stdout, "### testing normal logging\n"); 27 29 AUBIO_ERR("testing normal AUBIO_LOG_ERR\n"); … … 57 59 AUBIO_DBG("testing again normal AUBIO_LOG_DBG\n"); 58 60 61 aubio_cleanup(); 62 59 63 return 0; 60 64 } -
tests/src/utils/test-parameter.c
r34ce715 r986131d 25 25 int main (void) 26 26 { 27 aubio_init(); 28 27 29 smpl_t max_value = 100.; 28 30 smpl_t min_value = 0.; … … 67 69 del_aubio_parameter (param); 68 70 71 aubio_cleanup(); 72 69 73 return 0; 70 74 } -
tests/src/utils/test-scale.c
r34ce715 r986131d 5 5 int main (void) 6 6 { 7 aubio_init(); 8 7 9 uint_t n = 0; 8 10 uint_t win_s = 1024; // window size … … 19 21 del_fvec(in); 20 22 23 aubio_cleanup(); 24 21 25 return 0; 22 26 } -
wscript
r34ce715 r986131d 51 51 help_str = 'compile with fftw3 instead of ooura', 52 52 help_disable_str = 'do not compile with fftw3') 53 add_option_enable_disable(ctx, 'intelipp', default = None, 54 help_str = 'use Intel IPP libraries (auto)', 55 help_disable_str = 'do not use Intel IPP libraries') 53 56 add_option_enable_disable(ctx, 'complex', default = False, 54 57 help_str ='compile with C99 complex', … … 156 159 # configure warnings 157 160 ctx.env.CFLAGS += ['/W4', '/D_CRT_SECURE_NO_WARNINGS'] 161 # ignore "possible loss of data" warnings 162 ctx.env.CFLAGS += ['/wd4305', '/wd4244', '/wd4245', '/wd4267'] 163 # ignore "unreferenced formal parameter" warnings 164 ctx.env.CFLAGS += ['/wd4100'] 158 165 # set optimization level and runtime libs 159 166 if (ctx.options.build_type == "release"): … … 286 293 else: 287 294 ctx.msg('Checking if complex.h is enabled', 'no') 288 295 296 # check for Intel IPP 297 if (ctx.options.enable_intelipp != False): 298 if (ctx.check(header_name=['ippcore.h', 'ippvm.h', 'ipps.h'], mandatory = False) and 299 ctx.check(lib=['ippcore', 'ippvm', 'ipps'], uselib_store='INTEL_IPP', mandatory = False)): 300 ctx.msg('Checking if Intel IPP is available', 'yes') 301 ctx.define('HAVE_INTEL_IPP', 1) 302 if ctx.env.CC_NAME == 'msvc': 303 # force linking multi-threaded static IPP libraries on Windows with msvc 304 ctx.define('_IPP_SEQUENTIAL_STATIC', 1) 305 else: 306 ctx.msg('Checking if Intel IPP is available', 'no') 307 289 308 # check for fftw3 290 309 if (ctx.options.enable_fftw3 != False or ctx.options.enable_fftw3f != False): … … 310 329 ctx.define('HAVE_FFTW3', 1) 311 330 312 # fftw not enabled, use vDSP or ooura331 # fftw not enabled, use vDSP, intelIPP or ooura 313 332 if 'HAVE_FFTW3F' in ctx.env.define_key: 314 333 ctx.msg('Checking for FFT implementation', 'fftw3f') … … 317 336 elif 'HAVE_ACCELERATE' in ctx.env.define_key: 318 337 ctx.msg('Checking for FFT implementation', 'vDSP') 338 elif 'HAVE_INTEL_IPP' in ctx.env.define_key: 339 ctx.msg('Checking for FFT implementation', 'Intel IPP') 319 340 else: 320 341 ctx.msg('Checking for FFT implementation', 'ooura')
Note: See TracChangeset
for help on using the changeset viewer.