| |
| |
| |
| |
| |
| |
| |
| |
| #ifndef BROTLI_DEC_HUFFMAN_H_ |
| #define BROTLI_DEC_HUFFMAN_H_ |
| |
| #include "../common/platform.h" |
| #include <brotli/types.h> |
| |
| #if defined(__cplusplus) || defined(c_plusplus) |
| extern "C" { |
| #endif |
| |
| #define BROTLI_HUFFMAN_MAX_CODE_LENGTH 15 |
| |
| |
| |
| static const uint16_t kMaxHuffmanTableSize[] = { |
| 256, 402, 436, 468, 500, 534, 566, 598, 630, 662, 694, 726, 758, 790, 822, |
| 854, 886, 920, 952, 984, 1016, 1048, 1080, 1112, 1144, 1176, 1208, 1240, 1272, |
| 1304, 1336, 1368, 1400, 1432, 1464, 1496, 1528}; |
| |
| #define BROTLI_HUFFMAN_MAX_SIZE_26 396 |
| |
| #define BROTLI_HUFFMAN_MAX_SIZE_258 632 |
| |
| #define BROTLI_HUFFMAN_MAX_SIZE_272 646 |
| |
| #define BROTLI_HUFFMAN_MAX_CODE_LENGTH_CODE_LENGTH 5 |
| |
| typedef struct { |
| uint8_t bits; |
| uint16_t value; |
| } HuffmanCode; |
| |
| |
| BROTLI_INTERNAL void BrotliBuildCodeLengthsHuffmanTable(HuffmanCode* root_table, |
| const uint8_t* const code_lengths, uint16_t* count); |
| |
| |
| |
| BROTLI_INTERNAL uint32_t BrotliBuildHuffmanTable(HuffmanCode* root_table, |
| int root_bits, const uint16_t* const symbol_lists, uint16_t* count_arg); |
| |
| |
| |
| |
| |
| BROTLI_INTERNAL uint32_t BrotliBuildSimpleHuffmanTable(HuffmanCode* table, |
| int root_bits, uint16_t* symbols, uint32_t num_symbols); |
| |
| |
| |
| |
| typedef struct { |
| HuffmanCode** htrees; |
| HuffmanCode* codes; |
| uint16_t alphabet_size; |
| uint16_t max_symbol; |
| uint16_t num_htrees; |
| } HuffmanTreeGroup; |
| |
| #if defined(__cplusplus) || defined(c_plusplus) |
| } |
| #endif |
| |
| #endif |