Debian Codegraph @

c/dec/huffman.h

raw symbols SCIP
1 /* Copyright 2013 Google Inc. All Rights Reserved.
2
3 Distributed under MIT license.
4 See file LICENSE for detail or copy at https://opensource.org/licenses/MIT
5 */
6
7 /* Utilities for building Huffman decoding tables. */
8
9 #ifndef BROTLI_DEC_HUFFMAN_H_
10 #define BROTLI_DEC_HUFFMAN_H_cxx . . $ `c/dec/huffman.h:10:9`!
11
12 #include "../common/platform.h"cxx . . $ `<file>/c/common/platform.h`/
13
14 #if defined(__cplusplus) || defined(c_plusplus)
15 extern "C" {
16 #endif
17
18 #define BROTLI_HUFFMAN_MAX_CODE_LENGTHcxx . . $ `c/dec/huffman.h:18:9`! 15
19
20 /* BROTLI_NUM_BLOCK_LEN_SYMBOLS == 26 */
21 #define BROTLI_HUFFMAN_MAX_SIZE_26cxx . . $ `c/dec/huffman.h:21:9`! 396
22 /* BROTLI_MAX_BLOCK_TYPE_SYMBOLS == 258 */
23 #define BROTLI_HUFFMAN_MAX_SIZE_258cxx . . $ `c/dec/huffman.h:23:9`! 632
24 /* BROTLI_MAX_CONTEXT_MAP_SYMBOLS == 272 */
25 #define BROTLI_HUFFMAN_MAX_SIZE_272cxx . . $ `c/dec/huffman.h:25:9`! 646
26
27 #define BROTLI_HUFFMAN_MAX_CODE_LENGTH_CODE_LENGTHcxx . . $ `c/dec/huffman.h:27:9`! 5
28
29 #if ((defined(BROTLI_TARGET_ARMV7) || defined(BROTLI_TARGET_ARMV8_32)) && \
30 BROTLI_GNUC_HAS_ATTRIBUTEcxx . . $ `c/include/brotli/port.h:206:9`!(aligned, 2, 7, 0))
31 #define BROTLI_HUFFMAN_CODE_FAST_LOAD
32 #endif
33
34 #if !defined(BROTLI_HUFFMAN_CODE_FAST_LOAD)
35 /* Do not create this struct directly - use the ConstructHuffmanCode
36 * constructor below! */
37 typedef structcxx . . $ $anonymous_type_421782d160a65272_0# {
38 uint8_tcxx . . $ uint8_t# bitscxx . . $ $anonymous_type_421782d160a65272_0#bits.; /* number of bits used for this symbol */
39 uint16_tcxx . . $ uint16_t# valuecxx . . $ $anonymous_type_421782d160a65272_0#value.; /* symbol value or table offset */
40 } HuffmanCodecxx . . $ HuffmanCode#;
41
42 static BROTLI_INLINEcxx . . $ `c/common/platform.h:119:9`! HuffmanCodecxx . . $ HuffmanCode# ConstructHuffmanCodecxx . . $ ConstructHuffmanCode(81c74c0c4da566b).(const uint8_tcxx . . $ uint8_t# bits,
43 const uint16_tcxx . . $ uint16_t# value) {
44 HuffmanCodecxx . . $ HuffmanCode# h;
45 h.bitscxx . . $ $anonymous_type_421782d160a65272_0#bits. = bits;
46 h.valuecxx . . $ $anonymous_type_421782d160a65272_0#value. = value;
47 return h;
48 }
49
50 /* Please use the following macros to optimize HuffmanCode accesses in hot
51 * paths.
52 *
53 * For example, assuming |table| contains a HuffmanCode pointer:
54 *
55 * BROTLI_HC_MARK_TABLE_FOR_FAST_LOAD(table);
56 * BROTLI_HC_ADJUST_TABLE_INDEX(table, index_into_table);
57 * *bits = BROTLI_HC_GET_BITS(table);
58 * *value = BROTLI_HC_GET_VALUE(table);
59 * BROTLI_HC_ADJUST_TABLE_INDEX(table, offset);
60 * *bits2 = BROTLI_HC_GET_BITS(table);
61 * *value2 = BROTLI_HC_GET_VALUE(table);
62 *
63 */
64
65 #define BROTLI_HC_MARK_TABLE_FOR_FAST_LOADcxx . . $ `c/dec/huffman.h:65:9`!(H)
66 #define BROTLI_HC_ADJUST_TABLE_INDEXcxx . . $ `c/dec/huffman.h:66:9`!(H, V) H += (V)
67
68 /* These must be given a HuffmanCode pointer! */
69 #define BROTLI_HC_FAST_LOAD_BITScxx . . $ `c/dec/huffman.h:69:9`!(H) (H->bits)
70 #define BROTLI_HC_FAST_LOAD_VALUEcxx . . $ `c/dec/huffman.h:70:9`!(H) (H->value)
71
72 #else /* BROTLI_HUFFMAN_CODE_FAST_LOAD */
73
74 typedef BROTLI_ALIGNED(4) uint32_t HuffmanCode;
75
76 static BROTLI_INLINE HuffmanCode ConstructHuffmanCode(const uint8_t bits,
77 const uint16_t value) {
78 return (HuffmanCode) ((value & 0xFFFF) << 16) | (bits & 0xFF);
79 }
80
81 #define BROTLI_HC_MARK_TABLE_FOR_FAST_LOAD(H) uint32_t __fastload_##H = (*H)
82 #define BROTLI_HC_ADJUST_TABLE_INDEX(H, V) H += (V); __fastload_##H = (*H)
83
84 /* These must be given a HuffmanCode pointer! */
85 #define BROTLI_HC_FAST_LOAD_BITS(H) ((__fastload_##H) & 0xFF)
86 #define BROTLI_HC_FAST_LOAD_VALUE(H) ((__fastload_##H) >> 16)
87 #endif /* BROTLI_HUFFMAN_CODE_FAST_LOAD */
88
89 /* Builds Huffman lookup table assuming code lengths are in symbol order. */
90 BROTLI_INTERNALcxx . . $ `c/include/brotli/port.h:252:9`! void BrotliBuildCodeLengthsHuffmanTablecxx . . $ BrotliBuildCodeLengthsHuffmanTable(f1294370fd0a8600).(HuffmanCodecxx . . $ HuffmanCode#* root_table,
91 const uint8_tcxx . . $ uint8_t#* const code_lengths, uint16_tcxx . . $ uint16_t#* count);
92
93 /* Builds Huffman lookup table assuming code lengths are in symbol order.
94 Returns size of resulting table. */
95 BROTLI_INTERNALcxx . . $ `c/include/brotli/port.h:252:9`! uint32_tcxx . . $ uint32_t# BrotliBuildHuffmanTablecxx . . $ BrotliBuildHuffmanTable(aff94dc29a236ff6).(HuffmanCodecxx . . $ HuffmanCode#* root_table,
96 int root_bits, const uint16_tcxx . . $ uint16_t#* const symbol_lists, uint16_tcxx . . $ uint16_t#* count);
97
98 /* Builds a simple Huffman table. The |num_symbols| parameter is to be
99 interpreted as follows: 0 means 1 symbol, 1 means 2 symbols,
100 2 means 3 symbols, 3 means 4 symbols with lengths [2, 2, 2, 2],
101 4 means 4 symbols with lengths [1, 2, 3, 3]. */
102 BROTLI_INTERNALcxx . . $ `c/include/brotli/port.h:252:9`! uint32_tcxx . . $ uint32_t# BrotliBuildSimpleHuffmanTablecxx . . $ BrotliBuildSimpleHuffmanTable(128cfb7b6641eca7).(HuffmanCodecxx . . $ HuffmanCode#* table,
103 int root_bits, uint16_tcxx . . $ uint16_t#* symbols, uint32_tcxx . . $ uint32_t# num_symbols);
104
105 /* Contains a collection of Huffman trees with the same alphabet size. */
106 /* alphabet_size_limit is needed due to simple codes, since
107 log2(alphabet_size_max) could be greater than log2(alphabet_size_limit). */
108 typedef structcxx . . $ $anonymous_type_421782d160a65272_1# {
109 HuffmanCodecxx . . $ HuffmanCode#** htreescxx . . $ $anonymous_type_421782d160a65272_1#htrees.;
110 HuffmanCodecxx . . $ HuffmanCode#* codescxx . . $ $anonymous_type_421782d160a65272_1#codes.;
111 uint16_tcxx . . $ uint16_t# alphabet_size_maxcxx . . $ $anonymous_type_421782d160a65272_1#alphabet_size_max.;
112 uint16_tcxx . . $ uint16_t# alphabet_size_limitcxx . . $ $anonymous_type_421782d160a65272_1#alphabet_size_limit.;
113 uint16_tcxx . . $ uint16_t# num_htreescxx . . $ $anonymous_type_421782d160a65272_1#num_htrees.;
114 } HuffmanTreeGroupcxx . . $ HuffmanTreeGroup#;
115
116 #if defined(__cplusplus) || defined(c_plusplus)
117 } /* extern "C" */
118 #endif
119
120 #endif /* BROTLI_DEC_HUFFMAN_H_ */