WIP: lv_map_multi: make br multi symbol
The br_cdf and lps_cdf with a new 4-state symbol br_cdf.
The br symbol indicates whether the level is k, k+1, k+2 or >k+2
In the latter case, a new br symbol is read. Up to 4 br symbols are
read which will reach level 14 at most. Levels greater than 14 are
golomb coded.
The adapted symbol count is reduced further by this commit.
E.g. for the I-frame of ducks_take_off at cq=12, the number of adapted symbols
is reduced from 4.27M to 3.85M. About 10% reduction.
Gains seems about neutral on a limitied subset.
Change-Id: I294234dbd63fb0fa26aef297a371cba80bd67383
diff --git a/av1/decoder/decodetxb.c b/av1/decoder/decodetxb.c
index a89e39c..edcb0aa 100644
--- a/av1/decoder/decodetxb.c
+++ b/av1/decoder/decodetxb.c
@@ -286,6 +286,19 @@
ctx = get_br_ctx(levels, scan[c], bwl, level_counts[scan[c]]);
+#if CONFIG_LV_MAP_MULTI
+ for (idx = 0; idx < COEFF_BASE_RANGE / (BR_CDF_SIZE - 1); ++idx) {
+ int k = av1_read_record_symbol4(
+ counts, r, ec_ctx->coeff_br_cdf[txs_ctx][plane_type][ctx],
+ BR_CDF_SIZE, ACCT_STR);
+ *level += k;
+ if (k < BR_CDF_SIZE - 1) break;
+ }
+ if (*level <= NUM_BASE_LEVELS + COEFF_BASE_RANGE) {
+ cul_level += *level;
+ continue;
+ }
+#else
for (idx = 0; idx < BASE_RANGE_SETS; ++idx) {
// printf("br: %d %d %d %d\n", txs_ctx, plane_type, idx, ctx);
if (av1_read_record_bin(
@@ -318,7 +331,7 @@
}
if (idx < BASE_RANGE_SETS) continue;
-
+#endif
// decode 0-th order Golomb code
*level = COEFF_BASE_RANGE + 1 + NUM_BASE_LEVELS;
// Save golomb in tcoeffs because adding it to level may incur overflow