code cleanup
parent
805d2a7465
commit
e29caf7d1c
|
@ -731,7 +731,7 @@ MEM_STATIC void ZSTD_storeSeq(seqStore_t* seqStorePtr, size_t litLength, const B
|
||||||
printf("pos %6u : %3u literals & match %3u bytes at distance %6u \n",
|
printf("pos %6u : %3u literals & match %3u bytes at distance %6u \n",
|
||||||
(U32)(literals - g_start), (U32)litLength, (U32)matchCode+MINMATCH, (U32)offsetCode);
|
(U32)(literals - g_start), (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++;
|
||||||
seqStorePtr->realSeqSum++;
|
seqStorePtr->realSeqSum++;
|
||||||
seqStorePtr->realMatchSum += matchCode;
|
seqStorePtr->realMatchSum += matchCode;
|
||||||
|
@ -1917,11 +1917,12 @@ static size_t ZSTD_compress_generic (ZSTD_CCtx* zc,
|
||||||
BYTE* const ostart = (BYTE*)dst;
|
BYTE* const ostart = (BYTE*)dst;
|
||||||
BYTE* op = ostart;
|
BYTE* op = ostart;
|
||||||
const U32 maxDist = 1 << zc->params.windowLog;
|
const U32 maxDist = 1 << zc->params.windowLog;
|
||||||
|
#if ZSTD_OPT_DEBUG == 3
|
||||||
seqStore_t* ssPtr = &zc->seqStore;
|
seqStore_t* ssPtr = &zc->seqStore;
|
||||||
static U32 priceFunc = 0;
|
static U32 priceFunc = 0;
|
||||||
|
|
||||||
ssPtr->realMatchSum = ssPtr->realLitSum = ssPtr->realSeqSum = ssPtr->realRepSum = 1;
|
ssPtr->realMatchSum = ssPtr->realLitSum = ssPtr->realSeqSum = ssPtr->realRepSum = 1;
|
||||||
ssPtr->priceFunc = priceFunc;
|
ssPtr->priceFunc = priceFunc;
|
||||||
|
#endif
|
||||||
|
|
||||||
while (remaining) {
|
while (remaining) {
|
||||||
size_t cSize;
|
size_t cSize;
|
||||||
|
|
|
@ -206,13 +206,13 @@ typedef struct {
|
||||||
U32 litLengthSum;
|
U32 litLengthSum;
|
||||||
U32 litSum;
|
U32 litSum;
|
||||||
U32 offCodeSum;
|
U32 offCodeSum;
|
||||||
|
#if ZSTD_OPT_DEBUG == 3
|
||||||
U32 realMatchSum;
|
U32 realMatchSum;
|
||||||
U32 realLitSum;
|
U32 realLitSum;
|
||||||
U32 realSeqSum;
|
U32 realSeqSum;
|
||||||
U32 realRepSum;
|
U32 realRepSum;
|
||||||
U32 factor;
|
|
||||||
U32 factor2;
|
|
||||||
U32 priceFunc;
|
U32 priceFunc;
|
||||||
|
#endif
|
||||||
} seqStore_t;
|
} seqStore_t;
|
||||||
|
|
||||||
seqStore_t ZSTD_copySeqStore(const ZSTD_CCtx* ctx);
|
seqStore_t ZSTD_copySeqStore(const ZSTD_CCtx* ctx);
|
||||||
|
|
|
@ -118,16 +118,12 @@ FORCE_INLINE U32 ZSTD_getPrice(seqStore_t* seqStorePtr, U32 litLength, const BYT
|
||||||
if (matchLength >= MaxML) matchLength = MaxML;
|
if (matchLength >= MaxML) matchLength = MaxML;
|
||||||
price += ZSTD_getLiteralPrice(seqStorePtr, litLength, literals) + ZSTD_highbit(seqStorePtr->matchLengthSum+1) - ZSTD_highbit(seqStorePtr->matchLengthFreq[matchLength]+1);
|
price += ZSTD_getLiteralPrice(seqStorePtr, litLength, literals) + ZSTD_highbit(seqStorePtr->matchLengthSum+1) - ZSTD_highbit(seqStorePtr->matchLengthFreq[matchLength]+1);
|
||||||
|
|
||||||
#if ZSTD_OPT_DEBUG >= 3
|
#if ZSTD_OPT_DEBUG == 3
|
||||||
switch (seqStorePtr->priceFunc) {
|
switch (seqStorePtr->priceFunc) {
|
||||||
default:
|
default:
|
||||||
case 0:
|
case 0:
|
||||||
return 1 + price + seqStorePtr->factor + ((seqStorePtr->litSum>>5) / seqStorePtr->litLengthSum) + ((seqStorePtr->litSum<<1) / (seqStorePtr->litSum + seqStorePtr->matchSum));
|
return 1 + price + ((seqStorePtr->litSum>>5) / seqStorePtr->litLengthSum) + ((seqStorePtr->litSum<<1) / (seqStorePtr->litSum + seqStorePtr->matchSum));
|
||||||
case 1:
|
case 1:
|
||||||
return 1 + price + seqStorePtr->factor + ((seqStorePtr->factor2) ? ((seqStorePtr->litSum>>5) / seqStorePtr->litLengthSum) + ((seqStorePtr->litSum<<1) / (seqStorePtr->litSum + seqStorePtr->matchSum)) : 0);
|
|
||||||
case 2:
|
|
||||||
return 1 + price + seqStorePtr->factor + ((seqStorePtr->factor2) ? ((seqStorePtr->litSum>>4) / seqStorePtr->litLengthSum) + ((seqStorePtr->litSum<<1) / (seqStorePtr->litSum + seqStorePtr->matchSum)) : 0);
|
|
||||||
case 3:
|
|
||||||
return 1 + price;
|
return 1 + price;
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
|
|
Loading…
Reference in New Issue