Skip to main content

decode_scan

Function decode_scan 

Source
pub fn decode_scan(
    data: &[u8],
    scan_start: usize,
    frame: &FrameInfo,
    scan_components: &[ScanComponent],
    dc_specs: &[Option<HuffmanSpec>; 4],
    ac_specs: &[Option<HuffmanSpec>; 4],
    restart_interval: u16,
) -> Result<(Vec<DctGrid>, usize)>
Expand description

Decode the entropy-coded scan data into DctGrids.

  • data: full JPEG file bytes
  • scan_start: byte offset of the first entropy-coded byte (right after SOS header)
  • frame: parsed frame info
  • scan_components: component selectors from SOS
  • dc_specs/ac_specs: Huffman table specs, indexed by table ID
  • restart_interval: from DRI marker, 0 = no restarts

Returns (grids, end_position). end_position is the byte after the last scan byte.