goat3d

view libs/openctm/liblzma/LzmaLib.h @ 62:55571a390144

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