diff options
author | Yann Collet <yann.collet.73@gmail.com> | 2014-09-13 09:08:55 (GMT) |
---|---|---|
committer | Yann Collet <yann.collet.73@gmail.com> | 2014-09-13 09:08:55 (GMT) |
commit | bd704cf70ad7b935db0d1baaee902b28e6394bba (patch) | |
tree | e2ace4b60c783821092314b2c828a9eefcd5f787 /programs/frametest.c | |
parent | a586208597f28b7b4df0913f5b95cefbd46e2a31 (diff) | |
download | lz4-bd704cf70ad7b935db0d1baaee902b28e6394bba.zip lz4-bd704cf70ad7b935db0d1baaee902b28e6394bba.tar.gz lz4-bd704cf70ad7b935db0d1baaee902b28e6394bba.tar.bz2 |
lz4frame : implemented option stableSrc
Improved LZ4_compressFrame() speed
Diffstat (limited to 'programs/frametest.c')
-rw-r--r-- | programs/frametest.c | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/programs/frametest.c b/programs/frametest.c index c3662b4..73d6373 100644 --- a/programs/frametest.c +++ b/programs/frametest.c @@ -405,13 +405,19 @@ int fuzzerTests(U32 seed, unsigned nbTests, unsigned startTest, double compressi unsigned BMId = FUZ_rand(&randState) & 1; unsigned CCflag = FUZ_rand(&randState) & 1; unsigned autoflush = (FUZ_rand(&randState) & 3) == 2; - LZ4F_preferences_t prefs = { { BSId, BMId, CCflag, 0,0,0 }, 0,autoflush, 0,0,0,0 }; + LZ4F_preferences_t prefs = { 0 }; + LZ4F_compressOptions_t options = { 0 }; unsigned nbBits = (FUZ_rand(&randState) % (FUZ_highbit(srcDataLength-1) - 1)) + 1; size_t srcSize = (FUZ_rand(&randState) & ((1<<nbBits)-1)) + 1; size_t srcStart = FUZ_rand(&randState) % (srcDataLength - srcSize); size_t cSize; U64 crcOrig, crcDecoded; + prefs.frameInfo.blockMode = BMId; + prefs.frameInfo.blockSizeID = BSId; + prefs.frameInfo.contentChecksumFlag = CCflag; + prefs.autoFlush = autoflush; + DISPLAYUPDATE(2, "\r%5i ", testNb); crcOrig = XXH64((BYTE*)srcBuffer+srcStart, srcSize, 1); @@ -431,18 +437,21 @@ int fuzzerTests(U32 seed, unsigned nbTests, unsigned startTest, double compressi size_t oSize = oend-op; unsigned forceFlush = ((FUZ_rand(&randState) & 3) == 1); if (iSize > (size_t)(iend-ip)) iSize = iend-ip; - result = LZ4F_compressUpdate(cCtx, op, oSize, ip, iSize, NULL); + options.stableSrc = ((FUZ_rand(&randState) && 3) == 2); + + result = LZ4F_compressUpdate(cCtx, op, oSize, ip, iSize, &options); CHECK(LZ4F_isError(result), "Compression failed (error %i)", (int)result); op += result; ip += iSize; + if (forceFlush) { - result = LZ4F_flush(cCtx, op, oend-op, NULL); + result = LZ4F_flush(cCtx, op, oend-op, &options); CHECK(LZ4F_isError(result), "Compression failed (error %i)", (int)result); op += result; } } - result = LZ4F_compressEnd(cCtx, op, oend-op, NULL); + result = LZ4F_compressEnd(cCtx, op, oend-op, &options); CHECK(LZ4F_isError(result), "Compression completion failed (error %i)", (int)result); op += result; cSize = op-(BYTE*)compressedBuffer; |