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