OLD | NEW |
1 /* Copyright 2015 Google Inc. All Rights Reserved. | 1 /* Copyright 2015 Google Inc. All Rights Reserved. |
2 | 2 |
3 Licensed under the Apache License, Version 2.0 (the "License"); | 3 Licensed under the Apache License, Version 2.0 (the "License"); |
4 you may not use this file except in compliance with the License. | 4 you may not use this file except in compliance with the License. |
5 You may obtain a copy of the License at | 5 You may obtain a copy of the License at |
6 | 6 |
7 http://www.apache.org/licenses/LICENSE-2.0 | 7 http://www.apache.org/licenses/LICENSE-2.0 |
8 | 8 |
9 Unless required by applicable law or agreed to in writing, software | 9 Unless required by applicable law or agreed to in writing, software |
10 distributed under the License is distributed on an "AS IS" BASIS, | 10 distributed under the License is distributed on an "AS IS" BASIS, |
(...skipping 21 matching lines...) Expand all Loading... |
32 BROTLI_STATE_UNINITED = 0, | 32 BROTLI_STATE_UNINITED = 0, |
33 BROTLI_STATE_BITREADER_WARMUP = 1, | 33 BROTLI_STATE_BITREADER_WARMUP = 1, |
34 BROTLI_STATE_METABLOCK_BEGIN = 10, | 34 BROTLI_STATE_METABLOCK_BEGIN = 10, |
35 BROTLI_STATE_METABLOCK_HEADER_1 = 11, | 35 BROTLI_STATE_METABLOCK_HEADER_1 = 11, |
36 BROTLI_STATE_METABLOCK_HEADER_2 = 12, | 36 BROTLI_STATE_METABLOCK_HEADER_2 = 12, |
37 BROTLI_STATE_BLOCK_BEGIN = 13, | 37 BROTLI_STATE_BLOCK_BEGIN = 13, |
38 BROTLI_STATE_BLOCK_INNER = 14, | 38 BROTLI_STATE_BLOCK_INNER = 14, |
39 BROTLI_STATE_BLOCK_DISTANCE = 15, | 39 BROTLI_STATE_BLOCK_DISTANCE = 15, |
40 BROTLI_STATE_BLOCK_POST = 16, | 40 BROTLI_STATE_BLOCK_POST = 16, |
41 BROTLI_STATE_UNCOMPRESSED = 17, | 41 BROTLI_STATE_UNCOMPRESSED = 17, |
| 42 BROTLI_STATE_METADATA = 18, |
| 43 BROTLI_STATE_BLOCK_INNER_WRITE = 19, |
42 BROTLI_STATE_METABLOCK_DONE = 20, | 44 BROTLI_STATE_METABLOCK_DONE = 20, |
| 45 BROTLI_STATE_BLOCK_POST_WRITE_1 = 21, |
| 46 BROTLI_STATE_BLOCK_POST_WRITE_2 = 22, |
| 47 BROTLI_STATE_BLOCK_POST_CONTINUE = 23, |
43 BROTLI_STATE_HUFFMAN_CODE_0 = 30, | 48 BROTLI_STATE_HUFFMAN_CODE_0 = 30, |
44 BROTLI_STATE_HUFFMAN_CODE_1 = 31, | 49 BROTLI_STATE_HUFFMAN_CODE_1 = 31, |
45 BROTLI_STATE_HUFFMAN_CODE_2 = 32, | 50 BROTLI_STATE_HUFFMAN_CODE_2 = 32, |
46 BROTLI_STATE_CONTEXT_MAP_1 = 33, | 51 BROTLI_STATE_CONTEXT_MAP_1 = 33, |
47 BROTLI_STATE_CONTEXT_MAP_2 = 34, | 52 BROTLI_STATE_CONTEXT_MAP_2 = 34, |
48 BROTLI_STATE_TREE_GROUP = 35, | 53 BROTLI_STATE_TREE_GROUP = 35, |
49 BROTLI_STATE_SUB_NONE = 50, | 54 BROTLI_STATE_SUB_NONE = 50, |
50 BROTLI_STATE_SUB_UNCOMPRESSED_SHORT = 51, | 55 BROTLI_STATE_SUB_UNCOMPRESSED_SHORT = 51, |
51 BROTLI_STATE_SUB_UNCOMPRESSED_FILL = 52, | 56 BROTLI_STATE_SUB_UNCOMPRESSED_FILL = 52, |
52 BROTLI_STATE_SUB_UNCOMPRESSED_COPY = 53, | 57 BROTLI_STATE_SUB_UNCOMPRESSED_COPY = 53, |
53 BROTLI_STATE_SUB_UNCOMPRESSED_WARMUP = 54, | 58 BROTLI_STATE_SUB_UNCOMPRESSED_WARMUP = 54, |
| 59 BROTLI_STATE_SUB_UNCOMPRESSED_WRITE_1 = 55, |
| 60 BROTLI_STATE_SUB_UNCOMPRESSED_WRITE_2 = 56, |
| 61 BROTLI_STATE_SUB_UNCOMPRESSED_WRITE_3 = 57, |
54 BROTLI_STATE_SUB_HUFFMAN_LENGTH_BEGIN = 60, | 62 BROTLI_STATE_SUB_HUFFMAN_LENGTH_BEGIN = 60, |
55 BROTLI_STATE_SUB_HUFFMAN_LENGTH_SYMBOLS = 61, | 63 BROTLI_STATE_SUB_HUFFMAN_LENGTH_SYMBOLS = 61, |
56 BROTLI_STATE_SUB_HUFFMAN_DONE = 62, | 64 BROTLI_STATE_SUB_HUFFMAN_DONE = 62, |
57 BROTLI_STATE_SUB_TREE_GROUP = 70, | 65 BROTLI_STATE_SUB_TREE_GROUP = 70, |
58 BROTLI_STATE_SUB_CONTEXT_MAP_HUFFMAN = 80, | 66 BROTLI_STATE_SUB_CONTEXT_MAP_HUFFMAN = 80, |
59 BROTLI_STATE_SUB_CONTEXT_MAPS = 81, | 67 BROTLI_STATE_SUB_CONTEXT_MAPS = 81, |
60 BROTLI_STATE_DONE = 100 | 68 BROTLI_STATE_DONE = 100 |
61 } BrotliRunningState; | 69 } BrotliRunningState; |
62 | 70 |
63 typedef struct { | 71 typedef struct { |
(...skipping 20 matching lines...) Expand all Loading... |
84 HuffmanCode* block_type_trees; | 92 HuffmanCode* block_type_trees; |
85 HuffmanCode* block_len_trees; | 93 HuffmanCode* block_len_trees; |
86 BrotliBitReader br; | 94 BrotliBitReader br; |
87 /* This counter is reused for several disjoint loops. */ | 95 /* This counter is reused for several disjoint loops. */ |
88 int loop_counter; | 96 int loop_counter; |
89 /* This is true if the literal context map histogram type always matches the | 97 /* This is true if the literal context map histogram type always matches the |
90 block type. It is then not needed to keep the context (faster decoding). */ | 98 block type. It is then not needed to keep the context (faster decoding). */ |
91 int trivial_literal_context; | 99 int trivial_literal_context; |
92 | 100 |
93 int meta_block_remaining_len; | 101 int meta_block_remaining_len; |
| 102 int is_metadata; |
94 int is_uncompressed; | 103 int is_uncompressed; |
95 int block_length[3]; | 104 int block_length[3]; |
96 int block_type[3]; | 105 int block_type[3]; |
97 int num_block_types[3]; | 106 int num_block_types[3]; |
98 int block_type_rb[6]; | 107 int block_type_rb[6]; |
99 int block_type_rb_index[3]; | 108 int block_type_rb_index[3]; |
100 int distance_postfix_bits; | 109 int distance_postfix_bits; |
101 int num_direct_distance_codes; | 110 int num_direct_distance_codes; |
102 int distance_postfix_mask; | 111 int distance_postfix_mask; |
103 int num_distance_codes; | 112 int num_distance_codes; |
(...skipping 20 matching lines...) Expand all Loading... |
124 int insert_length; | 133 int insert_length; |
125 int copy_length; | 134 int copy_length; |
126 int distance_code; | 135 int distance_code; |
127 int distance; | 136 int distance; |
128 const uint8_t* copy_src; | 137 const uint8_t* copy_src; |
129 uint8_t* copy_dst; | 138 uint8_t* copy_dst; |
130 | 139 |
131 /* For CopyUncompressedBlockToOutput */ | 140 /* For CopyUncompressedBlockToOutput */ |
132 int nbytes; | 141 int nbytes; |
133 | 142 |
| 143 /* For partial write operations */ |
| 144 int partially_written; |
| 145 |
134 /* For HuffmanTreeGroupDecode */ | 146 /* For HuffmanTreeGroupDecode */ |
135 int htrees_decoded; | 147 int htrees_decoded; |
136 | 148 |
137 /* For ReadHuffmanCodeLengths */ | 149 /* For ReadHuffmanCodeLengths */ |
138 int symbol; | 150 int symbol; |
139 uint8_t prev_code_len; | 151 uint8_t prev_code_len; |
140 int repeat; | 152 int repeat; |
141 uint8_t repeat_code_len; | 153 uint8_t repeat_code_len; |
142 int space; | 154 int space; |
143 HuffmanCode table[32]; | 155 HuffmanCode table[32]; |
(...skipping 14 matching lines...) Expand all Loading... |
158 } BrotliState; | 170 } BrotliState; |
159 | 171 |
160 void BrotliStateInit(BrotliState* s); | 172 void BrotliStateInit(BrotliState* s); |
161 void BrotliStateCleanup(BrotliState* s); | 173 void BrotliStateCleanup(BrotliState* s); |
162 | 174 |
163 #if defined(__cplusplus) || defined(c_plusplus) | 175 #if defined(__cplusplus) || defined(c_plusplus) |
164 } /* extern "C" */ | 176 } /* extern "C" */ |
165 #endif | 177 #endif |
166 | 178 |
167 #endif /* BROTLI_DEC_STATE_H_ */ | 179 #endif /* BROTLI_DEC_STATE_H_ */ |
OLD | NEW |