fix for LevelCost + little speed-up
the p0 proba was incorrectly accumulated. Merging its contribution into the LevelCost[] was creating more problems than anything (esp. with trellis) so let's just not. Change-Id: I4c07bfee471085df901228d97b20a4d9606ba44e
This commit is contained in:
parent
7107d54483
commit
7f23678da0
@ -359,7 +359,7 @@ void VP8CalculateLevelCosts(VP8Proba* const proba) {
|
|||||||
for(ctx = 0; ctx < NUM_CTX; ++ctx) {
|
for(ctx = 0; ctx < NUM_CTX; ++ctx) {
|
||||||
const uint8_t* const p = proba->coeffs_[ctype][band][ctx];
|
const uint8_t* const p = proba->coeffs_[ctype][band][ctx];
|
||||||
uint16_t* const table = proba->level_cost_[ctype][band][ctx];
|
uint16_t* const table = proba->level_cost_[ctype][band][ctx];
|
||||||
const int cost_base = VP8BitCost(0, p[0]) + VP8BitCost(1, p[1]);
|
const int cost_base = VP8BitCost(1, p[1]);
|
||||||
int v;
|
int v;
|
||||||
table[0] = VP8BitCost(0, p[1]);
|
table[0] = VP8BitCost(0, p[1]);
|
||||||
for (v = 1; v <= MAX_VARIABLE_LEVEL; ++v) {
|
for (v = 1; v <= MAX_VARIABLE_LEVEL; ++v) {
|
||||||
|
@ -274,12 +274,15 @@ static int GetResidualCost(int ctx, const VP8Residual* const res) {
|
|||||||
const int b = VP8EncBands[n + 1];
|
const int b = VP8EncBands[n + 1];
|
||||||
++n;
|
++n;
|
||||||
if (v == 0) {
|
if (v == 0) {
|
||||||
cost += VP8LevelCost(t, 0);
|
// short-case for VP8LevelCost(t, 0) (note: VP8LevelFixedCosts[0] == 0):
|
||||||
|
cost += t[0];
|
||||||
t = res->cost[b][0];
|
t = res->cost[b][0];
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
cost += VP8BitCost(1, p0);
|
||||||
if (2u >= (unsigned int)(v + 1)) { // v = -1 or 1
|
if (2u >= (unsigned int)(v + 1)) { // v = -1 or 1
|
||||||
cost += VP8LevelCost(t, 1);
|
// short-case for "VP8LevelCost(t, 1)" (256 is VP8LevelFixedCosts[1]):
|
||||||
|
cost += 256 + t[1];
|
||||||
p0 = res->prob[b][1][0];
|
p0 = res->prob[b][1][0];
|
||||||
t = res->cost[b][1];
|
t = res->cost[b][1];
|
||||||
} else {
|
} else {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user