From 9b83be233e0ec867d91bcd451717c881eaf35ca2 Mon Sep 17 00:00:00 2001 From: Evgenii Kliuchnikov Date: Thu, 26 Oct 2023 02:02:51 -0700 Subject: fix wording PiperOrigin-RevId: 576788685 --- c/enc/encode.c | 18 +++++++++--------- c/enc/encoder_dict.c | 4 ++-- research/brotlidump.py | 2 +- 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/c/enc/encode.c b/c/enc/encode.c index 95ff2ea..6b39707 100644 --- a/c/enc/encode.c +++ b/c/enc/encode.c @@ -271,18 +271,18 @@ static void ChooseContextMap(int quality, uint32_t two_prefix_histo[6] = { 0 }; size_t total; size_t i; - size_t dummy; + size_t sink; double entropy[4]; for (i = 0; i < 9; ++i) { monogram_histo[i % 3] += bigram_histo[i]; two_prefix_histo[i % 6] += bigram_histo[i]; } - entropy[1] = ShannonEntropy(monogram_histo, 3, &dummy); - entropy[2] = (ShannonEntropy(two_prefix_histo, 3, &dummy) + - ShannonEntropy(two_prefix_histo + 3, 3, &dummy)); + entropy[1] = ShannonEntropy(monogram_histo, 3, &sink); + entropy[2] = (ShannonEntropy(two_prefix_histo, 3, &sink) + + ShannonEntropy(two_prefix_histo + 3, 3, &sink)); entropy[3] = 0; for (i = 0; i < 3; ++i) { - entropy[3] += ShannonEntropy(bigram_histo + 3 * i, 3, &dummy); + entropy[3] += ShannonEntropy(bigram_histo + 3 * i, 3, &sink); } total = monogram_histo[0] + monogram_histo[1] + monogram_histo[2]; @@ -348,7 +348,7 @@ static BROTLI_BOOL ShouldUseComplexStaticContextMap(const uint8_t* input, uint32_t* BROTLI_RESTRICT const context_histo = arena + 32; uint32_t total = 0; double entropy[3]; - size_t dummy; + size_t sink; size_t i; ContextLut utf8_lut = BROTLI_CONTEXT_LUT(CONTEXT_UTF8); memset(arena, 0, sizeof(arena[0]) * 32 * 14); @@ -370,10 +370,10 @@ static BROTLI_BOOL ShouldUseComplexStaticContextMap(const uint8_t* input, prev1 = literal; } } - entropy[1] = ShannonEntropy(combined_histo, 32, &dummy); + entropy[1] = ShannonEntropy(combined_histo, 32, &sink); entropy[2] = 0; for (i = 0; i < 13; ++i) { - entropy[2] += ShannonEntropy(context_histo + (i << 5), 32, &dummy); + entropy[2] += ShannonEntropy(context_histo + (i << 5), 32, &sink); } entropy[0] = 1.0 / (double)total; entropy[1] *= entropy[0]; @@ -817,7 +817,7 @@ static void CopyInputToRingBuffer(BrotliEncoderState* s, reading new bytes from the input. However, at the last few indexes of the ring buffer, there are not enough bytes to build full-length substrings from. Since the hash table always contains full-length - substrings, we erase with dummy zeros here to make sure that those + substrings, we overwrite with zeros here to make sure that those substrings will contain zeros at the end instead of uninitialized data. diff --git a/c/enc/encoder_dict.c b/c/enc/encoder_dict.c index 6602c55..0984281 100644 --- a/c/enc/encoder_dict.c +++ b/c/enc/encoder_dict.c @@ -118,8 +118,8 @@ static uint32_t BrotliTrieAlloc(MemoryManager* m, size_t num, BrotliTrie* trie, keep_index = (uint32_t)(*keep - trie->pool); } if (trie->pool_size == 0) { - /* Have a dummy node in the front. We do not want the result to be 0, it - must be at least 1, 0 represents "null pointer" */ + /* Have a placeholder node in the front. We do not want the result to be 0, + it must be at least 1, 0 represents "null pointer" */ trie->pool_size = 1; } BROTLI_ENSURE_CAPACITY(m, BrotliTrieNode, trie->pool, trie->pool_capacity, diff --git a/research/brotlidump.py b/research/brotlidump.py index ccdec61..c2fcaa1 100644 --- a/research/brotlidump.py +++ b/research/brotlidump.py @@ -2240,7 +2240,7 @@ __test__ = { 'file': """ >>> try: Layout(BitStream( - ... open("H:/Downloads/brotli-master/tests/testdata/10x10y.compressed",'rb') + ... open("./tests/testdata/10x10y.compressed",'rb') ... .read())).processStream() ... except NotImplementedError: pass addr hex binary context explanation -- cgit v1.1