kSlotNew
This commit is contained in:
parent
7d1742825b
commit
3e743052cd
@ -1662,10 +1662,20 @@ _storeSequence:
|
||||
{
|
||||
#if ZSTD_REP_NUM == 4
|
||||
if (offset >= ZSTD_REP_NUM) {
|
||||
#if 0
|
||||
rep[3] = rep[2];
|
||||
rep[2] = rep[1];
|
||||
rep[1] = rep[0];
|
||||
rep[0] = offset - (ZSTD_REP_NUM - 1);
|
||||
#else
|
||||
if (kSlotNew < 3)
|
||||
rep[3] = rep[2];
|
||||
if (kSlotNew < 2)
|
||||
rep[2] = rep[1];
|
||||
if (kSlotNew < 1)
|
||||
rep[1] = rep[0];
|
||||
rep[kSlotNew] = offset - (ZSTD_REP_NUM - 1);
|
||||
#endif
|
||||
} else {
|
||||
if (offset != 0) {
|
||||
size_t temp = rep[offset];
|
||||
@ -2463,6 +2473,3 @@ ZSTD_parameters ZSTD_getParams(int compressionLevel, U64 srcSizeHint)
|
||||
result.srcSize = srcSizeHint;
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
void ZSTD_setAdditionalParam(ZSTD_CCtx* ctx, int additionalParam) { ctx->additionalParam = additionalParam; };
|
||||
|
@ -620,8 +620,6 @@ typedef struct {
|
||||
const BYTE* dumpsEnd;
|
||||
} seqState_t;
|
||||
|
||||
|
||||
|
||||
static void ZSTD_decodeSequence(seq_t* seq, seqState_t* seqState, const U32 mls)
|
||||
{
|
||||
size_t litLength;
|
||||
@ -632,9 +630,6 @@ static void ZSTD_decodeSequence(seq_t* seq, seqState_t* seqState, const U32 mls)
|
||||
|
||||
/* Literal length */
|
||||
litLength = FSE_peakSymbol(&(seqState->stateLL));
|
||||
#if 0 //ZSTD_REP_NUM == 1
|
||||
size_t prevOffset = litLength ? seq->offset : seqState->prevOffset[0];
|
||||
#endif
|
||||
if (litLength == MaxLL) {
|
||||
U32 add = *dumps++;
|
||||
if (add < 255) litLength += add;
|
||||
@ -661,9 +656,10 @@ static void ZSTD_decodeSequence(seq_t* seq, seqState_t* seqState, const U32 mls)
|
||||
if (offsetCode==0) {
|
||||
if (!litLength) {
|
||||
offset = seqState->prevOffset[1];
|
||||
seqState->prevOffset[1] = seq->offset; /* cmove */
|
||||
seqState->prevOffset[1] = seqState->prevOffset[0];
|
||||
seqState->prevOffset[0] = offset;
|
||||
} else
|
||||
offset = seq->offset;
|
||||
offset = seqState->prevOffset[0];
|
||||
} else {
|
||||
if (offset < ZSTD_REP_NUM) { /* offset = 1,2,3 */
|
||||
size_t temp = seqState->prevOffset[offset];
|
||||
@ -671,23 +667,30 @@ static void ZSTD_decodeSequence(seq_t* seq, seqState_t* seqState, const U32 mls)
|
||||
if (offset == 3) seqState->prevOffset[3] = seqState->prevOffset[2];
|
||||
seqState->prevOffset[2] = seqState->prevOffset[1];
|
||||
}
|
||||
seqState->prevOffset[1] = seq->offset;
|
||||
offset = temp;
|
||||
seqState->prevOffset[1] = seqState->prevOffset[0];
|
||||
seqState->prevOffset[0] = offset;
|
||||
} else {
|
||||
offset -= ZSTD_REP_NUM - 1;
|
||||
#if 0
|
||||
seqState->prevOffset[3] = seqState->prevOffset[2];
|
||||
seqState->prevOffset[2] = seqState->prevOffset[1];
|
||||
seqState->prevOffset[1] = seq->offset; /* cmove */
|
||||
seqState->prevOffset[1] = seqState->prevOffset[0];
|
||||
seqState->prevOffset[0] = offset;
|
||||
#else
|
||||
if (kSlotNew < 3)
|
||||
seqState->prevOffset[3] = seqState->prevOffset[2];
|
||||
if (kSlotNew < 2)
|
||||
seqState->prevOffset[2] = seqState->prevOffset[1];
|
||||
if (kSlotNew < 1)
|
||||
seqState->prevOffset[1] = seqState->prevOffset[0];
|
||||
seqState->prevOffset[kSlotNew] = offset;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
#else
|
||||
#if 0
|
||||
if (offsetCode==0) offset = prevOffset; /* repcode, cmove */
|
||||
if (offsetCode | !litLength) seqState->prevOffset[0] = seq->offset; /* cmove */
|
||||
#else
|
||||
if (offsetCode==0) offset = litLength ? seq->offset : seqState->prevOffset[0]; /* repcode, cmove */
|
||||
if (offsetCode | !litLength) seqState->prevOffset[0] = seq->offset; /* cmove */
|
||||
#endif
|
||||
#endif
|
||||
FSE_decodeSymbol(&(seqState->stateOffb), &(seqState->DStream)); /* update */
|
||||
// printf("offsetCode=%d nbBits=%d offset=%d\n", offsetCode, nbBits, (int)offset); fflush(stdout);
|
||||
|
@ -51,9 +51,7 @@
|
||||
* Common constants
|
||||
***************************************/
|
||||
#define ZSTD_OPT_DEBUG 0 // 1 = tableID=0; 3 = price func tests; 5 = check encoded sequences; 9 = full logs
|
||||
#if defined(ZSTD_OPT_DEBUG) && ZSTD_OPT_DEBUG>0
|
||||
#include <stdio.h>
|
||||
#endif
|
||||
#include <stdio.h>
|
||||
#if defined(ZSTD_OPT_DEBUG) && ZSTD_OPT_DEBUG>=9
|
||||
#define ZSTD_LOG_PARSER(...) printf(__VA_ARGS__)
|
||||
#define ZSTD_LOG_ENCODE(...) printf(__VA_ARGS__)
|
||||
@ -227,7 +225,6 @@ typedef struct {
|
||||
|
||||
seqStore_t ZSTD_copySeqStore(const ZSTD_CCtx* ctx);
|
||||
|
||||
void ZSTD_setAdditionalParam(ZSTD_CCtx* ctx, int additionalParam);
|
||||
|
||||
extern int kSlotNew;
|
||||
|
||||
#endif /* ZSTD_CCOMMON_H_MODULE */
|
||||
|
@ -228,6 +228,8 @@ typedef struct
|
||||
#define MIN(a,b) ((a)<(b) ? (a) : (b))
|
||||
#define MAX(a,b) ((a)>(b) ? (a) : (b))
|
||||
|
||||
int kSlotNew = 0;
|
||||
|
||||
static int BMK_benchMem(const void* srcBuffer, size_t srcSize,
|
||||
const char* displayName, int cLevel, int additionalParam,
|
||||
const size_t* fileSizes, U32 nbFiles,
|
||||
@ -280,8 +282,9 @@ static int BMK_benchMem(const void* srcBuffer, size_t srcSize,
|
||||
} } }
|
||||
|
||||
/* warmimg up memory */
|
||||
int timeloop = additionalParam ? additionalParam : 2500;
|
||||
ZSTD_setAdditionalParam(refCtx, additionalParam);
|
||||
// int timeloop = additionalParam ? additionalParam : 2500;
|
||||
int timeloop = 2500;
|
||||
kSlotNew = additionalParam;
|
||||
RDG_genBuffer(compressedBuffer, maxCompressedSize, 0.10, 0.50, 1);
|
||||
|
||||
/* Bench */
|
||||
|
Loading…
Reference in New Issue
Block a user