Fix coeff cost error incurred by to br_node
We calculate eob cost in the end of the outer for loop
However, The continue statement from br_node may lead to ignoring
eob cost
Change-Id: Ic80c88e034836eb4dc4ac8b87bf0b7b45bf5d097
diff --git a/av1/encoder/encodetxb.c b/av1/encoder/encodetxb.c
index b06c43d..489d3d2 100644
--- a/av1/encoder/encodetxb.c
+++ b/av1/encoder/encodetxb.c
@@ -460,21 +460,18 @@
}
if (level > NUM_BASE_LEVELS) {
- int idx;
int ctx;
ctx = get_br_ctx(qcoeff, scan[c], bwl, height);
#if BR_NODE
int base_range = level - 1 - NUM_BASE_LEVELS;
if (base_range < COEFF_BASE_RANGE) {
cost += coeff_costs->lps_cost[ctx][base_range];
- continue;
} else {
cost += coeff_costs->lps_cost[ctx][COEFF_BASE_RANGE];
}
- idx = COEFF_BASE_RANGE;
#else
- for (idx = 0; idx < COEFF_BASE_RANGE; ++idx) {
+ for (int idx = 0; idx < COEFF_BASE_RANGE; ++idx) {
if (level == (idx + 1 + NUM_BASE_LEVELS)) {
cost += coeff_costs->lps_cost[ctx][1];
break;
@@ -482,7 +479,7 @@
cost += coeff_costs->lps_cost[ctx][0];
}
#endif
- if (idx >= COEFF_BASE_RANGE) {
+ if (level >= 1 + NUM_BASE_LEVELS + COEFF_BASE_RANGE) {
// residual cost
int r = level - COEFF_BASE_RANGE - NUM_BASE_LEVELS;
int ri = r;