Merge pull request #1196 from felixhandte/zstd-btopt-in-place-dict

ZSTD_btopt: Support Searching the Dictionary Context In-Place
This commit is contained in:
Yann Collet
2018-06-22 11:53:23 -07:00
committed by GitHub
4 changed files with 124 additions and 39 deletions
+5 -4
View File
@@ -967,6 +967,7 @@ static void ZSTD_invalidateMatchState(ZSTD_matchState_t* ms)
ZSTD_window_clear(&ms->window);
ms->nextToUpdate = ms->window.dictLimit + 1;
ms->nextToUpdate3 = ms->window.dictLimit + 1;
ms->loadedDictEnd = 0;
ms->opt.litLengthSum = 0; /* force reset of btopt stats */
ms->dictMatchState = NULL;
@@ -1238,14 +1239,13 @@ static size_t ZSTD_resetCCtx_usingCDict(ZSTD_CCtx* cctx,
32 KB, /* ZSTD_lazy */
32 KB, /* ZSTD_lazy2 */
32 KB, /* ZSTD_btlazy2 */
256 KB, /* ZSTD_btopt */
256 KB /* ZSTD_btultra */
32 KB, /* ZSTD_btopt */
8 KB /* ZSTD_btultra */
};
const int attachDict = ( pledgedSrcSize <= attachDictSizeCutoffs[cdict->cParams.strategy]
|| pledgedSrcSize == ZSTD_CONTENTSIZE_UNKNOWN )
&& !params.forceWindow /* dictMatchState isn't correctly
* handled in _enforceMaxDist */
&& cdict->cParams.strategy <= ZSTD_btlazy2
&& ZSTD_equivalentCParams(cctx->appliedParams.cParams,
cdict->cParams);
@@ -2255,7 +2255,8 @@ ZSTD_blockCompressor ZSTD_selectBlockCompressor(ZSTD_strategy strat, ZSTD_dictMo
ZSTD_compressBlock_lazy_dictMatchState,
ZSTD_compressBlock_lazy2_dictMatchState,
ZSTD_compressBlock_btlazy2_dictMatchState,
NULL, NULL /* unimplemented as of yet */ }
ZSTD_compressBlock_btopt_dictMatchState,
ZSTD_compressBlock_btultra_dictMatchState }
};
ZSTD_blockCompressor selectedCompressor;
ZSTD_STATIC_ASSERT((unsigned)ZSTD_fast == 1);