Canonical Huffman decoder for the bit-reversed codes used by DEFLATE. More...
#include <deflate.hpp>
Public Member Functions | |
| void | build (std::span< std::uint8_t const > lengths, format stream_format, bool allow_empty=false) |
| Builds and validates a decoder from per-symbol code lengths. | |
| template<typename reader_type> | |
| std::uint16_t | decode (reader_type &reader, format stream_format) const |
| Decodes one symbol from a bit reader. | |
Canonical Huffman decoder for the bit-reversed codes used by DEFLATE.
Definition at line 28 of file deflate.hpp.
|
inline |
Builds and validates a decoder from per-symbol code lengths.
| lengths | Code length for each symbol in symbol order. |
| stream_format | Format used to classify validation errors. |
| allow_empty | Whether an all-zero length set is accepted. |
| compression_error | If lengths exceed 15 bits or oversubscribe the tree. |
Definition at line 38 of file deflate.hpp.
References rpnx::compression::invalid_data.
Referenced by rpnx::compression::deflate_codec::decompress().
|
inlinenodiscard |
Decodes one symbol from a bit reader.
| reader_type | LSB-first reader providing read_bits(). |
| reader | Source bit reader. |
| stream_format | Format used to classify validation errors. |
| compression_error | If no code matches the next input bits. |
Definition at line 116 of file deflate.hpp.
References rpnx::compression::invalid_data.
Referenced by rpnx::compression::deflate_codec::decompress().