Mercurial > vba-clojure
view src/win32/7zip/7z/C/LzFindMt.h @ 1:f9f4f1b99eed
importing src directory
author | Robert McIntyre <rlm@mit.edu> |
---|---|
date | Sat, 03 Mar 2012 10:31:27 -0600 |
parents | |
children |
line wrap: on
line source
1 /* LzFindMt.h -- multithreaded Match finder for LZ algorithms2 2008-10-04 : Igor Pavlov : Public domain */4 #ifndef __LZFINDMT_H5 #define __LZFINDMT_H7 #include "Threads.h"8 #include "LzFind.h"10 #define kMtHashBlockSize (1 << 13)11 #define kMtHashNumBlocks (1 << 3)12 #define kMtHashNumBlocksMask (kMtHashNumBlocks - 1)14 #define kMtBtBlockSize (1 << 14)15 #define kMtBtNumBlocks (1 << 6)16 #define kMtBtNumBlocksMask (kMtBtNumBlocks - 1)18 typedef struct _CMtSync19 {20 Bool wasCreated;21 Bool needStart;22 Bool exit;23 Bool stopWriting;25 CThread thread;26 CAutoResetEvent canStart;27 CAutoResetEvent wasStarted;28 CAutoResetEvent wasStopped;29 CSemaphore freeSemaphore;30 CSemaphore filledSemaphore;31 Bool csWasInitialized;32 Bool csWasEntered;33 CCriticalSection cs;34 UInt32 numProcessedBlocks;35 } CMtSync;37 typedef UInt32 * (*Mf_Mix_Matches)(void *p, UInt32 matchMinPos, UInt32 *distances);39 /* kMtCacheLineDummy must be >= size_of_CPU_cache_line */40 #define kMtCacheLineDummy 12842 typedef void (*Mf_GetHeads)(const Byte *buffer, UInt32 pos,43 UInt32 *hash, UInt32 hashMask, UInt32 *heads, UInt32 numHeads, const UInt32 *crc);45 typedef struct _CMatchFinderMt46 {47 /* LZ */48 const Byte *pointerToCurPos;49 UInt32 *btBuf;50 UInt32 btBufPos;51 UInt32 btBufPosLimit;52 UInt32 lzPos;53 UInt32 btNumAvailBytes;55 UInt32 *hash;56 UInt32 fixedHashSize;57 UInt32 historySize;58 const UInt32 *crc;60 Mf_Mix_Matches MixMatchesFunc;62 /* LZ + BT */63 CMtSync btSync;64 Byte btDummy[kMtCacheLineDummy];66 /* BT */67 UInt32 *hashBuf;68 UInt32 hashBufPos;69 UInt32 hashBufPosLimit;70 UInt32 hashNumAvail;72 CLzRef *son;73 UInt32 matchMaxLen;74 UInt32 numHashBytes;75 UInt32 pos;76 Byte *buffer;77 UInt32 cyclicBufferPos;78 UInt32 cyclicBufferSize; /* it must be historySize + 1 */79 UInt32 cutValue;81 /* BT + Hash */82 CMtSync hashSync;83 /* Byte hashDummy[kMtCacheLineDummy]; */85 /* Hash */86 Mf_GetHeads GetHeadsFunc;87 CMatchFinder *MatchFinder;88 } CMatchFinderMt;90 void MatchFinderMt_Construct(CMatchFinderMt *p);91 void MatchFinderMt_Destruct(CMatchFinderMt *p, ISzAlloc *alloc);92 SRes MatchFinderMt_Create(CMatchFinderMt *p, UInt32 historySize, UInt32 keepAddBufferBefore,93 UInt32 matchMaxLen, UInt32 keepAddBufferAfter, ISzAlloc *alloc);94 void MatchFinderMt_CreateVTable(CMatchFinderMt *p, IMatchFinder *vTable);95 void MatchFinderMt_ReleaseStream(CMatchFinderMt *p);97 #endif