@woosh/meep-engine
Version:
Pure JavaScript game engine. Fully featured and production ready.
22 lines (20 loc) • 656 B
JavaScript
import { idct_1d } from "./idct_1d.js";
/**
* Performs a 2D 8x8 Inverse Discrete Cosine Transform.
*
* The 2D IDCT is computed by applying the 1D IDCT to each column
* and then to each row of the 8x8 block.
*
* @param {Float64Array} block A pointer to a 64-element array (representing an 8x8 block)
* of DCT coefficients. The transformation is done in-place.
*/
export function idct_2d(block) {
// Pass 1: Apply 1D IDCT to each column
for (let i = 0; i < 8; ++i) {
idct_1d(block, i, 8);
}
// Pass 2: Apply 1D IDCT to each row
for (let i = 0; i < 8; ++i) {
idct_1d(block, i * 8, 1);
}
}