Revision: | 1.1 |
Committed: | Tue Feb 24 20:13:57 2009 UTC (16 years, 2 months ago) by loizides |
Content type: | text/plain |
Branch: | MAIN |
CVS Tags: | Mit_032, Mit_031, Mit_025c_branch2, Mit_025c_branch1, Mit_030, Mit_029c, Mit_030_pre1, Mit_029a, Mit_029, Mit_029_pre1, Mit_028a, Mit_025c_branch0, Mit_028, Mit_027a, Mit_027, Mit_026, Mit_025e, Mit_025d, Mit_025c, Mit_025b, Mit_025a, Mit_025, Mit_025pre2, Mit_024b, Mit_025pre1, Mit_024a, Mit_024, Mit_023, Mit_022a, Mit_022, Mit_020d, TMit_020d, Mit_020c, Mit_021, Mit_021pre2, Mit_021pre1, Mit_020b, Mit_020a, Mit_020, Mit_020pre1, Mit_018, Mit_017, Mit_017pre3, Mit_017pre2, Mit_017pre1, V07-05-00, Mit_016, Mit_015b, Mit_015a, Mit_015, Mit_014e, Mit_014d, Mit_014c, Mit_014b, ConvRejection-10-06-09, Mit_014a, Mit_014, Mit_014pre3, Mit_014pre2, Mit_014pre1, Mit_013d, Mit_013c, Mit_013b, Mit_013a, Mit_013, Mit_013pre1, Mit_012i, Mit_012g, Mit_012f, Mit_012e, Mit_012d, Mit_012c, Mit_012b, Mit_012a, Mit_012, Mit_011a, Mit_011, Mit_010a, Mit_010, Mit_009c, Mit_009b, Mit_009a, Mit_009, Mit_008, Mit_008pre2, Mit_008pre1, HEAD |
Branch point for: | Mit_025c_branch |
Log Message: | Added lzma |
# | Content |
---|---|
1 | /* LzFind.h -- Match finder for LZ algorithms |
2 | 2008-10-04 : Igor Pavlov : Public domain */ |
3 | |
4 | #ifndef __LZFIND_H |
5 | #define __LZFIND_H |
6 | |
7 | #include "LzmaTypes.h" |
8 | |
9 | typedef UInt32 CLzRef; |
10 | |
11 | typedef struct _CMatchFinder |
12 | { |
13 | Byte *buffer; |
14 | UInt32 pos; |
15 | UInt32 posLimit; |
16 | UInt32 streamPos; |
17 | UInt32 lenLimit; |
18 | |
19 | UInt32 cyclicBufferPos; |
20 | UInt32 cyclicBufferSize; /* it must be = (historySize + 1) */ |
21 | |
22 | UInt32 matchMaxLen; |
23 | CLzRef *hash; |
24 | CLzRef *son; |
25 | UInt32 hashMask; |
26 | UInt32 cutValue; |
27 | |
28 | Byte *bufferBase; |
29 | ISeqInStream *stream; |
30 | int streamEndWasReached; |
31 | |
32 | UInt32 blockSize; |
33 | UInt32 keepSizeBefore; |
34 | UInt32 keepSizeAfter; |
35 | |
36 | UInt32 numHashBytes; |
37 | int directInput; |
38 | int btMode; |
39 | /* int skipModeBits; */ |
40 | int bigHash; |
41 | UInt32 historySize; |
42 | UInt32 fixedHashSize; |
43 | UInt32 hashSizeSum; |
44 | UInt32 numSons; |
45 | SRes result; |
46 | UInt32 crc[256]; |
47 | } CMatchFinder; |
48 | |
49 | #define Inline_MatchFinder_GetPointerToCurrentPos(p) ((p)->buffer) |
50 | #define Inline_MatchFinder_GetIndexByte(p, index) ((p)->buffer[(Int32)(index)]) |
51 | |
52 | #define Inline_MatchFinder_GetNumAvailableBytes(p) ((p)->streamPos - (p)->pos) |
53 | |
54 | int MatchFinder_NeedMove(CMatchFinder *p); |
55 | Byte *MatchFinder_GetPointerToCurrentPos(CMatchFinder *p); |
56 | void MatchFinder_MoveBlock(CMatchFinder *p); |
57 | void MatchFinder_ReadIfRequired(CMatchFinder *p); |
58 | |
59 | void MatchFinder_Construct(CMatchFinder *p); |
60 | |
61 | /* Conditions: |
62 | historySize <= 3 GB |
63 | keepAddBufferBefore + matchMaxLen + keepAddBufferAfter < 511MB |
64 | */ |
65 | int MatchFinder_Create(CMatchFinder *p, UInt32 historySize, |
66 | UInt32 keepAddBufferBefore, UInt32 matchMaxLen, UInt32 keepAddBufferAfter, |
67 | ISzAlloc *alloc); |
68 | void MatchFinder_Free(CMatchFinder *p, ISzAlloc *alloc); |
69 | void MatchFinder_Normalize3(UInt32 subValue, CLzRef *items, UInt32 numItems); |
70 | void MatchFinder_ReduceOffsets(CMatchFinder *p, UInt32 subValue); |
71 | |
72 | UInt32 * GetMatchesSpec1(UInt32 lenLimit, UInt32 curMatch, UInt32 pos, const Byte *buffer, CLzRef *son, |
73 | UInt32 _cyclicBufferPos, UInt32 _cyclicBufferSize, UInt32 _cutValue, |
74 | UInt32 *distances, UInt32 maxLen); |
75 | |
76 | /* |
77 | Conditions: |
78 | Mf_GetNumAvailableBytes_Func must be called before each Mf_GetMatchLen_Func. |
79 | Mf_GetPointerToCurrentPos_Func's result must be used only before any other function |
80 | */ |
81 | |
82 | typedef void (*Mf_Init_Func)(void *object); |
83 | typedef Byte (*Mf_GetIndexByte_Func)(void *object, Int32 index); |
84 | typedef UInt32 (*Mf_GetNumAvailableBytes_Func)(void *object); |
85 | typedef const Byte * (*Mf_GetPointerToCurrentPos_Func)(void *object); |
86 | typedef UInt32 (*Mf_GetMatches_Func)(void *object, UInt32 *distances); |
87 | typedef void (*Mf_Skip_Func)(void *object, UInt32); |
88 | |
89 | typedef struct _IMatchFinder |
90 | { |
91 | Mf_Init_Func Init; |
92 | Mf_GetIndexByte_Func GetIndexByte; |
93 | Mf_GetNumAvailableBytes_Func GetNumAvailableBytes; |
94 | Mf_GetPointerToCurrentPos_Func GetPointerToCurrentPos; |
95 | Mf_GetMatches_Func GetMatches; |
96 | Mf_Skip_Func Skip; |
97 | } IMatchFinder; |
98 | |
99 | void MatchFinder_CreateVTable(CMatchFinder *p, IMatchFinder *vTable); |
100 | |
101 | void MatchFinder_Init(CMatchFinder *p); |
102 | UInt32 Bt3Zip_MatchFinder_GetMatches(CMatchFinder *p, UInt32 *distances); |
103 | UInt32 Hc3Zip_MatchFinder_GetMatches(CMatchFinder *p, UInt32 *distances); |
104 | void Bt3Zip_MatchFinder_Skip(CMatchFinder *p, UInt32 num); |
105 | void Hc3Zip_MatchFinder_Skip(CMatchFinder *p, UInt32 num); |
106 | |
107 | #endif |