Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(176)

Unified Diff: third_party/brotli/dec/state.h

Issue 2537133002: Update brotli to v1.0.0-snapshot. (Closed)
Patch Set: Fixed typo Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « third_party/brotli/dec/prefix.h ('k') | third_party/brotli/dec/state.c » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/brotli/dec/state.h
diff --git a/third_party/brotli/dec/state.h b/third_party/brotli/dec/state.h
index f8e12595a4680aba8ad082781d2d35b56bef9051..de1056de9d4b712cd3232b2e64c22e5660af15f2 100644
--- a/third_party/brotli/dec/state.h
+++ b/third_party/brotli/dec/state.h
@@ -9,9 +9,10 @@
#ifndef BROTLI_DEC_STATE_H_
#define BROTLI_DEC_STATE_H_
+#include "../common/constants.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 +94,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 +115,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;
@@ -152,7 +152,6 @@ struct BrotliStateStruct {
uint32_t num_dist_htrees;
uint8_t* dist_context_map;
HuffmanCode* literal_htree;
- uint8_t literal_htree_index;
uint8_t dist_htree_index;
uint32_t repeat_code_len;
uint32_t prev_code_len;
@@ -161,8 +160,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;
@@ -174,10 +173,10 @@ struct BrotliStateStruct {
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];
@@ -193,7 +192,7 @@ struct BrotliStateStruct {
/* For InverseMoveToFrontTransform */
uint32_t mtf_upper_bound;
- uint8_t mtf[256 + 4];
+ uint32_t mtf[64 + 1];
/* For custom dictionaries */
const uint8_t* custom_dict;
@@ -209,30 +208,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 size_nibbles : 8;
uint32_t window_bits;
+ int new_ringbuffer_size;
+
uint32_t num_literal_htrees;
uint8_t* context_map;
uint8_t* context_modes;
+
+ 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);
+BROTLI_INTERNAL void BrotliDecoderHuffmanTreeGroupRelease(
+ BrotliDecoderState* s, HuffmanTreeGroup* group);
#if defined(__cplusplus) || defined(c_plusplus)
} /* extern "C" */
« no previous file with comments | « third_party/brotli/dec/prefix.h ('k') | third_party/brotli/dec/state.c » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698