// This file is part of the 64k demo project. // It implements the 512-point Inverse Discrete Cosine Transform. // Used for real-time synthesis of audio from spectral data. #include "dct.h" #include void idct_512(const float *input, float *output) { const float PI = 3.14159265358979323846f; for (int n = 0; n < DCT_SIZE; ++n) { float sum = input[0] / 2.0f; for (int k = 1; k < DCT_SIZE; ++k) { sum += input[k] * cosf(PI / (float)DCT_SIZE * (float)k * ((float)n + 0.5f)); } output[n] = sum * (2.0f / (float)DCT_SIZE); } }