mirror of
https://github.com/webmproject/libwebp.git
synced 2025-07-18 23:09:52 +02:00
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:
@ -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;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user