rlm@1
|
1 /* LzmaEnc.h -- LZMA Encoder
|
rlm@1
|
2 2008-10-04 : Igor Pavlov : Public domain */
|
rlm@1
|
3
|
rlm@1
|
4 #ifndef __LZMAENC_H
|
rlm@1
|
5 #define __LZMAENC_H
|
rlm@1
|
6
|
rlm@1
|
7 #include "Types.h"
|
rlm@1
|
8
|
rlm@1
|
9 #define LZMA_PROPS_SIZE 5
|
rlm@1
|
10
|
rlm@1
|
11 typedef struct _CLzmaEncProps
|
rlm@1
|
12 {
|
rlm@1
|
13 int level; /* 0 <= level <= 9 */
|
rlm@1
|
14 UInt32 dictSize; /* (1 << 12) <= dictSize <= (1 << 27) for 32-bit version
|
rlm@1
|
15 (1 << 12) <= dictSize <= (1 << 30) for 64-bit version
|
rlm@1
|
16 default = (1 << 24) */
|
rlm@1
|
17 int lc; /* 0 <= lc <= 8, default = 3 */
|
rlm@1
|
18 int lp; /* 0 <= lp <= 4, default = 0 */
|
rlm@1
|
19 int pb; /* 0 <= pb <= 4, default = 2 */
|
rlm@1
|
20 int algo; /* 0 - fast, 1 - normal, default = 1 */
|
rlm@1
|
21 int fb; /* 5 <= fb <= 273, default = 32 */
|
rlm@1
|
22 int btMode; /* 0 - hashChain Mode, 1 - binTree mode - normal, default = 1 */
|
rlm@1
|
23 int numHashBytes; /* 2, 3 or 4, default = 4 */
|
rlm@1
|
24 UInt32 mc; /* 1 <= mc <= (1 << 30), default = 32 */
|
rlm@1
|
25 unsigned writeEndMark; /* 0 - do not write EOPM, 1 - write EOPM, default = 0 */
|
rlm@1
|
26 int numThreads; /* 1 or 2, default = 2 */
|
rlm@1
|
27 } CLzmaEncProps;
|
rlm@1
|
28
|
rlm@1
|
29 void LzmaEncProps_Init(CLzmaEncProps *p);
|
rlm@1
|
30 void LzmaEncProps_Normalize(CLzmaEncProps *p);
|
rlm@1
|
31 UInt32 LzmaEncProps_GetDictSize(const CLzmaEncProps *props2);
|
rlm@1
|
32
|
rlm@1
|
33
|
rlm@1
|
34 /* ---------- CLzmaEncHandle Interface ---------- */
|
rlm@1
|
35
|
rlm@1
|
36 /* LzmaEnc_* functions can return the following exit codes:
|
rlm@1
|
37 Returns:
|
rlm@1
|
38 SZ_OK - OK
|
rlm@1
|
39 SZ_ERROR_MEM - Memory allocation error
|
rlm@1
|
40 SZ_ERROR_PARAM - Incorrect paramater in props
|
rlm@1
|
41 SZ_ERROR_WRITE - Write callback error.
|
rlm@1
|
42 SZ_ERROR_PROGRESS - some break from progress callback
|
rlm@1
|
43 SZ_ERROR_THREAD - errors in multithreading functions (only for Mt version)
|
rlm@1
|
44 */
|
rlm@1
|
45
|
rlm@1
|
46 typedef void * CLzmaEncHandle;
|
rlm@1
|
47
|
rlm@1
|
48 CLzmaEncHandle LzmaEnc_Create(ISzAlloc *alloc);
|
rlm@1
|
49 void LzmaEnc_Destroy(CLzmaEncHandle p, ISzAlloc *alloc, ISzAlloc *allocBig);
|
rlm@1
|
50 SRes LzmaEnc_SetProps(CLzmaEncHandle p, const CLzmaEncProps *props);
|
rlm@1
|
51 SRes LzmaEnc_WriteProperties(CLzmaEncHandle p, Byte *properties, SizeT *size);
|
rlm@1
|
52 SRes LzmaEnc_Encode(CLzmaEncHandle p, ISeqOutStream *outStream, ISeqInStream *inStream,
|
rlm@1
|
53 ICompressProgress *progress, ISzAlloc *alloc, ISzAlloc *allocBig);
|
rlm@1
|
54 SRes LzmaEnc_MemEncode(CLzmaEncHandle p, Byte *dest, SizeT *destLen, const Byte *src, SizeT srcLen,
|
rlm@1
|
55 int writeEndMark, ICompressProgress *progress, ISzAlloc *alloc, ISzAlloc *allocBig);
|
rlm@1
|
56
|
rlm@1
|
57 /* ---------- One Call Interface ---------- */
|
rlm@1
|
58
|
rlm@1
|
59 /* LzmaEncode
|
rlm@1
|
60 Return code:
|
rlm@1
|
61 SZ_OK - OK
|
rlm@1
|
62 SZ_ERROR_MEM - Memory allocation error
|
rlm@1
|
63 SZ_ERROR_PARAM - Incorrect paramater
|
rlm@1
|
64 SZ_ERROR_OUTPUT_EOF - output buffer overflow
|
rlm@1
|
65 SZ_ERROR_THREAD - errors in multithreading functions (only for Mt version)
|
rlm@1
|
66 */
|
rlm@1
|
67
|
rlm@1
|
68 SRes LzmaEncode(Byte *dest, SizeT *destLen, const Byte *src, SizeT srcLen,
|
rlm@1
|
69 const CLzmaEncProps *props, Byte *propsEncoded, SizeT *propsSize, int writeEndMark,
|
rlm@1
|
70 ICompressProgress *progress, ISzAlloc *alloc, ISzAlloc *allocBig);
|
rlm@1
|
71
|
rlm@1
|
72 #endif
|