attempt to fix build
[pcsx_rearmed.git] / deps / libchdr / deps / lzma-22.01 / include / LzFindMt.h
CommitLineData
9e052883 1/* LzFindMt.h -- multithreaded Match finder for LZ algorithms\r
22021-07-12 : Igor Pavlov : Public domain */\r
3\r
4#ifndef __LZ_FIND_MT_H\r
5#define __LZ_FIND_MT_H\r
6\r
7#include "LzFind.h"\r
8#include "Threads.h"\r
9\r
10EXTERN_C_BEGIN\r
11\r
12typedef struct _CMtSync\r
13{\r
14 UInt32 numProcessedBlocks;\r
15 CThread thread;\r
16 UInt64 affinity;\r
17\r
18 BoolInt wasCreated;\r
19 BoolInt needStart;\r
20 BoolInt csWasInitialized;\r
21 BoolInt csWasEntered;\r
22\r
23 BoolInt exit;\r
24 BoolInt stopWriting;\r
25\r
26 CAutoResetEvent canStart;\r
27 CAutoResetEvent wasStopped;\r
28 CSemaphore freeSemaphore;\r
29 CSemaphore filledSemaphore;\r
30 CCriticalSection cs;\r
31 // UInt32 numBlocks_Sent;\r
32} CMtSync;\r
33\r
34typedef UInt32 * (*Mf_Mix_Matches)(void *p, UInt32 matchMinPos, UInt32 *distances);\r
35\r
36/* kMtCacheLineDummy must be >= size_of_CPU_cache_line */\r
37#define kMtCacheLineDummy 128\r
38\r
39typedef void (*Mf_GetHeads)(const Byte *buffer, UInt32 pos,\r
40 UInt32 *hash, UInt32 hashMask, UInt32 *heads, UInt32 numHeads, const UInt32 *crc);\r
41\r
42typedef struct _CMatchFinderMt\r
43{\r
44 /* LZ */\r
45 const Byte *pointerToCurPos;\r
46 UInt32 *btBuf;\r
47 const UInt32 *btBufPos;\r
48 const UInt32 *btBufPosLimit;\r
49 UInt32 lzPos;\r
50 UInt32 btNumAvailBytes;\r
51\r
52 UInt32 *hash;\r
53 UInt32 fixedHashSize;\r
54 // UInt32 hash4Mask;\r
55 UInt32 historySize;\r
56 const UInt32 *crc;\r
57\r
58 Mf_Mix_Matches MixMatchesFunc;\r
59 UInt32 failure_LZ_BT; // failure in BT transfered to LZ\r
60 // UInt32 failure_LZ_LZ; // failure in LZ tables\r
61 UInt32 failureBuf[1];\r
62 // UInt32 crc[256];\r
63\r
64 /* LZ + BT */\r
65 CMtSync btSync;\r
66 Byte btDummy[kMtCacheLineDummy];\r
67\r
68 /* BT */\r
69 UInt32 *hashBuf;\r
70 UInt32 hashBufPos;\r
71 UInt32 hashBufPosLimit;\r
72 UInt32 hashNumAvail;\r
73 UInt32 failure_BT;\r
74\r
75\r
76 CLzRef *son;\r
77 UInt32 matchMaxLen;\r
78 UInt32 numHashBytes;\r
79 UInt32 pos;\r
80 const Byte *buffer;\r
81 UInt32 cyclicBufferPos;\r
82 UInt32 cyclicBufferSize; /* it must be = (historySize + 1) */\r
83 UInt32 cutValue;\r
84\r
85 /* BT + Hash */\r
86 CMtSync hashSync;\r
87 /* Byte hashDummy[kMtCacheLineDummy]; */\r
88 \r
89 /* Hash */\r
90 Mf_GetHeads GetHeadsFunc;\r
91 CMatchFinder *MatchFinder;\r
92 // CMatchFinder MatchFinder;\r
93} CMatchFinderMt;\r
94\r
95// only for Mt part\r
96void MatchFinderMt_Construct(CMatchFinderMt *p);\r
97void MatchFinderMt_Destruct(CMatchFinderMt *p, ISzAllocPtr alloc);\r
98\r
99SRes MatchFinderMt_Create(CMatchFinderMt *p, UInt32 historySize, UInt32 keepAddBufferBefore,\r
100 UInt32 matchMaxLen, UInt32 keepAddBufferAfter, ISzAllocPtr alloc);\r
101void MatchFinderMt_CreateVTable(CMatchFinderMt *p, IMatchFinder2 *vTable);\r
102\r
103/* call MatchFinderMt_InitMt() before IMatchFinder::Init() */\r
104SRes MatchFinderMt_InitMt(CMatchFinderMt *p);\r
105void MatchFinderMt_ReleaseStream(CMatchFinderMt *p);\r
106\r
107EXTERN_C_END\r
108\r
109#endif\r