Skip to main content

quantize

Function quantize 

Source
pub fn quantize(coeffs: &[i32; 16], qp: u8, dz_div: i64) -> [i32; 16]
Expand description

Quantizes forward-transform coefficients to levels. intra selects the rounding dead-zone offset (1/3 for intra, 1/6 for inter). Scalar quantization. dz_div sets the rounding dead-zone: the offset added before the right shift is 2^qbits / dz_div, so a smaller dz_div rounds up more (higher quality, more bits). Typical values: 6 for inter, 3 for an I-frame that serves as a reference, 2 for all-intra (where the larger offset is a net rate-distortion win — better-quantized blocks predict their neighbors better, shrinking downstream residuals).