mirror of
https://github.com/Xevion/easy7zip.git
synced 2025-12-08 10:07:02 -06:00
Update zstd to version 1.3.8
This commit is contained in:
@@ -291,6 +291,8 @@ ZSTD_OBJS = \
|
||||
$O\xxhash.obj \
|
||||
$O\zstd_common.obj \
|
||||
$O\zstd_compress.obj \
|
||||
$O\zstd_ddict.obj \
|
||||
$O\zstd_decompress_block.obj \
|
||||
$O\zstd_decompress.obj \
|
||||
$O\zstd_double_fast.obj \
|
||||
$O\zstd_fast.obj \
|
||||
|
||||
@@ -35,6 +35,8 @@ ZSTD_OBJS = \
|
||||
$O\xxhash.obj \
|
||||
$O\zstd_common.obj \
|
||||
$O\zstd_compress.obj \
|
||||
$O\zstd_ddict.obj \
|
||||
$O\zstd_decompress_block.obj \
|
||||
$O\zstd_decompress.obj \
|
||||
$O\zstd_double_fast.obj \
|
||||
$O\zstd_fast.obj \
|
||||
|
||||
@@ -213,6 +213,8 @@ ZSTD_OBJS = \
|
||||
$O\xxhash.obj \
|
||||
$O\zstd_common.obj \
|
||||
$O\zstd_compress.obj \
|
||||
$O\zstd_ddict.obj \
|
||||
$O\zstd_decompress_block.obj \
|
||||
$O\zstd_decompress.obj \
|
||||
$O\zstd_double_fast.obj \
|
||||
$O\zstd_fast.obj \
|
||||
|
||||
@@ -173,6 +173,8 @@ ZSTD_OBJS = \
|
||||
$O\xxhash.obj \
|
||||
$O\zstd_common.obj \
|
||||
$O\zstd_compress.obj \
|
||||
$O\zstd_ddict.obj \
|
||||
$O\zstd_decompress_block.obj \
|
||||
$O\zstd_decompress.obj \
|
||||
$O\zstd_double_fast.obj \
|
||||
$O\zstd_fast.obj \
|
||||
|
||||
@@ -88,6 +88,8 @@ ZSTD_OBJS = \
|
||||
$O\xxhash.obj \
|
||||
$O\zstd_common.obj \
|
||||
$O\zstd_compress.obj \
|
||||
$O\zstd_ddict.obj \
|
||||
$O\zstd_decompress_block.obj \
|
||||
$O\zstd_decompress.obj \
|
||||
$O\zstd_double_fast.obj \
|
||||
$O\zstd_fast.obj \
|
||||
|
||||
@@ -151,6 +151,8 @@ ZSTD_OBJS = \
|
||||
$O\xxhash.obj \
|
||||
$O\zstd_common.obj \
|
||||
$O\zstd_compress.obj \
|
||||
$O\zstd_ddict.obj \
|
||||
$O\zstd_decompress_block.obj \
|
||||
$O\zstd_decompress.obj \
|
||||
$O\zstd_double_fast.obj \
|
||||
$O\zstd_fast.obj \
|
||||
|
||||
@@ -169,6 +169,8 @@ ZSTD_OBJS = \
|
||||
$O\xxhash.obj \
|
||||
$O\zstd_common.obj \
|
||||
$O\zstd_compress.obj \
|
||||
$O\zstd_ddict.obj \
|
||||
$O\zstd_decompress_block.obj \
|
||||
$O\zstd_decompress.obj \
|
||||
$O\zstd_double_fast.obj \
|
||||
$O\zstd_fast.obj \
|
||||
|
||||
@@ -23,20 +23,20 @@ CEncoder::CEncoder():
|
||||
_processedIn(0),
|
||||
_processedOut(0),
|
||||
_numThreads(NWindows::NSystem::GetNumberOfProcessors()),
|
||||
_Strategy(-1),
|
||||
_Long(-1),
|
||||
_Level(ZSTD_CLEVEL_DEFAULT),
|
||||
_Strategy(-1),
|
||||
_WindowLog(-1),
|
||||
_HashLog(-1),
|
||||
_ChainLog(-1),
|
||||
_SearchLog(-1),
|
||||
_SearchLength(-1),
|
||||
_MinMatch(-1),
|
||||
_TargetLen(-1),
|
||||
_OverlapLog(-1),
|
||||
_LdmHashLog(-1),
|
||||
_LdmSearchLength(-1),
|
||||
_LdmMinMatch(-1),
|
||||
_LdmBucketSizeLog(-1),
|
||||
_LdmHashEveryLog(-1)
|
||||
_LdmHashRateLog(-1)
|
||||
{
|
||||
_props.clear();
|
||||
_hMutex = CreateMutex(NULL, FALSE, NULL);
|
||||
@@ -153,11 +153,11 @@ STDMETHODIMP CEncoder::SetCoderProperties(const PROPID * propIDs, const PROPVARI
|
||||
_SearchLog = v;
|
||||
break;
|
||||
}
|
||||
case NCoderPropID::kSearchLength:
|
||||
case NCoderPropID::kMinMatch:
|
||||
{
|
||||
if (v < ZSTD_SEARCHLENGTH_MIN) v = ZSTD_SEARCHLENGTH_MIN;
|
||||
if (v > ZSTD_SEARCHLENGTH_MAX) v = ZSTD_SEARCHLENGTH_MAX;
|
||||
_SearchLength = v;
|
||||
if (v < ZSTD_MINMATCH_MIN) v = ZSTD_MINMATCH_MIN;
|
||||
if (v > ZSTD_MINMATCH_MAX) v = ZSTD_MINMATCH_MAX;
|
||||
_MinMatch = v;
|
||||
break;
|
||||
}
|
||||
case NCoderPropID::kTargetLen:
|
||||
@@ -185,7 +185,7 @@ STDMETHODIMP CEncoder::SetCoderProperties(const PROPID * propIDs, const PROPVARI
|
||||
{
|
||||
if (v < ZSTD_LDM_MINMATCH_MIN) v = ZSTD_LDM_MINMATCH_MIN;
|
||||
if (v > ZSTD_LDM_MINMATCH_MAX) v = ZSTD_LDM_MINMATCH_MAX;
|
||||
_LdmSearchLength = v;
|
||||
_LdmMinMatch = v;
|
||||
break;
|
||||
}
|
||||
case NCoderPropID::kLdmBucketSizeLog:
|
||||
@@ -195,11 +195,11 @@ STDMETHODIMP CEncoder::SetCoderProperties(const PROPID * propIDs, const PROPVARI
|
||||
_LdmBucketSizeLog = v;
|
||||
break;
|
||||
}
|
||||
case NCoderPropID::kLdmHashEveryLog:
|
||||
case NCoderPropID::kLdmHashRateLog:
|
||||
{
|
||||
if (v < 0) v = 0; /* 0 => automatic mode */
|
||||
if (v > (ZSTD_WINDOWLOG_MAX - ZSTD_HASHLOG_MIN)) v = (ZSTD_WINDOWLOG_MAX - ZSTD_HASHLOG_MIN);
|
||||
_LdmHashEveryLog = v;
|
||||
_LdmHashRateLog = v;
|
||||
break;
|
||||
}
|
||||
default:
|
||||
@@ -240,15 +240,15 @@ STDMETHODIMP CEncoder::Code(ISequentialInStream *inStream,
|
||||
return E_OUTOFMEMORY;
|
||||
|
||||
/* setup level */
|
||||
err = ZSTD_CCtx_setParameter(_ctx, ZSTD_p_compressionLevel, (UInt32)_Level);
|
||||
err = ZSTD_CCtx_setParameter(_ctx, ZSTD_c_compressionLevel, (UInt32)_Level);
|
||||
if (ZSTD_isError(err)) return E_INVALIDARG;
|
||||
|
||||
/* setup thread count */
|
||||
err = ZSTD_CCtx_setParameter(_ctx, ZSTD_p_nbWorkers, _numThreads);
|
||||
err = ZSTD_CCtx_setParameter(_ctx, ZSTD_c_nbWorkers, _numThreads);
|
||||
if (ZSTD_isError(err)) return E_INVALIDARG;
|
||||
|
||||
/* set the content size flag */
|
||||
err = ZSTD_CCtx_setParameter(_ctx, ZSTD_p_contentSizeFlag, 1);
|
||||
err = ZSTD_CCtx_setParameter(_ctx, ZSTD_c_contentSizeFlag, 1);
|
||||
if (ZSTD_isError(err)) return E_INVALIDARG;
|
||||
|
||||
/* enable ldm for large windowlog values */
|
||||
@@ -257,67 +257,67 @@ STDMETHODIMP CEncoder::Code(ISequentialInStream *inStream,
|
||||
|
||||
/* set ldm */
|
||||
if (_Long != -1) {
|
||||
err = ZSTD_CCtx_setParameter(_ctx, ZSTD_p_enableLongDistanceMatching, _Long);
|
||||
err = ZSTD_CCtx_setParameter(_ctx, ZSTD_c_enableLongDistanceMatching, _Long);
|
||||
if (ZSTD_isError(err)) return E_INVALIDARG;
|
||||
}
|
||||
|
||||
if (_Strategy != -1) {
|
||||
err = ZSTD_CCtx_setParameter(_ctx, ZSTD_p_compressionStrategy, _Strategy);
|
||||
err = ZSTD_CCtx_setParameter(_ctx, ZSTD_c_strategy, _Strategy);
|
||||
if (ZSTD_isError(err)) return E_INVALIDARG;
|
||||
}
|
||||
|
||||
if (_WindowLog != -1) {
|
||||
err = ZSTD_CCtx_setParameter(_ctx, ZSTD_p_windowLog, _WindowLog);
|
||||
err = ZSTD_CCtx_setParameter(_ctx, ZSTD_c_windowLog, _WindowLog);
|
||||
if (ZSTD_isError(err)) return E_INVALIDARG;
|
||||
}
|
||||
|
||||
if (_HashLog != -1) {
|
||||
err = ZSTD_CCtx_setParameter(_ctx, ZSTD_p_hashLog, _HashLog);
|
||||
err = ZSTD_CCtx_setParameter(_ctx, ZSTD_c_hashLog, _HashLog);
|
||||
if (ZSTD_isError(err)) return E_INVALIDARG;
|
||||
}
|
||||
|
||||
if (_ChainLog != -1) {
|
||||
err = ZSTD_CCtx_setParameter(_ctx, ZSTD_p_chainLog, _ChainLog);
|
||||
err = ZSTD_CCtx_setParameter(_ctx, ZSTD_c_chainLog, _ChainLog);
|
||||
if (ZSTD_isError(err)) return E_INVALIDARG;
|
||||
}
|
||||
|
||||
if (_SearchLog != -1) {
|
||||
err = ZSTD_CCtx_setParameter(_ctx, ZSTD_p_searchLog, _SearchLog);
|
||||
err = ZSTD_CCtx_setParameter(_ctx, ZSTD_c_searchLog, _SearchLog);
|
||||
if (ZSTD_isError(err)) return E_INVALIDARG;
|
||||
}
|
||||
|
||||
if (_SearchLength != -1) {
|
||||
err = ZSTD_CCtx_setParameter(_ctx, ZSTD_p_minMatch, _SearchLength);
|
||||
if (_MinMatch != -1) {
|
||||
err = ZSTD_CCtx_setParameter(_ctx, ZSTD_c_minMatch, _MinMatch);
|
||||
if (ZSTD_isError(err)) return E_INVALIDARG;
|
||||
}
|
||||
|
||||
if (_TargetLen != -1) {
|
||||
err = ZSTD_CCtx_setParameter(_ctx, ZSTD_p_targetLength, _TargetLen);
|
||||
err = ZSTD_CCtx_setParameter(_ctx, ZSTD_c_targetLength, _TargetLen);
|
||||
if (ZSTD_isError(err)) return E_INVALIDARG;
|
||||
}
|
||||
|
||||
if (_OverlapLog != -1) {
|
||||
err = ZSTD_CCtx_setParameter(_ctx, ZSTD_p_overlapSizeLog, _OverlapLog);
|
||||
err = ZSTD_CCtx_setParameter(_ctx, ZSTD_c_overlapLog, _OverlapLog);
|
||||
if (ZSTD_isError(err)) return E_INVALIDARG;
|
||||
}
|
||||
|
||||
if (_LdmHashLog != -1) {
|
||||
err = ZSTD_CCtx_setParameter(_ctx, ZSTD_p_ldmHashLog, _LdmHashLog);
|
||||
err = ZSTD_CCtx_setParameter(_ctx, ZSTD_c_ldmHashLog, _LdmHashLog);
|
||||
if (ZSTD_isError(err)) return E_INVALIDARG;
|
||||
}
|
||||
|
||||
if (_LdmSearchLength != -1) {
|
||||
err = ZSTD_CCtx_setParameter(_ctx, ZSTD_p_ldmMinMatch, _LdmSearchLength);
|
||||
if (_LdmMinMatch != -1) {
|
||||
err = ZSTD_CCtx_setParameter(_ctx, ZSTD_c_ldmMinMatch, _LdmMinMatch);
|
||||
if (ZSTD_isError(err)) return E_INVALIDARG;
|
||||
}
|
||||
|
||||
if (_LdmBucketSizeLog != -1) {
|
||||
err = ZSTD_CCtx_setParameter(_ctx, ZSTD_p_ldmBucketSizeLog, _LdmBucketSizeLog);
|
||||
err = ZSTD_CCtx_setParameter(_ctx, ZSTD_c_ldmBucketSizeLog, _LdmBucketSizeLog);
|
||||
if (ZSTD_isError(err)) return E_INVALIDARG;
|
||||
}
|
||||
|
||||
if (_LdmHashEveryLog != -1) {
|
||||
err = ZSTD_CCtx_setParameter(_ctx, ZSTD_p_ldmHashEveryLog, _LdmHashEveryLog);
|
||||
if (_LdmHashRateLog != -1) {
|
||||
err = ZSTD_CCtx_setParameter(_ctx, ZSTD_c_ldmHashRateLog, _LdmHashRateLog);
|
||||
if (ZSTD_isError(err)) return E_INVALIDARG;
|
||||
}
|
||||
}
|
||||
@@ -352,7 +352,7 @@ STDMETHODIMP CEncoder::Code(ISequentialInStream *inStream,
|
||||
inBuff.pos = 0;
|
||||
}
|
||||
|
||||
err = ZSTD_compress_generic(_ctx, &outBuff, &inBuff, ZSTD_todo);
|
||||
err = ZSTD_compressStream2(_ctx, &outBuff, &inBuff, ZSTD_todo);
|
||||
if (ZSTD_isError(err)) return E_FAIL;
|
||||
|
||||
#if DEBUG
|
||||
|
||||
@@ -52,20 +52,20 @@ class CEncoder:
|
||||
HANDLE _hMutex;
|
||||
|
||||
/* zstd advanced compression options */
|
||||
Int32 _Strategy;
|
||||
Int32 _Long;
|
||||
Int32 _Level;
|
||||
Int32 _Strategy;
|
||||
Int32 _WindowLog;
|
||||
Int32 _HashLog;
|
||||
Int32 _ChainLog;
|
||||
Int32 _SearchLog;
|
||||
Int32 _SearchLength;
|
||||
Int32 _MinMatch;
|
||||
Int32 _TargetLen;
|
||||
Int32 _OverlapLog;
|
||||
Int32 _LdmHashLog;
|
||||
Int32 _LdmSearchLength;
|
||||
Int32 _LdmMinMatch;
|
||||
Int32 _LdmBucketSizeLog;
|
||||
Int32 _LdmHashEveryLog;
|
||||
Int32 _LdmHashRateLog;
|
||||
|
||||
public:
|
||||
MY_QUERYINTERFACE_BEGIN2(ICompressCoder)
|
||||
|
||||
@@ -141,13 +141,13 @@ namespace NCoderPropID
|
||||
kHashLog, // VT_UI4 The minimum hlog is 6 (64 B) and the maximum is 26 (128 MiB).
|
||||
kChainLog, // VT_UI4 The minimum clog is 6 (64 B) and the maximum is 28 (256 MiB)
|
||||
kSearchLog, // VT_UI4 The minimum slog is 1 and the maximum is 26
|
||||
kSearchLength, // VT_UI4 The minimum slen is 3 and the maximum is 7.
|
||||
kMinMatch, // VT_UI4 The minimum slen is 3 and the maximum is 7.
|
||||
kTargetLen, // VT_UI4 The minimum tlen is 0 and the maximum is 999.
|
||||
kOverlapLog, // VT_UI4 The minimum ovlog is 0 and the maximum is 9. (default: 6)
|
||||
kLdmHashLog, // VT_UI4 The minimum ldmhlog is 6 and the maximum is 26 (default: 20).
|
||||
kLdmSearchLength, // VT_UI4 The minimum ldmslen is 4 and the maximum is 4096 (default: 64).
|
||||
kLdmBucketSizeLog, // VT_UI4 The minimum ldmblog is 0 and the maximum is 8 (default: 3).
|
||||
kLdmHashEveryLog // VT_UI4 The default value is wlog - ldmhlog.
|
||||
kLdmHashRateLog // VT_UI4 The default value is wlog - ldmhlog.
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user