Commit 9a8a6a1b authored by Debargha Mukherjee's avatar Debargha Mukherjee

Some supertx fixes

Fixes some of the issues introduced by a merge from master.

derflr: -0.893% BDRATE
hevcmr: -1.667% BDRATE

Change-Id: I4c5b40ec63a6f19521191d3c730af87db3c4bc00
parent 968bbc7b
......@@ -1220,27 +1220,9 @@ default_intra_ext_tx_prob[EXT_TX_SETS_INTRA][EXT_TX_SIZES]
},
},
};
#endif // CONFIG_EXT_TX
#if CONFIG_SUPERTX
static const vpx_prob default_supertx_prob[PARTITION_SUPERTX_CONTEXTS]
[TX_SIZES] = {
{ 1, 160, 160, 170 },
{ 1, 200, 200, 210 },
};
#endif // CONFIG_SUPERTX
// FIXME(someone) need real defaults here
static const struct segmentation_probs default_seg_probs = {
{ 128, 128, 128, 128, 128, 128, 128 },
{ 128, 128, 128 },
};
#if CONFIG_EXT_INTRA
static const vpx_prob default_ext_intra_probs[2] = {230, 230};
#endif // CONFIG_EXT_INTRA
#else
#if !CONFIG_EXT_TX
const vpx_tree_index vp10_ext_tx_tree[TREE_SIZE(TX_TYPES)] = {
-DCT_DCT, 2,
-ADST_ADST, 4,
......@@ -1260,7 +1242,25 @@ static const vpx_prob default_inter_ext_tx_prob[EXT_TX_SIZES]
{176, 85, 128},
{192, 85, 128},
};
#endif
#endif // CONFIG_EXT_TX
#if CONFIG_SUPERTX
static const vpx_prob default_supertx_prob[PARTITION_SUPERTX_CONTEXTS]
[TX_SIZES] = {
{ 1, 160, 160, 170 },
{ 1, 200, 200, 210 },
};
#endif // CONFIG_SUPERTX
// FIXME(someone) need real defaults here
static const struct segmentation_probs default_seg_probs = {
{ 128, 128, 128, 128, 128, 128, 128 },
{ 128, 128, 128 },
};
#if CONFIG_EXT_INTRA
static const vpx_prob default_ext_intra_probs[2] = {230, 230};
#endif // CONFIG_EXT_INTRA
static void init_mode_probs(FRAME_CONTEXT *fc) {
vp10_copy(fc->uv_mode_prob, default_uv_probs);
......
......@@ -1035,9 +1035,7 @@ static void set_offsets_topblock(VP10_COMMON *const cm, MACROBLOCKD *const xd,
static void set_param_topblock(VP10_COMMON *const cm, MACROBLOCKD *const xd,
BLOCK_SIZE bsize, int mi_row, int mi_col,
#if CONFIG_EXT_TX
int txfm,
#endif
int skip) {
const int bw = num_8x8_blocks_wide_lookup[bsize];
const int bh = num_8x8_blocks_high_lookup[bsize];
......@@ -1052,9 +1050,7 @@ static void set_param_topblock(VP10_COMMON *const cm, MACROBLOCKD *const xd,
for (y = 0; y < y_mis; ++y)
for (x = 0; x < x_mis; ++x) {
xd->mi[y * cm->mi_stride + x]->mbmi.skip = skip;
#if CONFIG_EXT_TX
xd->mi[y * cm->mi_stride + x]->mbmi.tx_type = txfm;
#endif
}
#if CONFIG_VAR_TX
xd->above_txfm_context = cm->above_txfm_context + mi_col;
......@@ -1779,9 +1775,7 @@ static void decode_partition(VP10Decoder *const pbi, MACROBLOCKD *const xd,
int skip = 0;
TX_SIZE supertx_size = b_width_log2_lookup[bsize];
const TileInfo *const tile = &xd->tile;
#if CONFIG_EXT_TX
int txfm = DCT_DCT;
#endif // CONFIG_EXT_TX
#endif // CONFIG_SUPERTX
if (mi_row >= cm->mi_rows || mi_col >= cm->mi_cols)
......@@ -1813,10 +1807,10 @@ static void decode_partition(VP10Decoder *const pbi, MACROBLOCKD *const xd,
set_skip_context(xd, mi_row, mi_col);
// Here skip is read without using any segment level feature
skip = read_skip_without_seg(cm, xd, r);
if (skip)
if (skip) {
reset_skip_context(xd, bsize);
} else {
#if CONFIG_EXT_TX
if (!skip) {
if (get_ext_tx_types(supertx_size, bsize, 1) > 1) {
int eset = get_ext_tx_set(supertx_size, bsize, 1);
if (eset > 0) {
......@@ -1826,8 +1820,15 @@ static void decode_partition(VP10Decoder *const pbi, MACROBLOCKD *const xd,
++xd->counts->inter_ext_tx[eset][supertx_size][txfm];
}
}
}
#else
if (supertx_size < TX_32X32) {
txfm = vpx_read_tree(r, vp10_ext_tx_tree,
cm->fc->inter_ext_tx_prob[supertx_size]);
if (xd->counts)
++xd->counts->inter_ext_tx[supertx_size][txfm];
}
#endif // CONFIG_EXT_TX
}
}
#endif // CONFIG_SUPERTX
if (!hbs) {
......@@ -1958,9 +1959,7 @@ static void decode_partition(VP10Decoder *const pbi, MACROBLOCKD *const xd,
int eobtotal = 0;
MB_MODE_INFO *mbmi = &xd->mi[0]->mbmi;
set_offsets_topblock(cm, xd, tile, bsize, mi_row, mi_col);
#if CONFIG_EXT_TX
xd->mi[0]->mbmi.tx_type = txfm;
#endif
for (i = 0; i < MAX_MB_PLANE; ++i) {
const struct macroblockd_plane *const pd = &xd->plane[i];
const int num_4x4_w = pd->n4_w;
......@@ -1991,11 +1990,7 @@ static void decode_partition(VP10Decoder *const pbi, MACROBLOCKD *const xd,
if (!(subsize < BLOCK_8X8) && eobtotal == 0)
skip = 1;
}
set_param_topblock(cm, xd, bsize, mi_row, mi_col,
#if CONFIG_EXT_TX
txfm,
#endif
skip);
set_param_topblock(cm, xd, bsize, mi_row, mi_col, txfm, skip);
}
#endif // CONFIG_SUPERTX
......@@ -3184,7 +3179,9 @@ static void read_ext_tx_probs(FRAME_CONTEXT *fc, vpx_reader *r) {
}
}
}
#else
static void read_ext_tx_probs(FRAME_CONTEXT *fc, vpx_reader *r) {
int i, j, k;
if (vpx_read(r, GROUP_DIFF_UPDATE_PROB)) {
......@@ -3201,7 +3198,6 @@ static void read_ext_tx_probs(FRAME_CONTEXT *fc, vpx_reader *r) {
}
}
}
#endif // CONFIG_EXT_TX
#if CONFIG_SUPERTX
......
......@@ -1326,6 +1326,9 @@ static void read_inter_frame_mode_info(VP10Decoder *const pbi,
#else
if (mbmi->tx_size < TX_32X32 &&
cm->base_qindex > 0 && !mbmi->skip &&
#if CONFIG_SUPERTX
!supertx_enabled &&
#endif // CONFIG_SUPERTX
!segfeature_active(&cm->seg, mbmi->segment_id, SEG_LVL_SKIP)) {
FRAME_COUNTS *counts = xd->counts;
if (inter_block) {
......
......@@ -429,7 +429,9 @@ static void update_ext_tx_probs(VP10_COMMON *cm, vpx_writer *w) {
}
}
}
#else
static void update_ext_tx_probs(VP10_COMMON *cm, vpx_writer *w) {
const int savings_thresh = vp10_cost_one(GROUP_DIFF_UPDATE_PROB) -
vp10_cost_zero(GROUP_DIFF_UPDATE_PROB);
......@@ -1413,7 +1415,8 @@ static void write_modes_sb(VP10_COMP *cpi,
if (supertx_enabled) {
vpx_write(w, xd->mi[0]->mbmi.skip, vp10_get_skip_prob(cm, xd));
#if CONFIG_EXT_TX
if (supertx_size <= TX_16X16 && !xd->mi[0]->mbmi.skip) {
if (get_ext_tx_types(supertx_size, bsize, 1) > 1 &&
!xd->mi[0]->mbmi.skip) {
int eset = get_ext_tx_set(supertx_size, bsize, 1);
if (eset > 0) {
vp10_write_token(
......@@ -1422,6 +1425,13 @@ static void write_modes_sb(VP10_COMP *cpi,
&ext_tx_inter_encodings[eset][xd->mi[0]->mbmi.tx_type]);
}
}
#else
if (supertx_size < TX_32X32 && !xd->mi[0]->mbmi.skip) {
vp10_write_token(
w, vp10_ext_tx_tree,
cm->fc->inter_ext_tx_prob[supertx_size],
&ext_tx_encodings[xd->mi[0]->mbmi.tx_type]);
}
#endif // CONFIG_EXT_TX
}
}
......
This diff is collapsed.
......@@ -1761,9 +1761,7 @@ static int rd_pick_ext_intra_sby(VP10_COMP *cpi, MACROBLOCK *x,
EXT_INTRA_MODE mode;
TX_SIZE best_tx_size = TX_4X4;
EXT_INTRA_MODE_INFO ext_intra_mode_info;
#if CONFIG_EXT_TX
TX_TYPE best_tx_type;
#endif // CONFIG_EXT_TX
vp10_zero(ext_intra_mode_info);
mbmi->ext_intra_mode_info.use_ext_intra_mode[0] = 1;
......@@ -1785,9 +1783,7 @@ static int rd_pick_ext_intra_sby(VP10_COMP *cpi, MACROBLOCK *x,
*best_rd = this_rd;
best_tx_size = mic->mbmi.tx_size;
ext_intra_mode_info = mbmi->ext_intra_mode_info;
#if CONFIG_EXT_TX
best_tx_type = mic->mbmi.tx_type;
#endif // CONFIG_EXT_TX
*rate = this_rate;
*rate_tokenonly = this_rate_tokenonly;
*distortion = this_distortion;
......@@ -1803,9 +1799,7 @@ static int rd_pick_ext_intra_sby(VP10_COMP *cpi, MACROBLOCK *x,
ext_intra_mode_info.use_ext_intra_mode[0];
mbmi->ext_intra_mode_info.ext_intra_mode[0] =
ext_intra_mode_info.ext_intra_mode[0];
#if CONFIG_EXT_TX
mbmi->tx_type = best_tx_type;
#endif // CONFIG_EXT_TX
return 1;
} else {
return 0;
......@@ -1825,9 +1819,7 @@ static int64_t rd_pick_intra_angle_sby(VP10_COMP *cpi, MACROBLOCK *x,
const double rd_adjust = 1.2;
int64_t this_distortion, this_rd, sse_dummy;
TX_SIZE best_tx_size = mic->mbmi.tx_size;
#if CONFIG_EXT_TX
TX_TYPE best_tx_type = mbmi->tx_type;
#endif // CONFIG_EXT_TX
if (ANGLE_FAST_SEARCH) {
int deltas_level1[3] = {0, -2, 2};
......@@ -1858,9 +1850,7 @@ static int64_t rd_pick_intra_angle_sby(VP10_COMP *cpi, MACROBLOCK *x,
best_rd = this_rd;
best_angle_delta = mbmi->angle_delta[0];
best_tx_size = mbmi->tx_size;
#if CONFIG_EXT_TX
best_tx_type = mbmi->tx_type;
#endif // CONFIG_EXT_TX
*rate = this_rate;
*rate_tokenonly = this_rate_tokenonly;
*distortion = this_distortion;
......@@ -1881,9 +1871,7 @@ static int64_t rd_pick_intra_angle_sby(VP10_COMP *cpi, MACROBLOCK *x,
best_rd = this_rd;
best_angle_delta = mbmi->angle_delta[0];
best_tx_size = mbmi->tx_size;
#if CONFIG_EXT_TX
best_tx_type = mbmi->tx_type;
#endif // CONFIG_EXT_TX
*rate = this_rate;
*rate_tokenonly = this_rate_tokenonly;
*distortion = this_distortion;
......@@ -1908,9 +1896,7 @@ static int64_t rd_pick_intra_angle_sby(VP10_COMP *cpi, MACROBLOCK *x,
best_rd = this_rd;
best_angle_delta = mbmi->angle_delta[0];
best_tx_size = mbmi->tx_size;
#if CONFIG_EXT_TX
best_tx_type = mbmi->tx_type;
#endif // CONFIG_EXT_TX
*rate = this_rate;
*rate_tokenonly = this_rate_tokenonly;
*distortion = this_distortion;
......@@ -1921,9 +1907,7 @@ static int64_t rd_pick_intra_angle_sby(VP10_COMP *cpi, MACROBLOCK *x,
mbmi->tx_size = best_tx_size;
mbmi->angle_delta[0] = best_angle_delta;
#if CONFIG_EXT_TX
mbmi->tx_type = best_tx_type;
#endif // CONFIG_EXT_TX
if (*rate_tokenonly < INT_MAX) {
txfm_rd_in_plane(x,
......@@ -5440,8 +5424,13 @@ static int64_t handle_inter_mode(VP10_COMP *cpi, MACROBLOCK *x,
vp10_subtract_plane(x, bsize, 0);
#if CONFIG_VAR_TX
if (cm->tx_mode == TX_MODE_SELECT || xd->lossless[mbmi->segment_id]) {
#if CONFIG_EXT_TX
select_tx_type_yrd(cpi, x, rate_y, &distortion_y, &skippable_y, psse,
bsize, ref_best_rd);
#else
inter_block_yrd(cpi, x, rate_y, &distortion_y, &skippable_y, psse,
bsize, ref_best_rd);
#endif // CONFIG_EXT_TX
} else {
int idx, idy;
super_block_yrd(cpi, x, rate_y, &distortion_y, &skippable_y, psse,
......@@ -5453,7 +5442,7 @@ static int64_t handle_inter_mode(VP10_COMP *cpi, MACROBLOCK *x,
#else
super_block_yrd(cpi, x, rate_y, &distortion_y, &skippable_y, psse,
bsize, ref_best_rd);
#endif
#endif // CONFIG_VAR_TX
if (*rate_y == INT_MAX) {
*rate2 = INT_MAX;
......@@ -5474,7 +5463,7 @@ static int64_t handle_inter_mode(VP10_COMP *cpi, MACROBLOCK *x,
#else
if (!super_block_uvrd(cpi, x, rate_uv, &distortion_uv, &skippable_uv,
&sseuv, bsize, ref_best_rd - rdcosty)) {
#endif
#endif // CONFIG_VAR_TX
*rate2 = INT_MAX;
*distortion = INT64_MAX;
restore_dst_buf(xd, orig_dst, orig_dst_stride);
......
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