spectrogram: Speed up FFT iterator a bit more

This commit is contained in:
Mike Walters
2016-06-04 16:10:51 +01:00
parent 7ad24233fd
commit a96964bd2b

View File

@@ -147,7 +147,7 @@ void SpectrogramPlot::getLine(float *dest, off_t sample)
for (int i = 0; i < fftSize; i++) {
// Start from the middle of the FFTW array and wrap
// to rearrange the data
int k = (i + fftSize / 2) & (fftSize - 1);
int k = i ^ (fftSize >> 1);
auto s = buffer[k] * invFFTSize;
float power = s.real() * s.real() + s.imag() * s.imag();
float logPower = log2f(power) * logMultiplier;