set the window log value before performing compression

This commit is contained in:
Paul Cruz 2017-07-26 14:29:59 -07:00
parent a959cc881a
commit 6c1c1242fc
2 changed files with 15 additions and 6 deletions

View File

@ -513,7 +513,10 @@ static void* compressionThread(void* arg)
{ {
size_t const useDictSize = MIN(getUseableDictSize(cLevel), job->dictSize); size_t const useDictSize = MIN(getUseableDictSize(cLevel), job->dictSize);
size_t const dictModeError = ZSTD_setCCtxParameter(ctx->cctx, ZSTD_p_forceRawDict, 1); size_t const dictModeError = ZSTD_setCCtxParameter(ctx->cctx, ZSTD_p_forceRawDict, 1);
size_t const initError = ZSTD_compressBegin_usingDict(ctx->cctx, job->src.start + job->dictSize - useDictSize, useDictSize, cLevel); ZSTD_parameters params = ZSTD_getParams(cLevel, 0, useDictSize);
params.cParams.windowLog = 23;
{
size_t const initError = ZSTD_compressBegin_advanced(ctx->cctx, job->src.start + job->dictSize - useDictSize, useDictSize, params, 0);
size_t const windowSizeError = ZSTD_setCCtxParameter(ctx->cctx, ZSTD_p_forceWindow, 1); size_t const windowSizeError = ZSTD_setCCtxParameter(ctx->cctx, ZSTD_p_forceWindow, 1);
if (ZSTD_isError(dictModeError) || ZSTD_isError(initError) || ZSTD_isError(windowSizeError)) { if (ZSTD_isError(dictModeError) || ZSTD_isError(initError) || ZSTD_isError(windowSizeError)) {
DISPLAY("Error: something went wrong while starting compression\n"); DISPLAY("Error: something went wrong while starting compression\n");
@ -521,6 +524,7 @@ static void* compressionThread(void* arg)
return arg; return arg;
} }
} }
}
DEBUG(2, "finished with ZSTD_compressBegin()\n"); DEBUG(2, "finished with ZSTD_compressBegin()\n");
do { do {

View File

@ -237,4 +237,9 @@ rm tmp*
zstd -d tmp.zst -o tmp2 zstd -d tmp.zst -o tmp2
diff -s -q tmp tmp2 diff -s -q tmp tmp2
rm tmp* rm tmp*
echo -e "\ncorrectness tests -- window size test"
./datagen -s39 -g1GB | pv -L 25m -q | ./adapt -i1 | pv -q > tmp.zst
zstd -d tmp.zst
rm tmp*
make clean make clean