Source File
state.go
Belonging Package
github.com/andybalholm/brotli
package brotliimport/* Copyright 2015 Google Inc. All Rights Reserved.Distributed under MIT license.See file LICENSE for detail or copy at https://opensource.org/licenses/MIT*//* Brotli state for partial streaming decoding. */const (stateUninited = iotastateLargeWindowBitsstateInitializestateMetablockBeginstateMetablockHeaderstateMetablockHeader2stateContextModesstateCommandBeginstateCommandInnerstateCommandPostDecodeLiteralsstateCommandPostWrapCopystateUncompressedstateMetadatastateCommandInnerWritestateMetablockDonestateCommandPostWrite1stateCommandPostWrite2stateHuffmanCode0stateHuffmanCode1stateHuffmanCode2stateHuffmanCode3stateContextMap1stateContextMap2stateTreeGroupstateDone)const (stateMetablockHeaderNone = iotastateMetablockHeaderEmptystateMetablockHeaderNibblesstateMetablockHeaderSizestateMetablockHeaderUncompressedstateMetablockHeaderReservedstateMetablockHeaderBytesstateMetablockHeaderMetadata)const (stateUncompressedNone = iotastateUncompressedWrite)const (stateTreeGroupNone = iotastateTreeGroupLoop)const (stateContextMapNone = iotastateContextMapReadPrefixstateContextMapHuffmanstateContextMapDecodestateContextMapTransform)const (stateHuffmanNone = iotastateHuffmanSimpleSizestateHuffmanSimpleReadstateHuffmanSimpleBuildstateHuffmanComplexstateHuffmanLengthSymbols)const (stateDecodeUint8None = iotastateDecodeUint8ShortstateDecodeUint8Long)const (stateReadBlockLengthNone = iotastateReadBlockLengthSuffix)type Reader struct {src io.Readerbuf []byte // scratch space for reading from srcin []byte // current chunk to decode; usually aliases bufstate intloop_counter intbr bitReaderbuffer struct {u64 uint64u8 [8]byte}buffer_length uint32pos intmax_backward_distance intmax_distance intringbuffer_size intringbuffer_mask intdist_rb_idx intdist_rb [4]interror_code intsub_loop_counter uint32ringbuffer []byteringbuffer_end []bytehtree_command []huffmanCodecontext_lookup []bytecontext_map_slice []bytedist_context_map_slice []byteliteral_hgroup huffmanTreeGroupinsert_copy_hgroup huffmanTreeGroupdistance_hgroup huffmanTreeGroupblock_type_trees []huffmanCodeblock_len_trees []huffmanCodetrivial_literal_context intdistance_context intmeta_block_remaining_len intblock_length_index uint32block_length [3]uint32num_block_types [3]uint32block_type_rb [6]uint32distance_postfix_bits uint32num_direct_distance_codes uint32distance_postfix_mask intnum_dist_htrees uint32dist_context_map []byteliteral_htree []huffmanCodedist_htree_index byterepeat_code_len uint32prev_code_len uint32copy_length intdistance_code intrb_roundtrips uintpartial_pos_out uintsymbol uint32repeat uint32space uint32table [32]huffmanCodesymbol_lists symbolListsymbols_lists_array [huffmanMaxCodeLength + 1 + numCommandSymbols]uint16next_symbol [32]intcode_length_code_lengths [codeLengthCodes]bytecode_length_histo [16]uint16htree_index intnext []huffmanCodecontext_index uint32max_run_length_prefix uint32code uint32context_map_table [huffmanMaxSize272]huffmanCodesubstate_metablock_header intsubstate_tree_group intsubstate_context_map intsubstate_uncompressed intsubstate_huffman intsubstate_decode_uint8 intsubstate_read_block_length intis_last_metablock uintis_uncompressed uintis_metadata uintshould_wrap_ringbuffer uintcanny_ringbuffer_allocation uintlarge_window boolsize_nibbles uintwindow_bits uint32new_ringbuffer_size intnum_literal_htrees uint32context_map []bytecontext_modes []bytedictionary *dictionarytransforms *transformstrivial_literal_contexts [8]uint32}func decoderStateInit( *Reader) bool {.error_code = 0 /* BROTLI_DECODER_NO_ERROR */initBitReader(&.br).state = stateUninited.large_window = false.substate_metablock_header = stateMetablockHeaderNone.substate_tree_group = stateTreeGroupNone.substate_context_map = stateContextMapNone.substate_uncompressed = stateUncompressedNone.substate_huffman = stateHuffmanNone.substate_decode_uint8 = stateDecodeUint8None.substate_read_block_length = stateReadBlockLengthNone.buffer_length = 0.loop_counter = 0.pos = 0.rb_roundtrips = 0.partial_pos_out = 0.block_type_trees = nil.block_len_trees = nil.ringbuffer_size = 0.new_ringbuffer_size = 0.ringbuffer_mask = 0.context_map = nil.context_modes = nil.dist_context_map = nil.context_map_slice = nil.dist_context_map_slice = nil.sub_loop_counter = 0.literal_hgroup.codes = nil.literal_hgroup.htrees = nil.insert_copy_hgroup.codes = nil.insert_copy_hgroup.htrees = nil.distance_hgroup.codes = nil.distance_hgroup.htrees = nil.is_last_metablock = 0.is_uncompressed = 0.is_metadata = 0.should_wrap_ringbuffer = 0.canny_ringbuffer_allocation = 1.window_bits = 0.max_distance = 0.dist_rb[0] = 16.dist_rb[1] = 15.dist_rb[2] = 11.dist_rb[3] = 4.dist_rb_idx = 0.block_type_trees = nil.block_len_trees = nil.symbol_lists.storage = .symbols_lists_array[:].symbol_lists.offset = huffmanMaxCodeLength + 1.dictionary = getDictionary().transforms = getTransforms()return true}func decoderStateMetablockBegin( *Reader) {.meta_block_remaining_len = 0.block_length[0] = 1 << 24.block_length[1] = 1 << 24.block_length[2] = 1 << 24.num_block_types[0] = 1.num_block_types[1] = 1.num_block_types[2] = 1.block_type_rb[0] = 1.block_type_rb[1] = 0.block_type_rb[2] = 1.block_type_rb[3] = 0.block_type_rb[4] = 1.block_type_rb[5] = 0.context_map = nil.context_modes = nil.dist_context_map = nil.context_map_slice = nil.literal_htree = nil.dist_context_map_slice = nil.dist_htree_index = 0.context_lookup = nil.literal_hgroup.codes = nil.literal_hgroup.htrees = nil.insert_copy_hgroup.codes = nil.insert_copy_hgroup.htrees = nil.distance_hgroup.codes = nil.distance_hgroup.htrees = nil}func decoderStateCleanupAfterMetablock( *Reader) {.context_modes = nil.context_map = nil.dist_context_map = nil.literal_hgroup.htrees = nil.insert_copy_hgroup.htrees = nil.distance_hgroup.htrees = nil}func decoderHuffmanTreeGroupInit( *Reader, *huffmanTreeGroup, uint32, uint32, uint32) bool {var uint = uint(kMaxHuffmanTableSize[(+31)>>5]).alphabet_size = uint16().max_symbol = uint16().num_htrees = uint16().htrees = make([][]huffmanCode, ).codes = make([]huffmanCode, (uint() * ))return !(.codes == nil)}
![]() |
The pages are generated with Golds v0.6.7. (GOOS=linux GOARCH=amd64) Golds is a Go 101 project developed by Tapir Liu. PR and bug reports are welcome and can be submitted to the issue list. Please follow @Go100and1 (reachable from the left QR code) to get the latest news of Golds. |