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:
Pascal Massimino
2012-01-25 07:45:34 -08:00
parent 974aaff360
commit 1336fa719d
5 changed files with 19 additions and 8 deletions

View File

@ -158,9 +158,12 @@ const uint8_t
void VP8DefaultProbas(VP8Encoder* const enc) {
VP8Proba* const probas = &enc->proba_;
probas->use_skip_proba_ = 0;
memset(probas->segments_, 255u, sizeof(probas->segments_));
memcpy(probas->coeffs_, VP8CoeffsProba0, sizeof(VP8CoeffsProba0));
probas->use_skip_proba_ = 0;
// Note: we could hard-code the level_costs_ corresponding to VP8CoeffsProba0,
// but that's ~11k of static data. Better call VP8CalculateLevelCosts() later.
probas->dirty_ = 1;
}
// Paragraph 11.5. 900bytes.