summaryrefslogtreecommitdiffstats
path: root/Source/ThirdParty/brotli/dec/state.h
diff options
context:
space:
mode:
Diffstat (limited to 'Source/ThirdParty/brotli/dec/state.h')
-rw-r--r--Source/ThirdParty/brotli/dec/state.h65
1 files changed, 35 insertions, 30 deletions
diff --git a/Source/ThirdParty/brotli/dec/state.h b/Source/ThirdParty/brotli/dec/state.h
index 63647ef2b..1d2773b7f 100644
--- a/Source/ThirdParty/brotli/dec/state.h
+++ b/Source/ThirdParty/brotli/dec/state.h
@@ -9,9 +9,11 @@
#ifndef BROTLI_DEC_STATE_H_
#define BROTLI_DEC_STATE_H_
+#include "../common/constants.h"
+#include "../common/dictionary.h"
+#include <brotli/types.h>
#include "./bit_reader.h"
#include "./huffman.h"
-#include "./types.h"
#include "./port.h"
#if defined(__cplusplus) || defined(c_plusplus)
@@ -93,7 +95,7 @@ typedef enum {
BROTLI_STATE_READ_BLOCK_LENGTH_SUFFIX
} BrotliRunningReadBlockLengthState;
-struct BrotliStateStruct {
+struct BrotliDecoderStateStruct {
BrotliRunningState state;
/* This counter is reused for several disjoint loops. */
@@ -114,7 +116,6 @@ struct BrotliStateStruct {
int pos;
int max_backward_distance;
- int max_backward_distance_minus_custom_dict_size;
int max_distance;
int ringbuffer_size;
int ringbuffer_mask;
@@ -140,6 +141,8 @@ struct BrotliStateStruct {
/* This is true if the literal context map histogram type always matches the
block type. It is then not needed to keep the context (faster decoding). */
int trivial_literal_context;
+ /* Distance context is actual after command is decoded and before distance
+ is computed. After distance computation it is used as a temporary variable. */
int distance_context;
int meta_block_remaining_len;
uint32_t block_length_index;
@@ -160,8 +163,8 @@ struct BrotliStateStruct {
int distance_code;
/* For partial write operations */
- size_t rb_roundtrips; /* How many times we went around the ringbuffer */
- size_t partial_pos_out; /* How much output to the user in total (<= rb) */
+ size_t rb_roundtrips; /* How many times we went around the ring-buffer */
+ size_t partial_pos_out; /* How much output to the user in total */
/* For ReadHuffmanCode */
uint32_t symbol;
@@ -169,14 +172,14 @@ struct BrotliStateStruct {
uint32_t space;
HuffmanCode table[32];
- /* List of of symbol chains. */
+ /* List of heads of symbol chains. */
uint16_t* symbol_lists;
/* Storage from symbol_lists. */
uint16_t symbols_lists_array[BROTLI_HUFFMAN_MAX_CODE_LENGTH + 1 +
- BROTLI_HUFFMAN_MAX_CODE_LENGTHS_SIZE];
+ BROTLI_NUM_COMMAND_SYMBOLS];
/* Tails of symbol chains. */
int next_symbol[32];
- uint8_t code_length_code_lengths[18];
+ uint8_t code_length_code_lengths[BROTLI_CODE_LENGTH_CODES];
/* Population counts for the code lengths */
uint16_t code_length_histo[16];
@@ -192,11 +195,7 @@ struct BrotliStateStruct {
/* For InverseMoveToFrontTransform */
uint32_t mtf_upper_bound;
- uint8_t mtf[256 + 4];
-
- /* For custom dictionaries */
- const uint8_t* custom_dict;
- int custom_dict_size;
+ uint32_t mtf[64 + 1];
/* less used attributes are in the end of this struct */
/* States inside function calls */
@@ -208,32 +207,38 @@ struct BrotliStateStruct {
BrotliRunningDecodeUint8State substate_decode_uint8;
BrotliRunningReadBlockLengthState substate_read_block_length;
- uint8_t is_last_metablock;
- uint8_t is_uncompressed;
- uint8_t is_metadata;
- uint8_t size_nibbles;
+ unsigned int is_last_metablock : 1;
+ unsigned int is_uncompressed : 1;
+ unsigned int is_metadata : 1;
+ unsigned int should_wrap_ringbuffer : 1;
+ unsigned int canny_ringbuffer_allocation : 1;
+ unsigned int size_nibbles : 8;
uint32_t window_bits;
+ int new_ringbuffer_size;
+
uint32_t num_literal_htrees;
uint8_t* context_map;
uint8_t* context_modes;
+ const BrotliDictionary* dictionary;
uint32_t trivial_literal_contexts[8]; /* 256 bits */
};
-typedef struct BrotliStateStruct BrotliStateInternal;
-#define BrotliState BrotliStateInternal
-
-BROTLI_INTERNAL void BrotliStateInit(BrotliState* s);
-BROTLI_INTERNAL void BrotliStateInitWithCustomAllocators(BrotliState* s,
- brotli_alloc_func alloc_func, brotli_free_func free_func, void* opaque);
-BROTLI_INTERNAL void BrotliStateCleanup(BrotliState* s);
-BROTLI_INTERNAL void BrotliStateMetablockBegin(BrotliState* s);
-BROTLI_INTERNAL void BrotliStateCleanupAfterMetablock(BrotliState* s);
-BROTLI_INTERNAL void BrotliHuffmanTreeGroupInit(BrotliState* s,
- HuffmanTreeGroup* group, uint32_t alphabet_size, uint32_t ntrees);
-BROTLI_INTERNAL void BrotliHuffmanTreeGroupRelease(BrotliState* s,
- HuffmanTreeGroup* group);
+typedef struct BrotliDecoderStateStruct BrotliDecoderStateInternal;
+#define BrotliDecoderState BrotliDecoderStateInternal
+
+BROTLI_INTERNAL void BrotliDecoderStateInit(BrotliDecoderState* s);
+BROTLI_INTERNAL void BrotliDecoderStateInitWithCustomAllocators(
+ BrotliDecoderState* s, brotli_alloc_func alloc_func,
+ brotli_free_func free_func, void* opaque);
+BROTLI_INTERNAL void BrotliDecoderStateCleanup(BrotliDecoderState* s);
+BROTLI_INTERNAL void BrotliDecoderStateMetablockBegin(BrotliDecoderState* s);
+BROTLI_INTERNAL void BrotliDecoderStateCleanupAfterMetablock(
+ BrotliDecoderState* s);
+BROTLI_INTERNAL BROTLI_BOOL BrotliDecoderHuffmanTreeGroupInit(
+ BrotliDecoderState* s, HuffmanTreeGroup* group, uint32_t alphabet_size,
+ uint32_t ntrees);
#if defined(__cplusplus) || defined(c_plusplus)
} /* extern "C" */