zstdlib 0.14.0-x64-mingw32 → 0.15.0-x64-mingw32
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGES.md +5 -0
- data/ext/zstdlib_c/extconf.rb +1 -1
- data/ext/zstdlib_c/{zstd-1.5.6 → zstd-1.5.7}/lib/common/bits.h +92 -87
- data/ext/zstdlib_c/{zstd-1.5.6 → zstd-1.5.7}/lib/common/bitstream.h +26 -29
- data/ext/zstdlib_c/{zstd-1.5.6 → zstd-1.5.7}/lib/common/compiler.h +36 -22
- data/ext/zstdlib_c/{zstd-1.5.6 → zstd-1.5.7}/lib/common/cpu.h +1 -1
- data/ext/zstdlib_c/{zstd-1.5.6 → zstd-1.5.7}/lib/common/debug.h +0 -9
- data/ext/zstdlib_c/{zstd-1.5.6 → zstd-1.5.7}/lib/common/error_private.c +1 -0
- data/ext/zstdlib_c/{zstd-1.5.6 → zstd-1.5.7}/lib/common/error_private.h +0 -10
- data/ext/zstdlib_c/{zstd-1.5.6 → zstd-1.5.7}/lib/common/fse.h +2 -17
- data/ext/zstdlib_c/{zstd-1.5.6 → zstd-1.5.7}/lib/common/fse_decompress.c +2 -0
- data/ext/zstdlib_c/{zstd-1.5.6 → zstd-1.5.7}/lib/common/huf.h +0 -9
- data/ext/zstdlib_c/{zstd-1.5.6 → zstd-1.5.7}/lib/common/mem.h +7 -11
- data/ext/zstdlib_c/{zstd-1.5.6 → zstd-1.5.7}/lib/common/pool.h +0 -9
- data/ext/zstdlib_c/{zstd-1.5.6 → zstd-1.5.7}/lib/common/portability_macros.h +22 -9
- data/ext/zstdlib_c/{zstd-1.5.6 → zstd-1.5.7}/lib/common/threading.h +0 -8
- data/ext/zstdlib_c/{zstd-1.5.6 → zstd-1.5.7}/lib/common/xxhash.h +93 -19
- data/ext/zstdlib_c/{zstd-1.5.6 → zstd-1.5.7}/lib/common/zstd_deps.h +12 -0
- data/ext/zstdlib_c/{zstd-1.5.6 → zstd-1.5.7}/lib/common/zstd_internal.h +1 -69
- data/ext/zstdlib_c/{zstd-1.5.6 → zstd-1.5.7}/lib/common/zstd_trace.h +5 -12
- data/ext/zstdlib_c/{zstd-1.5.6 → zstd-1.5.7}/lib/compress/hist.c +10 -0
- data/ext/zstdlib_c/{zstd-1.5.6 → zstd-1.5.7}/lib/compress/hist.h +7 -0
- data/ext/zstdlib_c/{zstd-1.5.6 → zstd-1.5.7}/lib/compress/zstd_compress.c +1057 -367
- data/ext/zstdlib_c/{zstd-1.5.6 → zstd-1.5.7}/lib/compress/zstd_compress_internal.h +227 -125
- data/ext/zstdlib_c/{zstd-1.5.6 → zstd-1.5.7}/lib/compress/zstd_compress_literals.c +1 -1
- data/ext/zstdlib_c/{zstd-1.5.6 → zstd-1.5.7}/lib/compress/zstd_compress_sequences.c +7 -7
- data/ext/zstdlib_c/{zstd-1.5.6 → zstd-1.5.7}/lib/compress/zstd_compress_sequences.h +7 -6
- data/ext/zstdlib_c/{zstd-1.5.6 → zstd-1.5.7}/lib/compress/zstd_compress_superblock.c +17 -17
- data/ext/zstdlib_c/{zstd-1.5.6 → zstd-1.5.7}/lib/compress/zstd_cwksp.h +41 -24
- data/ext/zstdlib_c/{zstd-1.5.6 → zstd-1.5.7}/lib/compress/zstd_double_fast.c +58 -50
- data/ext/zstdlib_c/{zstd-1.5.6 → zstd-1.5.7}/lib/compress/zstd_double_fast.h +4 -12
- data/ext/zstdlib_c/{zstd-1.5.6 → zstd-1.5.7}/lib/compress/zstd_fast.c +91 -74
- data/ext/zstdlib_c/{zstd-1.5.6 → zstd-1.5.7}/lib/compress/zstd_fast.h +4 -12
- data/ext/zstdlib_c/{zstd-1.5.6 → zstd-1.5.7}/lib/compress/zstd_lazy.c +64 -64
- data/ext/zstdlib_c/{zstd-1.5.6 → zstd-1.5.7}/lib/compress/zstd_lazy.h +30 -39
- data/ext/zstdlib_c/{zstd-1.5.6 → zstd-1.5.7}/lib/compress/zstd_ldm.c +48 -33
- data/ext/zstdlib_c/{zstd-1.5.6 → zstd-1.5.7}/lib/compress/zstd_ldm.h +6 -14
- data/ext/zstdlib_c/{zstd-1.5.6 → zstd-1.5.7}/lib/compress/zstd_opt.c +55 -51
- data/ext/zstdlib_c/{zstd-1.5.6 → zstd-1.5.7}/lib/compress/zstd_opt.h +8 -16
- data/ext/zstdlib_c/zstd-1.5.7/lib/compress/zstd_preSplit.c +238 -0
- data/ext/zstdlib_c/zstd-1.5.7/lib/compress/zstd_preSplit.h +33 -0
- data/ext/zstdlib_c/{zstd-1.5.6 → zstd-1.5.7}/lib/compress/zstdmt_compress.c +134 -93
- data/ext/zstdlib_c/{zstd-1.5.6 → zstd-1.5.7}/lib/compress/zstdmt_compress.h +4 -15
- data/ext/zstdlib_c/{zstd-1.5.6 → zstd-1.5.7}/lib/decompress/huf_decompress_amd64.S +10 -3
- data/ext/zstdlib_c/{zstd-1.5.6 → zstd-1.5.7}/lib/decompress/zstd_decompress.c +14 -11
- data/ext/zstdlib_c/{zstd-1.5.6 → zstd-1.5.7}/lib/decompress/zstd_decompress_block.c +6 -12
- data/ext/zstdlib_c/{zstd-1.5.6 → zstd-1.5.7}/lib/decompress/zstd_decompress_internal.h +5 -5
- data/ext/zstdlib_c/{zstd-1.5.6 → zstd-1.5.7}/lib/zdict.h +15 -8
- data/ext/zstdlib_c/{zstd-1.5.6 → zstd-1.5.7}/lib/zstd.h +241 -132
- data/ext/zstdlib_c/{zstd-1.5.6 → zstd-1.5.7}/lib/zstd_errors.h +1 -8
- data/ext/zstdlib_c/{zstd-1.5.6 → zstd-1.5.7}/zlibWrapper/gzwrite.c +2 -1
- data/lib/2.4/zstdlib_c.so +0 -0
- data/lib/2.5/zstdlib_c.so +0 -0
- data/lib/2.6/zstdlib_c.so +0 -0
- data/lib/2.7/zstdlib_c.so +0 -0
- data/lib/3.0/zstdlib_c.so +0 -0
- metadata +75 -73
- data/ext/zstdlib_c/{zstd-1.5.6 → zstd-1.5.7}/lib/common/allocations.h +0 -0
- data/ext/zstdlib_c/{zstd-1.5.6 → zstd-1.5.7}/lib/common/debug.c +0 -0
- data/ext/zstdlib_c/{zstd-1.5.6 → zstd-1.5.7}/lib/common/entropy_common.c +0 -0
- data/ext/zstdlib_c/{zstd-1.5.6 → zstd-1.5.7}/lib/common/pool.c +0 -0
- data/ext/zstdlib_c/{zstd-1.5.6 → zstd-1.5.7}/lib/common/threading.c +0 -0
- data/ext/zstdlib_c/{zstd-1.5.6 → zstd-1.5.7}/lib/common/xxhash.c +0 -0
- data/ext/zstdlib_c/{zstd-1.5.6 → zstd-1.5.7}/lib/common/zstd_common.c +0 -0
- data/ext/zstdlib_c/{zstd-1.5.6 → zstd-1.5.7}/lib/compress/clevels.h +0 -0
- data/ext/zstdlib_c/{zstd-1.5.6 → zstd-1.5.7}/lib/compress/fse_compress.c +0 -0
- data/ext/zstdlib_c/{zstd-1.5.6 → zstd-1.5.7}/lib/compress/huf_compress.c +0 -0
- data/ext/zstdlib_c/{zstd-1.5.6 → zstd-1.5.7}/lib/compress/zstd_compress_literals.h +0 -0
- data/ext/zstdlib_c/{zstd-1.5.6 → zstd-1.5.7}/lib/compress/zstd_compress_superblock.h +0 -0
- data/ext/zstdlib_c/{zstd-1.5.6 → zstd-1.5.7}/lib/compress/zstd_ldm_geartab.h +0 -0
- data/ext/zstdlib_c/{zstd-1.5.6 → zstd-1.5.7}/lib/decompress/huf_decompress.c +0 -0
- data/ext/zstdlib_c/{zstd-1.5.6 → zstd-1.5.7}/lib/decompress/zstd_ddict.c +0 -0
- data/ext/zstdlib_c/{zstd-1.5.6 → zstd-1.5.7}/lib/decompress/zstd_ddict.h +0 -0
- data/ext/zstdlib_c/{zstd-1.5.6 → zstd-1.5.7}/lib/decompress/zstd_decompress_block.h +0 -0
- data/ext/zstdlib_c/{zstd-1.5.6 → zstd-1.5.7}/zlibWrapper/gzclose.c +0 -0
- data/ext/zstdlib_c/{zstd-1.5.6 → zstd-1.5.7}/zlibWrapper/gzcompatibility.h +0 -0
- data/ext/zstdlib_c/{zstd-1.5.6 → zstd-1.5.7}/zlibWrapper/gzguts.h +0 -0
- data/ext/zstdlib_c/{zstd-1.5.6 → zstd-1.5.7}/zlibWrapper/gzlib.c +0 -0
- data/ext/zstdlib_c/{zstd-1.5.6 → zstd-1.5.7}/zlibWrapper/gzread.c +0 -0
- data/ext/zstdlib_c/{zstd-1.5.6 → zstd-1.5.7}/zlibWrapper/zstd_zlibwrapper.c +0 -0
- data/ext/zstdlib_c/{zstd-1.5.6 → zstd-1.5.7}/zlibWrapper/zstd_zlibwrapper.h +5 -5
@@ -11,10 +11,6 @@
|
|
11
11
|
#ifndef ZSTD_LAZY_H
|
12
12
|
#define ZSTD_LAZY_H
|
13
13
|
|
14
|
-
#if defined (__cplusplus)
|
15
|
-
extern "C" {
|
16
|
-
#endif
|
17
|
-
|
18
14
|
#include "zstd_compress_internal.h"
|
19
15
|
|
20
16
|
/**
|
@@ -31,38 +27,38 @@ extern "C" {
|
|
31
27
|
|| !defined(ZSTD_EXCLUDE_LAZY_BLOCK_COMPRESSOR) \
|
32
28
|
|| !defined(ZSTD_EXCLUDE_LAZY2_BLOCK_COMPRESSOR) \
|
33
29
|
|| !defined(ZSTD_EXCLUDE_BTLAZY2_BLOCK_COMPRESSOR)
|
34
|
-
U32 ZSTD_insertAndFindFirstIndex(
|
35
|
-
void ZSTD_row_update(
|
30
|
+
U32 ZSTD_insertAndFindFirstIndex(ZSTD_MatchState_t* ms, const BYTE* ip);
|
31
|
+
void ZSTD_row_update(ZSTD_MatchState_t* const ms, const BYTE* ip);
|
36
32
|
|
37
|
-
void ZSTD_dedicatedDictSearch_lazy_loadDictionary(
|
33
|
+
void ZSTD_dedicatedDictSearch_lazy_loadDictionary(ZSTD_MatchState_t* ms, const BYTE* const ip);
|
38
34
|
|
39
35
|
void ZSTD_preserveUnsortedMark (U32* const table, U32 const size, U32 const reducerValue); /*! used in ZSTD_reduceIndex(). preemptively increase value of ZSTD_DUBT_UNSORTED_MARK */
|
40
36
|
#endif
|
41
37
|
|
42
38
|
#ifndef ZSTD_EXCLUDE_GREEDY_BLOCK_COMPRESSOR
|
43
39
|
size_t ZSTD_compressBlock_greedy(
|
44
|
-
|
40
|
+
ZSTD_MatchState_t* ms, SeqStore_t* seqStore, U32 rep[ZSTD_REP_NUM],
|
45
41
|
void const* src, size_t srcSize);
|
46
42
|
size_t ZSTD_compressBlock_greedy_row(
|
47
|
-
|
43
|
+
ZSTD_MatchState_t* ms, SeqStore_t* seqStore, U32 rep[ZSTD_REP_NUM],
|
48
44
|
void const* src, size_t srcSize);
|
49
45
|
size_t ZSTD_compressBlock_greedy_dictMatchState(
|
50
|
-
|
46
|
+
ZSTD_MatchState_t* ms, SeqStore_t* seqStore, U32 rep[ZSTD_REP_NUM],
|
51
47
|
void const* src, size_t srcSize);
|
52
48
|
size_t ZSTD_compressBlock_greedy_dictMatchState_row(
|
53
|
-
|
49
|
+
ZSTD_MatchState_t* ms, SeqStore_t* seqStore, U32 rep[ZSTD_REP_NUM],
|
54
50
|
void const* src, size_t srcSize);
|
55
51
|
size_t ZSTD_compressBlock_greedy_dedicatedDictSearch(
|
56
|
-
|
52
|
+
ZSTD_MatchState_t* ms, SeqStore_t* seqStore, U32 rep[ZSTD_REP_NUM],
|
57
53
|
void const* src, size_t srcSize);
|
58
54
|
size_t ZSTD_compressBlock_greedy_dedicatedDictSearch_row(
|
59
|
-
|
55
|
+
ZSTD_MatchState_t* ms, SeqStore_t* seqStore, U32 rep[ZSTD_REP_NUM],
|
60
56
|
void const* src, size_t srcSize);
|
61
57
|
size_t ZSTD_compressBlock_greedy_extDict(
|
62
|
-
|
58
|
+
ZSTD_MatchState_t* ms, SeqStore_t* seqStore, U32 rep[ZSTD_REP_NUM],
|
63
59
|
void const* src, size_t srcSize);
|
64
60
|
size_t ZSTD_compressBlock_greedy_extDict_row(
|
65
|
-
|
61
|
+
ZSTD_MatchState_t* ms, SeqStore_t* seqStore, U32 rep[ZSTD_REP_NUM],
|
66
62
|
void const* src, size_t srcSize);
|
67
63
|
|
68
64
|
#define ZSTD_COMPRESSBLOCK_GREEDY ZSTD_compressBlock_greedy
|
@@ -86,28 +82,28 @@ size_t ZSTD_compressBlock_greedy_extDict_row(
|
|
86
82
|
|
87
83
|
#ifndef ZSTD_EXCLUDE_LAZY_BLOCK_COMPRESSOR
|
88
84
|
size_t ZSTD_compressBlock_lazy(
|
89
|
-
|
85
|
+
ZSTD_MatchState_t* ms, SeqStore_t* seqStore, U32 rep[ZSTD_REP_NUM],
|
90
86
|
void const* src, size_t srcSize);
|
91
87
|
size_t ZSTD_compressBlock_lazy_row(
|
92
|
-
|
88
|
+
ZSTD_MatchState_t* ms, SeqStore_t* seqStore, U32 rep[ZSTD_REP_NUM],
|
93
89
|
void const* src, size_t srcSize);
|
94
90
|
size_t ZSTD_compressBlock_lazy_dictMatchState(
|
95
|
-
|
91
|
+
ZSTD_MatchState_t* ms, SeqStore_t* seqStore, U32 rep[ZSTD_REP_NUM],
|
96
92
|
void const* src, size_t srcSize);
|
97
93
|
size_t ZSTD_compressBlock_lazy_dictMatchState_row(
|
98
|
-
|
94
|
+
ZSTD_MatchState_t* ms, SeqStore_t* seqStore, U32 rep[ZSTD_REP_NUM],
|
99
95
|
void const* src, size_t srcSize);
|
100
96
|
size_t ZSTD_compressBlock_lazy_dedicatedDictSearch(
|
101
|
-
|
97
|
+
ZSTD_MatchState_t* ms, SeqStore_t* seqStore, U32 rep[ZSTD_REP_NUM],
|
102
98
|
void const* src, size_t srcSize);
|
103
99
|
size_t ZSTD_compressBlock_lazy_dedicatedDictSearch_row(
|
104
|
-
|
100
|
+
ZSTD_MatchState_t* ms, SeqStore_t* seqStore, U32 rep[ZSTD_REP_NUM],
|
105
101
|
void const* src, size_t srcSize);
|
106
102
|
size_t ZSTD_compressBlock_lazy_extDict(
|
107
|
-
|
103
|
+
ZSTD_MatchState_t* ms, SeqStore_t* seqStore, U32 rep[ZSTD_REP_NUM],
|
108
104
|
void const* src, size_t srcSize);
|
109
105
|
size_t ZSTD_compressBlock_lazy_extDict_row(
|
110
|
-
|
106
|
+
ZSTD_MatchState_t* ms, SeqStore_t* seqStore, U32 rep[ZSTD_REP_NUM],
|
111
107
|
void const* src, size_t srcSize);
|
112
108
|
|
113
109
|
#define ZSTD_COMPRESSBLOCK_LAZY ZSTD_compressBlock_lazy
|
@@ -131,28 +127,28 @@ size_t ZSTD_compressBlock_lazy_extDict_row(
|
|
131
127
|
|
132
128
|
#ifndef ZSTD_EXCLUDE_LAZY2_BLOCK_COMPRESSOR
|
133
129
|
size_t ZSTD_compressBlock_lazy2(
|
134
|
-
|
130
|
+
ZSTD_MatchState_t* ms, SeqStore_t* seqStore, U32 rep[ZSTD_REP_NUM],
|
135
131
|
void const* src, size_t srcSize);
|
136
132
|
size_t ZSTD_compressBlock_lazy2_row(
|
137
|
-
|
133
|
+
ZSTD_MatchState_t* ms, SeqStore_t* seqStore, U32 rep[ZSTD_REP_NUM],
|
138
134
|
void const* src, size_t srcSize);
|
139
135
|
size_t ZSTD_compressBlock_lazy2_dictMatchState(
|
140
|
-
|
136
|
+
ZSTD_MatchState_t* ms, SeqStore_t* seqStore, U32 rep[ZSTD_REP_NUM],
|
141
137
|
void const* src, size_t srcSize);
|
142
138
|
size_t ZSTD_compressBlock_lazy2_dictMatchState_row(
|
143
|
-
|
139
|
+
ZSTD_MatchState_t* ms, SeqStore_t* seqStore, U32 rep[ZSTD_REP_NUM],
|
144
140
|
void const* src, size_t srcSize);
|
145
141
|
size_t ZSTD_compressBlock_lazy2_dedicatedDictSearch(
|
146
|
-
|
142
|
+
ZSTD_MatchState_t* ms, SeqStore_t* seqStore, U32 rep[ZSTD_REP_NUM],
|
147
143
|
void const* src, size_t srcSize);
|
148
144
|
size_t ZSTD_compressBlock_lazy2_dedicatedDictSearch_row(
|
149
|
-
|
145
|
+
ZSTD_MatchState_t* ms, SeqStore_t* seqStore, U32 rep[ZSTD_REP_NUM],
|
150
146
|
void const* src, size_t srcSize);
|
151
147
|
size_t ZSTD_compressBlock_lazy2_extDict(
|
152
|
-
|
148
|
+
ZSTD_MatchState_t* ms, SeqStore_t* seqStore, U32 rep[ZSTD_REP_NUM],
|
153
149
|
void const* src, size_t srcSize);
|
154
150
|
size_t ZSTD_compressBlock_lazy2_extDict_row(
|
155
|
-
|
151
|
+
ZSTD_MatchState_t* ms, SeqStore_t* seqStore, U32 rep[ZSTD_REP_NUM],
|
156
152
|
void const* src, size_t srcSize);
|
157
153
|
|
158
154
|
#define ZSTD_COMPRESSBLOCK_LAZY2 ZSTD_compressBlock_lazy2
|
@@ -176,13 +172,13 @@ size_t ZSTD_compressBlock_lazy2_extDict_row(
|
|
176
172
|
|
177
173
|
#ifndef ZSTD_EXCLUDE_BTLAZY2_BLOCK_COMPRESSOR
|
178
174
|
size_t ZSTD_compressBlock_btlazy2(
|
179
|
-
|
175
|
+
ZSTD_MatchState_t* ms, SeqStore_t* seqStore, U32 rep[ZSTD_REP_NUM],
|
180
176
|
void const* src, size_t srcSize);
|
181
177
|
size_t ZSTD_compressBlock_btlazy2_dictMatchState(
|
182
|
-
|
178
|
+
ZSTD_MatchState_t* ms, SeqStore_t* seqStore, U32 rep[ZSTD_REP_NUM],
|
183
179
|
void const* src, size_t srcSize);
|
184
180
|
size_t ZSTD_compressBlock_btlazy2_extDict(
|
185
|
-
|
181
|
+
ZSTD_MatchState_t* ms, SeqStore_t* seqStore, U32 rep[ZSTD_REP_NUM],
|
186
182
|
void const* src, size_t srcSize);
|
187
183
|
|
188
184
|
#define ZSTD_COMPRESSBLOCK_BTLAZY2 ZSTD_compressBlock_btlazy2
|
@@ -194,9 +190,4 @@ size_t ZSTD_compressBlock_btlazy2_extDict(
|
|
194
190
|
#define ZSTD_COMPRESSBLOCK_BTLAZY2_EXTDICT NULL
|
195
191
|
#endif
|
196
192
|
|
197
|
-
|
198
|
-
#if defined (__cplusplus)
|
199
|
-
}
|
200
|
-
#endif
|
201
|
-
|
202
193
|
#endif /* ZSTD_LAZY_H */
|
@@ -16,7 +16,7 @@
|
|
16
16
|
#include "zstd_double_fast.h" /* ZSTD_fillDoubleHashTable() */
|
17
17
|
#include "zstd_ldm_geartab.h"
|
18
18
|
|
19
|
-
#define LDM_BUCKET_SIZE_LOG
|
19
|
+
#define LDM_BUCKET_SIZE_LOG 4
|
20
20
|
#define LDM_MIN_MATCH_LENGTH 64
|
21
21
|
#define LDM_HASH_RLOG 7
|
22
22
|
|
@@ -133,21 +133,35 @@ done:
|
|
133
133
|
}
|
134
134
|
|
135
135
|
void ZSTD_ldm_adjustParameters(ldmParams_t* params,
|
136
|
-
|
136
|
+
const ZSTD_compressionParameters* cParams)
|
137
137
|
{
|
138
138
|
params->windowLog = cParams->windowLog;
|
139
139
|
ZSTD_STATIC_ASSERT(LDM_BUCKET_SIZE_LOG <= ZSTD_LDM_BUCKETSIZELOG_MAX);
|
140
140
|
DEBUGLOG(4, "ZSTD_ldm_adjustParameters");
|
141
|
-
if (
|
142
|
-
|
141
|
+
if (params->hashRateLog == 0) {
|
142
|
+
if (params->hashLog > 0) {
|
143
|
+
/* if params->hashLog is set, derive hashRateLog from it */
|
144
|
+
assert(params->hashLog <= ZSTD_HASHLOG_MAX);
|
145
|
+
if (params->windowLog > params->hashLog) {
|
146
|
+
params->hashRateLog = params->windowLog - params->hashLog;
|
147
|
+
}
|
148
|
+
} else {
|
149
|
+
assert(1 <= (int)cParams->strategy && (int)cParams->strategy <= 9);
|
150
|
+
/* mapping from [fast, rate7] to [btultra2, rate4] */
|
151
|
+
params->hashRateLog = 7 - (cParams->strategy/3);
|
152
|
+
}
|
153
|
+
}
|
143
154
|
if (params->hashLog == 0) {
|
144
|
-
params->hashLog =
|
145
|
-
assert(params->hashLog <= ZSTD_HASHLOG_MAX);
|
155
|
+
params->hashLog = BOUNDED(ZSTD_HASHLOG_MIN, params->windowLog - params->hashRateLog, ZSTD_HASHLOG_MAX);
|
146
156
|
}
|
147
|
-
if (params->
|
148
|
-
params->
|
149
|
-
|
150
|
-
|
157
|
+
if (params->minMatchLength == 0) {
|
158
|
+
params->minMatchLength = LDM_MIN_MATCH_LENGTH;
|
159
|
+
if (cParams->strategy >= ZSTD_btultra)
|
160
|
+
params->minMatchLength /= 2;
|
161
|
+
}
|
162
|
+
if (params->bucketSizeLog==0) {
|
163
|
+
assert(1 <= (int)cParams->strategy && (int)cParams->strategy <= 9);
|
164
|
+
params->bucketSizeLog = BOUNDED(LDM_BUCKET_SIZE_LOG, (U32)cParams->strategy, ZSTD_LDM_BUCKETSIZELOG_MAX);
|
151
165
|
}
|
152
166
|
params->bucketSizeLog = MIN(params->bucketSizeLog, params->hashLog);
|
153
167
|
}
|
@@ -170,22 +184,22 @@ size_t ZSTD_ldm_getMaxNbSeq(ldmParams_t params, size_t maxChunkSize)
|
|
170
184
|
/** ZSTD_ldm_getBucket() :
|
171
185
|
* Returns a pointer to the start of the bucket associated with hash. */
|
172
186
|
static ldmEntry_t* ZSTD_ldm_getBucket(
|
173
|
-
ldmState_t* ldmState, size_t hash,
|
187
|
+
const ldmState_t* ldmState, size_t hash, U32 const bucketSizeLog)
|
174
188
|
{
|
175
|
-
return ldmState->hashTable + (hash <<
|
189
|
+
return ldmState->hashTable + (hash << bucketSizeLog);
|
176
190
|
}
|
177
191
|
|
178
192
|
/** ZSTD_ldm_insertEntry() :
|
179
193
|
* Insert the entry with corresponding hash into the hash table */
|
180
194
|
static void ZSTD_ldm_insertEntry(ldmState_t* ldmState,
|
181
195
|
size_t const hash, const ldmEntry_t entry,
|
182
|
-
|
196
|
+
U32 const bucketSizeLog)
|
183
197
|
{
|
184
198
|
BYTE* const pOffset = ldmState->bucketOffsets + hash;
|
185
199
|
unsigned const offset = *pOffset;
|
186
200
|
|
187
|
-
*(ZSTD_ldm_getBucket(ldmState, hash,
|
188
|
-
*pOffset = (BYTE)((offset + 1) & ((1u <<
|
201
|
+
*(ZSTD_ldm_getBucket(ldmState, hash, bucketSizeLog) + offset) = entry;
|
202
|
+
*pOffset = (BYTE)((offset + 1) & ((1u << bucketSizeLog) - 1));
|
189
203
|
|
190
204
|
}
|
191
205
|
|
@@ -234,7 +248,7 @@ static size_t ZSTD_ldm_countBackwardsMatch_2segments(
|
|
234
248
|
*
|
235
249
|
* The tables for the other strategies are filled within their
|
236
250
|
* block compressors. */
|
237
|
-
static size_t ZSTD_ldm_fillFastTables(
|
251
|
+
static size_t ZSTD_ldm_fillFastTables(ZSTD_MatchState_t* ms,
|
238
252
|
void const* end)
|
239
253
|
{
|
240
254
|
const BYTE* const iend = (const BYTE*)end;
|
@@ -273,7 +287,8 @@ void ZSTD_ldm_fillHashTable(
|
|
273
287
|
const BYTE* iend, ldmParams_t const* params)
|
274
288
|
{
|
275
289
|
U32 const minMatchLength = params->minMatchLength;
|
276
|
-
U32 const
|
290
|
+
U32 const bucketSizeLog = params->bucketSizeLog;
|
291
|
+
U32 const hBits = params->hashLog - bucketSizeLog;
|
277
292
|
BYTE const* const base = ldmState->window.base;
|
278
293
|
BYTE const* const istart = ip;
|
279
294
|
ldmRollingHashState_t hashState;
|
@@ -288,7 +303,7 @@ void ZSTD_ldm_fillHashTable(
|
|
288
303
|
unsigned n;
|
289
304
|
|
290
305
|
numSplits = 0;
|
291
|
-
hashed = ZSTD_ldm_gear_feed(&hashState, ip, iend - ip, splits, &numSplits);
|
306
|
+
hashed = ZSTD_ldm_gear_feed(&hashState, ip, (size_t)(iend - ip), splits, &numSplits);
|
292
307
|
|
293
308
|
for (n = 0; n < numSplits; n++) {
|
294
309
|
if (ip + splits[n] >= istart + minMatchLength) {
|
@@ -299,7 +314,7 @@ void ZSTD_ldm_fillHashTable(
|
|
299
314
|
|
300
315
|
entry.offset = (U32)(split - base);
|
301
316
|
entry.checksum = (U32)(xxhash >> 32);
|
302
|
-
ZSTD_ldm_insertEntry(ldmState, hash, entry,
|
317
|
+
ZSTD_ldm_insertEntry(ldmState, hash, entry, params->bucketSizeLog);
|
303
318
|
}
|
304
319
|
}
|
305
320
|
|
@@ -313,7 +328,7 @@ void ZSTD_ldm_fillHashTable(
|
|
313
328
|
* Sets cctx->nextToUpdate to a position corresponding closer to anchor
|
314
329
|
* if it is far way
|
315
330
|
* (after a long match, only update tables a limited amount). */
|
316
|
-
static void ZSTD_ldm_limitTableUpdate(
|
331
|
+
static void ZSTD_ldm_limitTableUpdate(ZSTD_MatchState_t* ms, const BYTE* anchor)
|
317
332
|
{
|
318
333
|
U32 const curr = (U32)(anchor - ms->window.base);
|
319
334
|
if (curr > ms->nextToUpdate + 1024) {
|
@@ -325,7 +340,7 @@ static void ZSTD_ldm_limitTableUpdate(ZSTD_matchState_t* ms, const BYTE* anchor)
|
|
325
340
|
static
|
326
341
|
ZSTD_ALLOW_POINTER_OVERFLOW_ATTR
|
327
342
|
size_t ZSTD_ldm_generateSequences_internal(
|
328
|
-
ldmState_t* ldmState,
|
343
|
+
ldmState_t* ldmState, RawSeqStore_t* rawSeqStore,
|
329
344
|
ldmParams_t const* params, void const* src, size_t srcSize)
|
330
345
|
{
|
331
346
|
/* LDM parameters */
|
@@ -379,7 +394,7 @@ size_t ZSTD_ldm_generateSequences_internal(
|
|
379
394
|
candidates[n].split = split;
|
380
395
|
candidates[n].hash = hash;
|
381
396
|
candidates[n].checksum = (U32)(xxhash >> 32);
|
382
|
-
candidates[n].bucket = ZSTD_ldm_getBucket(ldmState, hash,
|
397
|
+
candidates[n].bucket = ZSTD_ldm_getBucket(ldmState, hash, params->bucketSizeLog);
|
383
398
|
PREFETCH_L1(candidates[n].bucket);
|
384
399
|
}
|
385
400
|
|
@@ -402,7 +417,7 @@ size_t ZSTD_ldm_generateSequences_internal(
|
|
402
417
|
* the previous one, we merely register it in the hash table and
|
403
418
|
* move on */
|
404
419
|
if (split < anchor) {
|
405
|
-
ZSTD_ldm_insertEntry(ldmState, hash, newEntry,
|
420
|
+
ZSTD_ldm_insertEntry(ldmState, hash, newEntry, params->bucketSizeLog);
|
406
421
|
continue;
|
407
422
|
}
|
408
423
|
|
@@ -449,7 +464,7 @@ size_t ZSTD_ldm_generateSequences_internal(
|
|
449
464
|
/* No match found -- insert an entry into the hash table
|
450
465
|
* and process the next candidate match */
|
451
466
|
if (bestEntry == NULL) {
|
452
|
-
ZSTD_ldm_insertEntry(ldmState, hash, newEntry,
|
467
|
+
ZSTD_ldm_insertEntry(ldmState, hash, newEntry, params->bucketSizeLog);
|
453
468
|
continue;
|
454
469
|
}
|
455
470
|
|
@@ -470,7 +485,7 @@ size_t ZSTD_ldm_generateSequences_internal(
|
|
470
485
|
|
471
486
|
/* Insert the current entry into the hash table --- it must be
|
472
487
|
* done after the previous block to avoid clobbering bestEntry */
|
473
|
-
ZSTD_ldm_insertEntry(ldmState, hash, newEntry,
|
488
|
+
ZSTD_ldm_insertEntry(ldmState, hash, newEntry, params->bucketSizeLog);
|
474
489
|
|
475
490
|
anchor = split + forwardMatchLength;
|
476
491
|
|
@@ -509,7 +524,7 @@ static void ZSTD_ldm_reduceTable(ldmEntry_t* const table, U32 const size,
|
|
509
524
|
}
|
510
525
|
|
511
526
|
size_t ZSTD_ldm_generateSequences(
|
512
|
-
ldmState_t* ldmState,
|
527
|
+
ldmState_t* ldmState, RawSeqStore_t* sequences,
|
513
528
|
ldmParams_t const* params, void const* src, size_t srcSize)
|
514
529
|
{
|
515
530
|
U32 const maxDist = 1U << params->windowLog;
|
@@ -586,7 +601,7 @@ size_t ZSTD_ldm_generateSequences(
|
|
586
601
|
}
|
587
602
|
|
588
603
|
void
|
589
|
-
ZSTD_ldm_skipSequences(
|
604
|
+
ZSTD_ldm_skipSequences(RawSeqStore_t* rawSeqStore, size_t srcSize, U32 const minMatch)
|
590
605
|
{
|
591
606
|
while (srcSize > 0 && rawSeqStore->pos < rawSeqStore->size) {
|
592
607
|
rawSeq* seq = rawSeqStore->seq + rawSeqStore->pos;
|
@@ -622,7 +637,7 @@ ZSTD_ldm_skipSequences(rawSeqStore_t* rawSeqStore, size_t srcSize, U32 const min
|
|
622
637
|
* Returns the current sequence to handle, or if the rest of the block should
|
623
638
|
* be literals, it returns a sequence with offset == 0.
|
624
639
|
*/
|
625
|
-
static rawSeq maybeSplitSequence(
|
640
|
+
static rawSeq maybeSplitSequence(RawSeqStore_t* rawSeqStore,
|
626
641
|
U32 const remaining, U32 const minMatch)
|
627
642
|
{
|
628
643
|
rawSeq sequence = rawSeqStore->seq[rawSeqStore->pos];
|
@@ -646,7 +661,7 @@ static rawSeq maybeSplitSequence(rawSeqStore_t* rawSeqStore,
|
|
646
661
|
return sequence;
|
647
662
|
}
|
648
663
|
|
649
|
-
void ZSTD_ldm_skipRawSeqStoreBytes(
|
664
|
+
void ZSTD_ldm_skipRawSeqStoreBytes(RawSeqStore_t* rawSeqStore, size_t nbBytes) {
|
650
665
|
U32 currPos = (U32)(rawSeqStore->posInSequence + nbBytes);
|
651
666
|
while (currPos && rawSeqStore->pos < rawSeqStore->size) {
|
652
667
|
rawSeq currSeq = rawSeqStore->seq[rawSeqStore->pos];
|
@@ -663,14 +678,14 @@ void ZSTD_ldm_skipRawSeqStoreBytes(rawSeqStore_t* rawSeqStore, size_t nbBytes) {
|
|
663
678
|
}
|
664
679
|
}
|
665
680
|
|
666
|
-
size_t ZSTD_ldm_blockCompress(
|
667
|
-
|
668
|
-
|
681
|
+
size_t ZSTD_ldm_blockCompress(RawSeqStore_t* rawSeqStore,
|
682
|
+
ZSTD_MatchState_t* ms, SeqStore_t* seqStore, U32 rep[ZSTD_REP_NUM],
|
683
|
+
ZSTD_ParamSwitch_e useRowMatchFinder,
|
669
684
|
void const* src, size_t srcSize)
|
670
685
|
{
|
671
686
|
const ZSTD_compressionParameters* const cParams = &ms->cParams;
|
672
687
|
unsigned const minMatch = cParams->minMatch;
|
673
|
-
|
688
|
+
ZSTD_BlockCompressor_f const blockCompressor =
|
674
689
|
ZSTD_selectBlockCompressor(cParams->strategy, useRowMatchFinder, ZSTD_matchState_dictMode(ms));
|
675
690
|
/* Input bounds */
|
676
691
|
BYTE const* const istart = (BYTE const*)src;
|
@@ -11,10 +11,6 @@
|
|
11
11
|
#ifndef ZSTD_LDM_H
|
12
12
|
#define ZSTD_LDM_H
|
13
13
|
|
14
|
-
#if defined (__cplusplus)
|
15
|
-
extern "C" {
|
16
|
-
#endif
|
17
|
-
|
18
14
|
#include "zstd_compress_internal.h" /* ldmParams_t, U32 */
|
19
15
|
#include "../zstd.h" /* ZSTD_CCtx, size_t */
|
20
16
|
|
@@ -43,7 +39,7 @@ void ZSTD_ldm_fillHashTable(
|
|
43
39
|
* sequences.
|
44
40
|
*/
|
45
41
|
size_t ZSTD_ldm_generateSequences(
|
46
|
-
ldmState_t* ldms,
|
42
|
+
ldmState_t* ldms, RawSeqStore_t* sequences,
|
47
43
|
ldmParams_t const* params, void const* src, size_t srcSize);
|
48
44
|
|
49
45
|
/**
|
@@ -64,9 +60,9 @@ size_t ZSTD_ldm_generateSequences(
|
|
64
60
|
* two. We handle that case correctly, and update `rawSeqStore` appropriately.
|
65
61
|
* NOTE: This function does not return any errors.
|
66
62
|
*/
|
67
|
-
size_t ZSTD_ldm_blockCompress(
|
68
|
-
|
69
|
-
|
63
|
+
size_t ZSTD_ldm_blockCompress(RawSeqStore_t* rawSeqStore,
|
64
|
+
ZSTD_MatchState_t* ms, SeqStore_t* seqStore, U32 rep[ZSTD_REP_NUM],
|
65
|
+
ZSTD_ParamSwitch_e useRowMatchFinder,
|
70
66
|
void const* src, size_t srcSize);
|
71
67
|
|
72
68
|
/**
|
@@ -76,7 +72,7 @@ size_t ZSTD_ldm_blockCompress(rawSeqStore_t* rawSeqStore,
|
|
76
72
|
* Avoids emitting matches less than `minMatch` bytes.
|
77
73
|
* Must be called for data that is not passed to ZSTD_ldm_blockCompress().
|
78
74
|
*/
|
79
|
-
void ZSTD_ldm_skipSequences(
|
75
|
+
void ZSTD_ldm_skipSequences(RawSeqStore_t* rawSeqStore, size_t srcSize,
|
80
76
|
U32 const minMatch);
|
81
77
|
|
82
78
|
/* ZSTD_ldm_skipRawSeqStoreBytes():
|
@@ -84,7 +80,7 @@ void ZSTD_ldm_skipSequences(rawSeqStore_t* rawSeqStore, size_t srcSize,
|
|
84
80
|
* Not to be used in conjunction with ZSTD_ldm_skipSequences().
|
85
81
|
* Must be called for data with is not passed to ZSTD_ldm_blockCompress().
|
86
82
|
*/
|
87
|
-
void ZSTD_ldm_skipRawSeqStoreBytes(
|
83
|
+
void ZSTD_ldm_skipRawSeqStoreBytes(RawSeqStore_t* rawSeqStore, size_t nbBytes);
|
88
84
|
|
89
85
|
/** ZSTD_ldm_getTableSize() :
|
90
86
|
* Estimate the space needed for long distance matching tables or 0 if LDM is
|
@@ -110,8 +106,4 @@ size_t ZSTD_ldm_getMaxNbSeq(ldmParams_t params, size_t maxChunkSize);
|
|
110
106
|
void ZSTD_ldm_adjustParameters(ldmParams_t* params,
|
111
107
|
ZSTD_compressionParameters const* cParams);
|
112
108
|
|
113
|
-
#if defined (__cplusplus)
|
114
|
-
}
|
115
|
-
#endif
|
116
|
-
|
117
109
|
#endif /* ZSTD_FAST_H */
|