]> git.proxmox.com Git - mirror_edk2.git/blobdiff - MdeModulePkg/Library/BrotliCustomDecompressLib/dec/huffman.h
MdeModulePkg: Update Brotli DecompressLib to the latest v1.0.6
[mirror_edk2.git] / MdeModulePkg / Library / BrotliCustomDecompressLib / dec / huffman.h
index 268008918611fd3aa85c87d129f5d0342738f663..5fc8c0224edc178a8f21f730bc77beb8c76fce84 100644 (file)
@@ -9,9 +9,8 @@
 #ifndef BROTLI_DEC_HUFFMAN_H_\r
 #define BROTLI_DEC_HUFFMAN_H_\r
 \r
-#include "../common/types.h"\r
-#include "./port.h"\r
-#include <BrotliDecompressLibInternal.h>\r
+#include "../common/platform.h"\r
+#include <brotli/types.h>\r
 \r
 #if defined(__cplusplus) || defined(c_plusplus)\r
 extern "C" {\r
@@ -20,10 +19,11 @@ extern "C" {
 #define BROTLI_HUFFMAN_MAX_CODE_LENGTH 15\r
 \r
 /* Maximum possible Huffman table size for an alphabet size of (index * 32),\r
* max code length 15 and root table bits 8. */\r
  max code length 15 and root table bits 8. */\r
 static const uint16_t kMaxHuffmanTableSize[] = {\r
   256, 402, 436, 468, 500, 534, 566, 598, 630, 662, 694, 726, 758, 790, 822,\r
-  854, 886, 920, 952, 984, 1016, 1048, 1080};\r
+  854, 886, 920, 952, 984, 1016, 1048, 1080, 1112, 1144, 1176, 1208, 1240, 1272,\r
+  1304, 1336, 1368, 1400, 1432, 1464, 1496, 1528};\r
 /* BROTLI_NUM_BLOCK_LEN_SYMBOLS == 26 */\r
 #define BROTLI_HUFFMAN_MAX_SIZE_26 396\r
 /* BROTLI_MAX_BLOCK_TYPE_SYMBOLS == 258 */\r
@@ -42,23 +42,26 @@ typedef struct {
 BROTLI_INTERNAL void BrotliBuildCodeLengthsHuffmanTable(HuffmanCode* root_table,\r
     const uint8_t* const code_lengths, uint16_t* count);\r
 \r
-/* Builds Huffman lookup table assuming code lengths are in symbol order. */\r
-/* Returns size of resulting table. */\r
+/* Builds Huffman lookup table assuming code lengths are in symbol order.\r
+   Returns size of resulting table. */\r
 BROTLI_INTERNAL uint32_t BrotliBuildHuffmanTable(HuffmanCode* root_table,\r
     int root_bits, const uint16_t* const symbol_lists, uint16_t* count_arg);\r
 \r
-/* Builds a simple Huffman table. The num_symbols parameter is to be */\r
-/* interpreted as follows: 0 means 1 symbol, 1 means 2 symbols, 2 means 3 */\r
-/* symbols, 3 means 4 symbols with lengths 2,2,2,2, 4 means 4 symbols with */\r
-/* lengths 1,2,3,3. */\r
+/* Builds a simple Huffman table. The |num_symbols| parameter is to be\r
+   interpreted as follows: 0 means 1 symbol, 1 means 2 symbols,\r
+   2 means 3 symbols, 3 means 4 symbols with lengths [2, 2, 2, 2],\r
+   4 means 4 symbols with lengths [1, 2, 3, 3]. */\r
 BROTLI_INTERNAL uint32_t BrotliBuildSimpleHuffmanTable(HuffmanCode* table,\r
     int root_bits, uint16_t* symbols, uint32_t num_symbols);\r
 \r
 /* Contains a collection of Huffman trees with the same alphabet size. */\r
+/* max_symbol is needed due to simple codes since log2(alphabet_size) could be\r
+   greater than log2(max_symbol). */\r
 typedef struct {\r
   HuffmanCode** htrees;\r
   HuffmanCode* codes;\r
   uint16_t alphabet_size;\r
+  uint16_t max_symbol;\r
   uint16_t num_htrees;\r
 } HuffmanTreeGroup;\r
 \r