Commit d0930277 authored by Jingning Han's avatar Jingning Han
Browse files

Fix transform size coding mismatch

This commit fixes a transform size enc/dec mismatch issue in the
key frame coding.

Change-Id: I0c4f40464a367b33dd91ace84506650b1aec2873
parent a2db88fc
...@@ -155,8 +155,7 @@ static void kfread_modes(VP9D_COMP *pbi, MODE_INFO *m, ...@@ -155,8 +155,7 @@ static void kfread_modes(VP9D_COMP *pbi, MODE_INFO *m,
m->mbmi.uv_mode = read_uv_mode(r, cm->kf_uv_mode_prob[m->mbmi.mode]); m->mbmi.uv_mode = read_uv_mode(r, cm->kf_uv_mode_prob[m->mbmi.mode]);
if (cm->txfm_mode == TX_MODE_SELECT && if (cm->txfm_mode == TX_MODE_SELECT &&
!(m->mbmi.mb_skip_coeff && m->mbmi.ref_frame != INTRA_FRAME) m->mbmi.sb_type >= BLOCK_SIZE_SB8X8) {
&& m->mbmi.sb_type >= BLOCK_SIZE_SB8X8) {
const int allow_16x16 = m->mbmi.sb_type >= BLOCK_SIZE_MB16X16; const int allow_16x16 = m->mbmi.sb_type >= BLOCK_SIZE_MB16X16;
const int allow_32x32 = m->mbmi.sb_type >= BLOCK_SIZE_SB32X32; const int allow_32x32 = m->mbmi.sb_type >= BLOCK_SIZE_SB32X32;
m->mbmi.txfm_size = select_txfm_size(cm, r, allow_16x16, allow_32x32); m->mbmi.txfm_size = select_txfm_size(cm, r, allow_16x16, allow_32x32);
......
...@@ -887,8 +887,7 @@ static void write_mb_modes_kf(const VP9_COMP *cpi, ...@@ -887,8 +887,7 @@ static void write_mb_modes_kf(const VP9_COMP *cpi,
write_uv_mode(bc, m->mbmi.uv_mode, c->kf_uv_mode_prob[ym]); write_uv_mode(bc, m->mbmi.uv_mode, c->kf_uv_mode_prob[ym]);
if (m->mbmi.sb_type >= BLOCK_SIZE_SB8X8 && c->txfm_mode == TX_MODE_SELECT && if (m->mbmi.sb_type >= BLOCK_SIZE_SB8X8 && c->txfm_mode == TX_MODE_SELECT) {
!((skip_coeff || vp9_segfeature_active(xd, segment_id, SEG_LVL_SKIP)))) {
TX_SIZE sz = m->mbmi.txfm_size; TX_SIZE sz = m->mbmi.txfm_size;
// FIXME(rbultje) code ternary symbol once all experiments are merged // FIXME(rbultje) code ternary symbol once all experiments are merged
vp9_write(bc, sz != TX_4X4, c->prob_tx[0]); vp9_write(bc, sz != TX_4X4, c->prob_tx[0]);
...@@ -1032,7 +1031,7 @@ static void write_modes(VP9_COMP *cpi, vp9_writer* const bc, ...@@ -1032,7 +1031,7 @@ static void write_modes(VP9_COMP *cpi, vp9_writer* const bc,
vpx_memset(c->left_seg_context, 0, sizeof(c->left_seg_context)); vpx_memset(c->left_seg_context, 0, sizeof(c->left_seg_context));
for (mi_col = c->cur_tile_mi_col_start; for (mi_col = c->cur_tile_mi_col_start;
mi_col < c->cur_tile_mi_col_end; mi_col < c->cur_tile_mi_col_end;
mi_col += 8, m += 8) mi_col += 64 / MI_SIZE, m += 64 / MI_SIZE)
write_modes_sb(cpi, m, bc, tok, tok_end, mi_row, mi_col, write_modes_sb(cpi, m, bc, tok, tok_end, mi_row, mi_col,
BLOCK_SIZE_SB64X64); BLOCK_SIZE_SB64X64);
} }
......
...@@ -1202,6 +1202,7 @@ static void encode_frame_internal(VP9_COMP *cpi) { ...@@ -1202,6 +1202,7 @@ static void encode_frame_internal(VP9_COMP *cpi) {
vpx_memset(cpi->txfm_count_8x8p, 0, sizeof(cpi->txfm_count_8x8p)); vpx_memset(cpi->txfm_count_8x8p, 0, sizeof(cpi->txfm_count_8x8p));
vpx_memset(cpi->rd_tx_select_diff, 0, sizeof(cpi->rd_tx_select_diff)); vpx_memset(cpi->rd_tx_select_diff, 0, sizeof(cpi->rd_tx_select_diff));
vpx_memset(cpi->rd_tx_select_threshes, 0, sizeof(cpi->rd_tx_select_threshes)); vpx_memset(cpi->rd_tx_select_threshes, 0, sizeof(cpi->rd_tx_select_threshes));
{ {
struct vpx_usec_timer emr_timer; struct vpx_usec_timer emr_timer;
vpx_usec_timer_start(&emr_timer); vpx_usec_timer_start(&emr_timer);
...@@ -1456,7 +1457,7 @@ void vp9_encode_frame(VP9_COMP *cpi) { ...@@ -1456,7 +1457,7 @@ void vp9_encode_frame(VP9_COMP *cpi) {
} else } else
txfm_type = ALLOW_8X8; txfm_type = ALLOW_8X8;
#else #else
txfm_type = cpi->rd_tx_select_threshes[frame_type][ALLOW_32X32] >= txfm_type = cpi->rd_tx_select_threshes[frame_type][ALLOW_32X32] >
cpi->rd_tx_select_threshes[frame_type][TX_MODE_SELECT] ? cpi->rd_tx_select_threshes[frame_type][TX_MODE_SELECT] ?
ALLOW_32X32 : TX_MODE_SELECT; ALLOW_32X32 : TX_MODE_SELECT;
#endif #endif
...@@ -1711,7 +1712,7 @@ static void encode_superblock(VP9_COMP *cpi, TOKENEXTRA **t, ...@@ -1711,7 +1712,7 @@ static void encode_superblock(VP9_COMP *cpi, TOKENEXTRA **t,
sz = TX_8X8; sz = TX_8X8;
if (sz == TX_8X8 && bsize < BLOCK_SIZE_SB8X8) if (sz == TX_8X8 && bsize < BLOCK_SIZE_SB8X8)
sz = TX_4X4; sz = TX_4X4;
} else if (mbmi->mode != I4X4_PRED) { } else if (bsize >= BLOCK_SIZE_SB8X8) {
sz = mbmi->txfm_size; sz = mbmi->txfm_size;
} else { } else {
sz = TX_4X4; sz = TX_4X4;
......
...@@ -2810,6 +2810,7 @@ static void encode_frame_to_data_rate(VP9_COMP *cpi, ...@@ -2810,6 +2810,7 @@ static void encode_frame_to_data_rate(VP9_COMP *cpi,
} }
#endif #endif
loop_count = 0; loop_count = 0;
vpx_memset(cpi->rd_tx_select_threshes, 0, sizeof(cpi->rd_tx_select_threshes));
if (cm->frame_type != KEY_FRAME) { if (cm->frame_type != KEY_FRAME) {
/* TODO: Decide this more intelligently */ /* TODO: Decide this more intelligently */
......
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