Crate generic_compression

Source

Structs§

HuffmanEncoding
A tree structure for the huffman encoding. Under the hood, it is a binary heap.
LZ77entry
A struct to represent an LZ77 entry Traditionally a LZ77 entry is represented as a tuple of (offset, length, next_char) where offset is the distance to the last occurrence of the string, length is the length of the string, and next_char is the next character in the string.
LZ78entry
A struct to represent an LZ78 entry It contains an index to the dictionary and the next character. The index is None if the entry is a new character. The next character is None if the entry is the last character in the string.

Functions§

arithmetic_decode
Decode a sequence of symbols using arithmetic decoding. The input value must be in the range [0, 1).
arithmetic_encode
Encode a sequence of symbols using arithmetic encoding. The input symbols must be in the range [0, 1).
decode_bwt
Decodes a Burrows-Wheeler Transform (BWT) encoded data.
decode_move_to_front
Decodes a sequence of indices using the Move-to-Front (MTF) algorithm.
encode_bwt
Burrows-Wheeler Transform (BWT) implementation Transforms a slice of data, in a way that is useful for compression.
encode_move_to_front
Encodes a sequence of elements using the Move-to-Front (MTF) algorithm.
lz77_decode
A function to decode a vector of LZ77 entries The function takes a vector of LZ77 entries and returns a vector of data.
lz77_encode
A function to encode a slice of data using the LZ77 algorithm The function takes a slice of data, a maximum offset, and a maximum length. It returns a vector of LZ77 entries.
lz78_decode
A function to decode a slice of data using the LZ78 algorithm The function takes a slice of LZ78 entries. It returns a vector of decoded data.
lz78_encode
A function to encode a slice of data using the LZ78 algorithm The function takes a slice of data, a maximum lookahead size, and a maximum dictionary size. It returns a vector of LZ78 entries.
lzw_decode
A function to decode a vector of indices using the LZW algorithm The function takes a vector of indices and an initial dictionary. It returns a vector of data.
lzw_encode
A function to encode a slice of data using the LZW algorithm The function takes a slice of data, an initial dictionary, and a maximum lookahead size. It returns a vector of indices representing the encoded data.

Type Aliases§

LZ77tuple
A tuple to represent an LZ77 entry
LZ78tuple
A tuple to represent an LZ78 entry