]>
iEval git - io-compress-brotli.git/blob - dec/huffman.h
e8481f00fcc20875acb4dab4c3fd5771a628a91f
1 /* Copyright 2013 Google Inc. All Rights Reserved.
3 Distributed under MIT license.
4 See file LICENSE for detail or copy at https://opensource.org/licenses/MIT
7 /* Utilities for building Huffman decoding tables. */
9 #ifndef BROTLI_DEC_HUFFMAN_H_
10 #define BROTLI_DEC_HUFFMAN_H_
14 #if defined(__cplusplus) || defined(c_plusplus)
18 #define BROTLI_HUFFMAN_MAX_CODE_LENGTH 15
20 /* For current format this constant equals to kNumInsertAndCopyCodes */
21 #define BROTLI_HUFFMAN_MAX_CODE_LENGTHS_SIZE 704
23 /* Maximum possible Huffman table size for an alphabet size of 704, max code
24 * length 15 and root table bits 8. */
25 #define BROTLI_HUFFMAN_MAX_TABLE_SIZE 1080
27 #define BROTLI_HUFFMAN_MAX_CODE_LENGTH_CODE_LENGTH 5
30 uint8_t bits
; /* number of bits used for this symbol */
31 uint16_t value
; /* symbol value or table offset */
35 /* Builds Huffman lookup table assuming code lengths are in symbol order. */
36 void BrotliBuildCodeLengthsHuffmanTable(HuffmanCode
* root_table
,
37 const uint8_t* const code_lengths
,
40 /* Builds Huffman lookup table assuming code lengths are in symbol order. */
41 /* Returns size of resulting table. */
42 uint32_t BrotliBuildHuffmanTable(HuffmanCode
* root_table
,
44 const uint16_t* const symbol_lists
,
47 /* Builds a simple Huffman table. The num_symbols parameter is to be */
48 /* interpreted as follows: 0 means 1 symbol, 1 means 2 symbols, 2 means 3 */
49 /* symbols, 3 means 4 symbols with lengths 2,2,2,2, 4 means 4 symbols with */
50 /* lengths 1,2,3,3. */
51 uint32_t BrotliBuildSimpleHuffmanTable(HuffmanCode
* table
,
54 uint32_t num_symbols
);
56 /* Contains a collection of Huffman trees with the same alphabet size. */
60 uint16_t alphabet_size
;
64 #if defined(__cplusplus) || defined(c_plusplus)
68 #endif /* BROTLI_DEC_HUFFMAN_H_ */
This page took 0.048907 seconds and 3 git commands to generate.