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