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