[lv_map_multi] adjust speed of prob adaptation
Use a lookup table to deterimine speed of adaptation in update_cdf.
Tests on 5 keyframes show improvement in BD-rate: consistently more
than -0.2% for google test sets (lowres, midres, hdres).
Change-Id: I6f8927fc6e876e22ebcf2f9340ed62e54cc79d28
diff --git a/aom_dsp/prob.h b/aom_dsp/prob.h
index 7975c16..50d8ffd 100644
--- a/aom_dsp/prob.h
+++ b/aom_dsp/prob.h
@@ -215,7 +215,15 @@
#if 1
#if CONFIG_LV_MAP_MULTI
- rate = 3 + (cdf[nsymbs] > 15) + (cdf[nsymbs] > 31) + get_msb(nsymbs);
+ // static const int nsymbs2speed[17] = { 0, 0, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3,
+ // 3, 3, 3, 3, 4 };
+ // static const int nsymbs2speed[17] = { 0, 0, 1, 1, 2, 2, 2, 2, 2,
+ // 2, 2, 2, 3, 3, 3, 3, 3 };
+ static const int nsymbs2speed[17] = { 0, 0, 1, 1, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2 };
+ assert(nsymbs < 17);
+ rate = 3 + (cdf[nsymbs] > 15) + (cdf[nsymbs] > 31) +
+ nsymbs2speed[nsymbs]; // + get_msb(nsymbs);
tmp = AOM_ICDF(0);
(void)rate2;
(void)diff;
diff --git a/av1/encoder/encodetxb.c b/av1/encoder/encodetxb.c
index 915e122..6438e0b 100644
--- a/av1/encoder/encodetxb.c
+++ b/av1/encoder/encodetxb.c
@@ -771,13 +771,8 @@
const LV_MAP_EOB_COST *const eob_costs =
&x->eob_costs[eob_multi_size][plane_type];
#endif
-
- cost = 0;
-
- if (eob == 0) {
- cost = coeff_costs->txb_skip_cost[txb_skip_ctx][1];
- return cost;
- }
+ // eob must be greater than 0 here.
+ assert(eob > 0);
cost = coeff_costs->txb_skip_cost[txb_skip_ctx][0];
av1_txb_init_levels(qcoeff, width, height, levels);