MaxLit
This commit is contained in:
+15
-11
@@ -88,10 +88,10 @@ typedef struct {
|
|||||||
BYTE* matchLength;
|
BYTE* matchLength;
|
||||||
BYTE* dumpsStart;
|
BYTE* dumpsStart;
|
||||||
BYTE* dumps;
|
BYTE* dumps;
|
||||||
BYTE* matchLengthFreq;
|
U32* matchLengthFreq;
|
||||||
BYTE* litLengthFreq;
|
U32* litLengthFreq;
|
||||||
BYTE* litFreq;
|
U32* litFreq;
|
||||||
BYTE* offCodeFreq;
|
U32* offCodeFreq;
|
||||||
U32 matchLengthSum;
|
U32 matchLengthSum;
|
||||||
U32 litLengthSum;
|
U32 litLengthSum;
|
||||||
U32 litSum;
|
U32 litSum;
|
||||||
@@ -111,10 +111,14 @@ static void ZSTD_resetSeqStore(seqStore_t* ssPtr)
|
|||||||
ssPtr->litSum = (1<<Litbits);
|
ssPtr->litSum = (1<<Litbits);
|
||||||
ssPtr->offCodeSum = (1<<Offbits);
|
ssPtr->offCodeSum = (1<<Offbits);
|
||||||
|
|
||||||
memset(ssPtr->litFreq, 1, (1<<Litbits));
|
for (int i=0; i<=MaxLit; i++)
|
||||||
memset(ssPtr->litLengthFreq, 1, (1<<LLbits));
|
ssPtr->litFreq[i] = 1;
|
||||||
memset(ssPtr->matchLengthFreq, 1, (1<<MLbits));
|
for (int i=0; i<=MaxLL; i++)
|
||||||
memset(ssPtr->offCodeFreq, 1, (1<<Offbits));
|
ssPtr->litLengthFreq[i] = 1;
|
||||||
|
for (int i=0; i<=MaxML; i++)
|
||||||
|
ssPtr->matchLengthFreq[i] = 1;
|
||||||
|
for (int i=0; i<=MaxOff; i++)
|
||||||
|
ssPtr->offCodeFreq[i] = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -202,7 +206,7 @@ static size_t ZSTD_resetCCtx_advanced (ZSTD_CCtx* zc,
|
|||||||
/* reserve table memory */
|
/* reserve table memory */
|
||||||
const U32 contentLog = (params.strategy == ZSTD_fast) ? 1 : params.contentLog;
|
const U32 contentLog = (params.strategy == ZSTD_fast) ? 1 : params.contentLog;
|
||||||
const size_t tableSpace = ((1 << contentLog) + (1 << params.hashLog)) * sizeof(U32);
|
const size_t tableSpace = ((1 << contentLog) + (1 << params.hashLog)) * sizeof(U32);
|
||||||
const size_t neededSpace = tableSpace + (256*sizeof(U32)) + (3*blockSize) + (1<<MLbits) + (1<<LLbits) + (1<<Offbits) + (1<<Litbits);
|
const size_t neededSpace = tableSpace + (256*sizeof(U32)) + (3*blockSize) + ((1<<MLbits) + (1<<LLbits) + (1<<Offbits) + (1<<Litbits))*sizeof(U32);
|
||||||
if (zc->workSpaceSize < neededSpace) {
|
if (zc->workSpaceSize < neededSpace) {
|
||||||
free(zc->workSpace);
|
free(zc->workSpace);
|
||||||
zc->workSpace = malloc(neededSpace);
|
zc->workSpace = malloc(neededSpace);
|
||||||
@@ -231,11 +235,11 @@ static size_t ZSTD_resetCCtx_advanced (ZSTD_CCtx* zc,
|
|||||||
zc->seqStore.litLengthStart = zc->seqStore.litStart + blockSize;
|
zc->seqStore.litLengthStart = zc->seqStore.litStart + blockSize;
|
||||||
zc->seqStore.matchLengthStart = zc->seqStore.litLengthStart + (blockSize>>2);
|
zc->seqStore.matchLengthStart = zc->seqStore.litLengthStart + (blockSize>>2);
|
||||||
zc->seqStore.dumpsStart = zc->seqStore.matchLengthStart + (blockSize>>2);
|
zc->seqStore.dumpsStart = zc->seqStore.matchLengthStart + (blockSize>>2);
|
||||||
zc->seqStore.litFreq = zc->seqStore.dumpsStart + (blockSize>>2);
|
zc->seqStore.litFreq = (U32*) (zc->seqStore.dumpsStart + (blockSize>>2));
|
||||||
zc->seqStore.litLengthFreq = zc->seqStore.litFreq + (1<<Litbits);
|
zc->seqStore.litLengthFreq = zc->seqStore.litFreq + (1<<Litbits);
|
||||||
zc->seqStore.matchLengthFreq = zc->seqStore.litLengthFreq + (1<<LLbits);
|
zc->seqStore.matchLengthFreq = zc->seqStore.litLengthFreq + (1<<LLbits);
|
||||||
zc->seqStore.offCodeFreq = zc->seqStore.matchLengthFreq + (1<<MLbits);
|
zc->seqStore.offCodeFreq = zc->seqStore.matchLengthFreq + (1<<MLbits);
|
||||||
// zc->seqStore.XXX = zc->seqStore.offCodeFreq + (1<<Offbits);
|
// zc->seqStore.XXX = zc->seqStore.offCodeFreq + (1<<Offbits)*sizeof(U32);
|
||||||
|
|
||||||
zc->hbSize = 0;
|
zc->hbSize = 0;
|
||||||
zc->stage = 0;
|
zc->stage = 0;
|
||||||
|
|||||||
@@ -87,6 +87,7 @@ static const size_t ZSTD_frameHeaderSize_min = 5;
|
|||||||
#define MLbits 7
|
#define MLbits 7
|
||||||
#define LLbits 6
|
#define LLbits 6
|
||||||
#define Offbits 5
|
#define Offbits 5
|
||||||
|
#define MaxLit ((1<<Litbits) - 1)
|
||||||
#define MaxML ((1<<MLbits) - 1)
|
#define MaxML ((1<<MLbits) - 1)
|
||||||
#define MaxLL ((1<<LLbits) - 1)
|
#define MaxLL ((1<<LLbits) - 1)
|
||||||
#define MaxOff ((1<<Offbits)- 1)
|
#define MaxOff ((1<<Offbits)- 1)
|
||||||
|
|||||||
Reference in New Issue
Block a user