mirror of
https://github.com/facebook/zstd.git
synced 2025-12-07 00:02:39 -05:00
improved decompression speed (680)
This commit is contained in:
parent
646693e3be
commit
433a5cce7e
@ -798,9 +798,9 @@ MEM_STATIC void ZSTD_storeSeq(seqStore_t* seqStorePtr, size_t litLength, const B
|
|||||||
static const BYTE* g_start = NULL;
|
static const BYTE* g_start = NULL;
|
||||||
const U32 pos = (U32)(literals - g_start);
|
const U32 pos = (U32)(literals - g_start);
|
||||||
if (g_start==NULL) g_start = literals;
|
if (g_start==NULL) g_start = literals;
|
||||||
if ((pos > 23945000) && (pos < 23946800))
|
if ((pos > 15181500) && (pos < 15183150))
|
||||||
printf("Cpos %6u :%4u literals & match %3u bytes at distance %6u \n",
|
printf("Cpos %6u :%4u literals & match %3u bytes at distance %6u \n",
|
||||||
pos, (U32)litLength, (U32)matchCode+MINMATCH, (U32)offsetCode);
|
pos, (U32)litLength, (U32)matchCode+MINMATCH, (U32)offsetCode);
|
||||||
#endif
|
#endif
|
||||||
#if ZSTD_OPT_DEBUG == 3
|
#if ZSTD_OPT_DEBUG == 3
|
||||||
if (offsetCode == 0) seqStorePtr->realRepSum++;
|
if (offsetCode == 0) seqStorePtr->realRepSum++;
|
||||||
|
|||||||
@ -637,9 +637,7 @@ static void ZSTD_decodeSequence(seq_t* seq, seqState_t* seqState, const U32 mls)
|
|||||||
U32 const ofBits = ofCode;
|
U32 const ofBits = ofCode;
|
||||||
U32 const totalBits = llBits+mlBits+ofBits;
|
U32 const totalBits = llBits+mlBits+ofBits;
|
||||||
|
|
||||||
size_t const allBits = BIT_readBits(&(seqState->DStream), totalBits);
|
//size_t const allBits = BIT_readBits(&(seqState->DStream), totalBits);
|
||||||
|
|
||||||
if (totalBits > 64 - 7 - (LLFSELog+MLFSELog+OffFSELog)) BIT_reloadDStream(&(seqState->DStream));
|
|
||||||
|
|
||||||
static const U32 LL_base[MaxLL+1] = {
|
static const U32 LL_base[MaxLL+1] = {
|
||||||
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
|
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
|
||||||
@ -659,13 +657,15 @@ static void ZSTD_decodeSequence(seq_t* seq, seqState_t* seqState, const U32 mls)
|
|||||||
0xFFFFFF, 0x1FFFFFF, 0x3FFFFFF, /*fake*/ 1, 1, 1, 1, 1 };
|
0xFFFFFF, 0x1FFFFFF, 0x3FFFFFF, /*fake*/ 1, 1, 1, 1, 1 };
|
||||||
|
|
||||||
/* sequence */
|
/* sequence */
|
||||||
seq->litLength = LL_base[llCode] + BIT_getLowerBits(allBits, llBits);
|
{ size_t const offset = ofCode ? OF_base[ofCode] + BIT_readBits(&(seqState->DStream), ofBits) :
|
||||||
seq->matchLength = ML_base[mlCode] + mls + BIT_getMiddleBits(allBits, mlBits, llBits);
|
|
||||||
{ size_t const offset = ofCode ? OF_base[ofCode] + BIT_getUpperBits(allBits, llBits+mlBits) :
|
|
||||||
llCode ? seq->offset : seqState->prevOffset;
|
llCode ? seq->offset : seqState->prevOffset;
|
||||||
if (ofCode | !llCode) seqState->prevOffset = seq->offset; /* cmove */
|
if (ofCode | !llCode) seqState->prevOffset = seq->offset; /* cmove */
|
||||||
seq->offset = offset;
|
seq->offset = offset;
|
||||||
}
|
}
|
||||||
|
seq->matchLength = ML_base[mlCode] + mls + ((mlCode>31) ? BIT_readBits(&(seqState->DStream), mlBits) : 0);
|
||||||
|
seq->litLength = LL_base[llCode] + ((llCode>15) ? BIT_readBits(&(seqState->DStream), llBits) : 0);
|
||||||
|
|
||||||
|
if (totalBits > 64 - 7 - (LLFSELog+MLFSELog+OffFSELog)) BIT_reloadDStream(&(seqState->DStream));
|
||||||
|
|
||||||
/* ANS state update */
|
/* ANS state update */
|
||||||
FSE_updateState(&(seqState->stateLL), &(seqState->DStream));
|
FSE_updateState(&(seqState->stateLL), &(seqState->DStream));
|
||||||
@ -795,7 +795,7 @@ static size_t ZSTD_decompressSequences(
|
|||||||
ZSTD_decodeSequence(&sequence, &seqState, mls);
|
ZSTD_decodeSequence(&sequence, &seqState, mls);
|
||||||
#if 0 /* for debug */
|
#if 0 /* for debug */
|
||||||
{ U32 pos = (U32)(op-base);
|
{ U32 pos = (U32)(op-base);
|
||||||
if ((pos > 23945280) && (pos < 23946797))
|
if ((pos > 15181500) && (pos < 15183150))
|
||||||
printf("Dpos %6u : %3u literals & match %3u bytes at distance %6u \n",
|
printf("Dpos %6u : %3u literals & match %3u bytes at distance %6u \n",
|
||||||
pos, (U32)sequence.litLength, (U32)sequence.matchLength, (U32)sequence.offset);
|
pos, (U32)sequence.litLength, (U32)sequence.matchLength, (U32)sequence.offset);
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user