Commit d7e99113 authored by Jingning Han's avatar Jingning Han

Properly update the lv-map context in the RD loop

Account for the txb_optimize effect on level map context modeling
in the transform block rate distortion optimization search.
Properly update such information in the txb hash rd cost.

BUG=aomedia:1118

Change-Id: I16cf80c57fa37929f94291a7500d84f9e0778400
parent a4812acf
......@@ -147,6 +147,7 @@ typedef struct {
uint16_t eob;
#if CONFIG_LV_MAP
uint16_t entropy_context;
uint8_t txb_entropy_ctx;
#else
uint8_t entropy_context;
#endif
......
......@@ -2042,9 +2042,14 @@ int av1_optimize_txb(const AV1_COMMON *cm, MACROBLOCK *x, int plane,
const int update = optimize_txb(&txb_info, &txb_costs, NULL, 0, fast_mode);
if (update) p->eobs[block] = txb_info.eob;
if (update) {
p->eobs[block] = txb_info.eob;
p->txb_entropy_ctx[block] =
av1_get_txb_entropy_context(qcoeff, scan_order, txb_info.eob);
}
return txb_info.eob;
}
int av1_get_txb_entropy_context(const tran_low_t *qcoeff,
const SCAN_ORDER *scan_order, int eob) {
const int16_t *const scan = scan_order->scan;
......
......@@ -3700,6 +3700,9 @@ void av1_tx_block_rd_b(const AV1_COMP *cpi, MACROBLOCK *x, TX_SIZE tx_size,
rd_stats->rate += rd_info_array[tx_type].rate;
rd_stats->skip &= rd_info_array[tx_type].eob == 0;
p->eobs[block] = rd_info_array[tx_type].eob;
#if CONFIG_LV_MAP
p->txb_entropy_ctx[block] = rd_info_array[tx_type].txb_entropy_ctx;
#endif
return;
}
......@@ -3830,6 +3833,9 @@ void av1_tx_block_rd_b(const AV1_COMP *cpi, MACROBLOCK *x, TX_SIZE tx_size,
rd_info_array[tx_type].dist = cur_dist;
rd_info_array[tx_type].rate = cur_rate;
rd_info_array[tx_type].eob = eob;
#if CONFIG_LV_MAP
rd_info_array[tx_type].txb_entropy_ctx = p->txb_entropy_ctx[block];
#endif
}
rd_stats->dist += cur_dist;
......
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