| 147 | } |
| 148 | |
| 149 | inline bool espDspEnsureTwiddles(int N) FL_NOEXCEPT { |
| 150 | EspDspRealCtx &ctx = espDspRealCtx(); |
| 151 | if (ctx.n == N) return true; |
| 152 | if (!espDspGlobalInit()) return false; |
| 153 | ctx.work.resize(N); |
| 154 | ctx.cos_table.resize(N / 2 - 1); |
| 155 | ctx.sin_table.resize(N / 2 - 1); |
| 156 | const float twoPi = 6.28318530717958647692f; |
| 157 | const float invN = 1.0f / static_cast<float>(N); |
| 158 | for (int k = 1; k < N / 2; ++k) { |
| 159 | float th = twoPi * static_cast<float>(k) * invN; |
| 160 | ctx.cos_table[k - 1] = ::cosf(th); |
| 161 | ctx.sin_table[k - 1] = ::sinf(th); |
| 162 | } |
| 163 | ctx.n = N; |
| 164 | return true; |
| 165 | } |
| 166 | |
| 167 | /// Forward real FFT via packed N/2-complex trick + unpack. |
| 168 | /// |
no test coverage detected