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