9#ifndef BROTLI_DEC_HUFFMAN_H_
10#define BROTLI_DEC_HUFFMAN_H_
14#include "../common/platform.h"
16#if defined(__cplusplus) || defined(c_plusplus)
20#define BROTLI_HUFFMAN_MAX_CODE_LENGTH 15
23#define BROTLI_HUFFMAN_MAX_SIZE_26 396
25#define BROTLI_HUFFMAN_MAX_SIZE_258 632
27#define BROTLI_HUFFMAN_MAX_SIZE_272 646
29#define BROTLI_HUFFMAN_MAX_CODE_LENGTH_CODE_LENGTH 5
31#if ((defined(BROTLI_TARGET_ARMV7) || defined(BROTLI_TARGET_ARMV8_32)) && \
32 BROTLI_GNUC_HAS_ATTRIBUTE(aligned, 2, 7, 0))
33#define BROTLI_HUFFMAN_CODE_FAST_LOAD
36#if !defined(BROTLI_HUFFMAN_CODE_FAST_LOAD)
44static BROTLI_INLINE
HuffmanCode ConstructHuffmanCode(
const uint8_t bits,
45 const uint16_t value) {
67#define BROTLI_HC_MARK_TABLE_FOR_FAST_LOAD(H)
68#define BROTLI_HC_ADJUST_TABLE_INDEX(H, V) H += (V)
71#define BROTLI_HC_FAST_LOAD_BITS(H) (H->bits)
72#define BROTLI_HC_FAST_LOAD_VALUE(H) (H->value)
78static BROTLI_INLINE
HuffmanCode ConstructHuffmanCode(const uint8_t bits,
79 const uint16_t value) {
80 return (
HuffmanCode) ((value & 0xFFFF) << 16) | (bits & 0xFF);
83#define BROTLI_HC_MARK_TABLE_FOR_FAST_LOAD(H) uint32_t __fastload_##H = (*H)
84#define BROTLI_HC_ADJUST_TABLE_INDEX(H, V) H += (V); __fastload_##H = (*H)
87#define BROTLI_HC_FAST_LOAD_BITS(H) ((__fastload_##H) & 0xFF)
88#define BROTLI_HC_FAST_LOAD_VALUE(H) ((__fastload_##H) >> 16)
92BROTLI_INTERNAL
void BrotliBuildCodeLengthsHuffmanTable(
HuffmanCode* root_table,
93 const uint8_t*
const code_lengths, uint16_t* count);
97BROTLI_INTERNAL uint32_t BrotliBuildHuffmanTable(
HuffmanCode* root_table,
98 int root_bits,
const uint16_t*
const symbol_lists, uint16_t* count);
104BROTLI_INTERNAL uint32_t BrotliBuildSimpleHuffmanTable(
HuffmanCode* table,
105 int root_bits, uint16_t* symbols, uint32_t num_symbols);
113 uint16_t alphabet_size_max;
114 uint16_t alphabet_size_limit;
118#if defined(__cplusplus) || defined(c_plusplus)
Definition: huffman.h:110
Common types used in decoder and encoder API.