mirror of
https://github.com/webmproject/libwebp.git
synced 2025-07-14 21:09:55 +02:00
Only recompute level_cost_[] when needed
Add a dirty_ flag to keep track of updated probabilities and the need to recompute the level costs. This only makes a difference for "-m 2" method which was sub-optimal. But it's overall cleaner to have this flag. Change-Id: I21c71201e1d07a923d97a3adf2fbbd7d67d35433
This commit is contained in:
@ -354,6 +354,9 @@ static int VariableLevelCost(int level, const uint8_t probas[NUM_PROBAS]) {
|
||||
|
||||
void VP8CalculateLevelCosts(VP8Proba* const proba) {
|
||||
int ctype, band, ctx;
|
||||
|
||||
if (!proba->dirty_) return; // nothing to do.
|
||||
|
||||
for (ctype = 0; ctype < NUM_TYPES; ++ctype) {
|
||||
for (band = 0; band < NUM_BANDS; ++band) {
|
||||
for(ctx = 0; ctx < NUM_CTX; ++ctx) {
|
||||
@ -370,6 +373,7 @@ void VP8CalculateLevelCosts(VP8Proba* const proba) {
|
||||
}
|
||||
}
|
||||
}
|
||||
proba->dirty_ = 0;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
Reference in New Issue
Block a user