Reset txfm context condition for skip coded blocks

If a block has all coefficients quantized to zero, the codec will
assume that it uses largest transform block size.

Change-Id: Icd4e8e7cdc4b6af6974f87169e50b040ebfe9020
This commit is contained in:
Jingning Han
2015-10-15 17:50:13 -07:00
parent 3edad6e887
commit 981f09a1f1
5 changed files with 46 additions and 9 deletions

View File

@@ -220,6 +220,9 @@ typedef struct macroblockd {
TXFM_CONTEXT *above_txfm_context; TXFM_CONTEXT *above_txfm_context;
TXFM_CONTEXT *left_txfm_context; TXFM_CONTEXT *left_txfm_context;
TXFM_CONTEXT left_txfm_context_buffer[8]; 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 #endif
#if CONFIG_VP9_HIGHBITDEPTH #if CONFIG_VP9_HIGHBITDEPTH

View File

@@ -452,6 +452,11 @@ static INLINE void set_mi_row_col(MACROBLOCKD *xd, const TileInfo *const tile,
xd->left_mi = NULL; xd->left_mi = NULL;
xd->left_mbmi = 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, 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 #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, static INLINE void txfm_partition_update(TXFM_CONTEXT *above_ctx,
TXFM_CONTEXT *left_ctx, TXFM_CONTEXT *left_ctx,
TX_SIZE tx_size) { TX_SIZE tx_size) {

View File

@@ -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); inter_block = read_is_inter_block(cm, xd, mbmi->segment_id, r);
#if CONFIG_VAR_TX #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 && if (bsize >= BLOCK_8X8 && cm->tx_mode == TX_MODE_SELECT &&
!mbmi->skip && inter_block) { !mbmi->skip && inter_block) {
const TX_SIZE max_tx_size = max_txsize_lookup[bsize]; 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 width = num_4x4_blocks_wide_lookup[bsize];
const int height = num_4x4_blocks_high_lookup[bsize]; const int height = num_4x4_blocks_high_lookup[bsize];
int idx, idy; 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 (idy = 0; idy < height; idy += bs)
for (idx = 0; idx < width; idx += bs) for (idx = 0; idx < width; idx += bs)
read_tx_size_inter(cm, xd, mbmi, xd->counts, max_tx_size, read_tx_size_inter(cm, xd, mbmi, xd->counts, max_tx_size,
@@ -800,6 +800,9 @@ static void read_inter_frame_mode_info(VP10Decoder *const pbi,
for (idx = 0; idx < width; ++idx) for (idx = 0; idx < width; ++idx)
mbmi->inter_tx_size[(idy >> 1) * 8 + (idx >> 1)] = mbmi->tx_size; 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 #else
mbmi->tx_size = read_tx_size(cm, xd, !mbmi->skip || !inter_block, r); mbmi->tx_size = read_tx_size(cm, xd, !mbmi->skip || !inter_block, r);

View File

@@ -564,10 +564,16 @@ static void pack_inter_mode_mvs(VP10_COMP *cpi, const MODE_INFO *mi,
for (idx = 0; idx < width; idx += bs) for (idx = 0; idx < width; idx += bs)
write_tx_size_inter(cm, xd, mbmi, max_tx_size, idy, idx, w); write_tx_size_inter(cm, xd, mbmi, max_tx_size, idy, idx, w);
} else { } 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); 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 #else
write_selected_tx_size(cm, xd, w); write_selected_tx_size(cm, xd, w);
#endif #endif
} }

View File

@@ -3279,12 +3279,11 @@ static void encode_superblock(VP10_COMP *cpi, ThreadData *td,
int x, y; int x, y;
TX_SIZE tx_size; TX_SIZE tx_size;
// The new intra coding scheme requires no change of transform 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], tx_size = VPXMIN(tx_mode_to_biggest_tx_size[cm->tx_mode],
max_txsize_lookup[bsize]); max_txsize_lookup[bsize]);
} else { else
tx_size = (bsize >= BLOCK_8X8) ? mbmi->tx_size : TX_4X4; tx_size = (bsize >= BLOCK_8X8) ? mbmi->tx_size : TX_4X4;
}
for (y = 0; y < mi_height; y++) for (y = 0; y < mi_height; y++)
for (x = 0; x < mi_width; x++) for (x = 0; x < mi_width; x++)
@@ -3313,8 +3312,21 @@ static void encode_superblock(VP10_COMP *cpi, ThreadData *td,
#if CONFIG_VAR_TX #if CONFIG_VAR_TX
if (cm->tx_mode == TX_MODE_SELECT && mbmi->sb_type >= BLOCK_8X8 && if (cm->tx_mode == TX_MODE_SELECT && mbmi->sb_type >= BLOCK_8X8 &&
is_inter_block(mbmi) && !(mbmi->skip || seg_skip) && is_inter_block(mbmi) && !(mbmi->skip || seg_skip)) {
!output_enabled) if (!output_enabled)
tx_partition_set_contexts(cm, xd, bsize, mi_row, mi_col); 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 #endif
} }