Removing redundant condition in decompression, making first block rles valid to deocmpress
This commit is contained in:
parent
c3e3c8bf32
commit
d687d603e4
@ -1314,7 +1314,6 @@ static size_t ZSTD_continueCCtx(ZSTD_CCtx* cctx, ZSTD_CCtx_params params, U64 pl
|
|||||||
cctx->blockState.matchState.cParams = params.cParams;
|
cctx->blockState.matchState.cParams = params.cParams;
|
||||||
cctx->pledgedSrcSizePlusOne = pledgedSrcSize+1;
|
cctx->pledgedSrcSizePlusOne = pledgedSrcSize+1;
|
||||||
cctx->consumedSrcSize = 0;
|
cctx->consumedSrcSize = 0;
|
||||||
cctx->isFirstBlock = 1;
|
|
||||||
cctx->producedCSize = 0;
|
cctx->producedCSize = 0;
|
||||||
if (pledgedSrcSize == ZSTD_CONTENTSIZE_UNKNOWN)
|
if (pledgedSrcSize == ZSTD_CONTENTSIZE_UNKNOWN)
|
||||||
cctx->appliedParams.fParams.contentSizeFlag = 0;
|
cctx->appliedParams.fParams.contentSizeFlag = 0;
|
||||||
@ -1417,7 +1416,6 @@ static size_t ZSTD_resetCCtx_internal(ZSTD_CCtx* zc,
|
|||||||
(U32)pledgedSrcSize, params.cParams.windowLog);
|
(U32)pledgedSrcSize, params.cParams.windowLog);
|
||||||
assert(!ZSTD_isError(ZSTD_checkCParams(params.cParams)));
|
assert(!ZSTD_isError(ZSTD_checkCParams(params.cParams)));
|
||||||
|
|
||||||
zc->isFirstBlock = 1;
|
|
||||||
if (crp == ZSTDcrp_continue) {
|
if (crp == ZSTDcrp_continue) {
|
||||||
if (ZSTD_equivalentParams(zc->appliedParams, params,
|
if (ZSTD_equivalentParams(zc->appliedParams, params,
|
||||||
zc->inBuffSize,
|
zc->inBuffSize,
|
||||||
@ -2307,11 +2305,6 @@ static size_t ZSTD_compressBlock_internal(ZSTD_CCtx* zc,
|
|||||||
zc->bmi2);
|
zc->bmi2);
|
||||||
|
|
||||||
if (frame &&
|
if (frame &&
|
||||||
/* We don't want to emit our first block as a RLE even if it qualifies because
|
|
||||||
* doing so will cause the decoder to throw a "should consume all input error."
|
|
||||||
* https://github.com/facebook/zstd/blob/dev/programs/fileio.c#L1723
|
|
||||||
*/
|
|
||||||
!zc->isFirstBlock &&
|
|
||||||
cSize < rleMaxLength &&
|
cSize < rleMaxLength &&
|
||||||
ZSTD_isRLE(ip, srcSize))
|
ZSTD_isRLE(ip, srcSize))
|
||||||
{
|
{
|
||||||
@ -2416,7 +2409,6 @@ static size_t ZSTD_compress_frameChunk (ZSTD_CCtx* cctx,
|
|||||||
op += cSize;
|
op += cSize;
|
||||||
assert(dstCapacity >= cSize);
|
assert(dstCapacity >= cSize);
|
||||||
dstCapacity -= cSize;
|
dstCapacity -= cSize;
|
||||||
cctx->isFirstBlock = 0;
|
|
||||||
DEBUGLOG(5, "ZSTD_compress_frameChunk: adding a block of size %u",
|
DEBUGLOG(5, "ZSTD_compress_frameChunk: adding a block of size %u",
|
||||||
(unsigned)cSize);
|
(unsigned)cSize);
|
||||||
} }
|
} }
|
||||||
|
@ -238,7 +238,6 @@ struct ZSTD_CCtx_s {
|
|||||||
XXH64_state_t xxhState;
|
XXH64_state_t xxhState;
|
||||||
ZSTD_customMem customMem;
|
ZSTD_customMem customMem;
|
||||||
size_t staticSize;
|
size_t staticSize;
|
||||||
int isFirstBlock;
|
|
||||||
|
|
||||||
seqStore_t seqStore; /* sequences storage ptrs */
|
seqStore_t seqStore; /* sequences storage ptrs */
|
||||||
ldmState_t ldmState; /* long distance matching state */
|
ldmState_t ldmState; /* long distance matching state */
|
||||||
|
@ -1711,11 +1711,6 @@ static unsigned long long FIO_decompressZstdFrame(
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (readSizeHint == 0) break; /* end of frame */
|
if (readSizeHint == 0) break; /* end of frame */
|
||||||
if (inBuff.size != inBuff.pos) {
|
|
||||||
DISPLAYLEVEL(1, "%s : Decoding error (37) : should consume entire input \n",
|
|
||||||
srcFileName);
|
|
||||||
return FIO_ERROR_FRAME_DECODING;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Fill input buffer */
|
/* Fill input buffer */
|
||||||
{ size_t const toDecode = MIN(readSizeHint, ress->srcBufferSize); /* support large skippable frames */
|
{ size_t const toDecode = MIN(readSizeHint, ress->srcBufferSize); /* support large skippable frames */
|
||||||
|
Loading…
Reference in New Issue
Block a user