]> git.proxmox.com Git - mirror_edk2.git/blobdiff - BaseTools/Source/C/BrotliCompress/common/constants.h
BaseTools: Copy Brotli algorithm 3rd party source code for tool
[mirror_edk2.git] / BaseTools / Source / C / BrotliCompress / common / constants.h
diff --git a/BaseTools/Source/C/BrotliCompress/common/constants.h b/BaseTools/Source/C/BrotliCompress/common/constants.h
new file mode 100644 (file)
index 0000000..f82a89b
--- /dev/null
@@ -0,0 +1,47 @@
+/* Copyright 2016 Google Inc. All Rights Reserved.\r
+\r
+   Distributed under MIT license.\r
+   See file LICENSE for detail or copy at https://opensource.org/licenses/MIT\r
+*/\r
+\r
+#ifndef BROTLI_COMMON_CONSTANTS_H_\r
+#define BROTLI_COMMON_CONSTANTS_H_\r
+\r
+/* Specification: 7.3. Encoding of the context map */\r
+#define BROTLI_CONTEXT_MAP_MAX_RLE 16\r
+\r
+/* Specification: 2. Compressed representation overview */\r
+#define BROTLI_MAX_NUMBER_OF_BLOCK_TYPES 256\r
+\r
+/* Specification: 3.3. Alphabet sizes: insert-and-copy length */\r
+#define BROTLI_NUM_LITERAL_SYMBOLS 256\r
+#define BROTLI_NUM_COMMAND_SYMBOLS 704\r
+#define BROTLI_NUM_BLOCK_LEN_SYMBOLS 26\r
+#define BROTLI_MAX_CONTEXT_MAP_SYMBOLS (BROTLI_MAX_NUMBER_OF_BLOCK_TYPES + \\r
+                                        BROTLI_CONTEXT_MAP_MAX_RLE)\r
+#define BROTLI_MAX_BLOCK_TYPE_SYMBOLS (BROTLI_MAX_NUMBER_OF_BLOCK_TYPES + 2)\r
+\r
+/* Specification: 3.5. Complex prefix codes */\r
+#define BROTLI_REPEAT_PREVIOUS_CODE_LENGTH 16\r
+#define BROTLI_REPEAT_ZERO_CODE_LENGTH 17\r
+#define BROTLI_CODE_LENGTH_CODES (BROTLI_REPEAT_ZERO_CODE_LENGTH + 1)\r
+/* "code length of 8 is repeated" */\r
+#define BROTLI_INITIAL_REPEATED_CODE_LENGTH 8\r
+\r
+/* Specification: 4. Encoding of distances */\r
+#define BROTLI_NUM_DISTANCE_SHORT_CODES 16\r
+#define BROTLI_MAX_NPOSTFIX 3\r
+#define BROTLI_MAX_NDIRECT 120\r
+/* BROTLI_NUM_DISTANCE_SYMBOLS == 520 */\r
+#define BROTLI_NUM_DISTANCE_SYMBOLS (BROTLI_NUM_DISTANCE_SHORT_CODES + \\r
+                                     BROTLI_MAX_NDIRECT +              \\r
+                                     (24 << (BROTLI_MAX_NPOSTFIX + 1)))\r
+\r
+/* 7.1. Context modes and context ID lookup for literals */\r
+/* "context IDs for literals are in the range of 0..63" */\r
+#define BROTLI_LITERAL_CONTEXT_BITS 6\r
+\r
+/* 7.2. Context ID for distances */\r
+#define BROTLI_DISTANCE_CONTEXT_BITS 2\r
+\r
+#endif  /* BROTLI_COMMON_CONSTANTS_H_ */\r