Fields

repeat_offsets: [3]u32,
offset: StateData(8),
match: StateData(9),
literal: StateData(9),
offset_fse_buffer: []Table.Fse,
match_fse_buffer: []Table.Fse,
literal_fse_buffer: []Table.Fse,
fse_tables_undefined: bool,
literal_stream_reader: readers.ReverseBitReader,
literal_stream_index: usize,
literal_streams: LiteralsSection.Streams,
literal_header: LiteralsSection.Header,
literal_written_count: usize,
written_count: usize = 0,

Functions

fn decodeLiteralsRingBuffer(self: *DecodeState, dest: *RingBuffer, len: usize) DecodeLiteralsError!void

Decode literals into dest; see decodeLiteralsSlice().

fn decodeLiteralsSlice(self: *DecodeState, dest: []u8, len: usize) DecodeLiteralsError!void

Decode len bytes of literals into dest.

Decode len bytes of literals into dest.

Errors returned:

  • error.MalformedLiteralsLength if the number of literal bytes decoded by self plus len is greater than the regenerated size of literals
  • error.UnexpectedEndOfLiteralStream and error.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 into dest; see decodeSequenceSlice.

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 into dest, written starting at `write_p…

Decode one sequence from bit_reader into dest, written starting at write_pos and update FSE states if last_sequence is false. prepare() must be called for the block before attempting to decode sequences.

Errors returned:

  • error.MalformedSequence if the decompressed sequence would be longer than sequence_size_limit or the sequence’s offset is too large
  • error.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 malformed
  • error.EndOfStream if bit_reader does not contain enough bits
  • error.DestTooSmall if dest 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 from source.

Errors returned:

  • error.BitStreamHasNoStartBit if the (reversed) literal bitstream’s first byte does not have any bits set
  • error.TreelessLiteralsFirst literals is a treeless literals section and the decode state does not have a Huffman tree from a previous block
  • error.RepeatModeFirst on the first call if one of the sequence FSE tables is set to repeat mode
  • error.MalformedAccuracyLog if an FSE table has an invalid accuracy
  • error.MalformedFseTable if there are errors decoding an FSE table
  • error.EndOfStream if source 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 if bit_reader does not contain enough bits.