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.
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.
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.
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.
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.
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.