| 1 |
/* |
| 2 |
* deflate_constants.h - constants for the DEFLATE compression format |
| 3 |
*/ |
| 4 |
|
| 5 |
#ifndef LIB_DEFLATE_CONSTANTS_H |
| 6 |
#define LIB_DEFLATE_CONSTANTS_H |
| 7 |
|
| 8 |
/* Valid block types */ |
| 9 |
#define DEFLATE_BLOCKTYPE_UNCOMPRESSED 0 |
| 10 |
#define DEFLATE_BLOCKTYPE_STATIC_HUFFMAN 1 |
| 11 |
#define DEFLATE_BLOCKTYPE_DYNAMIC_HUFFMAN 2 |
| 12 |
|
| 13 |
/* Minimum and maximum supported match lengths (in bytes) */ |
| 14 |
#define DEFLATE_MIN_MATCH_LEN 3 |
| 15 |
#define DEFLATE_MAX_MATCH_LEN 258 |
| 16 |
|
| 17 |
/* Maximum supported match offset (in bytes) */ |
| 18 |
#define DEFLATE_MAX_MATCH_OFFSET 32768 |
| 19 |
|
| 20 |
/* log2 of DEFLATE_MAX_MATCH_OFFSET */ |
| 21 |
#define DEFLATE_WINDOW_ORDER 15 |
| 22 |
|
| 23 |
/* Number of symbols in each Huffman code. Note: for the literal/length |
| 24 |
* and offset codes, these are actually the maximum values; a given block |
| 25 |
* might use fewer symbols. */ |
| 26 |
#define DEFLATE_NUM_PRECODE_SYMS 19 |
| 27 |
#define DEFLATE_NUM_LITLEN_SYMS 288 |
| 28 |
#define DEFLATE_NUM_OFFSET_SYMS 32 |
| 29 |
|
| 30 |
/* The maximum number of symbols across all codes */ |
| 31 |
#define DEFLATE_MAX_NUM_SYMS 288 |
| 32 |
|
| 33 |
/* Division of symbols in the literal/length code */ |
| 34 |
#define DEFLATE_NUM_LITERALS 256 |
| 35 |
#define DEFLATE_END_OF_BLOCK 256 |
| 36 |
#define DEFLATE_FIRST_LEN_SYM 257 |
| 37 |
|
| 38 |
/* Maximum codeword length, in bits, within each Huffman code */ |
| 39 |
#define DEFLATE_MAX_PRE_CODEWORD_LEN 7 |
| 40 |
#define DEFLATE_MAX_LITLEN_CODEWORD_LEN 15 |
| 41 |
#define DEFLATE_MAX_OFFSET_CODEWORD_LEN 15 |
| 42 |
|
| 43 |
/* The maximum codeword length across all codes */ |
| 44 |
#define DEFLATE_MAX_CODEWORD_LEN 15 |
| 45 |
|
| 46 |
/* Maximum possible overrun when decoding codeword lengths */ |
| 47 |
#define DEFLATE_MAX_LENS_OVERRUN 137 |
| 48 |
|
| 49 |
/* |
| 50 |
* Maximum number of extra bits that may be required to represent a match |
| 51 |
* length or offset. |
| 52 |
*/ |
| 53 |
#define DEFLATE_MAX_EXTRA_LENGTH_BITS 5 |
| 54 |
#define DEFLATE_MAX_EXTRA_OFFSET_BITS 13 |
| 55 |
|
| 56 |
#endif /* LIB_DEFLATE_CONSTANTS_H */ |