Update eme_player to handle SessionType changes.
[chromium-blink-merge.git] / third_party / lzma_sdk / LzFind.h
blob010c4b92ba337fef8861c7245a367cbfa920680b
1 /* LzFind.h -- Match finder for LZ algorithms
2 2009-04-22 : Igor Pavlov : Public domain */
4 #ifndef __LZ_FIND_H
5 #define __LZ_FIND_H
7 #include "Types.h"
9 #ifdef __cplusplus
10 extern "C" {
11 #endif
13 typedef UInt32 CLzRef;
15 typedef struct _CMatchFinder
17 Byte *buffer;
18 UInt32 pos;
19 UInt32 posLimit;
20 UInt32 streamPos;
21 UInt32 lenLimit;
23 UInt32 cyclicBufferPos;
24 UInt32 cyclicBufferSize; /* it must be = (historySize + 1) */
26 UInt32 matchMaxLen;
27 CLzRef *hash;
28 CLzRef *son;
29 UInt32 hashMask;
30 UInt32 cutValue;
32 Byte *bufferBase;
33 ISeqInStream *stream;
34 int streamEndWasReached;
36 UInt32 blockSize;
37 UInt32 keepSizeBefore;
38 UInt32 keepSizeAfter;
40 UInt32 numHashBytes;
41 int directInput;
42 size_t directInputRem;
43 int btMode;
44 int bigHash;
45 UInt32 historySize;
46 UInt32 fixedHashSize;
47 UInt32 hashSizeSum;
48 UInt32 numSons;
49 SRes result;
50 UInt32 crc[256];
51 } CMatchFinder;
53 #define Inline_MatchFinder_GetPointerToCurrentPos(p) ((p)->buffer)
54 #define Inline_MatchFinder_GetIndexByte(p, index) ((p)->buffer[(Int32)(index)])
56 #define Inline_MatchFinder_GetNumAvailableBytes(p) ((p)->streamPos - (p)->pos)
58 int MatchFinder_NeedMove(CMatchFinder *p);
59 Byte *MatchFinder_GetPointerToCurrentPos(CMatchFinder *p);
60 void MatchFinder_MoveBlock(CMatchFinder *p);
61 void MatchFinder_ReadIfRequired(CMatchFinder *p);
63 void MatchFinder_Construct(CMatchFinder *p);
65 /* Conditions:
66 historySize <= 3 GB
67 keepAddBufferBefore + matchMaxLen + keepAddBufferAfter < 511MB
69 int MatchFinder_Create(CMatchFinder *p, UInt32 historySize,
70 UInt32 keepAddBufferBefore, UInt32 matchMaxLen, UInt32 keepAddBufferAfter,
71 ISzAlloc *alloc);
72 void MatchFinder_Free(CMatchFinder *p, ISzAlloc *alloc);
73 void MatchFinder_Normalize3(UInt32 subValue, CLzRef *items, UInt32 numItems);
74 void MatchFinder_ReduceOffsets(CMatchFinder *p, UInt32 subValue);
76 UInt32 * GetMatchesSpec1(UInt32 lenLimit, UInt32 curMatch, UInt32 pos, const Byte *buffer, CLzRef *son,
77 UInt32 _cyclicBufferPos, UInt32 _cyclicBufferSize, UInt32 _cutValue,
78 UInt32 *distances, UInt32 maxLen);
81 Conditions:
82 Mf_GetNumAvailableBytes_Func must be called before each Mf_GetMatchLen_Func.
83 Mf_GetPointerToCurrentPos_Func's result must be used only before any other function
86 typedef void (*Mf_Init_Func)(void *object);
87 typedef Byte (*Mf_GetIndexByte_Func)(void *object, Int32 index);
88 typedef UInt32 (*Mf_GetNumAvailableBytes_Func)(void *object);
89 typedef const Byte * (*Mf_GetPointerToCurrentPos_Func)(void *object);
90 typedef UInt32 (*Mf_GetMatches_Func)(void *object, UInt32 *distances);
91 typedef void (*Mf_Skip_Func)(void *object, UInt32);
93 typedef struct _IMatchFinder
95 Mf_Init_Func Init;
96 Mf_GetIndexByte_Func GetIndexByte;
97 Mf_GetNumAvailableBytes_Func GetNumAvailableBytes;
98 Mf_GetPointerToCurrentPos_Func GetPointerToCurrentPos;
99 Mf_GetMatches_Func GetMatches;
100 Mf_Skip_Func Skip;
101 } IMatchFinder;
103 void MatchFinder_CreateVTable(CMatchFinder *p, IMatchFinder *vTable);
105 void MatchFinder_Init(CMatchFinder *p);
106 UInt32 Bt3Zip_MatchFinder_GetMatches(CMatchFinder *p, UInt32 *distances);
107 UInt32 Hc3Zip_MatchFinder_GetMatches(CMatchFinder *p, UInt32 *distances);
108 void Bt3Zip_MatchFinder_Skip(CMatchFinder *p, UInt32 num);
109 void Hc3Zip_MatchFinder_Skip(CMatchFinder *p, UInt32 num);
111 #ifdef __cplusplus
113 #endif
115 #endif