diff options
-rw-r--r-- | common/fft.cpp | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/common/fft.cpp b/common/fft.cpp index a750792047..30e5449ef4 100644 --- a/common/fft.cpp +++ b/common/fft.cpp @@ -37,6 +37,7 @@ FFT::FFT(int bits, int inverse) : _bits(bits), _inverse(inverse) { assert((_bits >= 2) && (_bits <= 16)); int n = 1 << bits; + int nPoints; _tmpBuf = new Complex[n]; _expTab = new Complex[n / 2]; @@ -48,8 +49,10 @@ FFT::FFT(int bits, int inverse) : _bits(bits), _inverse(inverse) { _revTab[-splitRadixPermutation(i, n, _inverse) & (n - 1)] = i; for (int i = 0; i < ARRAYSIZE(_cosTables); i++) { - if (i+4 <= _bits) - _cosTables[i] = new Common::CosineTable(i+4); + if (i + 4 <= _bits) { + nPoints = 1 << (i + 4); + _cosTables[i] = new Common::CosineTable(nPoints); + } else _cosTables[i] = nullptr; } |