/* LzmaEnc.h -- LZMA Encoder12023-04-13 : Igor Pavlov : Public domain */23#ifndef ZIP7_INC_LZMA_ENC_H4#define ZIP7_INC_LZMA_ENC_H56#include "7zTypes.h"78EXTERN_C_BEGIN910#define LZMA_PROPS_SIZE 51112typedef struct13{14int level; /* 0 <= level <= 9 */15UInt32 dictSize; /* (1 << 12) <= dictSize <= (1 << 27) for 32-bit version16(1 << 12) <= dictSize <= (3 << 29) for 64-bit version17default = (1 << 24) */18int lc; /* 0 <= lc <= 8, default = 3 */19int lp; /* 0 <= lp <= 4, default = 0 */20int pb; /* 0 <= pb <= 4, default = 2 */21int algo; /* 0 - fast, 1 - normal, default = 1 */22int fb; /* 5 <= fb <= 273, default = 32 */23int btMode; /* 0 - hashChain Mode, 1 - binTree mode - normal, default = 1 */24int numHashBytes; /* 2, 3 or 4, default = 4 */25unsigned numHashOutBits; /* default = ? */26UInt32 mc; /* 1 <= mc <= (1 << 30), default = 32 */27unsigned writeEndMark; /* 0 - do not write EOPM, 1 - write EOPM, default = 0 */28int numThreads; /* 1 or 2, default = 2 */2930// int _pad;3132UInt64 reduceSize; /* estimated size of data that will be compressed. default = (UInt64)(Int64)-1.33Encoder uses this value to reduce dictionary size */3435UInt64 affinity;36} CLzmaEncProps;3738void LzmaEncProps_Init(CLzmaEncProps *p);39void LzmaEncProps_Normalize(CLzmaEncProps *p);40UInt32 LzmaEncProps_GetDictSize(const CLzmaEncProps *props2);414243/* ---------- CLzmaEncHandle Interface ---------- */4445/* LzmaEnc* functions can return the following exit codes:46SRes:47SZ_OK - OK48SZ_ERROR_MEM - Memory allocation error49SZ_ERROR_PARAM - Incorrect paramater in props50SZ_ERROR_WRITE - ISeqOutStream write callback error51SZ_ERROR_OUTPUT_EOF - output buffer overflow - version with (Byte *) output52SZ_ERROR_PROGRESS - some break from progress callback53SZ_ERROR_THREAD - error in multithreading functions (only for Mt version)54*/5556typedef struct CLzmaEnc CLzmaEnc;57typedef CLzmaEnc * CLzmaEncHandle;58// Z7_DECLARE_HANDLE(CLzmaEncHandle)5960CLzmaEncHandle LzmaEnc_Create(ISzAllocPtr alloc);61void LzmaEnc_Destroy(CLzmaEncHandle p, ISzAllocPtr alloc, ISzAllocPtr allocBig);6263SRes LzmaEnc_SetProps(CLzmaEncHandle p, const CLzmaEncProps *props);64void LzmaEnc_SetDataSize(CLzmaEncHandle p, UInt64 expectedDataSiize);65SRes LzmaEnc_WriteProperties(CLzmaEncHandle p, Byte *properties, SizeT *size);66unsigned LzmaEnc_IsWriteEndMark(CLzmaEncHandle p);6768SRes LzmaEnc_Encode(CLzmaEncHandle p, ISeqOutStreamPtr outStream, ISeqInStreamPtr inStream,69ICompressProgressPtr progress, ISzAllocPtr alloc, ISzAllocPtr allocBig);70SRes LzmaEnc_MemEncode(CLzmaEncHandle p, Byte *dest, SizeT *destLen, const Byte *src, SizeT srcLen,71int writeEndMark, ICompressProgressPtr progress, ISzAllocPtr alloc, ISzAllocPtr allocBig);727374/* ---------- One Call Interface ---------- */7576SRes LzmaEncode(Byte *dest, SizeT *destLen, const Byte *src, SizeT srcLen,77const CLzmaEncProps *props, Byte *propsEncoded, SizeT *propsSize, int writeEndMark,78ICompressProgressPtr progress, ISzAllocPtr alloc, ISzAllocPtr allocBig);7980EXTERN_C_END8182#endif838485