aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEugene Kliuchnikov <eustas@google.com>2018-10-16 16:46:54 +0200
committerGitHub <noreply@github.com>2018-10-16 16:46:54 +0200
commitf7cbc97c96d998d2e0b0299b9a9dab0a3b7a8521 (patch)
tree0f725da8472efda07ae8a35d961d986dbd7ffda7
parentcc7a74f15fff163319be63a13ae822513336544e (diff)
downloadbrotli-f7cbc97c96d998d2e0b0299b9a9dab0a3b7a8521.zip
brotli-f7cbc97c96d998d2e0b0299b9a9dab0a3b7a8521.tar.gz
brotli-f7cbc97c96d998d2e0b0299b9a9dab0a3b7a8521.tar.bz2
Fix typo / minor formatting (#716)
* Fix typo / minor formatting / pull computable constant to the place of use.
-rwxr-xr-xc/common/transform.c8
-rw-r--r--c/dec/huffman.c6
-rw-r--r--c/enc/backward_references_hq.c105
-rw-r--r--c/enc/backward_references_hq.h13
-rw-r--r--c/enc/backward_references_inc.h18
-rw-r--r--c/enc/encode.c34
-rw-r--r--c/enc/hash.h9
-rwxr-xr-xc/enc/hash_composite_inc.h11
-rw-r--r--c/enc/hash_longest_match64_inc.h5
-rw-r--r--c/enc/hash_longest_match_inc.h5
-rwxr-xr-xc/enc/hash_rolling_inc.h5
-rw-r--r--c/enc/hash_to_binary_tree_inc.h5
12 files changed, 111 insertions, 113 deletions
diff --git a/c/common/transform.c b/c/common/transform.c
index 4184ae5..426e635 100755
--- a/c/common/transform.c
+++ b/c/common/transform.c
@@ -191,11 +191,11 @@ static int ToUpperCase(uint8_t* p) {
}
int BrotliTransformDictionaryWord(uint8_t* dst, const uint8_t* word, int len,
- const BrotliTransforms* transforms, int transfom_idx) {
+ const BrotliTransforms* transforms, int transform_idx) {
int idx = 0;
- const uint8_t* prefix = BROTLI_TRANSFORM_PREFIX(transforms, transfom_idx);
- uint8_t type = BROTLI_TRANSFORM_TYPE(transforms, transfom_idx);
- const uint8_t* suffix = BROTLI_TRANSFORM_SUFFIX(transforms, transfom_idx);
+ const uint8_t* prefix = BROTLI_TRANSFORM_PREFIX(transforms, transform_idx);
+ uint8_t type = BROTLI_TRANSFORM_TYPE(transforms, transform_idx);
+ const uint8_t* suffix = BROTLI_TRANSFORM_SUFFIX(transforms, transform_idx);
{
int prefix_len = *prefix++;
while (prefix_len--) { dst[idx++] = *prefix++; }
diff --git a/c/dec/huffman.c b/c/dec/huffman.c
index 9deb42c..30c40d3 100644
--- a/c/dec/huffman.c
+++ b/c/dec/huffman.c
@@ -157,8 +157,7 @@ void BrotliBuildCodeLengthsHuffmanTable(HuffmanCode* table,
step = 2;
do {
for (bits_count = count[bits]; bits_count != 0; --bits_count) {
- code = ConstructHuffmanCode((uint8_t)bits,
- (uint16_t)sorted[symbol++]);
+ code = ConstructHuffmanCode((uint8_t)bits, (uint16_t)sorted[symbol++]);
ReplicateValue(&table[BrotliReverseBits(key)], step, table_size, code);
key += key_step;
}
@@ -248,8 +247,7 @@ uint32_t BrotliBuildHuffmanTable(HuffmanCode* root_table,
sub_key = 0;
}
symbol = symbol_lists[symbol];
- code = ConstructHuffmanCode((uint8_t)(len - root_bits),
- (uint16_t)symbol);
+ code = ConstructHuffmanCode((uint8_t)(len - root_bits), (uint16_t)symbol);
ReplicateValue(
&table[BrotliReverseBits(sub_key)], step, table_size, code);
sub_key += sub_key_step;
diff --git a/c/enc/backward_references_hq.c b/c/enc/backward_references_hq.c
index e7486c4..96b0e70 100644
--- a/c/enc/backward_references_hq.c
+++ b/c/enc/backward_references_hq.c
@@ -330,7 +330,7 @@ static size_t ComputeMinimumCopyLength(const float start_cost,
REQUIRES: nodes[0..pos] satisfies that "ZopfliNode array invariant". */
static uint32_t ComputeDistanceShortcut(const size_t block_start,
const size_t pos,
- const size_t max_backward,
+ const size_t max_backward_limit,
const size_t gap,
const ZopfliNode* nodes) {
const size_t clen = ZopfliNodeCopyLength(&nodes[pos]);
@@ -338,13 +338,13 @@ static uint32_t ComputeDistanceShortcut(const size_t block_start,
const size_t dist = ZopfliNodeCopyDistance(&nodes[pos]);
/* Since |block_start + pos| is the end position of the command, the copy part
starts from |block_start + pos - clen|. Distances that are greater than
- this or greater than |max_backward| are static dictionary references, and
- do not update the last distances. Also distance code 0 (last distance)
- does not update the last distances. */
+ this or greater than |max_backward_limit| + |gap| are static dictionary
+ references, and do not update the last distances.
+ Also distance code 0 (last distance) does not update the last distances. */
if (pos == 0) {
return 0;
} else if (dist + clen <= block_start + pos + gap &&
- dist <= max_backward + gap &&
+ dist <= max_backward_limit + gap &&
ZopfliNodeDistanceCode(&nodes[pos]) > 0) {
return (uint32_t)pos;
} else {
@@ -454,9 +454,11 @@ static size_t UpdateNodes(
break;
}
if (BROTLI_PREDICT_FALSE(backward > max_distance + gap)) {
+ /* Word dictionary -> ignore. */
continue;
}
if (backward <= max_distance) {
+ /* Regular backward reference. */
if (prev_ix >= cur_ix) {
continue;
}
@@ -564,14 +566,10 @@ static size_t ComputeShortestPathFromNodes(size_t num_bytes,
/* REQUIRES: nodes != NULL and len(nodes) >= num_bytes + 1 */
void BrotliZopfliCreateCommands(const size_t num_bytes,
- const size_t block_start,
- const size_t max_backward_limit,
- const ZopfliNode* nodes,
- int* dist_cache,
- size_t* last_insert_len,
- const BrotliEncoderParams* params,
- Command* commands,
- size_t* num_literals) {
+ const size_t block_start, const ZopfliNode* nodes, int* dist_cache,
+ size_t* last_insert_len, const BrotliEncoderParams* params,
+ Command* commands, size_t* num_literals) {
+ const size_t max_backward_limit = BROTLI_MAX_BACKWARD_LIMIT(params->lgwin);
size_t pos = 0;
uint32_t offset = nodes[0].u.next;
size_t i;
@@ -610,18 +608,12 @@ void BrotliZopfliCreateCommands(const size_t num_bytes,
*last_insert_len += num_bytes - pos;
}
-static size_t ZopfliIterate(size_t num_bytes,
- size_t position,
- const uint8_t* ringbuffer,
- size_t ringbuffer_mask,
- const BrotliEncoderParams* params,
- const size_t max_backward_limit,
- const size_t gap,
- const int* dist_cache,
- const ZopfliCostModel* model,
- const uint32_t* num_matches,
- const BackwardMatch* matches,
- ZopfliNode* nodes) {
+static size_t ZopfliIterate(size_t num_bytes, size_t position,
+ const uint8_t* ringbuffer, size_t ringbuffer_mask,
+ const BrotliEncoderParams* params, const size_t gap, const int* dist_cache,
+ const ZopfliCostModel* model, const uint32_t* num_matches,
+ const BackwardMatch* matches, ZopfliNode* nodes) {
+ const size_t max_backward_limit = BROTLI_MAX_BACKWARD_LIMIT(params->lgwin);
const size_t max_zopfli_len = MaxZopfliLen(params);
StartPosQueue queue;
size_t cur_match_pos = 0;
@@ -645,8 +637,8 @@ static size_t ZopfliIterate(size_t num_bytes,
while (skip) {
i++;
if (i + 3 >= num_bytes) break;
- EvaluateNode(position, i, max_backward_limit, gap, dist_cache, model,
- &queue, nodes);
+ EvaluateNode(position, i, max_backward_limit, gap,
+ dist_cache, model, &queue, nodes);
cur_match_pos += num_matches[i];
skip--;
}
@@ -656,11 +648,11 @@ static size_t ZopfliIterate(size_t num_bytes,
}
/* REQUIRES: nodes != NULL and len(nodes) >= num_bytes + 1 */
-size_t BrotliZopfliComputeShortestPath(MemoryManager* m,
- size_t num_bytes, size_t position, const uint8_t* ringbuffer,
- size_t ringbuffer_mask, const BrotliEncoderParams* params,
- const size_t max_backward_limit, const int* dist_cache, HasherHandle hasher,
- ZopfliNode* nodes) {
+size_t BrotliZopfliComputeShortestPath(MemoryManager* m, size_t num_bytes,
+ size_t position, const uint8_t* ringbuffer, size_t ringbuffer_mask,
+ const BrotliEncoderParams* params,
+ const int* dist_cache, HasherHandle hasher, ZopfliNode* nodes) {
+ const size_t max_backward_limit = BROTLI_MAX_BACKWARD_LIMIT(params->lgwin);
const size_t max_zopfli_len = MaxZopfliLen(params);
ZopfliCostModel model;
StartPosQueue queue;
@@ -681,9 +673,11 @@ size_t BrotliZopfliComputeShortestPath(MemoryManager* m,
const size_t pos = position + i;
const size_t max_distance = BROTLI_MIN(size_t, pos, max_backward_limit);
size_t skip;
- size_t num_matches = FindAllMatchesH10(hasher, &params->dictionary,
- ringbuffer, ringbuffer_mask, pos, num_bytes - i, max_distance, gap,
- params, &matches[lz_matches_offset]);
+ size_t num_matches;
+ num_matches = FindAllMatchesH10(hasher,
+ &params->dictionary,
+ ringbuffer, ringbuffer_mask, pos, num_bytes - i, max_distance,
+ gap, params, &matches[lz_matches_offset]);
if (num_matches > 0 &&
BackwardMatchLength(&matches[num_matches - 1]) > max_zopfli_len) {
matches[0] = matches[num_matches - 1];
@@ -704,8 +698,8 @@ size_t BrotliZopfliComputeShortestPath(MemoryManager* m,
while (skip) {
i++;
if (i + HashTypeLengthH10() - 1 >= num_bytes) break;
- EvaluateNode(position, i, max_backward_limit, gap, dist_cache, &model,
- &queue, nodes);
+ EvaluateNode(position, i, max_backward_limit, gap,
+ dist_cache, &model, &queue, nodes);
skip--;
}
}
@@ -714,28 +708,27 @@ size_t BrotliZopfliComputeShortestPath(MemoryManager* m,
return ComputeShortestPathFromNodes(num_bytes, nodes);
}
-void BrotliCreateZopfliBackwardReferences(MemoryManager* m,
- size_t num_bytes, size_t position, const uint8_t* ringbuffer,
- size_t ringbuffer_mask, const BrotliEncoderParams* params,
+void BrotliCreateZopfliBackwardReferences(MemoryManager* m, size_t num_bytes,
+ size_t position, const uint8_t* ringbuffer, size_t ringbuffer_mask,
+ const BrotliEncoderParams* params,
HasherHandle hasher, int* dist_cache, size_t* last_insert_len,
Command* commands, size_t* num_commands, size_t* num_literals) {
- const size_t max_backward_limit = BROTLI_MAX_BACKWARD_LIMIT(params->lgwin);
ZopfliNode* nodes;
nodes = BROTLI_ALLOC(m, ZopfliNode, num_bytes + 1);
if (BROTLI_IS_OOM(m)) return;
BrotliInitZopfliNodes(nodes, num_bytes + 1);
- *num_commands += BrotliZopfliComputeShortestPath(m,
- num_bytes, position, ringbuffer, ringbuffer_mask,
- params, max_backward_limit, dist_cache, hasher, nodes);
+ *num_commands += BrotliZopfliComputeShortestPath(m, num_bytes,
+ position, ringbuffer, ringbuffer_mask, params,
+ dist_cache, hasher, nodes);
if (BROTLI_IS_OOM(m)) return;
- BrotliZopfliCreateCommands(num_bytes, position, max_backward_limit, nodes,
- dist_cache, last_insert_len, params, commands, num_literals);
+ BrotliZopfliCreateCommands(num_bytes, position, nodes, dist_cache,
+ last_insert_len, params, commands, num_literals);
BROTLI_FREE(m, nodes);
}
-void BrotliCreateHqZopfliBackwardReferences(MemoryManager* m,
- size_t num_bytes, size_t position, const uint8_t* ringbuffer,
- size_t ringbuffer_mask, const BrotliEncoderParams* params,
+void BrotliCreateHqZopfliBackwardReferences(MemoryManager* m, size_t num_bytes,
+ size_t position, const uint8_t* ringbuffer, size_t ringbuffer_mask,
+ const BrotliEncoderParams* params,
HasherHandle hasher, int* dist_cache, size_t* last_insert_len,
Command* commands, size_t* num_commands, size_t* num_literals) {
const size_t max_backward_limit = BROTLI_MAX_BACKWARD_LIMIT(params->lgwin);
@@ -767,8 +760,10 @@ void BrotliCreateHqZopfliBackwardReferences(MemoryManager* m,
cur_match_pos + MAX_NUM_MATCHES_H10 + shadow_matches);
if (BROTLI_IS_OOM(m)) return;
num_found_matches = FindAllMatchesH10(hasher,
- &params->dictionary, ringbuffer, ringbuffer_mask, pos, max_length,
- max_distance, gap, params, &matches[cur_match_pos + shadow_matches]);
+ &params->dictionary,
+ ringbuffer, ringbuffer_mask, pos, max_length,
+ max_distance, gap, params,
+ &matches[cur_match_pos + shadow_matches]);
cur_match_end = cur_match_pos + num_found_matches;
for (j = cur_match_pos; j + 1 < cur_match_end; ++j) {
BROTLI_DCHECK(BackwardMatchLength(&matches[j]) <=
@@ -814,10 +809,10 @@ void BrotliCreateHqZopfliBackwardReferences(MemoryManager* m,
*last_insert_len = orig_last_insert_len;
memcpy(dist_cache, orig_dist_cache, 4 * sizeof(dist_cache[0]));
*num_commands += ZopfliIterate(num_bytes, position, ringbuffer,
- ringbuffer_mask, params, max_backward_limit, gap, dist_cache,
- &model, num_matches, matches, nodes);
- BrotliZopfliCreateCommands(num_bytes, position, max_backward_limit,
- nodes, dist_cache, last_insert_len, params, commands, num_literals);
+ ringbuffer_mask, params, gap, dist_cache, &model, num_matches, matches,
+ nodes);
+ BrotliZopfliCreateCommands(num_bytes, position, nodes, dist_cache,
+ last_insert_len, params, commands, num_literals);
}
CleanupZopfliCostModel(m, &model);
BROTLI_FREE(m, nodes);
diff --git a/c/enc/backward_references_hq.h b/c/enc/backward_references_hq.h
index 7c38bd6..1e4275d 100644
--- a/c/enc/backward_references_hq.h
+++ b/c/enc/backward_references_hq.h
@@ -74,15 +74,14 @@ BROTLI_INTERNAL void BrotliInitZopfliNodes(ZopfliNode* array, size_t length);
(1) nodes[i].copy_length() >= 2
(2) nodes[i].command_length() <= i and
(3) nodes[i - nodes[i].command_length()].cost < kInfinity */
-BROTLI_INTERNAL size_t BrotliZopfliComputeShortestPath(MemoryManager* m,
- size_t num_bytes, size_t position, const uint8_t* ringbuffer,
- size_t ringbuffer_mask, const BrotliEncoderParams* params,
- const size_t max_backward_limit, const int* dist_cache, HasherHandle hasher,
- ZopfliNode* nodes);
+BROTLI_INTERNAL size_t BrotliZopfliComputeShortestPath(
+ MemoryManager* m, size_t num_bytes,
+ size_t position, const uint8_t* ringbuffer, size_t ringbuffer_mask,
+ const BrotliEncoderParams* params,
+ const int* dist_cache, HasherHandle hasher, ZopfliNode* nodes);
BROTLI_INTERNAL void BrotliZopfliCreateCommands(
- const size_t num_bytes, const size_t block_start,
- const size_t max_backward_limit, const ZopfliNode* nodes,
+ const size_t num_bytes, const size_t block_start, const ZopfliNode* nodes,
int* dist_cache, size_t* last_insert_len, const BrotliEncoderParams* params,
Command* commands, size_t* num_literals);
diff --git a/c/enc/backward_references_inc.h b/c/enc/backward_references_inc.h
index 38a48d3..c18cdb0 100644
--- a/c/enc/backward_references_inc.h
+++ b/c/enc/backward_references_inc.h
@@ -10,9 +10,9 @@
static BROTLI_NOINLINE void EXPORT_FN(CreateBackwardReferences)(
size_t num_bytes, size_t position,
const uint8_t* ringbuffer, size_t ringbuffer_mask,
- const BrotliEncoderParams* params, HasherHandle hasher, int* dist_cache,
- size_t* last_insert_len, Command* commands, size_t* num_commands,
- size_t* num_literals) {
+ const BrotliEncoderParams* params,
+ HasherHandle hasher, int* dist_cache, size_t* last_insert_len,
+ Command* commands, size_t* num_commands, size_t* num_literals) {
/* Set maximum distance, see section 9.1. of the spec. */
const size_t max_backward_limit = BROTLI_MAX_BACKWARD_LIMIT(params->lgwin);
@@ -42,9 +42,8 @@ static BROTLI_NOINLINE void EXPORT_FN(CreateBackwardReferences)(
sr.distance = 0;
sr.score = kMinScore;
FN(FindLongestMatch)(hasher, &params->dictionary,
- ringbuffer, ringbuffer_mask, dist_cache, position,
- max_length, max_distance, gap,
- params->dist.max_distance, &sr);
+ ringbuffer, ringbuffer_mask, dist_cache, position, max_length,
+ max_distance, gap, params->dist.max_distance, &sr);
if (sr.score > kMinScore) {
/* Found a match. Let's look for something even better ahead. */
int delayed_backward_references_in_row = 0;
@@ -58,7 +57,8 @@ static BROTLI_NOINLINE void EXPORT_FN(CreateBackwardReferences)(
sr2.distance = 0;
sr2.score = kMinScore;
max_distance = BROTLI_MIN(size_t, position + 1, max_backward_limit);
- FN(FindLongestMatch)(hasher, &params->dictionary,
+ FN(FindLongestMatch)(hasher,
+ &params->dictionary,
ringbuffer, ringbuffer_mask, dist_cache, position + 1, max_length,
max_distance, gap, params->dist.max_distance, &sr2);
if (sr2.score >= sr.score + cost_diff_lazy) {
@@ -80,8 +80,8 @@ static BROTLI_NOINLINE void EXPORT_FN(CreateBackwardReferences)(
{
/* The first 16 codes are special short-codes,
and the minimum offset is 1. */
- size_t distance_code =
- ComputeDistanceCode(sr.distance, max_distance + gap, dist_cache);
+ size_t distance_code = ComputeDistanceCode(
+ sr.distance, max_distance + gap, dist_cache);
if ((sr.distance <= (max_distance + gap)) && distance_code > 0) {
dist_cache[3] = dist_cache[2];
dist_cache[2] = dist_cache[1];
diff --git a/c/enc/encode.c b/c/enc/encode.c
index ec56da2..141e70a 100644
--- a/c/enc/encode.c
+++ b/c/enc/encode.c
@@ -496,6 +496,8 @@ static void DecideOverLiteralContextModeling(const uint8_t* input,
static BROTLI_BOOL ShouldCompress(
const uint8_t* data, const size_t mask, const uint64_t last_flush_pos,
const size_t bytes, const size_t num_literals, const size_t num_commands) {
+ /* TODO: find more precise minimal block overhead. */
+ if (bytes <= 2) return BROTLI_FALSE;
if (num_commands < (bytes >> 8) + 2) {
if (num_literals > 0.99 * (double)bytes) {
uint32_t literal_histo[256] = { 0 };
@@ -674,12 +676,14 @@ static BROTLI_BOOL EnsureInitialized(BrotliEncoderState* s) {
if (BROTLI_IS_OOM(&s->memory_manager_)) return BROTLI_FALSE;
if (s->is_initialized_) return BROTLI_TRUE;
+ s->last_bytes_bits_ = 0;
+ s->last_bytes_ = 0;
+ s->remaining_metadata_bytes_ = BROTLI_UINT32_MAX;
+
SanitizeParams(&s->params);
s->params.lgblock = ComputeLgBlock(&s->params);
ChooseDistanceParams(&s->params);
- s->remaining_metadata_bytes_ = BROTLI_UINT32_MAX;
-
RingBufferSetup(&s->params, &s->ringbuffer_);
/* Initialize last byte with stream header. */
@@ -1029,23 +1033,20 @@ static BROTLI_BOOL EncodeData(
if (s->params.quality == ZOPFLIFICATION_QUALITY) {
BROTLI_DCHECK(s->params.hasher.type == 10);
- BrotliCreateZopfliBackwardReferences(m,
- bytes, wrapped_last_processed_pos,
+ BrotliCreateZopfliBackwardReferences(m, bytes, wrapped_last_processed_pos,
data, mask, &s->params, s->hasher_, s->dist_cache_,
&s->last_insert_len_, &s->commands_[s->num_commands_],
&s->num_commands_, &s->num_literals_);
if (BROTLI_IS_OOM(m)) return BROTLI_FALSE;
} else if (s->params.quality == HQ_ZOPFLIFICATION_QUALITY) {
BROTLI_DCHECK(s->params.hasher.type == 10);
- BrotliCreateHqZopfliBackwardReferences(m,
- bytes, wrapped_last_processed_pos,
+ BrotliCreateHqZopfliBackwardReferences(m, bytes, wrapped_last_processed_pos,
data, mask, &s->params, s->hasher_, s->dist_cache_,
&s->last_insert_len_, &s->commands_[s->num_commands_],
&s->num_commands_, &s->num_literals_);
if (BROTLI_IS_OOM(m)) return BROTLI_FALSE;
} else {
- BrotliCreateBackwardReferences(
- bytes, wrapped_last_processed_pos,
+ BrotliCreateBackwardReferences(bytes, wrapped_last_processed_pos,
data, mask, &s->params, s->hasher_, s->dist_cache_,
&s->last_insert_len_, &s->commands_[s->num_commands_],
&s->num_commands_, &s->num_literals_);
@@ -1166,7 +1167,6 @@ static BROTLI_BOOL BrotliCompressBufferQuality10(
MemoryManager* m = &memory_manager;
const size_t mask = BROTLI_SIZE_MAX >> 1;
- const size_t max_backward_limit = BROTLI_MAX_BACKWARD_LIMIT(lgwin);
int dist_cache[4] = { 4, 11, 15, 16 };
int saved_dist_cache[4] = { 4, 11, 15, 16 };
BROTLI_BOOL ok = BROTLI_TRUE;
@@ -1176,8 +1176,8 @@ static BROTLI_BOOL BrotliCompressBufferQuality10(
uint8_t last_bytes_bits;
HasherHandle hasher = NULL;
- const size_t hasher_eff_size =
- BROTLI_MIN(size_t, input_size, max_backward_limit + BROTLI_WINDOW_GAP);
+ const size_t hasher_eff_size = BROTLI_MIN(size_t,
+ input_size, BROTLI_MAX_BACKWARD_LIMIT(lgwin) + BROTLI_WINDOW_GAP);
BrotliEncoderParams params;
@@ -1238,9 +1238,9 @@ static BROTLI_BOOL BrotliCompressBufferQuality10(
BrotliInitZopfliNodes(nodes, block_size + 1);
StitchToPreviousBlockH10(hasher, block_size, block_start,
input_buffer, mask);
- path_size = BrotliZopfliComputeShortestPath(m,
- block_size, block_start, input_buffer, mask, &params,
- max_backward_limit, dist_cache, hasher, nodes);
+ path_size = BrotliZopfliComputeShortestPath(m, block_size, block_start,
+ input_buffer, mask, &params, dist_cache, hasher,
+ nodes);
if (BROTLI_IS_OOM(m)) goto oom;
/* We allocate a command buffer in the first iteration of this loop that
will be likely big enough for the whole metablock, so that for most
@@ -1262,10 +1262,8 @@ static BROTLI_BOOL BrotliCompressBufferQuality10(
}
commands = new_commands;
}
- BrotliZopfliCreateCommands(block_size, block_start, max_backward_limit,
- &nodes[0], dist_cache, &last_insert_len,
- &params, &commands[num_commands],
- &num_literals);
+ BrotliZopfliCreateCommands(block_size, block_start, &nodes[0], dist_cache,
+ &last_insert_len, &params, &commands[num_commands], &num_literals);
num_commands += path_size;
block_start += block_size;
metablock_size += block_size;
diff --git a/c/enc/hash.h b/c/enc/hash.h
index 2602490..8c5a7bb 100644
--- a/c/enc/hash.h
+++ b/c/enc/hash.h
@@ -149,9 +149,9 @@ static BROTLI_INLINE score_t BackwardReferencePenaltyUsingLastDistance(
}
static BROTLI_INLINE BROTLI_BOOL TestStaticDictionaryItem(
- const BrotliEncoderDictionary* dictionary, size_t item, const uint8_t* data,
- size_t max_length, size_t max_backward, size_t max_distance,
- HasherSearchResult* out) {
+ const BrotliEncoderDictionary* dictionary, size_t item,
+ const uint8_t* data, size_t max_length, size_t max_backward,
+ size_t max_distance, HasherSearchResult* out) {
size_t len;
size_t word_idx;
size_t offset;
@@ -208,7 +208,8 @@ static BROTLI_INLINE void SearchInStaticDictionary(
self->dict_num_lookups++;
if (item != 0) {
BROTLI_BOOL item_matches = TestStaticDictionaryItem(
- dictionary, item, data, max_length, max_backward, max_distance, out);
+ dictionary, item, data,
+ max_length, max_backward, max_distance, out);
if (item_matches) {
self->dict_num_matches++;
}
diff --git a/c/enc/hash_composite_inc.h b/c/enc/hash_composite_inc.h
index f829a97..b266aa2 100755
--- a/c/enc/hash_composite_inc.h
+++ b/c/enc/hash_composite_inc.h
@@ -121,13 +121,16 @@ static BROTLI_INLINE void FN(FindLongestMatch)(HasherHandle handle,
const BrotliEncoderDictionary* dictionary,
const uint8_t* BROTLI_RESTRICT data, const size_t ring_buffer_mask,
const int* BROTLI_RESTRICT distance_cache, const size_t cur_ix,
- const size_t max_length, const size_t max_backward, const size_t gap,
- const size_t max_distance, HasherSearchResult* BROTLI_RESTRICT out) {
+ const size_t max_length, const size_t max_backward,
+ const size_t gap, const size_t max_distance,
+ HasherSearchResult* BROTLI_RESTRICT out) {
HashComposite* self = FN(Self)(handle);
FN_A(FindLongestMatch)(self->ha, dictionary, data, ring_buffer_mask,
- distance_cache, cur_ix, max_length, max_backward, gap, max_distance, out);
+ distance_cache, cur_ix, max_length, max_backward, gap,
+ max_distance, out);
FN_B(FindLongestMatch)(self->hb, dictionary, data, ring_buffer_mask,
- distance_cache, cur_ix, max_length, max_backward, gap, max_distance, out);
+ distance_cache, cur_ix, max_length, max_backward, gap,
+ max_distance, out);
}
#undef HashComposite
diff --git a/c/enc/hash_longest_match64_inc.h b/c/enc/hash_longest_match64_inc.h
index e099edf..cb953a6 100644
--- a/c/enc/hash_longest_match64_inc.h
+++ b/c/enc/hash_longest_match64_inc.h
@@ -161,8 +161,9 @@ static BROTLI_INLINE void FN(FindLongestMatch)(HasherHandle handle,
const BrotliEncoderDictionary* dictionary,
const uint8_t* BROTLI_RESTRICT data, const size_t ring_buffer_mask,
const int* BROTLI_RESTRICT distance_cache, const size_t cur_ix,
- const size_t max_length, const size_t max_backward, const size_t gap,
- const size_t max_distance, HasherSearchResult* BROTLI_RESTRICT out) {
+ const size_t max_length, const size_t max_backward,
+ const size_t gap, const size_t max_distance,
+ HasherSearchResult* BROTLI_RESTRICT out) {
HasherCommon* common = GetHasherCommon(handle);
HashLongestMatch* self = FN(Self)(handle);
uint16_t* num = FN(Num)(self);
diff --git a/c/enc/hash_longest_match_inc.h b/c/enc/hash_longest_match_inc.h
index 951d7a4..457f5a9 100644
--- a/c/enc/hash_longest_match_inc.h
+++ b/c/enc/hash_longest_match_inc.h
@@ -154,8 +154,9 @@ static BROTLI_INLINE void FN(FindLongestMatch)(HasherHandle handle,
const BrotliEncoderDictionary* dictionary,
const uint8_t* BROTLI_RESTRICT data, const size_t ring_buffer_mask,
const int* BROTLI_RESTRICT distance_cache, const size_t cur_ix,
- const size_t max_length, const size_t max_backward, const size_t gap,
- const size_t max_distance, HasherSearchResult* BROTLI_RESTRICT out) {
+ const size_t max_length, const size_t max_backward,
+ const size_t gap, const size_t max_distance,
+ HasherSearchResult* BROTLI_RESTRICT out) {
HasherCommon* common = GetHasherCommon(handle);
HashLongestMatch* self = FN(Self)(handle);
uint16_t* num = FN(Num)(self);
diff --git a/c/enc/hash_rolling_inc.h b/c/enc/hash_rolling_inc.h
index 4d5d14a..17f8a40 100755
--- a/c/enc/hash_rolling_inc.h
+++ b/c/enc/hash_rolling_inc.h
@@ -155,8 +155,9 @@ static BROTLI_INLINE void FN(FindLongestMatch)(HasherHandle handle,
const BrotliEncoderDictionary* dictionary,
const uint8_t* BROTLI_RESTRICT data, const size_t ring_buffer_mask,
const int* BROTLI_RESTRICT distance_cache, const size_t cur_ix,
- const size_t max_length, const size_t max_backward, const size_t gap,
- const size_t max_distance, HasherSearchResult* BROTLI_RESTRICT out) {
+ const size_t max_length, const size_t max_backward,
+ const size_t gap, const size_t max_distance,
+ HasherSearchResult* BROTLI_RESTRICT out) {
HashRolling* self = FN(Self)(handle);
const size_t cur_ix_masked = cur_ix & ring_buffer_mask;
size_t pos = self->next_ix;
diff --git a/c/enc/hash_to_binary_tree_inc.h b/c/enc/hash_to_binary_tree_inc.h
index 48097b1..7fb0356 100644
--- a/c/enc/hash_to_binary_tree_inc.h
+++ b/c/enc/hash_to_binary_tree_inc.h
@@ -202,8 +202,9 @@ static BROTLI_INLINE BackwardMatch* FN(StoreAndFindMatches)(
static BROTLI_INLINE size_t FN(FindAllMatches)(HasherHandle handle,
const BrotliEncoderDictionary* dictionary, const uint8_t* data,
const size_t ring_buffer_mask, const size_t cur_ix,
- const size_t max_length, const size_t max_backward, const size_t gap,
- const BrotliEncoderParams* params, BackwardMatch* matches) {
+ const size_t max_length, const size_t max_backward,
+ const size_t gap, const BrotliEncoderParams* params,
+ BackwardMatch* matches) {
BackwardMatch* const orig_matches = matches;
const size_t cur_ix_masked = cur_ix & ring_buffer_mask;
size_t best_len = 1;