Commit 51fac92a authored by Jingning Han's avatar Jingning Han

Refactor base range decoding to avoid hard division

Use cumulative range check to avoid the division in the for-loop
for base range decoding in lv-map. This makes the lv-map transform
coefficient decoding process 10% faster at the decoder end, at
high target bit-rate range.

Change-Id: I85e9646ce05f0c20c10f776ff9cdd082b16e9989
parent 6217782f
......@@ -305,7 +305,7 @@ uint8_t av1_read_coeffs_txb(const AV1_COMMON *const cm, MACROBLOCKD *const xd,
for (c = 0; c < num_updates; ++c) {
const int pos = update_pos[c];
uint8_t *const level = &levels[get_padded_idx(pos, bwl)];
int idx;
int idx = 0;
int ctx;
assert(*level > NUM_BASE_LEVELS);
......@@ -315,7 +315,7 @@ uint8_t av1_read_coeffs_txb(const AV1_COMMON *const cm, MACROBLOCKD *const xd,
#else
ctx = get_br_ctx(levels, pos, bwl, level_counts[pos]);
#endif
for (idx = 0; idx < COEFF_BASE_RANGE / (BR_CDF_SIZE - 1); ++idx) {
for (idx = 0; idx < COEFF_BASE_RANGE; idx += BR_CDF_SIZE - 1) {
int k = av1_read_record_symbol(
counts, r,
ec_ctx->coeff_br_cdf[AOMMIN(txs_ctx, TX_32X32)][plane_type][ctx],
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment