ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/MitCommon/OptIO/src/LzmaEnc.h
Revision: 1.1
Committed: Tue Feb 24 20:13:57 2009 UTC (16 years, 2 months ago) by loizides
Content type: text/plain
Branch: MAIN
CVS Tags: Mit_032, Mit_031, Mit_025c_branch2, Mit_025c_branch1, Mit_030, Mit_029c, Mit_030_pre1, Mit_029a, Mit_029, Mit_029_pre1, Mit_028a, Mit_025c_branch0, Mit_028, Mit_027a, Mit_027, Mit_026, Mit_025e, Mit_025d, Mit_025c, Mit_025b, Mit_025a, Mit_025, Mit_025pre2, Mit_024b, Mit_025pre1, Mit_024a, Mit_024, Mit_023, Mit_022a, Mit_022, Mit_020d, TMit_020d, Mit_020c, Mit_021, Mit_021pre2, Mit_021pre1, Mit_020b, Mit_020a, Mit_020, Mit_020pre1, Mit_018, Mit_017, Mit_017pre3, Mit_017pre2, Mit_017pre1, V07-05-00, Mit_016, Mit_015b, Mit_015a, Mit_015, Mit_014e, Mit_014d, Mit_014c, Mit_014b, ConvRejection-10-06-09, Mit_014a, Mit_014, Mit_014pre3, Mit_014pre2, Mit_014pre1, Mit_013d, Mit_013c, Mit_013b, Mit_013a, Mit_013, Mit_013pre1, Mit_012i, Mit_012g, Mit_012f, Mit_012e, Mit_012d, Mit_012c, Mit_012b, Mit_012a, Mit_012, Mit_011a, Mit_011, Mit_010a, Mit_010, Mit_009c, Mit_009b, Mit_009a, Mit_009, Mit_008, Mit_008pre2, Mit_008pre1, HEAD
Branch point for: Mit_025c_branch
Log Message:
Added lzma

File Contents

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