diff options
author | Anton Samokhvalov <pg83@yandex.ru> | 2022-02-10 16:45:15 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:45:15 +0300 |
commit | 72cb13b4aff9bc9cf22e49251bc8fd143f82538f (patch) | |
tree | da2c34829458c7d4e74bdfbdf85dff449e9e7fb8 /contrib/libs/brotli/dec/huffman.h | |
parent | 778e51ba091dc39e7b7fcab2b9cf4dbedfb6f2b5 (diff) | |
download | ydb-72cb13b4aff9bc9cf22e49251bc8fd143f82538f.tar.gz |
Restoring authorship annotation for Anton Samokhvalov <pg83@yandex.ru>. Commit 1 of 2.
Diffstat (limited to 'contrib/libs/brotli/dec/huffman.h')
-rw-r--r-- | contrib/libs/brotli/dec/huffman.h | 72 |
1 files changed, 36 insertions, 36 deletions
diff --git a/contrib/libs/brotli/dec/huffman.h b/contrib/libs/brotli/dec/huffman.h index b9f0716c16..9951f8e15d 100644 --- a/contrib/libs/brotli/dec/huffman.h +++ b/contrib/libs/brotli/dec/huffman.h @@ -1,23 +1,23 @@ -/* Copyright 2013 Google Inc. All Rights Reserved. - +/* Copyright 2013 Google Inc. All Rights Reserved. + Distributed under MIT license. See file LICENSE for detail or copy at https://opensource.org/licenses/MIT -*/ - -/* Utilities for building Huffman decoding tables. */ - -#ifndef BROTLI_DEC_HUFFMAN_H_ -#define BROTLI_DEC_HUFFMAN_H_ - +*/ + +/* Utilities for building Huffman decoding tables. */ + +#ifndef BROTLI_DEC_HUFFMAN_H_ +#define BROTLI_DEC_HUFFMAN_H_ + #include "../common/platform.h" #include <brotli/types.h> - -#if defined(__cplusplus) || defined(c_plusplus) -extern "C" { -#endif - -#define BROTLI_HUFFMAN_MAX_CODE_LENGTH 15 - + +#if defined(__cplusplus) || defined(c_plusplus) +extern "C" { +#endif + +#define BROTLI_HUFFMAN_MAX_CODE_LENGTH 15 + /* Maximum possible Huffman table size for an alphabet size of (index * 32), max code length 15 and root table bits 8. */ static const uint16_t kMaxHuffmanTableSize[] = { @@ -30,9 +30,9 @@ static const uint16_t kMaxHuffmanTableSize[] = { #define BROTLI_HUFFMAN_MAX_SIZE_258 632 /* BROTLI_MAX_CONTEXT_MAP_SYMBOLS == 272 */ #define BROTLI_HUFFMAN_MAX_SIZE_272 646 - -#define BROTLI_HUFFMAN_MAX_CODE_LENGTH_CODE_LENGTH 5 - + +#define BROTLI_HUFFMAN_MAX_CODE_LENGTH_CODE_LENGTH 5 + #if ((defined(BROTLI_TARGET_ARMV7) || defined(BROTLI_TARGET_ARMV8_32)) && \ BROTLI_GNUC_HAS_ATTRIBUTE(aligned, 2, 7, 0)) #define BROTLI_HUFFMAN_CODE_FAST_LOAD @@ -41,11 +41,11 @@ static const uint16_t kMaxHuffmanTableSize[] = { #if !defined(BROTLI_HUFFMAN_CODE_FAST_LOAD) /* Do not create this struct directly - use the ConstructHuffmanCode * constructor below! */ -typedef struct { +typedef struct { uint8_t bits; /* number of bits used for this symbol */ uint16_t value; /* symbol value or table offset */ -} HuffmanCode; - +} HuffmanCode; + static BROTLI_INLINE HuffmanCode ConstructHuffmanCode(const uint8_t bits, const uint16_t value) { HuffmanCode h; @@ -93,35 +93,35 @@ static BROTLI_INLINE HuffmanCode ConstructHuffmanCode(const uint8_t bits, #define BROTLI_HC_FAST_LOAD_VALUE(H) ((__fastload_##H) >> 16) #endif /* BROTLI_HUFFMAN_CODE_FAST_LOAD */ -/* Builds Huffman lookup table assuming code lengths are in symbol order. */ +/* Builds Huffman lookup table assuming code lengths are in symbol order. */ BROTLI_INTERNAL void BrotliBuildCodeLengthsHuffmanTable(HuffmanCode* root_table, const uint8_t* const code_lengths, uint16_t* count); - + /* Builds Huffman lookup table assuming code lengths are in symbol order. Returns size of resulting table. */ BROTLI_INTERNAL uint32_t BrotliBuildHuffmanTable(HuffmanCode* root_table, int root_bits, const uint16_t* const symbol_lists, uint16_t* count_arg); - + /* Builds a simple Huffman table. The |num_symbols| parameter is to be interpreted as follows: 0 means 1 symbol, 1 means 2 symbols, 2 means 3 symbols, 3 means 4 symbols with lengths [2, 2, 2, 2], 4 means 4 symbols with lengths [1, 2, 3, 3]. */ BROTLI_INTERNAL uint32_t BrotliBuildSimpleHuffmanTable(HuffmanCode* table, int root_bits, uint16_t* symbols, uint32_t num_symbols); - -/* Contains a collection of Huffman trees with the same alphabet size. */ + +/* Contains a collection of Huffman trees with the same alphabet size. */ /* max_symbol is needed due to simple codes since log2(alphabet_size) could be greater than log2(max_symbol). */ -typedef struct { - HuffmanCode** htrees; - HuffmanCode* codes; +typedef struct { + HuffmanCode** htrees; + HuffmanCode* codes; uint16_t alphabet_size; uint16_t max_symbol; uint16_t num_htrees; -} HuffmanTreeGroup; - -#if defined(__cplusplus) || defined(c_plusplus) +} HuffmanTreeGroup; + +#if defined(__cplusplus) || defined(c_plusplus) } /* extern "C" */ -#endif - -#endif /* BROTLI_DEC_HUFFMAN_H_ */ +#endif + +#endif /* BROTLI_DEC_HUFFMAN_H_ */ |