When calculating a type-II DCT with FFTW, you create an fftw_plan, via

fftw_plan plan = fftw_plan_r2r_1d(size, in_ptr, out_ptr, FFTW_REDFT10, FFTW_ESTIMATE);

As I understand it, the plan precomputes the twiddle factors so that the plan can be efficiently reused for multiple calls to fftw_execute_r2r(plan, in_ptr, out_ptr).

Since I'm trying to calculate \begin{align*} c_{k} = \frac{1}{N} \sum_{j=0}^{N-1} f\left(\cos\left(\frac{(j+1/2)\pi}{N}\right)\right) \cos\left(\frac{(j+1/2)k\pi}{N}\right) \end{align*} I figure that the fftw_plan already has computed the argument to $f$, so I don't want to recompute it.

How do you extract the twiddle factors from the fftw_plan?


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.