1 /* Lzma2DecMt.h -- LZMA2 Decoder Multi-thread 2 2023-04-13 : Igor Pavlov : Public domain */ 3 4 #ifndef ZIP7_INC_LZMA2_DEC_MT_H 5 #define ZIP7_INC_LZMA2_DEC_MT_H 6 7 #include "7zTypes.h" 8 9 EXTERN_C_BEGIN 10 11 typedef struct 12 { 13 size_t inBufSize_ST; 14 size_t outStep_ST; 15 16 #ifndef Z7_ST 17 unsigned numThreads; 18 size_t inBufSize_MT; 19 size_t outBlockMax; 20 size_t inBlockMax; 21 #endif 22 } CLzma2DecMtProps; 23 24 /* init to single-thread mode */ 25 void Lzma2DecMtProps_Init(CLzma2DecMtProps *p); 26 27 28 /* ---------- CLzma2DecMtHandle Interface ---------- */ 29 30 /* Lzma2DecMt_ * functions can return the following exit codes: 31 SRes: 32 SZ_OK - OK 33 SZ_ERROR_MEM - Memory allocation error 34 SZ_ERROR_PARAM - Incorrect paramater in props 35 SZ_ERROR_WRITE - ISeqOutStream write callback error 36 // SZ_ERROR_OUTPUT_EOF - output buffer overflow - version with (Byte *) output 37 SZ_ERROR_PROGRESS - some break from progress callback 38 SZ_ERROR_THREAD - error in multithreading functions (only for Mt version) 39 */ 40 41 typedef struct CLzma2DecMt CLzma2DecMt; 42 typedef CLzma2DecMt * CLzma2DecMtHandle; 43 // Z7_DECLARE_HANDLE(CLzma2DecMtHandle) 44 45 CLzma2DecMtHandle Lzma2DecMt_Create(ISzAllocPtr alloc, ISzAllocPtr allocMid); 46 void Lzma2DecMt_Destroy(CLzma2DecMtHandle p); 47 48 SRes Lzma2DecMt_Decode(CLzma2DecMtHandle p, 49 Byte prop, 50 const CLzma2DecMtProps *props, 51 ISeqOutStreamPtr outStream, 52 const UInt64 *outDataSize, // NULL means undefined 53 int finishMode, // 0 - partial unpacking is allowed, 1 - if lzma2 stream must be finished 54 // Byte *outBuf, size_t *outBufSize, 55 ISeqInStreamPtr inStream, 56 // const Byte *inData, size_t inDataSize, 57 58 // out variables: 59 UInt64 *inProcessed, 60 int *isMT, /* out: (*isMT == 0), if single thread decoding was used */ 61 62 // UInt64 *outProcessed, 63 ICompressProgressPtr progress); 64 65 66 /* ---------- Read from CLzma2DecMtHandle Interface ---------- */ 67 68 SRes Lzma2DecMt_Init(CLzma2DecMtHandle pp, 69 Byte prop, 70 const CLzma2DecMtProps *props, 71 const UInt64 *outDataSize, int finishMode, 72 ISeqInStreamPtr inStream); 73 74 SRes Lzma2DecMt_Read(CLzma2DecMtHandle pp, 75 Byte *data, size_t *outSize, 76 UInt64 *inStreamProcessed); 77 78 79 EXTERN_C_END 80 81 #endif 82