 Timestamp:
 Oct 1, 2017, 3:32:35 PM (2 years ago)
 Branches:
 feature/autosink, feature/constantq, feature/pitchshift, feature/pydocstrings, feature/timestretch, master
 Children:
 379ef6c
 Parents:
 4b943729
 File:

 1 edited
Legend:
 Unmodified
 Added
 Removed

src/spectral/fft.c
r4b943729 r0ad2e17 114 114 #elif defined HAVE_INTEL_IPP // using INTEL IPP 115 115 116 #include <ippcore.h> 117 #include <ippvm.h> 118 #include <ipps.h> 116 #if !HAVE_AUBIO_DOUBLE 117 #define aubio_IppFloat Ipp32f 118 #define aubio_IppComplex Ipp32fc 119 #define aubio_FFTSpec FFTSpec_R_32f 120 #define aubio_ippsPhas ippsPhase_32fc 121 #define aubio_ippsMalloc_complex ippsMalloc_32fc 122 #define aubio_ippsFFTInit_R ippsFFTInit_R_32f 123 #define aubio_ippsFFTGetSize_R ippsFFTGetSize_R_32f 124 #define aubio_ippsFFTInv_CCSToR ippsFFTInv_CCSToR_32f 125 #define aubio_ippsFFTFwd_RToCCS ippsFFTFwd_RToCCS_32f 126 #else /* HAVE_AUBIO_DOUBLE */ 127 #define aubio_IppFloat Ipp64f 128 #define aubio_IppComplex Ipp64fc 129 #define aubio_FFTSpec FFTSpec_R_64f 130 #define aubio_ippsPhas ippsPhase_64fc 131 #define aubio_ippsMalloc_complex ippsMalloc_64fc 132 #define aubio_ippsFFTInit_R ippsFFTInit_R_64f 133 #define aubio_ippsFFTGetSize_R ippsFFTGetSize_R_64f 134 #define aubio_ippsFFTInv_CCSToR ippsFFTInv_CCSToR_64f 135 #define aubio_ippsFFTFwd_RToCCS ippsFFTFwd_RToCCS_64f 136 #endif 137 119 138 120 139 #else // using OOURA … … 146 165 Ipp8u* memInit; 147 166 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 167 struct aubio_FFTSpec* fftSpec; 168 aubio_IppComplex* complexOut; 155 169 #else // using OOURA 156 170 smpl_t *in, *out; … … 223 237 } 224 238 225 #if HAVE_AUBIO_DOUBLE 226 status = ippsFFTGetSize_R_64f(order, flags, qualityHint, 239 status = aubio_ippsFFTGetSize_R(order, flags, qualityHint, 227 240 &sizeSpec, &sizeInit, &sizeBuffer); 228 #else229 status = ippsFFTGetSize_R_32f(order, flags, qualityHint,230 &sizeSpec, &sizeInit, &sizeBuffer);231 #endif232 241 if (status != ippStsNoErr) { 233 242 AUBIO_ERR("fft: failed to initialize fft. IPP error: %d\n", status); … … 243 252 s>memInit = ippsMalloc_8u(sizeInit); 244 253 } 245 #if HAVE_AUBIO_DOUBLE 246 s>complexOut = ippsMalloc_64fc(s>fft_size / 2 + 1); 247 status = ippsFFTInit_R_64f( 254 s>complexOut = aubio_ippsMalloc_complex(s>fft_size / 2 + 1); 255 status = aubio_ippsFFTInit_R( 248 256 &s>fftSpec, order, flags, qualityHint, s>memSpec, s>memInit); 249 #else250 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 #endif254 257 if (status != ippStsNoErr) { 255 258 AUBIO_ERR("fft: failed to initialize. IPP error: %d\n", status); … … 365 368 366 369 // 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 370 aubio_ippsFFTFwd_RToCCS(s>in, (aubio_IppFloat*)s>complexOut, s>fftSpec, s>memBuffer); 372 371 // convert complex buffer to [ r0, r1, ..., rN, iN1, .., i2, i1] 373 372 compspec>data[0] = s>complexOut[0].re; … … 378 377 } 379 378 // 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 379 aubio_ippsMulC(compspec>data, 1.0 / 2.0, compspec>data, s>fft_size); 385 380 386 381 #else // using OOURA … … 446 441 s>complexOut[i].im = compspec>data[s>fft_size  i]; 447 442 } 448 #if HAVE_AUBIO_DOUBLE449 443 // apply fft 450 ippsFFTInv_CCSToR_64f((const Ipp64f*)s>complexOut, output>data, s>fftSpec, s>memBuffer);444 aubio_ippsFFTInv_CCSToR((const aubio_IppFloat *)s>complexOut, output>data, s>fftSpec, s>memBuffer); 451 445 // apply scaling 452 ippsMulC_64f(output>data, 2.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, 2.0f / s>winsize, output>data, s>fft_size); 458 #endif /* HAVE_AUBIO_DOUBLE */ 446 aubio_ippsMulC(output>data, 1.0 / s>winsize, output>data, s>fft_size); 459 447 460 448 #else // using OOURA … … 497 485 s>complexOut[i].im = compspec>data[compspec>length  i]; 498 486 } 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 487 488 IppStatus status = aubio_ippsPhas(s>complexOut, spectrum>phas, spectrum>length); 505 489 if (status != ippStsNoErr) { 506 490 AUBIO_ERR("fft: failed to extract phase from fft. IPP error: %d\n", status);
Note: See TracChangeset
for help on using the changeset viewer.