]>
Commit | Line | Data |
---|---|---|
30fdf114 | 1 | /* LzmaEnc.h -- LZMA Encoder\r |
5ec5a236 | 2 | 2017-07-27 : Igor Pavlov : Public domain */\r |
30fdf114 | 3 | \r |
c4ab09ef LG |
4 | #ifndef __LZMA_ENC_H\r |
5 | #define __LZMA_ENC_H\r | |
30fdf114 | 6 | \r |
c4ab09ef LG |
7 | #include "7zTypes.h"\r |
8 | \r | |
9 | EXTERN_C_BEGIN\r | |
30fdf114 LG |
10 | \r |
11 | #define LZMA_PROPS_SIZE 5\r | |
12 | \r | |
13 | typedef struct _CLzmaEncProps\r | |
14 | {\r | |
5ec5a236 | 15 | int level; /* 0 <= level <= 9 */\r |
30fdf114 | 16 | UInt32 dictSize; /* (1 << 12) <= dictSize <= (1 << 27) for 32-bit version\r |
5ec5a236 LG |
17 | (1 << 12) <= dictSize <= (3 << 29) for 64-bit version\r |
18 | default = (1 << 24) */\r | |
30fdf114 LG |
19 | int lc; /* 0 <= lc <= 8, default = 3 */\r |
20 | int lp; /* 0 <= lp <= 4, default = 0 */\r | |
21 | int pb; /* 0 <= pb <= 4, default = 2 */\r | |
22 | int algo; /* 0 - fast, 1 - normal, default = 1 */\r | |
23 | int fb; /* 5 <= fb <= 273, default = 32 */\r | |
24 | int btMode; /* 0 - hashChain Mode, 1 - binTree mode - normal, default = 1 */\r | |
25 | int numHashBytes; /* 2, 3 or 4, default = 4 */\r | |
5ec5a236 | 26 | UInt32 mc; /* 1 <= mc <= (1 << 30), default = 32 */\r |
30fdf114 LG |
27 | unsigned writeEndMark; /* 0 - do not write EOPM, 1 - write EOPM, default = 0 */\r |
28 | int numThreads; /* 1 or 2, default = 2 */\r | |
5ec5a236 LG |
29 | \r |
30 | UInt64 reduceSize; /* estimated size of data that will be compressed. default = (UInt64)(Int64)-1.\r | |
31 | Encoder uses this value to reduce dictionary size */\r | |
30fdf114 LG |
32 | } CLzmaEncProps;\r |
33 | \r | |
34 | void LzmaEncProps_Init(CLzmaEncProps *p);\r | |
35 | void LzmaEncProps_Normalize(CLzmaEncProps *p);\r | |
36 | UInt32 LzmaEncProps_GetDictSize(const CLzmaEncProps *props2);\r | |
37 | \r | |
38 | \r | |
39 | /* ---------- CLzmaEncHandle Interface ---------- */\r | |
40 | \r | |
5ec5a236 LG |
41 | /* LzmaEnc* functions can return the following exit codes:\r |
42 | SRes:\r | |
30fdf114 LG |
43 | SZ_OK - OK\r |
44 | SZ_ERROR_MEM - Memory allocation error\r | |
45 | SZ_ERROR_PARAM - Incorrect paramater in props\r | |
5ec5a236 LG |
46 | SZ_ERROR_WRITE - ISeqOutStream write callback error\r |
47 | SZ_ERROR_OUTPUT_EOF - output buffer overflow - version with (Byte *) output\r | |
30fdf114 | 48 | SZ_ERROR_PROGRESS - some break from progress callback\r |
5ec5a236 | 49 | SZ_ERROR_THREAD - error in multithreading functions (only for Mt version)\r |
30fdf114 LG |
50 | */\r |
51 | \r | |
52 | typedef void * CLzmaEncHandle;\r | |
53 | \r | |
5ec5a236 LG |
54 | CLzmaEncHandle LzmaEnc_Create(ISzAllocPtr alloc);\r |
55 | void LzmaEnc_Destroy(CLzmaEncHandle p, ISzAllocPtr alloc, ISzAllocPtr allocBig);\r | |
56 | \r | |
30fdf114 | 57 | SRes LzmaEnc_SetProps(CLzmaEncHandle p, const CLzmaEncProps *props);\r |
5ec5a236 | 58 | void LzmaEnc_SetDataSize(CLzmaEncHandle p, UInt64 expectedDataSiize);\r |
30fdf114 | 59 | SRes LzmaEnc_WriteProperties(CLzmaEncHandle p, Byte *properties, SizeT *size);\r |
5ec5a236 LG |
60 | unsigned LzmaEnc_IsWriteEndMark(CLzmaEncHandle p);\r |
61 | \r | |
30fdf114 | 62 | SRes LzmaEnc_Encode(CLzmaEncHandle p, ISeqOutStream *outStream, ISeqInStream *inStream,\r |
5ec5a236 | 63 | ICompressProgress *progress, ISzAllocPtr alloc, ISzAllocPtr allocBig);\r |
30fdf114 | 64 | SRes LzmaEnc_MemEncode(CLzmaEncHandle p, Byte *dest, SizeT *destLen, const Byte *src, SizeT srcLen,\r |
5ec5a236 | 65 | int writeEndMark, ICompressProgress *progress, ISzAllocPtr alloc, ISzAllocPtr allocBig);\r |
30fdf114 | 66 | \r |
30fdf114 | 67 | \r |
5ec5a236 | 68 | /* ---------- One Call Interface ---------- */\r |
30fdf114 LG |
69 | \r |
70 | SRes LzmaEncode(Byte *dest, SizeT *destLen, const Byte *src, SizeT srcLen,\r | |
71 | const CLzmaEncProps *props, Byte *propsEncoded, SizeT *propsSize, int writeEndMark,\r | |
5ec5a236 | 72 | ICompressProgress *progress, ISzAllocPtr alloc, ISzAllocPtr allocBig);\r |
30fdf114 | 73 | \r |
c4ab09ef LG |
74 | EXTERN_C_END\r |
75 | \r | |
30fdf114 | 76 | #endif\r |