MCPcopy Create free account
hub / github.com/FastLED/FastLED / espDspEnsureTwiddles

Function espDspEnsureTwiddles

src/fl/audio/fft/fft_backend.h:149–165  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

147}
148
149inline 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///

Callers 1

espDspRealForwardFunction · 0.85

Calls 4

espDspGlobalInitFunction · 0.85
cosfFunction · 0.85
sinfFunction · 0.85
resizeMethod · 0.45

Tested by

no test coverage detected