set the window log value before performing compression
This commit is contained in:
parent
a959cc881a
commit
6c1c1242fc
@ -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 {
|
||||||
|
@ -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
|
||||||
|
Loading…
Reference in New Issue
Block a user