Commit 84dc6e97 authored by David Barker's avatar David Barker

Fix inter block detection in get_tx_size_context()

In the decoder, the function get_tx_size_context() is called
by read_selected_tx_size(), *before* mbmi->ref_frame is set up.
This means that mbmi->ref_frame still holds the ref frames from
the previous block, and does not indicate if the current block is
inter or not.

Fortunately, all of the other functions called by read_selected_tx_size()
have an explicit "is_inter" parameter, which is set correctly.
So we can just plumb this through into get_tx_size_context().

Change-Id: I00f0f3704937f592ccc5d304ed20ee25196dd520
parent 2fc20eba
......@@ -329,10 +329,9 @@ static INLINE aom_cdf_prob *av1_get_pred_cdf_single_ref_p6(
// The mode info data structure has a one element border above and to the
// left of the entries corresponding to real blocks.
// The prediction flags in these dummy entries are initialized to 0.
static INLINE int get_tx_size_context(const MACROBLOCKD *xd) {
static INLINE int get_tx_size_context(const MACROBLOCKD *xd, int is_inter) {
const MB_MODE_INFO *mbmi = &xd->mi[0]->mbmi;
const TX_SIZE max_tx_size =
max_txsize_rect_lookup[is_inter_block(mbmi)][mbmi->sb_type];
const TX_SIZE max_tx_size = max_txsize_rect_lookup[is_inter][mbmi->sb_type];
const int max_tx_wide = tx_size_wide[max_tx_size];
const int max_tx_high = tx_size_high[max_tx_size];
const MB_MODE_INFO *const above_mbmi = xd->above_mbmi;
......
......@@ -473,7 +473,7 @@ static TX_SIZE read_selected_tx_size(AV1_COMMON *cm, MACROBLOCKD *xd,
const BLOCK_SIZE bsize = xd->mi[0]->mbmi.sb_type;
const int32_t tx_size_cat = bsize_to_tx_size_cat(bsize, is_inter);
const int max_depths = bsize_to_max_depth(bsize, 0);
const int ctx = get_tx_size_context(xd);
const int ctx = get_tx_size_context(xd, is_inter);
FRAME_CONTEXT *ec_ctx = xd->tile_ctx;
(void)cm;
......
......@@ -238,7 +238,7 @@ static void write_selected_tx_size(const AV1_COMMON *cm, const MACROBLOCKD *xd,
(void)cm;
if (block_signals_txsize(bsize)) {
const TX_SIZE tx_size = mbmi->tx_size;
const int tx_size_ctx = get_tx_size_context(xd);
const int tx_size_ctx = get_tx_size_context(xd, 0);
const int depth = tx_size_to_depth(tx_size, bsize, 0);
const int max_depths = bsize_to_max_depth(bsize, 0);
const int32_t tx_size_cat = bsize_to_tx_size_cat(bsize, 0);
......
......@@ -775,7 +775,7 @@ static void sum_intra_stats(FRAME_COUNTS *counts, MACROBLOCKD *xd,
if (block_signals_txsize(bsize) && !xd->lossless[mbmi->segment_id] &&
allow_update_cdf) {
const TX_SIZE tx_size = mbmi->tx_size;
const int tx_size_ctx = get_tx_size_context(xd);
const int tx_size_ctx = get_tx_size_context(xd, 0);
const int32_t tx_size_cat = bsize_to_tx_size_cat(bsize, 0);
const int depth = tx_size_to_depth(tx_size, bsize, 0);
const int max_depths = bsize_to_max_depth(bsize, 0);
......
......@@ -2125,7 +2125,7 @@ static int tx_size_cost(const AV1_COMMON *const cm, const MACROBLOCK *const x,
const int is_inter = is_inter_block(mbmi);
const int32_t tx_size_cat = bsize_to_tx_size_cat(bsize, is_inter);
const int depth = tx_size_to_depth(tx_size, bsize, is_inter);
const int tx_size_ctx = get_tx_size_context(xd);
const int tx_size_ctx = get_tx_size_context(xd, is_inter);
int r_tx_size = x->tx_size_cost[tx_size_cat][tx_size_ctx][depth];
return r_tx_size;
} else {
......
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