ZSTD_getPrice
This commit is contained in:
parent
d02506c186
commit
78e5ea3a32
@ -2305,7 +2305,7 @@ static const ZSTD_parameters ZSTD_defaultParameters[4][ZSTD_MAX_CLEVEL+1] = {
|
||||
{ 0, 22, 20, 22, 4, 4, ZSTD_lazy2 }, /* level 11 + L=4 */ // 41902762 lazy1=42087013 norep1=42911693
|
||||
{ 0, 23, 21, 22, 5, 4, ZSTD_btlazy2 }, /* level 16 + L=4 */ // 41233150 btlazy1=41560211 norep1=42322286
|
||||
{ 0, 23, 21, 22, 5, 4, ZSTD_opt }, /* level 23 */
|
||||
{ 0, 23, 21, 22, 5, 4, ZSTD_opt_bt }, /* level 23 */
|
||||
{ 0, 23, 21, 22, 5, 4, ZSTD_opt_bt }, /* level 24 */
|
||||
},
|
||||
{ /* for srcSize <= 256 KB */
|
||||
/* W, C, H, S, L, strat */
|
||||
|
@ -64,6 +64,41 @@ FORCE_INLINE U32 LZ5HC_get_price(U32 litlen, U32 offset, U32 mlen)
|
||||
return lit_cost + match_cost;
|
||||
}
|
||||
|
||||
MEM_STATIC size_t ZSTD_getPrice(seqStore_t* seqStorePtr, size_t litLength, const BYTE* literals, size_t offsetCode, size_t matchCode)
|
||||
{
|
||||
#if 0
|
||||
static const BYTE* g_start = NULL;
|
||||
if (g_start==NULL) g_start = literals;
|
||||
//if (literals - g_start == 8695)
|
||||
printf("pos %6u : %3u literals & match %3u bytes at distance %6u \n",
|
||||
(U32)(literals - g_start), (U32)litLength, (U32)matchCode+4, (U32)offsetCode);
|
||||
#endif
|
||||
size_t price = 0;
|
||||
|
||||
/* literals */
|
||||
seqStorePtr->lit += litLength;
|
||||
|
||||
/* literal Length */
|
||||
if (litLength >= MaxLL) {
|
||||
*(seqStorePtr->litLength++) = MaxLL;
|
||||
if (litLength<255 + MaxLL) price += 8; else price += 32;
|
||||
}
|
||||
else *(seqStorePtr->litLength++) = (BYTE)litLength;
|
||||
|
||||
/* match offset */
|
||||
*(seqStorePtr->offset++) = (U32)offsetCode;
|
||||
|
||||
/* match Length */
|
||||
if (matchCode >= MaxML) {
|
||||
*(seqStorePtr->matchLength++) = MaxML;
|
||||
if (matchCode < 255+MaxML) price += 8; else price += 32;
|
||||
}
|
||||
else *(seqStorePtr->matchLength++) = (BYTE)matchCode;
|
||||
|
||||
return price;
|
||||
}
|
||||
|
||||
|
||||
|
||||
#define SET_PRICE(pos, mlen, offset, litlen, price) \
|
||||
{ \
|
||||
|
Loading…
x
Reference in New Issue
Block a user