Fields
repeat_offsets: [3]u32,
offset: StateData(8),
match: StateData(9),
literal: StateData(9),
fse_tables_undefined: bool,
literal_stream_reader: readers.ReverseBitReader,
literal_stream_index: usize,
literal_streams: LiteralsSection.Streams,
literal_header: LiteralsSection.Header,
huffman_tree: ?LiteralsSection.HuffmanTree,
literal_written_count: usize,
written_count: usize = 0,
Functions
fn decodeLiteralsRingBuffer(self: *DecodeState, dest: *RingBuffer, len: usize) DecodeLiteralsError!void
Decode literals into
dest
; seedecodeLiteralsSlice()
.fn decodeLiteralsSlice(self: *DecodeState, dest: []u8, len: usize) DecodeLiteralsError!void
Decode
len
bytes of literals intodest
.Decode
len
bytes of literals intodest
.Errors returned:
error.MalformedLiteralsLength
if the number of literal bytes decoded byself
pluslen
is greater than the regenerated size ofliterals
error.UnexpectedEndOfLiteralStream
anderror.NotFound
if there are problems decoding Huffman compressed literals
fn decodeSequenceRingBuffer(self: *DecodeState, dest: *RingBuffer, bit_reader: anytype, sequence_size_limit: usize, last_sequence: bool) DecodeSequenceError!usize
Decode one sequence from
bit_reader
intodest
; seedecodeSequenceSlice
.fn decodeSequenceSlice(self: *DecodeState, dest: []u8, write_pos: usize, bit_reader: *readers.ReverseBitReader, sequence_size_limit: usize, last_sequence: bool) error{DestTooSmall} || DecodeSequenceError!usize
Decode one sequence from
bit_reader
intodest
, written starting at `write_p…Decode one sequence from
bit_reader
intodest
, written starting atwrite_pos
and update FSE states iflast_sequence
isfalse
.prepare()
must be called for the block before attempting to decode sequences.Errors returned:
error.MalformedSequence
if the decompressed sequence would be longer thansequence_size_limit
or the sequence’s offset is too largeerror.UnexpectedEndOfLiteralStream
if the decoder state’s literal streams do not contain enough literals for the sequence (this may mean the literal stream or the sequence is malformed).error.InvalidBitStream
if the FSE sequence bitstream is malformederror.EndOfStream
ifbit_reader
does not contain enough bitserror.DestTooSmall
ifdest
is not large enough to holde the decompressed sequence
fn init(literal_fse_buffer: []Table.Fse, match_fse_buffer: []Table.Fse, offset_fse_buffer: []Table.Fse) DecodeState
No documentation provided.
fn prepare(self: *DecodeState, source: anytype, literals: LiteralsSection, sequences_header: SequencesSection.Header) !void
Prepare the decoder to decode a compressed block. Loads the literals stream and…
Prepare the decoder to decode a compressed block. Loads the literals stream and Huffman tree from
literals
and reads the FSE tables fromsource
.Errors returned:
error.BitStreamHasNoStartBit
if the (reversed) literal bitstream’s first byte does not have any bits seterror.TreelessLiteralsFirst
literals
is a treeless literals section and the decode state does not have a Huffman tree from a previous blockerror.RepeatModeFirst
on the first call if one of the sequence FSE tables is set to repeat modeerror.MalformedAccuracyLog
if an FSE table has an invalid accuracyerror.MalformedFseTable
if there are errors decoding an FSE tableerror.EndOfStream
ifsource
ends before all FSE tables are read
fn readInitialFseState(self: *DecodeState, bit_reader: *readers.ReverseBitReader) error{EndOfStream}!void
Read initial FSE states for sequence decoding.
Read initial FSE states for sequence decoding.
Errors returned:
error.EndOfStream
ifbit_reader
does not contain enough bits.