static size_t ZSTD_ldm_initializeParameters(ldmParams_t* params, U32 enableLdm)
{
- assert(LDM_BUCKET_SIZE_LOG <= ZSTD_LDM_BUCKETSIZELOG_MAX);
+ ZSTD_STATIC_ASSERT(LDM_BUCKET_SIZE_LOG <= ZSTD_LDM_BUCKETSIZELOG_MAX);
params->enableLdm = enableLdm>0;
params->hashLog = LDM_HASH_LOG;
params->bucketSizeLog = LDM_BUCKET_SIZE_LOG;
}
ip += rLength;
anchor = ip;
-
- continue; /* faster when present ... (?) */
}
}
const U32 current = (U32)(istart-base);
size_t lastLLSize;
const BYTE* anchor;
+ U32 const extDict = zc->lowLimit < zc->dictLimit;
const ZSTD_blockCompressor blockCompressor =
- zc->appliedParams.ldmParams.enableLdm ?
- (zc->lowLimit < zc->dictLimit ? ZSTD_compressBlock_ldm_extDict :
- ZSTD_compressBlock_ldm) :
- ZSTD_selectBlockCompressor(zc->appliedParams.cParams.strategy,
- zc->lowLimit < zc->dictLimit);
+ zc->appliedParams.ldmParams.enableLdm
+ ? (extDict ? ZSTD_compressBlock_ldm_extDict : ZSTD_compressBlock_ldm)
+ : ZSTD_selectBlockCompressor(zc->appliedParams.cParams.strategy, extDict);
if (srcSize < MIN_CBLOCK_SIZE+ZSTD_blockHeaderSize+1) return 0; /* don't even attempt compression below a certain srcSize */
ZSTD_resetSeqStore(&(zc->seqStore));
/* advanced parameters - may not remain available after API update */
ZSTD_p_forceMaxWindow=1100, /* Force back-reference distances to remain < windowSize,
* even when referencing into Dictionary content (default:0) */
- ZSTD_p_enableLongDistanceMatching, /* Enable long distance matching.
+ ZSTD_p_enableLongDistanceMatching=1200, /* Enable long distance matching.
* This parameter is designed to improve the compression
* ratio for large inputs with long distance matches.
* This increases the memory usage as well as window size.
The minimum \fIovlog\fR is 0, and the maximum is 9\. 0 means "no overlap", hence completely independent jobs\. 9 means "full overlap", meaning up to \fBwindowSize\fR is reloaded from previous job\. Reducing \fIovlog\fR by 1 reduces the amount of reload by a factor 2\. Default \fIovlog\fR is 6, which means "reload \fBwindowSize / 8\fR"\. Exception : the maximum compression level (22) has a default \fIovlog\fR of 9\.
.
.TP
-\fBldmHashLog\fR=\fIldmHlog\fR, \fBldmHlog\fR=\fIldmHlog\fR
+\fBldmHashLog\fR=\fIldmhlog\fR, \fBldmhlog\fR=\fIldmhlog\fR
Specify the maximum size for a hash table used for long distance matching\.
.
.IP
Bigger hash tables usually improve compression ratio at the expense of more memory during compression and a decrease in compression speed\.
.
.IP
-The minimum \fIldmHlog\fR is 6 and the maximum is 26 (default: 20)\.
+The minimum \fIldmhlog\fR is 6 and the maximum is 26 (default: 20)\.
.
.TP
-\fBldmSearchLength\fR=\fIldmSlen\fR, \fBldmSlen\fR=\fIldmSlen\fR
+\fBldmSearchLength\fR=\fIldmslen\fR, \fBldmSlen\fR=\fIldmslen\fR
Specify the minimum searched length of a match for long distance matching\.
.
.IP
Larger/very small values usually decrease compression ratio\.
.
.IP
-The minumum \fIldmSlen\fR is 4 and the maximum is 4096 (default: 64)\.
+The minumum \fIldmslen\fR is 4 and the maximum is 4096 (default: 64)\.
.
.TP
-\fBldmBucketSizeLog\fR=\fIldmBucketSizeLog\fR
+\fBldmBucketSizeLog\fR=\fIldmblog\fR, \fBldmblog\fR=\fIldmblog\fR
Specify the size of each bucket for the hash table used for long distance matching\.
.
.IP
Larger bucket sizes improve collision resolution but decrease compression speed\.
.
.IP
-The minimum \fIldmBucketSizeLog\fR is 0 and the maximum is 8 (default: 3)\.
+The minimum \fIldmblog\fR is 0 and the maximum is 8 (default: 3)\.
.
.TP
-\fBldmHashEveryLog\fR=\fIldmHashEveryLog\fR
+\fBldmHashEveryLog\fR=\fIldmhevery\fR, \fBldmhevery\fR=\fIldmhevery\fR
Specify the frequency of inserting entries into the long distance matching hash table\.
.
.IP
Larger values will improve compression speed\. Deviating far from the default value will likely result in a decrease in compression ratio\.
.
.IP
-The default value is \fBwLog \- ldmHlog\fR\.
+The default value is \fBwlog \- ldmhlog\fR\.
.
.SS "\-B#:"
Select the size of each compression job\. This parameter is available only when multi\-threading is enabled\. Default value is \fB4 * windowSize\fR, which means it varies depending on compression level\. \fB\-B#\fR makes it possible to select a custom value\. Note that job size must respect a minimum value which is enforced transparently\. This minimum is either 1 MB, or \fBoverlapSize\fR, whichever is largest\.
Default _ovlog_ is 6, which means "reload `windowSize / 8`".
Exception : the maximum compression level (22) has a default _ovlog_ of 9.
-- `ldmHashLog`=_ldmHlog_, `ldmHlog`=_ldmHlog_:
+- `ldmHashLog`=_ldmhlog_, `ldmhlog`=_ldmhlog_:
Specify the maximum size for a hash table used for long distance matching.
This option is ignored unless long distance matching is enabled.
Bigger hash tables usually improve compression ratio at the expense of more
memory during compression and a decrease in compression speed.
- The minimum _ldmHlog_ is 6 and the maximum is 26 (default: 20).
+ The minimum _ldmhlog_ is 6 and the maximum is 26 (default: 20).
-- `ldmSearchLength`=_ldmSlen_, `ldmSlen`=_ldmSlen_:
+- `ldmSearchLength`=_ldmslen_, `ldmslen`=_ldmslen_:
Specify the minimum searched length of a match for long distance matching.
This option is ignored unless long distance matching is enabled.
Larger/very small values usually decrease compression ratio.
- The minumum _ldmSlen_ is 4 and the maximum is 4096 (default: 64).
+ The minumum _ldmslen_ is 4 and the maximum is 4096 (default: 64).
-- `ldmBucketSizeLog`=_ldmBucketSizeLog_:
+- `ldmBucketSizeLog`=_ldmblog_, `ldmblog`=_ldmblog_:
Specify the size of each bucket for the hash table used for long distance
matching.
Larger bucket sizes improve collision resolution but decrease compression
speed.
- The minimum _ldmBucketSizeLog_ is 0 and the maximum is 8 (default: 3).
+ The minimum _ldmblog_ is 0 and the maximum is 8 (default: 3).
-- `ldmHashEveryLog`=_ldmHashEveryLog_:
+- `ldmHashEveryLog`=_ldmhevery_, `ldmhevery`=_ldmhevery_:
Specify the frequency of inserting entries into the long distance matching
hash table.
Larger values will improve compression speed. Deviating far from the
default value will likely result in a decrease in compression ratio.
- The default value is `wLog - ldmHlog`.
-
+ The default value is `wlog - ldmhlog`.
+
### -B#:
Select the size of each compression job.
This parameter is available only when multi-threading is enabled.
if (longCommandWArg(&stringPtr, "targetLength=") || longCommandWArg(&stringPtr, "tlen=")) { params->targetLength = readU32FromChar(&stringPtr); if (stringPtr[0]==',') { stringPtr++; continue; } else break; }
if (longCommandWArg(&stringPtr, "strategy=") || longCommandWArg(&stringPtr, "strat=")) { params->strategy = (ZSTD_strategy)(readU32FromChar(&stringPtr)); if (stringPtr[0]==',') { stringPtr++; continue; } else break; }
if (longCommandWArg(&stringPtr, "overlapLog=") || longCommandWArg(&stringPtr, "ovlog=")) { g_overlapLog = readU32FromChar(&stringPtr); if (stringPtr[0]==',') { stringPtr++; continue; } else break; }
- if (longCommandWArg(&stringPtr, "ldmHashLog=") || longCommandWArg(&stringPtr, "ldmHlog=")) { g_ldmHashLog = readU32FromChar(&stringPtr); if (stringPtr[0]==',') { stringPtr++; continue; } else break; }
- if (longCommandWArg(&stringPtr, "ldmSearchLength=") || longCommandWArg(&stringPtr, "ldmSlen=")) { g_ldmMinMatch = readU32FromChar(&stringPtr); if (stringPtr[0]==',') { stringPtr++; continue; } else break; }
- if (longCommandWArg(&stringPtr, "ldmBucketSizeLog=")) { g_ldmBucketSizeLog = readU32FromChar(&stringPtr); if (stringPtr[0]==',') { stringPtr++; continue; } else break; }
- if (longCommandWArg(&stringPtr, "ldmHashEveryLog=")) { g_ldmHashEveryLog = readU32FromChar(&stringPtr); if (stringPtr[0]==',') { stringPtr++; continue; } else break; }
+ if (longCommandWArg(&stringPtr, "ldmHashLog=") || longCommandWArg(&stringPtr, "ldmhlog=")) { g_ldmHashLog = readU32FromChar(&stringPtr); if (stringPtr[0]==',') { stringPtr++; continue; } else break; }
+ if (longCommandWArg(&stringPtr, "ldmSearchLength=") || longCommandWArg(&stringPtr, "ldmslen=")) { g_ldmMinMatch = readU32FromChar(&stringPtr); if (stringPtr[0]==',') { stringPtr++; continue; } else break; }
+ if (longCommandWArg(&stringPtr, "ldmBucketSizeLog=") || longCommandWArg(&stringPtr, "ldmblog")) { g_ldmBucketSizeLog = readU32FromChar(&stringPtr); if (stringPtr[0]==',') { stringPtr++; continue; } else break; }
+ if (longCommandWArg(&stringPtr, "ldmHashEveryLog=") || longCommandWArg(&stringPtr, "ldmhevery")) { g_ldmHashEveryLog = readU32FromChar(&stringPtr); if (stringPtr[0]==',') { stringPtr++; continue; } else break; }
return 0;
}