// This file is part of the 64k demo project. // It implements the 512-point Forward Discrete Cosine Transform. // Used for analyzing audio files into spectrograms. #include "dct.h" #include void fdct_512(const float* input, float* output) { const float PI = 3.14159265358979323846f; for (int k = 0; k < DCT_SIZE; ++k) { float sum = 0.0f; for (int n = 0; n < DCT_SIZE; ++n) { sum += input[n] * cosf(PI / (float)DCT_SIZE * ((float)n + 0.5f) * (float)k); } output[k] = sum; } }