replaced FSE_count by FSE_count_simple
to reduce usage of stack memory. Also : tweaked a few comments, as suggested by @terrelln
This commit is contained in:
parent
99ddca43a6
commit
761758982e
@ -97,8 +97,8 @@ typedef struct {
|
||||
U32 log2matchLengthSum; /* pow2 to compare log2(mlfreq) to */
|
||||
U32 log2offCodeSum; /* pow2 to compare log2(offreq) to */
|
||||
/* end : updated by ZSTD_setLog2Prices */
|
||||
ZSTD_OptPrice_e priceType; /* prices follow a pre-defined cost structure, statistics are irrelevant */
|
||||
const ZSTD_entropyCTables_t* symbolCosts; /* pre-calculated symbol costs, from dictionary */
|
||||
ZSTD_OptPrice_e priceType; /* prices can be determined dynamically, or follow dictionary statistics, or a pre-defined cost structure */
|
||||
const ZSTD_entropyCTables_t* symbolCosts; /* pre-calculated dictionary statistics */
|
||||
} optState_t;
|
||||
|
||||
typedef struct {
|
||||
|
@ -97,9 +97,9 @@ static void ZSTD_rescaleFreqs(optState_t* const optPtr,
|
||||
} else { /* not a dictionary */
|
||||
|
||||
assert(optPtr->litFreq != NULL);
|
||||
optPtr->litSum = 0;
|
||||
{ unsigned lit = MaxLit;
|
||||
FSE_count(optPtr->litFreq, &lit, src, srcSize); /* use raw first block to init statistics */
|
||||
FSE_count_simple(optPtr->litFreq, &lit, src, srcSize); /* use raw first block to init statistics */
|
||||
optPtr->litSum = 0;
|
||||
for (lit=0; lit<=MaxLit; lit++) {
|
||||
optPtr->litFreq[lit] = 1 + (optPtr->litFreq[lit] >> (ZSTD_FREQ_DIV+1));
|
||||
optPtr->litSum += optPtr->litFreq[lit];
|
||||
@ -244,7 +244,7 @@ static int ZSTD_litLengthContribution(U32 const litLength, const optState_t* con
|
||||
/* dynamic statistics */
|
||||
{ U32 const llCode = ZSTD_LLcode(litLength);
|
||||
int const contribution = (LL_bits[llCode]
|
||||
+ ZSTD_highbit32(optPtr->litLengthFreq[0]+1)
|
||||
+ ZSTD_highbit32(optPtr->litLengthFreq[0]+1) /* note: log2litLengthSum cancels out with following one */
|
||||
- ZSTD_highbit32(optPtr->litLengthFreq[llCode]+1))
|
||||
* BITCOST_MULTIPLIER;
|
||||
#if 1
|
||||
|
Loading…
Reference in New Issue
Block a user