rlm@1: /* LzmaEnc.h -- LZMA Encoder rlm@1: 2008-10-04 : Igor Pavlov : Public domain */ rlm@1: rlm@1: #ifndef __LZMAENC_H rlm@1: #define __LZMAENC_H rlm@1: rlm@1: #include "Types.h" rlm@1: rlm@1: #define LZMA_PROPS_SIZE 5 rlm@1: rlm@1: typedef struct _CLzmaEncProps rlm@1: { rlm@1: int level; /* 0 <= level <= 9 */ rlm@1: UInt32 dictSize; /* (1 << 12) <= dictSize <= (1 << 27) for 32-bit version rlm@1: (1 << 12) <= dictSize <= (1 << 30) for 64-bit version rlm@1: default = (1 << 24) */ rlm@1: int lc; /* 0 <= lc <= 8, default = 3 */ rlm@1: int lp; /* 0 <= lp <= 4, default = 0 */ rlm@1: int pb; /* 0 <= pb <= 4, default = 2 */ rlm@1: int algo; /* 0 - fast, 1 - normal, default = 1 */ rlm@1: int fb; /* 5 <= fb <= 273, default = 32 */ rlm@1: int btMode; /* 0 - hashChain Mode, 1 - binTree mode - normal, default = 1 */ rlm@1: int numHashBytes; /* 2, 3 or 4, default = 4 */ rlm@1: UInt32 mc; /* 1 <= mc <= (1 << 30), default = 32 */ rlm@1: unsigned writeEndMark; /* 0 - do not write EOPM, 1 - write EOPM, default = 0 */ rlm@1: int numThreads; /* 1 or 2, default = 2 */ rlm@1: } CLzmaEncProps; rlm@1: rlm@1: void LzmaEncProps_Init(CLzmaEncProps *p); rlm@1: void LzmaEncProps_Normalize(CLzmaEncProps *p); rlm@1: UInt32 LzmaEncProps_GetDictSize(const CLzmaEncProps *props2); rlm@1: rlm@1: rlm@1: /* ---------- CLzmaEncHandle Interface ---------- */ rlm@1: rlm@1: /* LzmaEnc_* functions can return the following exit codes: rlm@1: Returns: rlm@1: SZ_OK - OK rlm@1: SZ_ERROR_MEM - Memory allocation error rlm@1: SZ_ERROR_PARAM - Incorrect paramater in props rlm@1: SZ_ERROR_WRITE - Write callback error. rlm@1: SZ_ERROR_PROGRESS - some break from progress callback rlm@1: SZ_ERROR_THREAD - errors in multithreading functions (only for Mt version) rlm@1: */ rlm@1: rlm@1: typedef void * CLzmaEncHandle; rlm@1: rlm@1: CLzmaEncHandle LzmaEnc_Create(ISzAlloc *alloc); rlm@1: void LzmaEnc_Destroy(CLzmaEncHandle p, ISzAlloc *alloc, ISzAlloc *allocBig); rlm@1: SRes LzmaEnc_SetProps(CLzmaEncHandle p, const CLzmaEncProps *props); rlm@1: SRes LzmaEnc_WriteProperties(CLzmaEncHandle p, Byte *properties, SizeT *size); rlm@1: SRes LzmaEnc_Encode(CLzmaEncHandle p, ISeqOutStream *outStream, ISeqInStream *inStream, rlm@1: ICompressProgress *progress, ISzAlloc *alloc, ISzAlloc *allocBig); rlm@1: SRes LzmaEnc_MemEncode(CLzmaEncHandle p, Byte *dest, SizeT *destLen, const Byte *src, SizeT srcLen, rlm@1: int writeEndMark, ICompressProgress *progress, ISzAlloc *alloc, ISzAlloc *allocBig); rlm@1: rlm@1: /* ---------- One Call Interface ---------- */ rlm@1: rlm@1: /* LzmaEncode rlm@1: Return code: rlm@1: SZ_OK - OK rlm@1: SZ_ERROR_MEM - Memory allocation error rlm@1: SZ_ERROR_PARAM - Incorrect paramater rlm@1: SZ_ERROR_OUTPUT_EOF - output buffer overflow rlm@1: SZ_ERROR_THREAD - errors in multithreading functions (only for Mt version) rlm@1: */ rlm@1: rlm@1: SRes LzmaEncode(Byte *dest, SizeT *destLen, const Byte *src, SizeT srcLen, rlm@1: const CLzmaEncProps *props, Byte *propsEncoded, SizeT *propsSize, int writeEndMark, rlm@1: ICompressProgress *progress, ISzAlloc *alloc, ISzAlloc *allocBig); rlm@1: rlm@1: #endif