Commit d894d34d authored by hui su's avatar hui su

Turn off tx type selection for intra blocks by default

Coding gain on derflr drops to +1.83%.

Change-Id: If68c429f09422a70513d9f1e8e36e10c928e034a
parent 7eeb7671
......@@ -274,6 +274,8 @@ static const TX_TYPE intra_mode_to_tx_type_lookup[INTRA_MODES] = {
};
#if CONFIG_EXT_TX
#define ALLOW_INTRA_EXT_TX 1
static const int num_ext_tx_set_inter[EXT_TX_SETS_INTER] = {
1, 17, 10, 2
};
......@@ -368,7 +370,8 @@ static INLINE TX_TYPE get_tx_type(PLANE_TYPE plane_type,
return DCT_DCT;
#if CONFIG_EXT_TX
if (mbmi->sb_type >= BLOCK_8X8 && plane_type == PLANE_TYPE_Y)
if (mbmi->sb_type >= BLOCK_8X8 && plane_type == PLANE_TYPE_Y &&
ALLOW_INTRA_EXT_TX)
return mbmi->tx_type;
#endif // CONFIG_EXT_TX
......@@ -405,8 +408,10 @@ static INLINE TX_TYPE get_tx_type(PLANE_TYPE plane_type,
#endif
return DCT_DCT;
if (mbmi->sb_type >= BLOCK_8X8) {
if (plane_type == PLANE_TYPE_Y)
if (plane_type == PLANE_TYPE_Y) {
if (is_inter_block(mbmi) || ALLOW_INTRA_EXT_TX)
return mbmi->tx_type;
}
if (is_inter_block(mbmi))
// UV Inter only
return (mbmi->tx_type == IDTX && tx_size == TX_32X32 ?
......
......@@ -422,7 +422,8 @@ static void read_intra_frame_mode_info(VP10_COMMON *const cm,
#if CONFIG_EXT_TX
if (get_ext_tx_types(mbmi->tx_size, mbmi->sb_type, 0) > 1 &&
cm->base_qindex > 0 && !mbmi->skip &&
!segfeature_active(&cm->seg, mbmi->segment_id, SEG_LVL_SKIP)) {
!segfeature_active(&cm->seg, mbmi->segment_id, SEG_LVL_SKIP) &&
ALLOW_INTRA_EXT_TX) {
FRAME_COUNTS *counts = xd->counts;
int eset = get_ext_tx_set(mbmi->tx_size, mbmi->sb_type, 0);
if (eset > 0) {
......@@ -887,7 +888,7 @@ static void read_inter_frame_mode_info(VP10Decoder *const pbi,
if (counts)
++counts->inter_ext_tx[eset][mbmi->tx_size][mbmi->tx_type];
}
} else {
} else if (ALLOW_INTRA_EXT_TX) {
if (eset > 0) {
mbmi->tx_type = vpx_read_tree(r, vp10_ext_tx_intra_tree[eset],
cm->fc->intra_ext_tx_prob[eset]
......
......@@ -693,7 +693,7 @@ static void pack_inter_mode_mvs(VP10_COMP *cpi, const MODE_INFO *mi,
vp10_write_token(w, vp10_ext_tx_inter_tree[eset],
cm->fc->inter_ext_tx_prob[eset][mbmi->tx_size],
&ext_tx_inter_encodings[eset][mbmi->tx_type]);
} else {
} else if (ALLOW_INTRA_EXT_TX) {
if (eset > 0)
vp10_write_token(
w, vp10_ext_tx_intra_tree[eset],
......@@ -790,7 +790,8 @@ static void write_mb_modes_kf(const VP10_COMMON *cm, const MACROBLOCKD *xd,
#if CONFIG_EXT_TX
if (get_ext_tx_types(mbmi->tx_size, bsize, 0) > 1 &&
cm->base_qindex > 0 && !mbmi->skip &&
!segfeature_active(&cm->seg, mbmi->segment_id, SEG_LVL_SKIP)) {
!segfeature_active(&cm->seg, mbmi->segment_id, SEG_LVL_SKIP) &&
ALLOW_INTRA_EXT_TX) {
int eset = get_ext_tx_set(mbmi->tx_size, bsize, 0);
if (eset > 0)
vp10_write_token(
......
......@@ -691,6 +691,10 @@ static void choose_largest_tx_size(VP10_COMP *cpi, MACROBLOCK *x,
if (!ext_tx_used_inter[ext_tx_set][tx_type])
continue;
} else {
if (!ALLOW_INTRA_EXT_TX && bs >= BLOCK_8X8) {
if (tx_type != intra_mode_to_tx_type_lookup[mbmi->mode])
continue;
}
if (!ext_tx_used_intra[ext_tx_set][tx_type])
continue;
}
......@@ -719,7 +723,7 @@ static void choose_largest_tx_size(VP10_COMP *cpi, MACROBLOCK *x,
r += cpi->inter_tx_type_costs[ext_tx_set]
[mbmi->tx_size][mbmi->tx_type];
} else {
if (ext_tx_set > 0)
if (ext_tx_set > 0 && ALLOW_INTRA_EXT_TX)
r += cpi->intra_tx_type_costs[ext_tx_set][mbmi->tx_size]
[mbmi->mode][mbmi->tx_type];
}
......@@ -754,12 +758,16 @@ static void choose_largest_tx_size(VP10_COMP *cpi, MACROBLOCK *x,
if (get_ext_tx_types(mbmi->tx_size, bs, is_inter) > 1 &&
!xd->lossless[mbmi->segment_id] && *rate != INT_MAX) {
int ext_tx_set = get_ext_tx_set(mbmi->tx_size, bs, is_inter);
if (is_inter)
*rate += cpi->inter_tx_type_costs[ext_tx_set][mbmi->tx_size]
[mbmi->tx_type];
else
*rate += cpi->intra_tx_type_costs[ext_tx_set][mbmi->tx_size]
[mbmi->mode][mbmi->tx_type];
if (is_inter) {
if (ext_tx_set > 0)
*rate += cpi->inter_tx_type_costs[ext_tx_set][mbmi->tx_size]
[mbmi->tx_type];
} else {
if (ext_tx_set > 0 && ALLOW_INTRA_EXT_TX)
*rate +=
cpi->intra_tx_type_costs[ext_tx_set][mbmi->tx_size]
[mbmi->mode][mbmi->tx_type];
}
}
#endif // CONFIG_EXT_TX
}
......@@ -849,6 +857,10 @@ static void choose_tx_size_from_rd(VP10_COMP *cpi, MACROBLOCK *x,
if (!ext_tx_used_inter[ext_tx_set][tx_type])
continue;
} else {
if (!ALLOW_INTRA_EXT_TX && bs >= BLOCK_8X8) {
if (tx_type != intra_mode_to_tx_type_lookup[mbmi->mode])
continue;
}
if (!ext_tx_used_intra[ext_tx_set][tx_type])
continue;
}
......@@ -874,7 +886,7 @@ static void choose_tx_size_from_rd(VP10_COMP *cpi, MACROBLOCK *x,
r += cpi->inter_tx_type_costs[ext_tx_set]
[mbmi->tx_size][mbmi->tx_type];
} else {
if (ext_tx_set > 0)
if (ext_tx_set > 0 && ALLOW_INTRA_EXT_TX)
r += cpi->intra_tx_type_costs[ext_tx_set][mbmi->tx_size]
[mbmi->mode][mbmi->tx_type];
}
......@@ -2227,6 +2239,10 @@ static void select_tx_type_yrd(const VP10_COMP *cpi, MACROBLOCK *x,
if (!ext_tx_used_inter[ext_tx_set][tx_type])
continue;
} else {
if (!ALLOW_INTRA_EXT_TX && bsize >= BLOCK_8X8) {
if (tx_type != intra_mode_to_tx_type_lookup[mbmi->mode])
continue;
}
if (!ext_tx_used_intra[ext_tx_set][tx_type])
continue;
}
......@@ -2251,7 +2267,7 @@ static void select_tx_type_yrd(const VP10_COMP *cpi, MACROBLOCK *x,
this_rate += cpi->inter_tx_type_costs[ext_tx_set]
[max_tx_size][mbmi->tx_type];
} else {
if (ext_tx_set > 0)
if (ext_tx_set > 0 && ALLOW_INTRA_EXT_TX)
this_rate += cpi->intra_tx_type_costs[ext_tx_set][max_tx_size]
[mbmi->mode][mbmi->tx_type];
}
......
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