Skip to main content

quantize_block_dct8

Function quantize_block_dct8 

Source
pub fn quantize_block_dct8(
    dct_coeffs: &[f32; 64],
    weights: &[f32; 64],
    qac_qm: f32,
    thresholds: &[f32; 4],
    output: &mut [i32; 64],
)
Expand description

Quantize a DCT8 block (64 coefficients) with dead-zone thresholding.

For each coefficient i (except DC at index 0): val = dct_coeffs[i] / weights[i] * qac_qm if |val| < threshold[quadrant]: output 0 else: output round(val) as i32

DC (index 0) is always set to 0 (handled separately by LLF coding).

thresholds are the 4 quadrant thresholds: [0] = top-left (y<4, x<4), [1] = top-right (y<4, x>=4), [2] = bottom-left (y>=4, x<4), [3] = bottom-right (y>=4, x>=4)