Commit 19619886 authored by Debargha Mukherjee's avatar Debargha Mukherjee

Enhance option to handle chroma tx-size for vartx

Adds an option to split chroma tx size by one level if the luma
transform size is split at least one level. Otherwise use the
largest transform size for chroma.
This option is enabled with DISABLE_VARTX_FOR_CHROMA set as 2,
but is currently turned off until we finish testing.

Change-Id: Ie048c4e33193e0cc7e1bbee37e4ccc085834433c
parent 26f89694
......@@ -40,6 +40,11 @@ extern "C" {
#define MAX_SEG_MASK_BITS 1
// Disables vartx transform split for chroma
// There are two possible options:
// 1: Always choose chroma tx_size to be the largest allowed for the PU
// 2: If the luma tranform size is split at least one level, split the
// chroma by one level, otherwise use the largest allowed transform size for
// chroma.
#define DISABLE_VARTX_FOR_CHROMA 1
// SEG_MASK_TYPES should not surpass 1 << MAX_SEG_MASK_BITS
......
......@@ -535,8 +535,20 @@ static void decode_token_and_recon_block(AV1Decoder *const pbi,
mu_blocks_wide = AOMMIN(max_blocks_wide, mu_blocks_wide);
mu_blocks_high = AOMMIN(max_blocks_high, mu_blocks_high);
const TX_SIZE max_tx_size = get_vartx_max_txsize(
TX_SIZE max_tx_size = get_vartx_max_txsize(
xd, plane_bsize, pd->subsampling_x || pd->subsampling_y);
#if DISABLE_VARTX_FOR_CHROMA == 2
// If the luma transform size is split at least one level, split the
// chroma by one level. Otherwise use the largest possible trasnform
// size for chroma.
if (plane && (pd->subsampling_x || pd->subsampling_y)) {
const TX_SIZE l_max_tx_size = get_vartx_max_txsize(xd, bsizec, 0);
const int is_split =
(l_max_tx_size != mbmi->inter_tx_size[0][0] && bsize == bsizec &&
txsize_to_bsize[l_max_tx_size] == bsizec);
if (is_split) max_tx_size = sub_tx_size_map[max_tx_size];
}
#endif // DISABLE_VARTX_FOR_CHROMA == 2
const int bh_var_tx = tx_size_high_unit[max_tx_size];
const int bw_var_tx = tx_size_wide_unit[max_tx_size];
int block = 0;
......
......@@ -1785,12 +1785,27 @@ static void write_inter_txb_coeff(AV1_COMMON *const cm, MACROBLOCK *const x,
const int col, int *block, const int plane) {
MACROBLOCKD *const xd = &x->e_mbd;
const struct macroblockd_plane *const pd = &xd->plane[plane];
const BLOCK_SIZE bsize = mbmi->sb_type;
const BLOCK_SIZE bsizec =
scale_chroma_bsize(bsize, pd->subsampling_x, pd->subsampling_y);
const BLOCK_SIZE plane_bsize =
AOMMAX(BLOCK_4X4, get_plane_block_size(mbmi->sb_type, pd));
AOMMAX(BLOCK_4X4, get_plane_block_size(bsizec, pd));
const TX_SIZE max_tx_size = get_vartx_max_txsize(
TX_SIZE max_tx_size = get_vartx_max_txsize(
xd, plane_bsize, pd->subsampling_x || pd->subsampling_y);
#if DISABLE_VARTX_FOR_CHROMA == 2
// If the luma transform size is split at least one level, split the chroma
// by one level. Otherwise use the largest possible trasnform size for
// chroma.
if (plane && (pd->subsampling_x || pd->subsampling_y)) {
const TX_SIZE l_max_tx_size = get_vartx_max_txsize(xd, bsizec, 0);
const int is_split =
(l_max_tx_size != mbmi->inter_tx_size[0][0] && bsize == bsizec &&
txsize_to_bsize[l_max_tx_size] == bsizec);
if (is_split) max_tx_size = sub_tx_size_map[max_tx_size];
}
#endif // DISABLE_VARTX_FOR_CHROMA == 2
const int step =
tx_size_wide_unit[max_tx_size] * tx_size_high_unit[max_tx_size];
const int bkw = tx_size_wide_unit[max_tx_size];
......
......@@ -833,8 +833,22 @@ void av1_encode_sb(AV1_COMMON *cm, MACROBLOCK *x, BLOCK_SIZE bsize, int mi_row,
const BLOCK_SIZE plane_bsize = get_plane_block_size(bsizec, pd);
const int mi_width = block_size_wide[plane_bsize] >> tx_size_wide_log2[0];
const int mi_height = block_size_high[plane_bsize] >> tx_size_wide_log2[0];
const TX_SIZE max_tx_size = get_vartx_max_txsize(
TX_SIZE max_tx_size = get_vartx_max_txsize(
xd, plane_bsize, pd->subsampling_x || pd->subsampling_y);
#if DISABLE_VARTX_FOR_CHROMA == 2
// If the luma transform size is split at least one level, split the chroma
// by one level. Otherwise use the largest possible trasnform size for
// chroma.
if (plane && (pd->subsampling_x || pd->subsampling_y)) {
const TX_SIZE l_max_tx_size = get_vartx_max_txsize(xd, bsizec, 0);
const int is_split =
(l_max_tx_size != mbmi->inter_tx_size[0][0] && bsize == bsizec &&
txsize_to_bsize[l_max_tx_size] == bsizec);
if (is_split) max_tx_size = sub_tx_size_map[max_tx_size];
}
#endif // DISABLE_VARTX_FOR_CHROMA == 2
const BLOCK_SIZE txb_size = txsize_to_bsize[max_tx_size];
const int bw = block_size_wide[txb_size] >> tx_size_wide_log2[0];
const int bh = block_size_high[txb_size] >> tx_size_wide_log2[0];
......
......@@ -5037,8 +5037,20 @@ int inter_block_uvrd(const AV1_COMP *cpi, MACROBLOCK *x, RD_STATS *rd_stats,
const int mi_width = block_size_wide[plane_bsize] >> tx_size_wide_log2[0];
const int mi_height =
block_size_high[plane_bsize] >> tx_size_high_log2[0];
const TX_SIZE max_tx_size = get_vartx_max_txsize(
TX_SIZE max_tx_size = get_vartx_max_txsize(
xd, plane_bsize, pd->subsampling_x || pd->subsampling_y);
#if DISABLE_VARTX_FOR_CHROMA == 2
// If the luma transform size is split at least one level, split the
// chroma by one level. Otherwise use the largest possible trasnform size
// for chroma.
if (pd->subsampling_x || pd->subsampling_y) {
const TX_SIZE l_max_tx_size = get_vartx_max_txsize(xd, bsizec, 0);
const int is_split =
(l_max_tx_size != mbmi->inter_tx_size[0][0] && bsize == bsizec &&
txsize_to_bsize[l_max_tx_size] == bsizec);
if (is_split) max_tx_size = sub_tx_size_map[max_tx_size];
}
#endif // DISABLE_VARTX_FOR_CHROMA == 2
const int bh = tx_size_high_unit[max_tx_size];
const int bw = tx_size_wide_unit[max_tx_size];
int idx, idy;
......
......@@ -664,8 +664,20 @@ void av1_tokenize_sb_vartx(const AV1_COMP *cpi, ThreadData *td, TOKENEXTRA **t,
AOMMAX(BLOCK_4X4, get_plane_block_size(bsizec, pd));
const int mi_width = block_size_wide[plane_bsize] >> tx_size_wide_log2[0];
const int mi_height = block_size_high[plane_bsize] >> tx_size_wide_log2[0];
const TX_SIZE max_tx_size = get_vartx_max_txsize(
TX_SIZE max_tx_size = get_vartx_max_txsize(
xd, plane_bsize, pd->subsampling_x || pd->subsampling_y);
#if DISABLE_VARTX_FOR_CHROMA == 2
// If the luma transform size is split at least one level, split the chroma
// by one level. Otherwise use the largest possible trasnform size for
// chroma.
if (plane && (pd->subsampling_x || pd->subsampling_y)) {
const TX_SIZE l_max_tx_size = get_vartx_max_txsize(xd, bsizec, 0);
const int is_split =
(l_max_tx_size != mbmi->inter_tx_size[0][0] && bsize == bsizec &&
txsize_to_bsize[l_max_tx_size] == bsizec);
if (is_split) max_tx_size = sub_tx_size_map[max_tx_size];
}
#endif // DISABLE_VARTX_FOR_CHROMA == 2
const BLOCK_SIZE txb_size = txsize_to_bsize[max_tx_size];
int bw = block_size_wide[txb_size] >> tx_size_wide_log2[0];
int bh = block_size_high[txb_size] >> tx_size_wide_log2[0];
......
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