Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(436)

Side by Side Diff: third_party/lzma_sdk/LzFind.h

Issue 1700453002: Update lzma_sdk sources to 15.14. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Chromium modifications Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « third_party/lzma_sdk/Delta.c ('k') | third_party/lzma_sdk/LzFind.c » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* LzFind.h -- Match finder for LZ algorithms 1 /* LzFind.h -- Match finder for LZ algorithms
2 2009-04-22 : Igor Pavlov : Public domain */ 2 2015-10-15 : Igor Pavlov : Public domain */
3 3
4 #ifndef __LZ_FIND_H 4 #ifndef __LZ_FIND_H
5 #define __LZ_FIND_H 5 #define __LZ_FIND_H
6 6
7 #include "Types.h" 7 #include "7zTypes.h"
8 8
9 #ifdef __cplusplus 9 EXTERN_C_BEGIN
10 extern "C" {
11 #endif
12 10
13 typedef UInt32 CLzRef; 11 typedef UInt32 CLzRef;
14 12
15 typedef struct _CMatchFinder 13 typedef struct _CMatchFinder
16 { 14 {
17 Byte *buffer; 15 Byte *buffer;
18 UInt32 pos; 16 UInt32 pos;
19 UInt32 posLimit; 17 UInt32 posLimit;
20 UInt32 streamPos; 18 UInt32 streamPos;
21 UInt32 lenLimit; 19 UInt32 lenLimit;
22 20
23 UInt32 cyclicBufferPos; 21 UInt32 cyclicBufferPos;
24 UInt32 cyclicBufferSize; /* it must be = (historySize + 1) */ 22 UInt32 cyclicBufferSize; /* it must be = (historySize + 1) */
25 23
24 Byte streamEndWasReached;
25 Byte btMode;
26 Byte bigHash;
27 Byte directInput;
28
26 UInt32 matchMaxLen; 29 UInt32 matchMaxLen;
27 CLzRef *hash; 30 CLzRef *hash;
28 CLzRef *son; 31 CLzRef *son;
29 UInt32 hashMask; 32 UInt32 hashMask;
30 UInt32 cutValue; 33 UInt32 cutValue;
31 34
32 Byte *bufferBase; 35 Byte *bufferBase;
33 ISeqInStream *stream; 36 ISeqInStream *stream;
34 int streamEndWasReached; 37
35
36 UInt32 blockSize; 38 UInt32 blockSize;
37 UInt32 keepSizeBefore; 39 UInt32 keepSizeBefore;
38 UInt32 keepSizeAfter; 40 UInt32 keepSizeAfter;
39 41
40 UInt32 numHashBytes; 42 UInt32 numHashBytes;
41 int directInput;
42 size_t directInputRem; 43 size_t directInputRem;
43 int btMode;
44 int bigHash;
45 UInt32 historySize; 44 UInt32 historySize;
46 UInt32 fixedHashSize; 45 UInt32 fixedHashSize;
47 UInt32 hashSizeSum; 46 UInt32 hashSizeSum;
48 UInt32 numSons;
49 SRes result; 47 SRes result;
50 UInt32 crc[256]; 48 UInt32 crc[256];
49 size_t numRefs;
51 } CMatchFinder; 50 } CMatchFinder;
52 51
53 #define Inline_MatchFinder_GetPointerToCurrentPos(p) ((p)->buffer) 52 #define Inline_MatchFinder_GetPointerToCurrentPos(p) ((p)->buffer)
54 #define Inline_MatchFinder_GetIndexByte(p, index) ((p)->buffer[(Int32)(index)])
55 53
56 #define Inline_MatchFinder_GetNumAvailableBytes(p) ((p)->streamPos - (p)->pos) 54 #define Inline_MatchFinder_GetNumAvailableBytes(p) ((p)->streamPos - (p)->pos)
57 55
56 #define Inline_MatchFinder_IsFinishedOK(p) \
57 ((p)->streamEndWasReached \
58 && (p)->streamPos == (p)->pos \
59 && (!(p)->directInput || (p)->directInputRem == 0))
60
58 int MatchFinder_NeedMove(CMatchFinder *p); 61 int MatchFinder_NeedMove(CMatchFinder *p);
59 Byte *MatchFinder_GetPointerToCurrentPos(CMatchFinder *p); 62 Byte *MatchFinder_GetPointerToCurrentPos(CMatchFinder *p);
60 void MatchFinder_MoveBlock(CMatchFinder *p); 63 void MatchFinder_MoveBlock(CMatchFinder *p);
61 void MatchFinder_ReadIfRequired(CMatchFinder *p); 64 void MatchFinder_ReadIfRequired(CMatchFinder *p);
62 65
63 void MatchFinder_Construct(CMatchFinder *p); 66 void MatchFinder_Construct(CMatchFinder *p);
64 67
65 /* Conditions: 68 /* Conditions:
66 historySize <= 3 GB 69 historySize <= 3 GB
67 keepAddBufferBefore + matchMaxLen + keepAddBufferAfter < 511MB 70 keepAddBufferBefore + matchMaxLen + keepAddBufferAfter < 511MB
68 */ 71 */
69 int MatchFinder_Create(CMatchFinder *p, UInt32 historySize, 72 int MatchFinder_Create(CMatchFinder *p, UInt32 historySize,
70 UInt32 keepAddBufferBefore, UInt32 matchMaxLen, UInt32 keepAddBufferAfter, 73 UInt32 keepAddBufferBefore, UInt32 matchMaxLen, UInt32 keepAddBufferAfter,
71 ISzAlloc *alloc); 74 ISzAlloc *alloc);
72 void MatchFinder_Free(CMatchFinder *p, ISzAlloc *alloc); 75 void MatchFinder_Free(CMatchFinder *p, ISzAlloc *alloc);
73 void MatchFinder_Normalize3(UInt32 subValue, CLzRef *items, UInt32 numItems); 76 void MatchFinder_Normalize3(UInt32 subValue, CLzRef *items, size_t numItems);
74 void MatchFinder_ReduceOffsets(CMatchFinder *p, UInt32 subValue); 77 void MatchFinder_ReduceOffsets(CMatchFinder *p, UInt32 subValue);
75 78
76 UInt32 * GetMatchesSpec1(UInt32 lenLimit, UInt32 curMatch, UInt32 pos, const Byt e *buffer, CLzRef *son, 79 UInt32 * GetMatchesSpec1(UInt32 lenLimit, UInt32 curMatch, UInt32 pos, const Byt e *buffer, CLzRef *son,
77 UInt32 _cyclicBufferPos, UInt32 _cyclicBufferSize, UInt32 _cutValue, 80 UInt32 _cyclicBufferPos, UInt32 _cyclicBufferSize, UInt32 _cutValue,
78 UInt32 *distances, UInt32 maxLen); 81 UInt32 *distances, UInt32 maxLen);
79 82
80 /* 83 /*
81 Conditions: 84 Conditions:
82 Mf_GetNumAvailableBytes_Func must be called before each Mf_GetMatchLen_Func. 85 Mf_GetNumAvailableBytes_Func must be called before each Mf_GetMatchLen_Func.
83 Mf_GetPointerToCurrentPos_Func's result must be used only before any other fun ction 86 Mf_GetPointerToCurrentPos_Func's result must be used only before any other fun ction
84 */ 87 */
85 88
86 typedef void (*Mf_Init_Func)(void *object); 89 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); 90 typedef UInt32 (*Mf_GetNumAvailableBytes_Func)(void *object);
89 typedef const Byte * (*Mf_GetPointerToCurrentPos_Func)(void *object); 91 typedef const Byte * (*Mf_GetPointerToCurrentPos_Func)(void *object);
90 typedef UInt32 (*Mf_GetMatches_Func)(void *object, UInt32 *distances); 92 typedef UInt32 (*Mf_GetMatches_Func)(void *object, UInt32 *distances);
91 typedef void (*Mf_Skip_Func)(void *object, UInt32); 93 typedef void (*Mf_Skip_Func)(void *object, UInt32);
92 94
93 typedef struct _IMatchFinder 95 typedef struct _IMatchFinder
94 { 96 {
95 Mf_Init_Func Init; 97 Mf_Init_Func Init;
96 Mf_GetIndexByte_Func GetIndexByte;
97 Mf_GetNumAvailableBytes_Func GetNumAvailableBytes; 98 Mf_GetNumAvailableBytes_Func GetNumAvailableBytes;
98 Mf_GetPointerToCurrentPos_Func GetPointerToCurrentPos; 99 Mf_GetPointerToCurrentPos_Func GetPointerToCurrentPos;
99 Mf_GetMatches_Func GetMatches; 100 Mf_GetMatches_Func GetMatches;
100 Mf_Skip_Func Skip; 101 Mf_Skip_Func Skip;
101 } IMatchFinder; 102 } IMatchFinder;
102 103
103 void MatchFinder_CreateVTable(CMatchFinder *p, IMatchFinder *vTable); 104 void MatchFinder_CreateVTable(CMatchFinder *p, IMatchFinder *vTable);
104 105
106 void MatchFinder_Init_2(CMatchFinder *p, int readData);
105 void MatchFinder_Init(CMatchFinder *p); 107 void MatchFinder_Init(CMatchFinder *p);
108
106 UInt32 Bt3Zip_MatchFinder_GetMatches(CMatchFinder *p, UInt32 *distances); 109 UInt32 Bt3Zip_MatchFinder_GetMatches(CMatchFinder *p, UInt32 *distances);
107 UInt32 Hc3Zip_MatchFinder_GetMatches(CMatchFinder *p, UInt32 *distances); 110 UInt32 Hc3Zip_MatchFinder_GetMatches(CMatchFinder *p, UInt32 *distances);
111
108 void Bt3Zip_MatchFinder_Skip(CMatchFinder *p, UInt32 num); 112 void Bt3Zip_MatchFinder_Skip(CMatchFinder *p, UInt32 num);
109 void Hc3Zip_MatchFinder_Skip(CMatchFinder *p, UInt32 num); 113 void Hc3Zip_MatchFinder_Skip(CMatchFinder *p, UInt32 num);
110 114
111 #ifdef __cplusplus 115 EXTERN_C_END
112 }
113 #endif
114 116
115 #endif 117 #endif
OLDNEW
« no previous file with comments | « third_party/lzma_sdk/Delta.c ('k') | third_party/lzma_sdk/LzFind.c » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698