Skip to main content

Module phaseone

Module phaseone 

Source
Expand description

Phase One IIQ entropy coders.

IIQ stores a row-offset table, so every row is an independent bit stream (the container decodes rows in parallel). Two coders exist:

  • IIQ L (“raw_c”, formats 3/5/8): per 8-pixel block and per column parity a prefix code selects a difference width from a 10-entry table; width 14 is an escape for a literal 16-bit value. Samples are 14-bit (shifted left by two into the 16-bit range) except for format 8, which carries native 16-bit values. Format 5 additionally maps values below 256 through a square-law curve.
  • IIQ S (format 6): per 8-pixel block, each parity keeps a “bit check” level (adjusted by a delta code or reset through an index table) that sets the quantisation step of the coded differences; level 9 is a literal escape.

Both read bits MSB-first from 32-bit little-endian words (BitPumpMsb32) for little-endian files (the big-endian variant uses BitPumpMsb).

Structs§

IiqLParams
Variant parameters of the IIQ L coder.

Functions§

decode_l_row
Decode one IIQ L row of out.len() samples from a bit pump positioned at the row start.
decode_s_row
Decode one IIQ S row (output already scaled to 16 bits).
unscramble_pairs
Undo the key scrambling of uncompressed IIQ formats 1 and 2 on a run of samples (processed in pairs over the whole raster, independent of row boundaries).