diff options
author | Igor Pavlov <87184205+ip7z@users.noreply.github.com> | 2021-12-27 00:00:00 +0000 |
---|---|---|
committer | Igor Pavlov <87184205+ip7z@users.noreply.github.com> | 2022-03-18 15:35:13 +0500 |
commit | f19f813537c7aea1c20749c914e756b54a9c3cf5 (patch) | |
tree | 816ba62ca7c0fa19f2eb46d9e9d6f7dd7c3a744d /C/LzmaEnc.h | |
parent | 98e06a519b63b81986abe76d28887f6984a7732b (diff) | |
download | 7zip-21.07.tar.gz 7zip-21.07.tar.bz2 7zip-21.07.zip |
'21.07'21.07
Diffstat (limited to 'C/LzmaEnc.h')
-rw-r--r-- | C/LzmaEnc.h | 78 |
1 files changed, 78 insertions, 0 deletions
diff --git a/C/LzmaEnc.h b/C/LzmaEnc.h new file mode 100644 index 0000000..bc2ed50 --- /dev/null +++ b/C/LzmaEnc.h | |||
@@ -0,0 +1,78 @@ | |||
1 | /* LzmaEnc.h -- LZMA Encoder | ||
2 | 2019-10-30 : Igor Pavlov : Public domain */ | ||
3 | |||
4 | #ifndef __LZMA_ENC_H | ||
5 | #define __LZMA_ENC_H | ||
6 | |||
7 | #include "7zTypes.h" | ||
8 | |||
9 | EXTERN_C_BEGIN | ||
10 | |||
11 | #define LZMA_PROPS_SIZE 5 | ||
12 | |||
13 | typedef struct _CLzmaEncProps | ||
14 | { | ||
15 | int level; /* 0 <= level <= 9 */ | ||
16 | UInt32 dictSize; /* (1 << 12) <= dictSize <= (1 << 27) for 32-bit version | ||
17 | (1 << 12) <= dictSize <= (3 << 29) for 64-bit version | ||
18 | default = (1 << 24) */ | ||
19 | int lc; /* 0 <= lc <= 8, default = 3 */ | ||
20 | int lp; /* 0 <= lp <= 4, default = 0 */ | ||
21 | int pb; /* 0 <= pb <= 4, default = 2 */ | ||
22 | int algo; /* 0 - fast, 1 - normal, default = 1 */ | ||
23 | int fb; /* 5 <= fb <= 273, default = 32 */ | ||
24 | int btMode; /* 0 - hashChain Mode, 1 - binTree mode - normal, default = 1 */ | ||
25 | int numHashBytes; /* 2, 3 or 4, default = 4 */ | ||
26 | UInt32 mc; /* 1 <= mc <= (1 << 30), default = 32 */ | ||
27 | unsigned writeEndMark; /* 0 - do not write EOPM, 1 - write EOPM, default = 0 */ | ||
28 | int numThreads; /* 1 or 2, default = 2 */ | ||
29 | |||
30 | UInt64 reduceSize; /* estimated size of data that will be compressed. default = (UInt64)(Int64)-1. | ||
31 | Encoder uses this value to reduce dictionary size */ | ||
32 | |||
33 | UInt64 affinity; | ||
34 | } CLzmaEncProps; | ||
35 | |||
36 | void LzmaEncProps_Init(CLzmaEncProps *p); | ||
37 | void LzmaEncProps_Normalize(CLzmaEncProps *p); | ||
38 | UInt32 LzmaEncProps_GetDictSize(const CLzmaEncProps *props2); | ||
39 | |||
40 | |||
41 | /* ---------- CLzmaEncHandle Interface ---------- */ | ||
42 | |||
43 | /* LzmaEnc* functions can return the following exit codes: | ||
44 | SRes: | ||
45 | SZ_OK - OK | ||
46 | SZ_ERROR_MEM - Memory allocation error | ||
47 | SZ_ERROR_PARAM - Incorrect paramater in props | ||
48 | SZ_ERROR_WRITE - ISeqOutStream write callback error | ||
49 | SZ_ERROR_OUTPUT_EOF - output buffer overflow - version with (Byte *) output | ||
50 | SZ_ERROR_PROGRESS - some break from progress callback | ||
51 | SZ_ERROR_THREAD - error in multithreading functions (only for Mt version) | ||
52 | */ | ||
53 | |||
54 | typedef void * CLzmaEncHandle; | ||
55 | |||
56 | CLzmaEncHandle LzmaEnc_Create(ISzAllocPtr alloc); | ||
57 | void LzmaEnc_Destroy(CLzmaEncHandle p, ISzAllocPtr alloc, ISzAllocPtr allocBig); | ||
58 | |||
59 | SRes LzmaEnc_SetProps(CLzmaEncHandle p, const CLzmaEncProps *props); | ||
60 | void LzmaEnc_SetDataSize(CLzmaEncHandle p, UInt64 expectedDataSiize); | ||
61 | SRes LzmaEnc_WriteProperties(CLzmaEncHandle p, Byte *properties, SizeT *size); | ||
62 | unsigned LzmaEnc_IsWriteEndMark(CLzmaEncHandle p); | ||
63 | |||
64 | SRes LzmaEnc_Encode(CLzmaEncHandle p, ISeqOutStream *outStream, ISeqInStream *inStream, | ||
65 | ICompressProgress *progress, ISzAllocPtr alloc, ISzAllocPtr allocBig); | ||
66 | SRes LzmaEnc_MemEncode(CLzmaEncHandle p, Byte *dest, SizeT *destLen, const Byte *src, SizeT srcLen, | ||
67 | int writeEndMark, ICompressProgress *progress, ISzAllocPtr alloc, ISzAllocPtr allocBig); | ||
68 | |||
69 | |||
70 | /* ---------- One Call Interface ---------- */ | ||
71 | |||
72 | SRes LzmaEncode(Byte *dest, SizeT *destLen, const Byte *src, SizeT srcLen, | ||
73 | const CLzmaEncProps *props, Byte *propsEncoded, SizeT *propsSize, int writeEndMark, | ||
74 | ICompressProgress *progress, ISzAllocPtr alloc, ISzAllocPtr allocBig); | ||
75 | |||
76 | EXTERN_C_END | ||
77 | |||
78 | #endif | ||