Expand description
The MDEC’s IDCT matrix, generated from the DCT basis.
MDEC command 3 takes 64 signed 16-bit coefficients, sent as 32 words
with the even-numbered coefficient in each word’s low halfword
(psx-spx, “MDEC Decompression”, command 3). Coefficient 8k + n is
the 8-point DCT-II basis function of frequency k sampled at n,
scaled to 1.15 fixed point and truncated toward zero:
M[0][n] = 32768 / sqrt(2) (= 16384 * sqrt(2))
M[k][n] = 32768 * cos((2n + 1) * k * pi / 16) for k = 1..7Everything below runs at compile time, in integers: pi from Machin’s formula, cosines from their Taylor series in 2.62 fixed point, and the DC term from an integer square root. Nothing here exists at run time except the finished table.
Constants§
- MATRIX
- The 64 coefficients, frequency-major:
MATRIX[8 * k + n]. - MATRIX_
WORDS MATRIXpacked for the MDEC: wordwholds coefficient2win its low halfword and2w + 1in its high halfword.