Parolin 0.7.9 6796
Console (soon DLLs) to do a tar like job
Loading...
Searching...
No Matches
LzFind.h
Go to the documentation of this file.
1/* LzFind.h -- Match finder for LZ algorithms
22024-01-22 : Igor Pavlov : Public domain */
3
4#ifndef ZIP7_INC_LZ_FIND_H
5#define ZIP7_INC_LZ_FIND_H
6
7#include "7zTypes.h"
8
10
11typedef UInt32 CLzRef;
12
55
56#define Inline_MatchFinder_GetPointerToCurrentPos(p) ((const Byte *)(p)->buffer)
57
58#define Inline_MatchFinder_GetNumAvailableBytes(p) ((UInt32)((p)->streamPos - (p)->pos))
59
60/*
61#define Inline_MatchFinder_IsFinishedOK(p) \
62 ((p)->streamEndWasReached \
63 && (p)->streamPos == (p)->pos \
64 && (!(p)->directInput || (p)->directInputRem == 0))
65*/
66
68/* Byte *MatchFinder_GetPointerToCurrentPos(CMatchFinder *p); */
71
73
74/* (directInput = 0) is default value.
75 It's required to provide correct (directInput) value
76 before calling MatchFinder_Create().
77 You can set (directInput) by any of the following calls:
78 - MatchFinder_SET_DIRECT_INPUT_BUF()
79 - MatchFinder_SET_STREAM()
80 - MatchFinder_SET_STREAM_MODE()
81*/
82
83#define MatchFinder_SET_DIRECT_INPUT_BUF(p, _src_, _srcLen_) { \
84 (p)->stream = NULL; \
85 (p)->directInput = 1; \
86 (p)->buffer = (_src_); \
87 (p)->directInputRem = (_srcLen_); }
88
89/*
90#define MatchFinder_SET_STREAM_MODE(p) { \
91 (p)->directInput = 0; }
92*/
93
94#define MatchFinder_SET_STREAM(p, _stream_) { \
95 (p)->stream = _stream_; \
96 (p)->directInput = 0; }
97
98
99int MatchFinder_Create(CMatchFinder *p, UInt32 historySize,
100 UInt32 keepAddBufferBefore, UInt32 matchMaxLen, UInt32 keepAddBufferAfter,
101 ISzAllocPtr alloc);
103void MatchFinder_Normalize3(UInt32 subValue, CLzRef *items, size_t numItems);
104
105/*
106#define MatchFinder_INIT_POS(p, val) \
107 (p)->pos = (val); \
108 (p)->streamPos = (val);
109*/
110
111// void MatchFinder_ReduceOffsets(CMatchFinder *p, UInt32 subValue);
112#define MatchFinder_REDUCE_OFFSETS(p, subValue) \
113 (p)->pos -= (subValue); \
114 (p)->streamPos -= (subValue);
115
116
117UInt32 * GetMatchesSpec1(UInt32 lenLimit, UInt32 curMatch, UInt32 pos, const Byte *buffer, CLzRef *son,
118 size_t _cyclicBufferPos, UInt32 _cyclicBufferSize, UInt32 _cutValue,
119 UInt32 *distances, UInt32 maxLen);
120
121/*
122Conditions:
123 Mf_GetNumAvailableBytes_Func must be called before each Mf_GetMatchLen_Func.
124 Mf_GetPointerToCurrentPos_Func's result must be used only before any other function
125*/
126
127typedef void (*Mf_Init_Func)(void *object);
128typedef UInt32 (*Mf_GetNumAvailableBytes_Func)(void *object);
129typedef const Byte * (*Mf_GetPointerToCurrentPos_Func)(void *object);
130typedef UInt32 * (*Mf_GetMatches_Func)(void *object, UInt32 *distances);
131typedef void (*Mf_Skip_Func)(void *object, UInt32);
132
141
143
147// void MatchFinder_Init(CMatchFinder *p);
148void MatchFinder_Init(void *p);
149
152
155
156void LzFindPrepare(void);
157
159
160#endif
#define EXTERN_C_BEGIN
Definition 7zTypes.h:20
unsigned long long int UInt64
Definition 7zTypes.h:234
int SRes
Definition 7zTypes.h:45
#define EXTERN_C_END
Definition 7zTypes.h:21
void MatchFinder_Normalize3(UInt32 subValue, CLzRef *items, size_t numItems)
Definition LzFind.c:795
void MatchFinder_Init_4(CMatchFinder *p)
Definition LzFind.c:559
void MatchFinder_ReadIfRequired(CMatchFinder *p)
Definition LzFind.c:217
void LzFindPrepare(void)
Definition LzFind.c:1706
void MatchFinder_MoveBlock(CMatchFinder *p)
Definition LzFind.c:190
void MatchFinder_Construct(CMatchFinder *p)
Definition LzFind.c:237
void(* Mf_Init_Func)(void *object)
Definition LzFind.h:127
UInt32(* Mf_GetNumAvailableBytes_Func)(void *object)
Definition LzFind.h:128
void Bt3Zip_MatchFinder_Skip(CMatchFinder *p, UInt32 num)
Definition LzFind.c:1527
EXTERN_C_BEGIN typedef UInt32 CLzRef
Definition LzFind.h:11
void(* Mf_Skip_Func)(void *object, UInt32)
Definition LzFind.h:131
int MatchFinder_NeedMove(CMatchFinder *p)
Definition LzFind.c:208
void MatchFinder_Init_LowHash(CMatchFinder *p)
Definition LzFind.c:539
int MatchFinder_Create(CMatchFinder *p, UInt32 historySize, UInt32 keepAddBufferBefore, UInt32 matchMaxLen, UInt32 keepAddBufferAfter, ISzAllocPtr alloc)
Definition LzFind.c:376
void MatchFinder_Free(CMatchFinder *p, ISzAllocPtr alloc)
Definition LzFind.c:266
void Hc3Zip_MatchFinder_Skip(CMatchFinder *p, UInt32 num)
Definition LzFind.c:1652
UInt32 * GetMatchesSpec1(UInt32 lenLimit, UInt32 curMatch, UInt32 pos, const Byte *buffer, CLzRef *son, size_t _cyclicBufferPos, UInt32 _cyclicBufferSize, UInt32 _cutValue, UInt32 *distances, UInt32 maxLen)
Definition LzFind.c:962
void MatchFinder_Init(void *p)
Definition LzFind.c:580
UInt32 * Bt3Zip_MatchFinder_GetMatches(CMatchFinder *p, UInt32 *distances)
Definition LzFind.c:1161
UInt32 *(* Mf_GetMatches_Func)(void *object, UInt32 *distances)
Definition LzFind.h:130
void MatchFinder_Init_HighHash(CMatchFinder *p)
Definition LzFind.c:549
void MatchFinder_CreateVTable(CMatchFinder *p, IMatchFinder2 *vTable)
Definition LzFind.c:1664
UInt32 * Hc3Zip_MatchFinder_GetMatches(CMatchFinder *p, UInt32 *distances)
Definition LzFind.c:1505
const Byte *(* Mf_GetPointerToCurrentPos_Func)(void *object)
Definition LzFind.h:129
struct _CMatchFinder CMatchFinder
Definition LzFind.h:14
UInt32 cyclicBufferSize
Definition LzFind.h:22
const Byte * buffer
Definition LzFind.h:15
SRes result
Definition LzFind.h:49
UInt32 posLimit
Definition LzFind.h:17
UInt32 keepSizeBefore
Definition LzFind.h:39
Byte streamEndWasReached
Definition LzFind.h:24
size_t numRefs
Definition LzFind.h:51
CLzRef * hash
Definition LzFind.h:30
Byte bigHash
Definition LzFind.h:26
UInt32 fixedHashSize
Definition LzFind.h:45
UInt32 keepSizeAfter
Definition LzFind.h:40
ISeqInStreamPtr stream
Definition LzFind.h:36
Byte numHashOutBits
Definition LzFind.h:47
UInt32 matchMaxLen
Definition LzFind.h:29
UInt32 historySize
Definition LzFind.h:44
UInt32 numHashBytes
Definition LzFind.h:42
size_t directInputRem
Definition LzFind.h:43
Byte numHashBytes_Min
Definition LzFind.h:46
UInt32 pos
Definition LzFind.h:16
Byte directInput
Definition LzFind.h:27
Byte * bufBase
Definition LzFind.h:35
UInt32 cutValue
Definition LzFind.h:33
UInt32 streamPos
Definition LzFind.h:18
UInt64 expectedDataSize
Definition LzFind.h:53
Byte btMode
Definition LzFind.h:25
CLzRef * son
Definition LzFind.h:31
UInt32 hashMask
Definition LzFind.h:32
UInt32 blockSize
Definition LzFind.h:38
UInt32 lenLimit
Definition LzFind.h:19
UInt32 cyclicBufferPos
Definition LzFind.h:21
Definition LzFind.h:134
Mf_Init_Func Init
Definition LzFind.h:135
Mf_GetNumAvailableBytes_Func GetNumAvailableBytes
Definition LzFind.h:136
Mf_Skip_Func Skip
Definition LzFind.h:139
Mf_GetMatches_Func GetMatches
Definition LzFind.h:138
Mf_GetPointerToCurrentPos_Func GetPointerToCurrentPos
Definition LzFind.h:137
Definition 7zTypes.h:460
unsigned int UInt32
Definition bzlib_private.h:45
unsigned char Byte
Definition zconf.h:391