48#define M_PI 3.14159265358979323846
67 h->SinTable.reinit(2*h->Points);
69 h->BitReversed.reinit(h->Points);
71 for(
size_t i = 0; i < h->Points; i++)
74 for(
size_t mask = h->Points / 2; mask > 0; mask >>= 1)
75 temp = (temp >> 1) + (i & mask ? h->Points : 0);
77 h->BitReversed[i] = temp;
80 for(
size_t i = 0; i < h->Points; i++)
82 h->SinTable[h->BitReversed[i] ]=(
fft_type)-sin(2*
M_PI*i/(2*h->Points));
83 h->SinTable[h->BitReversed[i]+1]=(
fft_type)-cos(2*
M_PI*i/(2*h->Points));
86#ifdef EXPERIMENTAL_EQ_SSE_THREADED
88 for(
size_t i = 0; i < 32; i++)
135 while (it !=
end && it->get() != hFFT)
167 fft_type HRplus,HRminus,HIplus,HIminus;
170 auto ButterfliesPerGroup = h->
Points/2;
180 endptr1 = buffer + h->
Points * 2;
182 while(ButterfliesPerGroup > 0)
185 B = buffer + ButterfliesPerGroup * 2;
195 v1 = *B * cos + *(B + 1) * sin;
196 v2 = *B * sin - *(B + 1) * cos;
198 *(
A++) = *(B++) - 2 * v1;
200 *(
A++) = *(B++) + 2 * v2;
203 B += ButterfliesPerGroup * 2;
206 ButterfliesPerGroup >>= 1;
218 HRplus = (HRminus = *
A - *B ) + (*B * 2);
219 HIplus = (HIminus = *(
A+1) - *(B+1)) + (*(B+1) * 2);
220 v1 = (sin*HRminus - cos*HIplus);
221 v2 = (cos*HRminus + sin*HIplus);
225 *(B+1) = *(
A+1) - HIminus;
238 v1=buffer[0]-buffer[1];
239 buffer[0]+=buffer[1];
269 fft_type HRplus,HRminus,HIplus,HIminus;
272 auto ButterfliesPerGroup = h->
Points / 2;
276 B = buffer + h->
Points * 2 - 2;
282 HRplus = (HRminus = *
A - *B ) + (*B * 2);
283 HIplus = (HIminus = *(
A+1) - *(B+1)) + (*(B+1) * 2);
284 v1 = (sin*HRminus + cos*HIplus);
285 v2 = (cos*HRminus - sin*HIplus);
289 *(B+1) = *(
A+1) - HIminus;
304 v1=0.5f*(buffer[0]+buffer[1]);
305 v2=0.5f*(buffer[0]-buffer[1]);
317 endptr1 = buffer + h->
Points * 2;
319 while(ButterfliesPerGroup > 0)
322 B = buffer + ButterfliesPerGroup * 2;
332 v1 = *B * cos - *(B + 1) * sin;
333 v2 = *B * sin + *(B + 1) * cos;
335 *(
A++) = *(B++) - v1;
337 *(
A++) = *(B++) - v2;
340 B += ButterfliesPerGroup * 2;
342 ButterfliesPerGroup >>= 1;
350 for(
size_t i = 1; i < hFFT->
Points; i++) {
354 RealOut[0] = buffer[0];
356 RealOut[hFFT->
Points] = buffer[1];
357 ImagOut[hFFT->
Points] = 0;
363 for(
size_t i = 0; i < hFFT->
Points; i++) {
void RealFFTf(fft_type *buffer, const FFTParam *h)
static std::vector< std::unique_ptr< FFTParam > > hFFTArray(MAX_HFFT)
void InverseRealFFTf(fft_type *buffer, const FFTParam *h)
HFFT InitializeFFT(size_t fftlen)
void ReorderToTime(const FFTParam *hFFT, const fft_type *buffer, fft_type *TimeOut)
HFFT GetFFT(size_t fftlen)
wxCriticalSection getFFTMutex
void ReorderToFreq(const FFTParam *hFFT, const fft_type *buffer, fft_type *RealOut, fft_type *ImagOut)
std::unique_ptr< FFTParam, FFTDeleter > HFFT
const char * end(const char *str) noexcept
void operator()(FFTParam *p) const
ArrayOf< int > BitReversed
ArrayOf< fft_type > SinTable