xref: /aosp_15_r20/external/lzma/C/XzEnc.h (revision f6dc9357d832569d4d1f5d24eacdb3935a1ae8e6)
1 /* XzEnc.h -- Xz Encode
2 2023-04-13 : Igor Pavlov : Public domain */
3 
4 #ifndef ZIP7_INC_XZ_ENC_H
5 #define ZIP7_INC_XZ_ENC_H
6 
7 #include "Lzma2Enc.h"
8 
9 #include "Xz.h"
10 
11 EXTERN_C_BEGIN
12 
13 
14 #define XZ_PROPS_BLOCK_SIZE_AUTO   LZMA2_ENC_PROPS_BLOCK_SIZE_AUTO
15 #define XZ_PROPS_BLOCK_SIZE_SOLID  LZMA2_ENC_PROPS_BLOCK_SIZE_SOLID
16 
17 
18 typedef struct
19 {
20   UInt32 id;
21   UInt32 delta;
22   UInt32 ip;
23   int ipDefined;
24 } CXzFilterProps;
25 
26 void XzFilterProps_Init(CXzFilterProps *p);
27 
28 
29 typedef struct
30 {
31   CLzma2EncProps lzma2Props;
32   CXzFilterProps filterProps;
33   unsigned checkId;
34   UInt64 blockSize;
35   int numBlockThreads_Reduced;
36   int numBlockThreads_Max;
37   int numTotalThreads;
38   int forceWriteSizesInHeader;
39   UInt64 reduceSize;
40 } CXzProps;
41 
42 void XzProps_Init(CXzProps *p);
43 
44 typedef struct CXzEnc CXzEnc;
45 typedef CXzEnc * CXzEncHandle;
46 // Z7_DECLARE_HANDLE(CXzEncHandle)
47 
48 CXzEncHandle XzEnc_Create(ISzAllocPtr alloc, ISzAllocPtr allocBig);
49 void XzEnc_Destroy(CXzEncHandle p);
50 SRes XzEnc_SetProps(CXzEncHandle p, const CXzProps *props);
51 void XzEnc_SetDataSize(CXzEncHandle p, UInt64 expectedDataSiize);
52 SRes XzEnc_Encode(CXzEncHandle p, ISeqOutStreamPtr outStream, ISeqInStreamPtr inStream, ICompressProgressPtr progress);
53 
54 SRes Xz_Encode(ISeqOutStreamPtr outStream, ISeqInStreamPtr inStream,
55     const CXzProps *props, ICompressProgressPtr progress);
56 
57 SRes Xz_EncodeEmpty(ISeqOutStreamPtr outStream);
58 
59 EXTERN_C_END
60 
61 #endif
62