1-2% faster encoding by removing an indirection in GetResidualCost()

The MIPS code for cost is not updated yet, that's why i keep Residual::*cost
around for now. Should be removed in favor of *costs later.

Change-Id: Id1d09a8c37ea8c5b34ad5eb8811d6a3ec6c4d89f
This commit is contained in:
Pascal Massimino
2015-02-19 08:44:35 +01:00
parent eddb7e70be
commit 2382050748
6 changed files with 25 additions and 12 deletions

View File

@ -63,6 +63,7 @@ void VP8CalculateLevelCosts(VP8Proba* const proba) {
if (!proba->dirty_) return; // nothing to do.
for (ctype = 0; ctype < NUM_TYPES; ++ctype) {
int n;
for (band = 0; band < NUM_BANDS; ++band) {
for (ctx = 0; ctx < NUM_CTX; ++ctx) {
const uint8_t* const p = proba->coeffs_[ctype][band][ctx];
@ -78,6 +79,12 @@ void VP8CalculateLevelCosts(VP8Proba* const proba) {
// actually constant.
}
}
for (n = 0; n < 16; ++n) { // replicate bands. We don't need to sentinel.
for (ctx = 0; ctx < NUM_CTX; ++ctx) {
proba->remapped_costs_[ctype][n][ctx] =
proba->level_cost_[ctype][VP8EncBands[n]][ctx];
}
}
}
proba->dirty_ = 0;
}
@ -202,6 +209,7 @@ void VP8InitResidual(int first, int coeff_type,
res->prob = enc->proba_.coeffs_[coeff_type];
res->stats = enc->proba_.stats_[coeff_type];
res->cost = enc->proba_.level_cost_[coeff_type];
res->costs = enc->proba_.remapped_costs_[coeff_type];
res->first = first;
}