Commit 366bf3c2 authored by Jingning Han's avatar Jingning Han Committed by Gerrit Code Review

Merge "Reset txfm context condition for skip coded blocks" into nextgenv2

parents 88b9e90a 981f09a1
......@@ -220,6 +220,9 @@ typedef struct macroblockd {
TXFM_CONTEXT *above_txfm_context;
TXFM_CONTEXT *left_txfm_context;
TXFM_CONTEXT left_txfm_context_buffer[8];
// dimension in the unit of 8x8 block of the current block
int16_t n8_w, n8_h;
#endif
#if CONFIG_VP9_HIGHBITDEPTH
......
......@@ -452,6 +452,11 @@ static INLINE void set_mi_row_col(MACROBLOCKD *xd, const TileInfo *const tile,
xd->left_mi = NULL;
xd->left_mbmi = NULL;
}
#if CONFIG_VAR_TX
xd->n8_h = bh;
xd->n8_w = bw;
#endif
}
static INLINE const vpx_prob *get_y_mode_probs(const VP10_COMMON *cm,
......@@ -496,6 +501,14 @@ static INLINE int partition_plane_context(const MACROBLOCKD *xd,
}
#if CONFIG_VAR_TX
static INLINE void set_txfm_ctx(TXFM_CONTEXT *txfm_ctx,
TX_SIZE tx_size,
int len) {
int i;
for (i = 0; i < len; ++i)
txfm_ctx[i] = tx_size;
}
static INLINE void txfm_partition_update(TXFM_CONTEXT *above_ctx,
TXFM_CONTEXT *left_ctx,
TX_SIZE tx_size) {
......
......@@ -771,6 +771,8 @@ static void read_inter_frame_mode_info(VP10Decoder *const pbi,
inter_block = read_is_inter_block(cm, xd, mbmi->segment_id, r);
#if CONFIG_VAR_TX
xd->above_txfm_context = cm->above_txfm_context + mi_col;
xd->left_txfm_context = xd->left_txfm_context_buffer + (mi_row & 0x07);
if (bsize >= BLOCK_8X8 && cm->tx_mode == TX_MODE_SELECT &&
!mbmi->skip && inter_block) {
const TX_SIZE max_tx_size = max_txsize_lookup[bsize];
......@@ -779,8 +781,6 @@ static void read_inter_frame_mode_info(VP10Decoder *const pbi,
const int width = num_4x4_blocks_wide_lookup[bsize];
const int height = num_4x4_blocks_high_lookup[bsize];
int idx, idy;
xd->above_txfm_context = cm->above_txfm_context + mi_col;
xd->left_txfm_context = xd->left_txfm_context_buffer + (mi_row & 0x07);
for (idy = 0; idy < height; idy += bs)
for (idx = 0; idx < width; idx += bs)
read_tx_size_inter(cm, xd, mbmi, xd->counts, max_tx_size,
......@@ -799,6 +799,9 @@ static void read_inter_frame_mode_info(VP10Decoder *const pbi,
for (idx = 0; idx < width; ++idx)
mbmi->inter_tx_size[(idy >> 1) * 8 + (idx >> 1)] = mbmi->tx_size;
}
set_txfm_ctx(xd->left_txfm_context, mbmi->tx_size, xd->n8_h);
set_txfm_ctx(xd->above_txfm_context, mbmi->tx_size, xd->n8_w);
}
#else
mbmi->tx_size = read_tx_size(cm, xd, !mbmi->skip || !inter_block, r);
......
......@@ -564,10 +564,16 @@ static void pack_inter_mode_mvs(VP10_COMP *cpi, const MODE_INFO *mi,
for (idx = 0; idx < width; idx += bs)
write_tx_size_inter(cm, xd, mbmi, max_tx_size, idy, idx, w);
} else {
set_txfm_ctx(xd->left_txfm_context, mbmi->tx_size, xd->n8_h);
set_txfm_ctx(xd->above_txfm_context, mbmi->tx_size, xd->n8_w);
write_selected_tx_size(cm, xd, w);
}
} else {
set_txfm_ctx(xd->left_txfm_context, mbmi->tx_size, xd->n8_h);
set_txfm_ctx(xd->above_txfm_context, mbmi->tx_size, xd->n8_w);
#else
write_selected_tx_size(cm, xd, w);
write_selected_tx_size(cm, xd, w);
#endif
}
......
......@@ -3272,12 +3272,11 @@ static void encode_superblock(VP10_COMP *cpi, ThreadData *td,
int x, y;
TX_SIZE tx_size;
// The new intra coding scheme requires no change of transform size
if (is_inter_block(&mi->mbmi)) {
if (is_inter_block(&mi->mbmi))
tx_size = VPXMIN(tx_mode_to_biggest_tx_size[cm->tx_mode],
max_txsize_lookup[bsize]);
} else {
else
tx_size = (bsize >= BLOCK_8X8) ? mbmi->tx_size : TX_4X4;
}
for (y = 0; y < mi_height; y++)
for (x = 0; x < mi_width; x++)
......@@ -3306,8 +3305,21 @@ static void encode_superblock(VP10_COMP *cpi, ThreadData *td,
#if CONFIG_VAR_TX
if (cm->tx_mode == TX_MODE_SELECT && mbmi->sb_type >= BLOCK_8X8 &&
is_inter_block(mbmi) && !(mbmi->skip || seg_skip) &&
!output_enabled)
tx_partition_set_contexts(cm, xd, bsize, mi_row, mi_col);
is_inter_block(mbmi) && !(mbmi->skip || seg_skip)) {
if (!output_enabled)
tx_partition_set_contexts(cm, xd, bsize, mi_row, mi_col);
} else {
TX_SIZE tx_size;
// The new intra coding scheme requires no change of transform size
if (is_inter_block(mbmi))
tx_size = VPXMIN(tx_mode_to_biggest_tx_size[cm->tx_mode],
max_txsize_lookup[bsize]);
else
tx_size = (bsize >= BLOCK_8X8) ? mbmi->tx_size : TX_4X4;
mbmi->tx_size = tx_size;
set_txfm_ctx(xd->left_txfm_context, tx_size, xd->n8_h);
set_txfm_ctx(xd->above_txfm_context, tx_size, xd->n8_w);
}
#endif
}
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