29 static constexpr size_t WINDOW = 512;
51 uint8_t
byte_at_(
const uint8_t *data,
size_t pos)
const;
LZSS compression of a block of data on its own, with a preset dictionary: text that both ends hold,...
static constexpr size_t MAX_CHAIN
How many earlier positions the compressor tries for each match; more finds longer matches,...
static constexpr size_t MAX_MATCH
The longest match, as the decoder reads a length code of at most 16 bits after the first.
static constexpr uint8_t HASH_BITS
The compressor finds earlier positions starting with the same two bytes through a hash table of this ...
static constexpr size_t CHAIN_WORDS
The working space compress() needs: the latest position for each hash, then the previous one for each...
const uint8_t * dictionary_
uint8_t byte_at_(const uint8_t *data, size_t pos) const
The byte at pos counting from the start of the dictionary, with data following it.
size_t compress(const uint8_t *in, size_t size, uint8_t *out, size_t capacity, uint16_t *chains) const
Compress size bytes into out, which holds capacity bytes, using chains (CHAIN_WORDS words) as working...
Lzss(const uint8_t *dictionary, size_t dictionary_size)
size_t dictionary_size() const
static constexpr size_t WINDOW
Part of the format: a match reaches back at most this far, and offsets take the bits that the bytes b...
size_t expand(const uint8_t *in, size_t size, uint8_t *out, size_t capacity) const
Expand size bytes into out, which holds capacity bytes; returns the length, or SIZE_MAX if the data i...
std::vector< uint8_t > & out
uint16_t uint16_t & capacity