ZSTD_REP_NUM
This commit is contained in:
parent
d700a1a8b9
commit
4569667c85
@ -627,8 +627,10 @@ size_t ZSTD_compressSequences(ZSTD_CCtx* zc,
|
||||
/* CTable for Offset codes */
|
||||
{ /* create Offset codes */
|
||||
size_t i; for (i=0; i<nbSeq; i++) {
|
||||
offCodeTable[i] = (BYTE)ZSTD_highbit(offsetTable[i]) + 1;
|
||||
if (offsetTable[i]==0) offCodeTable[i]=0;
|
||||
if (offsetTable[i] < ZSTD_REP_NUM)
|
||||
offCodeTable[i] = 0;
|
||||
else
|
||||
offCodeTable[i] = (BYTE)ZSTD_highbit(offsetTable[i]) + 1;
|
||||
}
|
||||
}
|
||||
max = MaxOff;
|
||||
@ -774,7 +776,7 @@ MEM_STATIC void ZSTD_storeSeq(seqStore_t* seqStorePtr, size_t litLength, const B
|
||||
else *(seqStorePtr->litLength++) = (BYTE)litLength;
|
||||
|
||||
/* match offset */
|
||||
*(seqStorePtr->offset++) = (U32)offsetCode;
|
||||
*(seqStorePtr->offset++) = (U32)offsetCode + ZSTD_REP_NUM - 1;
|
||||
|
||||
/* match Length */
|
||||
if (matchCode >= MaxML) {
|
||||
|
@ -657,8 +657,10 @@ static void ZSTD_decodeSequence(seq_t* seq, seqState_t* seqState, const U32 mls)
|
||||
offset = offsetPrefix[offsetCode] + BIT_readBits(&(seqState->DStream), nbBits);
|
||||
if (MEM_32bits()) BIT_reloadDStream(&(seqState->DStream));
|
||||
if (offsetCode==0) offset = prevOffset; /* repcode, cmove */
|
||||
else offset -= ZSTD_REP_NUM - 1;
|
||||
if (offsetCode | !litLength) seqState->prevOffset = seq->offset; /* cmove */
|
||||
FSE_decodeSymbol(&(seqState->stateOffb), &(seqState->DStream)); /* update */
|
||||
// printf("offsetCode=%d nbBits=%d offset=%d\n", offsetCode, nbBits, (int)offset); fflush(stdout);
|
||||
}
|
||||
|
||||
/* Literal length update */
|
||||
|
@ -66,6 +66,7 @@
|
||||
|
||||
#define ZSTD_OPT_NUM (1<<12)
|
||||
#define ZSTD_DICT_MAGIC 0xEC30A435
|
||||
#define ZSTD_REP_NUM 4
|
||||
|
||||
#define KB *(1 <<10)
|
||||
#define MB *(1 <<20)
|
||||
|
@ -89,7 +89,6 @@
|
||||
#endif
|
||||
|
||||
#define NBLOOPS 3
|
||||
#define TIMELOOP 2500
|
||||
|
||||
#define KB *(1 <<10)
|
||||
#define MB *(1 <<20)
|
||||
@ -281,6 +280,7 @@ static int BMK_benchMem(const void* srcBuffer, size_t srcSize,
|
||||
} } }
|
||||
|
||||
/* warmimg up memory */
|
||||
int timeloop = additionalParam; //2500;
|
||||
ZSTD_setAdditionalParam(refCtx, additionalParam);
|
||||
RDG_genBuffer(compressedBuffer, maxCompressedSize, 0.10, 0.50, 1);
|
||||
|
||||
@ -305,7 +305,7 @@ static int BMK_benchMem(const void* srcBuffer, size_t srcSize,
|
||||
milliTime = BMK_GetMilliStart();
|
||||
while (BMK_GetMilliStart() == milliTime);
|
||||
milliTime = BMK_GetMilliStart();
|
||||
while (BMK_GetMilliSpan(milliTime) < TIMELOOP) {
|
||||
while (BMK_GetMilliSpan(milliTime) < timeloop) {
|
||||
ZSTD_compressBegin_advanced(refCtx, dictBuffer, dictBufferSize, ZSTD_getParams(cLevel, MAX(dictBufferSize, largestBlockSize)));
|
||||
for (blockNb=0; blockNb<nbBlocks; blockNb++) {
|
||||
size_t rSize = ZSTD_compress_usingPreparedCCtx(ctx, refCtx,
|
||||
@ -334,7 +334,7 @@ static int BMK_benchMem(const void* srcBuffer, size_t srcSize,
|
||||
while (BMK_GetMilliStart() == milliTime);
|
||||
milliTime = BMK_GetMilliStart();
|
||||
|
||||
for ( ; BMK_GetMilliSpan(milliTime) < TIMELOOP; nbLoops++) {
|
||||
for ( ; BMK_GetMilliSpan(milliTime) < timeloop; nbLoops++) {
|
||||
ZSTD_decompressBegin_usingDict(refDCtx, dictBuffer, dictBufferSize);
|
||||
for (blockNb=0; blockNb<nbBlocks; blockNb++) {
|
||||
size_t regenSize = ZSTD_decompress_usingPreparedDCtx(dctx, refDCtx,
|
||||
|
Loading…
Reference in New Issue
Block a user