attempt to fix build
[pcsx_rearmed.git] / deps / libchdr / deps / lzma-22.01 / include / LzmaLib.h
1 /* LzmaLib.h -- LZMA library interface\r
2 2021-04-03 : Igor Pavlov : Public domain */\r
3 \r
4 #ifndef __LZMA_LIB_H\r
5 #define __LZMA_LIB_H\r
6 \r
7 #include "7zTypes.h"\r
8 \r
9 EXTERN_C_BEGIN\r
10 \r
11 #define MY_STDAPI int MY_STD_CALL\r
12 \r
13 #define LZMA_PROPS_SIZE 5\r
14 \r
15 /*\r
16 RAM requirements for LZMA:\r
17   for compression:   (dictSize * 11.5 + 6 MB) + state_size\r
18   for decompression: dictSize + state_size\r
19     state_size = (4 + (1.5 << (lc + lp))) KB\r
20     by default (lc=3, lp=0), state_size = 16 KB.\r
21 \r
22 LZMA properties (5 bytes) format\r
23     Offset Size  Description\r
24       0     1    lc, lp and pb in encoded form.\r
25       1     4    dictSize (little endian).\r
26 */\r
27 \r
28 /*\r
29 LzmaCompress\r
30 ------------\r
31 \r
32 outPropsSize -\r
33      In:  the pointer to the size of outProps buffer; *outPropsSize = LZMA_PROPS_SIZE = 5.\r
34      Out: the pointer to the size of written properties in outProps buffer; *outPropsSize = LZMA_PROPS_SIZE = 5.\r
35 \r
36   LZMA Encoder will use defult values for any parameter, if it is\r
37   -1  for any from: level, loc, lp, pb, fb, numThreads\r
38    0  for dictSize\r
39   \r
40 level - compression level: 0 <= level <= 9;\r
41 \r
42   level dictSize algo  fb\r
43     0:    64 KB   0    32\r
44     1:   256 KB   0    32\r
45     2:     1 MB   0    32\r
46     3:     4 MB   0    32\r
47     4:    16 MB   0    32\r
48     5:    16 MB   1    32\r
49     6:    32 MB   1    32\r
50     7:    32 MB   1    64\r
51     8:    64 MB   1    64\r
52     9:    64 MB   1    64\r
53  \r
54   The default value for "level" is 5.\r
55 \r
56   algo = 0 means fast method\r
57   algo = 1 means normal method\r
58 \r
59 dictSize - The dictionary size in bytes. The maximum value is\r
60         128 MB = (1 << 27) bytes for 32-bit version\r
61           1 GB = (1 << 30) bytes for 64-bit version\r
62      The default value is 16 MB = (1 << 24) bytes.\r
63      It's recommended to use the dictionary that is larger than 4 KB and\r
64      that can be calculated as (1 << N) or (3 << N) sizes.\r
65 \r
66 lc - The number of literal context bits (high bits of previous literal).\r
67      It can be in the range from 0 to 8. The default value is 3.\r
68      Sometimes lc=4 gives the gain for big files.\r
69 \r
70 lp - The number of literal pos bits (low bits of current position for literals).\r
71      It can be in the range from 0 to 4. The default value is 0.\r
72      The lp switch is intended for periodical data when the period is equal to 2^lp.\r
73      For example, for 32-bit (4 bytes) periodical data you can use lp=2. Often it's\r
74      better to set lc=0, if you change lp switch.\r
75 \r
76 pb - The number of pos bits (low bits of current position).\r
77      It can be in the range from 0 to 4. The default value is 2.\r
78      The pb switch is intended for periodical data when the period is equal 2^pb.\r
79 \r
80 fb - Word size (the number of fast bytes).\r
81      It can be in the range from 5 to 273. The default value is 32.\r
82      Usually, a big number gives a little bit better compression ratio and\r
83      slower compression process.\r
84 \r
85 numThreads - The number of thereads. 1 or 2. The default value is 2.\r
86      Fast mode (algo = 0) can use only 1 thread.\r
87 \r
88 In:\r
89   dest     - output data buffer\r
90   destLen  - output data buffer size\r
91   src      - input data\r
92   srcLen   - input data size\r
93 Out:\r
94   destLen  - processed output size\r
95 Returns:\r
96   SZ_OK               - OK\r
97   SZ_ERROR_MEM        - Memory allocation error\r
98   SZ_ERROR_PARAM      - Incorrect paramater\r
99   SZ_ERROR_OUTPUT_EOF - output buffer overflow\r
100   SZ_ERROR_THREAD     - errors in multithreading functions (only for Mt version)\r
101 */\r
102 \r
103 MY_STDAPI LzmaCompress(unsigned char *dest, size_t *destLen, const unsigned char *src, size_t srcLen,\r
104   unsigned char *outProps, size_t *outPropsSize, /* *outPropsSize must be = 5 */\r
105   int level,      /* 0 <= level <= 9, default = 5 */\r
106   unsigned dictSize,  /* default = (1 << 24) */\r
107   int lc,        /* 0 <= lc <= 8, default = 3  */\r
108   int lp,        /* 0 <= lp <= 4, default = 0  */\r
109   int pb,        /* 0 <= pb <= 4, default = 2  */\r
110   int fb,        /* 5 <= fb <= 273, default = 32 */\r
111   int numThreads /* 1 or 2, default = 2 */\r
112   );\r
113 \r
114 /*\r
115 LzmaUncompress\r
116 --------------\r
117 In:\r
118   dest     - output data buffer\r
119   destLen  - output data buffer size\r
120   src      - input data\r
121   srcLen   - input data size\r
122 Out:\r
123   destLen  - processed output size\r
124   srcLen   - processed input size\r
125 Returns:\r
126   SZ_OK                - OK\r
127   SZ_ERROR_DATA        - Data error\r
128   SZ_ERROR_MEM         - Memory allocation arror\r
129   SZ_ERROR_UNSUPPORTED - Unsupported properties\r
130   SZ_ERROR_INPUT_EOF   - it needs more bytes in input buffer (src)\r
131 */\r
132 \r
133 MY_STDAPI LzmaUncompress(unsigned char *dest, size_t *destLen, const unsigned char *src, SizeT *srcLen,\r
134   const unsigned char *props, size_t propsSize);\r
135 \r
136 EXTERN_C_END\r
137 \r
138 #endif\r