]> wimlib.net Git - wimlib/blob - include/wimlib/lzms.h
a18c526e5dea05f25c2cf4c825de27c4d47b2d27
[wimlib] / include / wimlib / lzms.h
1 #ifndef _WIMLIB_LZMS_H
2 #define _WIMLIB_LZMS_H
3
4 /* Constants for the LZMS data compression format.  See the comments in
5  * lzms-decompress.c for more information about this format.  */
6
7 //#define ENABLE_LZMS_DEBUG
8 #ifdef ENABLE_LZMS_DEBUG
9 #       define LZMS_DEBUG DEBUG
10 #       define LZMS_ASSERT wimlib_assert
11 #else
12 #       define LZMS_DEBUG(format, ...)
13 #       define LZMS_ASSERT(...)
14 #endif
15
16 #define LZMS_NUM_RECENT_OFFSETS                 3
17
18 #define LZMS_PROBABILITY_BITS                   6
19 #define LZMS_PROBABILITY_MAX                    (1U << LZMS_PROBABILITY_BITS)
20 #define LZMS_INITIAL_PROBABILITY                48
21 #define LZMS_INITIAL_RECENT_BITS                0x0000000055555555ULL
22
23 #define LZMS_NUM_MAIN_STATES                    16
24 #define LZMS_NUM_MATCH_STATES                   32
25 #define LZMS_NUM_LZ_MATCH_STATES                64
26 #define LZMS_NUM_LZ_REPEAT_MATCH_STATES         64
27 #define LZMS_NUM_DELTA_MATCH_STATES             64
28 #define LZMS_NUM_DELTA_REPEAT_MATCH_STATES      64
29 #define LZMS_MAX_NUM_STATES                     64
30
31 #define LZMS_NUM_LITERAL_SYMS                   256
32 #define LZMS_NUM_LEN_SYMS                       54
33 #define LZMS_NUM_DELTA_POWER_SYMS               8
34 #define LZMS_MAX_NUM_OFFSET_SYMS                799
35 #define LZMS_MAX_NUM_SYMS                       799
36
37 #define LZMS_MAX_CODEWORD_LEN                   15
38
39 #define LZMS_LITERAL_CODE_REBUILD_FREQ          1024
40 #define LZMS_LZ_OFFSET_CODE_REBUILD_FREQ        1024
41 #define LZMS_LENGTH_CODE_REBUILD_FREQ           512
42 #define LZMS_DELTA_OFFSET_CODE_REBUILD_FREQ     1024
43 #define LZMS_DELTA_POWER_CODE_REBUILD_FREQ      512
44
45 #define LZMS_X86_MAX_GOOD_TARGET_OFFSET         65535
46 #define LZMS_X86_MAX_TRANSLATION_OFFSET         1023
47
48 #include <wimlib/types.h>
49
50 extern void
51 lzms_x86_filter(u8 data[], s32 size, s32 last_target_usages[], bool undo);
52
53 #endif /* _WIMLIB_LZMS_H  */