Segment id fix in tx-skip/supertx experiment

Change-Id: Ice9e833ad7f60e943acc011260dc3121ad3b136f
This commit is contained in:
Deb Mukherjee 2014-12-29 01:17:32 -08:00
parent 695c4bc321
commit 28258c5fe2
6 changed files with 35 additions and 41 deletions

View File

@ -967,10 +967,21 @@ static PARTITION_TYPE read_partition(VP9_COMMON *cm, MACROBLOCKD *xd, int hbs,
return p;
}
#if CONFIG_SUPERTX
static int read_skip_without_seg(VP9_COMMON *cm, const MACROBLOCKD *xd,
vp9_reader *r) {
const int ctx = vp9_get_skip_context(xd);
const int skip = vp9_read(r, cm->fc.skip_probs[ctx]);
if (!cm->frame_parallel_decoding_mode)
++cm->counts.skip[ctx][skip];
return skip;
}
#endif // CONFIG_SUPERTX
static void decode_partition(VP9_COMMON *const cm, MACROBLOCKD *const xd,
const TileInfo *const tile,
#if CONFIG_SUPERTX
int read_token, int supertx_enabled,
int supertx_enabled,
#endif
int mi_row, int mi_col,
vp9_reader* r, BLOCK_SIZE bsize) {
@ -978,12 +989,13 @@ static void decode_partition(VP9_COMMON *const cm, MACROBLOCKD *const xd,
PARTITION_TYPE partition;
BLOCK_SIZE subsize, uv_subsize;
#if CONFIG_SUPERTX
const int read_token = !supertx_enabled;
int skip = 0;
TX_SIZE supertx_size = b_width_log2_lookup[bsize];
#if CONFIG_EXT_TX
int txfm = NORM;
#endif
#endif
#endif // CONFIG_SUPERTX
if (mi_row >= cm->mi_rows || mi_col >= cm->mi_cols)
return;
@ -1013,8 +1025,8 @@ static void decode_partition(VP9_COMMON *const cm, MACROBLOCKD *const xd,
mi_col, num_8x8_blocks_wide_lookup[bsize],
cm->mi_rows, cm->mi_cols);
set_skip_context(xd, mi_row, mi_col);
// Here we assume mbmi->segment_id = 0
skip = read_skip(cm, xd, 0, r);
// Here skip is read without using any segment level feature
skip = read_skip_without_seg(cm, xd, r);
if (skip)
reset_skip_context(xd, bsize);
#if CONFIG_EXT_TX
@ -1070,13 +1082,13 @@ static void decode_partition(VP9_COMMON *const cm, MACROBLOCKD *const xd,
break;
case PARTITION_SPLIT:
#if CONFIG_SUPERTX
decode_partition(cm, xd, tile, !supertx_enabled, supertx_enabled,
decode_partition(cm, xd, tile, supertx_enabled,
mi_row, mi_col, r, subsize);
decode_partition(cm, xd, tile, !supertx_enabled, supertx_enabled,
decode_partition(cm, xd, tile, supertx_enabled,
mi_row, mi_col + hbs, r, subsize);
decode_partition(cm, xd, tile, !supertx_enabled, supertx_enabled,
decode_partition(cm, xd, tile, supertx_enabled,
mi_row + hbs, mi_col, r, subsize);
decode_partition(cm, xd, tile, !supertx_enabled, supertx_enabled,
decode_partition(cm, xd, tile, supertx_enabled,
mi_row + hbs, mi_col + hbs, r, subsize);
#else
decode_partition(cm, xd, tile, mi_row, mi_col, r, subsize);
@ -1596,7 +1608,7 @@ static const uint8_t *decode_tiles(VP9Decoder *pbi,
mi_col += MI_BLOCK_SIZE) {
decode_partition(tile_data->cm, &tile_data->xd, &tile,
#if CONFIG_SUPERTX
1, 0,
0,
#endif
mi_row, mi_col,
&tile_data->bit_reader, BLOCK_64X64);
@ -1653,7 +1665,7 @@ static int tile_worker_hook(TileWorkerData *const tile_data,
mi_col += MI_BLOCK_SIZE) {
decode_partition(tile_data->cm, &tile_data->xd, tile,
#if CONFIG_SUPERTX
1, 0,
0,
#endif
mi_row, mi_col, &tile_data->bit_reader, BLOCK_64X64);
}

View File

@ -180,11 +180,7 @@ static int read_inter_segment_id(VP9_COMMON *const cm, MACROBLOCKD *const xd,
return segment_id;
}
#if CONFIG_SUPERTX
int read_skip(VP9_COMMON *cm, const MACROBLOCKD *xd,
#else
static int read_skip(VP9_COMMON *cm, const MACROBLOCKD *xd,
#endif
int segment_id, vp9_reader *r) {
if (vp9_segfeature_active(&cm->seg, segment_id, SEG_LVL_SKIP)) {
return 1;
@ -792,10 +788,10 @@ static void read_inter_frame_mode_info(VP9_COMMON *const cm,
}
#endif // CONFIG_COPY_MODE
mbmi->segment_id = read_inter_segment_id(cm, xd, mi_row, mi_col, r);
#if CONFIG_SUPERTX
if (!supertx_enabled) {
#endif
mbmi->segment_id = read_inter_segment_id(cm, xd, mi_row, mi_col, r);
mbmi->skip = read_skip(cm, xd, mbmi->segment_id, r);
#if CONFIG_COPY_MODE
if (mbmi->copy_mode == NOREF)
@ -821,7 +817,6 @@ static void read_inter_frame_mode_info(VP9_COMMON *const cm,
#if CONFIG_SUPERTX
} else {
const int ctx = vp9_get_intra_inter_context(xd);
mbmi->segment_id = 0;
inter_block = 1;
if (!cm->frame_parallel_decoding_mode)
#if CONFIG_COPY_MODE
@ -833,11 +828,7 @@ static void read_inter_frame_mode_info(VP9_COMMON *const cm,
#if CONFIG_TX_SKIP
if (mbmi->sb_type >= BLOCK_8X8) {
#if CONFIG_SUPERTX
int q_idx = cm->base_qindex;
#else
int q_idx = vp9_get_qindex(&cm->seg, mbmi->segment_id, cm->base_qindex);
#endif // CONFIG_SUPERTX
int try_tx_skip = inter_block ? q_idx <= TX_SKIP_Q_THRESH_INTER :
q_idx <= TX_SKIP_Q_THRESH_INTRA;
#if CONFIG_SUPERTX

View File

@ -26,10 +26,6 @@ void vp9_read_mode_info(VP9_COMMON *cm, MACROBLOCKD *xd,
#endif
int mi_row, int mi_col, vp9_reader *r);
#if CONFIG_SUPERTX
int read_skip(VP9_COMMON *cm, const MACROBLOCKD *xd,
int segment_id, vp9_reader *r);
#endif
#ifdef __cplusplus
} // extern "C"
#endif

View File

@ -433,11 +433,7 @@ static void pack_inter_mode_mvs(VP9_COMP *cpi, const MODE_INFO *mi,
#if CONFIG_TX_SKIP
if (bsize >= BLOCK_8X8) {
#if CONFIG_SUPERTX
int q_idx = cm->base_qindex;
#else
int q_idx = vp9_get_qindex(seg, segment_id, cm->base_qindex);
#endif // CONFIG_SUPERTX
int try_tx_skip = is_inter ? q_idx <= TX_SKIP_Q_THRESH_INTER :
q_idx <= TX_SKIP_Q_THRESH_INTRA;
#if CONFIG_SUPERTX
@ -695,7 +691,7 @@ static void write_modes_sb(VP9_COMP *cpi,
const TileInfo *const tile, vp9_writer *w,
TOKENEXTRA **tok, const TOKENEXTRA *const tok_end,
#if CONFIG_SUPERTX
int pack_token, int supertx_enabled,
int supertx_enabled,
#endif
int mi_row, int mi_col, BLOCK_SIZE bsize) {
const VP9_COMMON *const cm = &cpi->common;
@ -706,6 +702,9 @@ static void write_modes_sb(VP9_COMP *cpi,
PARTITION_TYPE partition;
BLOCK_SIZE subsize;
MODE_INFO *m = NULL;
#if CONFIG_SUPERTX
const int pack_token = !supertx_enabled;
#endif
if (mi_row >= cm->mi_rows || mi_col >= cm->mi_cols)
return;
@ -784,22 +783,22 @@ static void write_modes_sb(VP9_COMP *cpi,
case PARTITION_SPLIT:
write_modes_sb(cpi, tile, w, tok, tok_end,
#if CONFIG_SUPERTX
!supertx_enabled, supertx_enabled,
supertx_enabled,
#endif
mi_row, mi_col, subsize);
write_modes_sb(cpi, tile, w, tok, tok_end,
#if CONFIG_SUPERTX
!supertx_enabled, supertx_enabled,
supertx_enabled,
#endif
mi_row, mi_col + bs, subsize);
write_modes_sb(cpi, tile, w, tok, tok_end,
#if CONFIG_SUPERTX
!supertx_enabled, supertx_enabled,
supertx_enabled,
#endif
mi_row + bs, mi_col, subsize);
write_modes_sb(cpi, tile, w, tok, tok_end,
#if CONFIG_SUPERTX
!supertx_enabled, supertx_enabled,
supertx_enabled,
#endif
mi_row + bs, mi_col + bs, subsize);
break;
@ -832,7 +831,7 @@ static void write_modes(VP9_COMP *cpi,
mi_col += MI_BLOCK_SIZE)
write_modes_sb(cpi, tile, w, tok, tok_end,
#if CONFIG_SUPERTX
1, 0,
0,
#endif
mi_row, mi_col, BLOCK_64X64);
}

View File

@ -4779,11 +4779,7 @@ static void encode_superblock(VP9_COMP *cpi, TOKENEXTRA **t, int output_enabled,
#endif
#if CONFIG_TX_SKIP
if (bsize >= BLOCK_8X8) {
#if CONFIG_SUPERTX
int q_idx = cm->base_qindex;
#else
int q_idx = vp9_get_qindex(&cm->seg, mbmi->segment_id, cm->base_qindex);
#endif
int try_tx_skip = is_inter_block(mbmi) ? q_idx <= TX_SKIP_Q_THRESH_INTER :
q_idx <= TX_SKIP_Q_THRESH_INTRA;
#if CONFIG_SUPERTX

View File

@ -3083,7 +3083,7 @@ static int64_t handle_inter_mode(VP9_COMP *cpi, MACROBLOCK *x,
bsize, txfm_cache, ref_best_rd);
#if CONFIG_TX_SKIP
if (vp9_get_qindex(&cm->seg, mbmi->segment_id, cm->base_qindex) <=
TX_SKIP_Q_THRESH_INTER) {
TX_SKIP_Q_THRESH_INTER) {
mbmi->tx_skip[0] = 1;
super_block_yrd(cpi, x, &rate_s, &distortion_s, &skippable_s, &psse_s,
bsize, tx_cache_s, ref_best_rd);
@ -3123,7 +3123,7 @@ static int64_t handle_inter_mode(VP9_COMP *cpi, MACROBLOCK *x,
#if CONFIG_TX_SKIP
if (vp9_get_qindex(&cm->seg, mbmi->segment_id, cm->base_qindex) <=
TX_SKIP_Q_THRESH_INTER) {
TX_SKIP_Q_THRESH_INTER) {
super_block_uvrd(cpi, x, rate_uv, &distortion_uv, &skippable_uv,
&sseuv, bsize, ref_best_rd - rdcosty);
mbmi->tx_skip[1] = 1;
@ -3154,7 +3154,7 @@ static int64_t handle_inter_mode(VP9_COMP *cpi, MACROBLOCK *x,
}
#if CONFIG_TX_SKIP
if (vp9_get_qindex(&cm->seg, mbmi->segment_id, cm->base_qindex) <=
TX_SKIP_Q_THRESH_INTER)
TX_SKIP_Q_THRESH_INTER)
*rate_uv += vp9_cost_bit(cpi->common.fc.uv_tx_skip_prob[mbmi->tx_skip[0]],
mbmi->tx_skip[1]);
#endif