Function exr::compression::piz::huffman::pack_encoding_table

source ·
fn pack_encoding_table(
    frequencies: &[u64],
    min_index: usize,
    max_index: usize,
    out: &mut Cursor<Vec<u8>>,
) -> UnitResult
Expand description

Pack an encoding table:

  • only code lengths, not actual codes, are stored

  • runs of zeroes are compressed as follows:

    §unpacked packed

    1 zero 0 (6 bits) 2 zeroes 59 3 zeroes 60 4 zeroes 61 5 zeroes 62 n zeroes (6 or more) 63 n-6 (6 + 8 bits)