Module huffman

Source
Expand description

16-bit Huffman compression and decompression. Huffman compression and decompression routines written by Christian Rouet for his PIZ image file format.

StructsΒ§

ShortCode πŸ”’

EnumsΒ§

Code πŸ”’

ConstantsΒ§

DECODE_BITS πŸ”’
DECODE_MASK πŸ”’
DECODING_TABLE_SIZE πŸ”’
ENCODE_BITS πŸ”’
ENCODING_TABLE_SIZE πŸ”’
INVALID_BIT_COUNT πŸ”’
INVALID_CODE πŸ”’
INVALID_TABLE_ENTRY πŸ”’
INVALID_TABLE_SIZE πŸ”’
LONGEST_LONG_RUN πŸ”’
LONG_ZEROCODE_RUN πŸ”’
NOT_ENOUGH_DATA πŸ”’
SHORTEST_LONG_RUN πŸ”’
SHORT_ZEROCODE_RUN πŸ”’
TABLE_TOO_LONG πŸ”’
TOO_MUCH_DATA πŸ”’

FunctionsΒ§

build_canonical_table πŸ”’
Build a β€œcanonical” Huffman code table:
build_decoding_table πŸ”’
Build a decoding hash table based on the encoding table code:
build_encoding_table πŸ”’
Compute Huffman codes (based on frq input) and store them in frq:
code πŸ”’
compress
count_frequencies πŸ”’
decode_with_tables πŸ”’
Decode (uncompress) n bits based on encoding & decoding tables:
decompress
encode_with_frequencies πŸ”’
length πŸ”’
pack_encoding_table πŸ”’
Pack an encoding table:
read_bits πŸ”’
read_byte πŸ”’
read_code_into_vec πŸ”’
read_encoding_table πŸ”’
Run-length-decompresses all zero runs from the packed table to the encoding table
send_code πŸ”’
write_bits πŸ”’
write_code πŸ”’