pub struct SideInfo {
pub blocks_wide: usize,
pub blocks_tall: usize,
/* private fields */
}Expand description
Per-coefficient rounding errors from quantization.
Each error is in [-0.5, +0.5] and represents how far the continuous (unquantized) DCT coefficient was from its rounded integer value. Positive error means the pre-quantization value was above the integer; negative means below.
Stored as i8 [-127, +127] via error * 254, giving ~0.004 resolution.
This is 8x smaller than f64 and 4x smaller than f32, saving 85 MB (12MP)
or 341 MB (48MP) compared to the original f64 representation.
Fields§
§blocks_wide: usizeNumber of 8x8 blocks horizontally.
blocks_tall: usizeNumber of 8x8 blocks vertically.
Implementations§
Source§impl SideInfo
impl SideInfo
Sourcepub fn compute(
raw_rgb: &[u8],
pixel_width: u32,
pixel_height: u32,
cover_grid: &DctGrid,
qt_values: &[u16; 64],
) -> Self
pub fn compute( raw_rgb: &[u8], pixel_width: u32, pixel_height: u32, cover_grid: &DctGrid, qt_values: &[u16; 64], ) -> Self
Compute side information from raw RGB pixels and the cover JPEG.
For each Y-channel 8x8 block:
- Forward DCT on the original (pre-JPEG) pixels
- Divide by quantization table (without rounding)
- error = unquantized_value - cover_integer_coefficient
Errors are clamped to [-0.5, +0.5] for robustness against minor floating-point differences between the platform’s JPEG encoder and our forward DCT implementation.
Luma blocks are computed in strips of 50 block-rows to limit transient memory (~12.9 MB per strip instead of ~97.5 MB for all blocks at once on a 12MP image).