Commit 1a00cffd authored by Jingning Han's avatar Jingning Han

Enable cb4x4 mode support to ext-tx experiment

This commit enables the cb4x4 mode to support ext-tx experiment. The
coding performance gains are:

       ext-tx   cb4x4    ext-tx + cb4x4
lowres  2.7%     2.6%      4.9%
midres  2.1%     1.2%      3.0%

Change-Id: I6c566b6073527262abcdbb1a0c6bcb8729988f3b
parent aa434238
...@@ -573,24 +573,42 @@ static const int num_ext_tx_set_intra[EXT_TX_SETS_INTRA] = { 1, 7, 5 }; ...@@ -573,24 +573,42 @@ static const int num_ext_tx_set_intra[EXT_TX_SETS_INTRA] = { 1, 7, 5 };
static INLINE int get_ext_tx_set(TX_SIZE tx_size, BLOCK_SIZE bs, int is_inter) { static INLINE int get_ext_tx_set(TX_SIZE tx_size, BLOCK_SIZE bs, int is_inter) {
tx_size = txsize_sqr_map[tx_size]; tx_size = txsize_sqr_map[tx_size];
#if CONFIG_CB4X4
(void)bs;
if (tx_size > TX_32X32) return 0;
#else
if (tx_size > TX_32X32 || bs < BLOCK_8X8) return 0; if (tx_size > TX_32X32 || bs < BLOCK_8X8) return 0;
#endif
if (tx_size == TX_32X32) return is_inter ? 3 : 0; if (tx_size == TX_32X32) return is_inter ? 3 : 0;
return (tx_size == TX_16X16 ? 2 : 1); return (tx_size == TX_16X16 ? 2 : 1);
} }
static const int use_intra_ext_tx_for_txsize[EXT_TX_SETS_INTRA] static const int use_intra_ext_tx_for_txsize[EXT_TX_SETS_INTRA]
[EXT_TX_SIZES] = { [EXT_TX_SIZES] = {
#if CONFIG_CB4X4
{ 1, 1, 1, 1, 1 }, // unused
{ 0, 1, 1, 0, 0 },
{ 0, 0, 0, 1, 0 },
#else
{ 1, 1, 1, 1 }, // unused { 1, 1, 1, 1 }, // unused
{ 1, 1, 0, 0 }, { 1, 1, 0, 0 },
{ 0, 0, 1, 0 }, { 0, 0, 1, 0 },
#endif // CONFIG_CB4X4
}; };
static const int use_inter_ext_tx_for_txsize[EXT_TX_SETS_INTER] static const int use_inter_ext_tx_for_txsize[EXT_TX_SETS_INTER]
[EXT_TX_SIZES] = { [EXT_TX_SIZES] = {
#if CONFIG_CB4X4
{ 1, 1, 1, 1, 1 }, // unused
{ 0, 1, 1, 0, 0 },
{ 0, 0, 0, 1, 0 },
{ 0, 0, 0, 0, 1 },
#else
{ 1, 1, 1, 1 }, // unused { 1, 1, 1, 1 }, // unused
{ 1, 1, 0, 0 }, { 1, 1, 0, 0 },
{ 0, 0, 1, 0 }, { 0, 0, 1, 0 },
{ 0, 0, 0, 1 }, { 0, 0, 0, 1 },
#endif // CONFIG_CB4X4
}; };
// Transform types used in each intra set // Transform types used in each intra set
...@@ -832,15 +850,23 @@ static INLINE TX_TYPE get_tx_type(PLANE_TYPE plane_type, const MACROBLOCKD *xd, ...@@ -832,15 +850,23 @@ static INLINE TX_TYPE get_tx_type(PLANE_TYPE plane_type, const MACROBLOCKD *xd,
#endif // ALLOW_INTRA_EXT_TX #endif // ALLOW_INTRA_EXT_TX
return mbmi->tx_type; return mbmi->tx_type;
} }
if (is_inter_block(mbmi))
// UV Inter only if (is_inter_block(mbmi)) {
// UV Inter only
#if CONFIG_CB4X4
if (tx_size < TX_4X4) return DCT_DCT;
#endif
return (mbmi->tx_type == IDTX && txsize_sqr_map[tx_size] >= TX_32X32) return (mbmi->tx_type == IDTX && txsize_sqr_map[tx_size] >= TX_32X32)
? DCT_DCT ? DCT_DCT
: mbmi->tx_type; : mbmi->tx_type;
}
} }
#if CONFIG_CB4X4 #if CONFIG_CB4X4
return DCT_DCT; if (tx_size < TX_4X4)
return DCT_DCT;
else
return intra_mode_to_tx_type_context[mbmi->uv_mode];
#endif #endif
// Sub8x8-Inter/Intra OR UV-Intra // Sub8x8-Inter/Intra OR UV-Intra
......
...@@ -1413,13 +1413,19 @@ const aom_tree_index av1_ext_tx_intra_tree[EXT_TX_SETS_INTRA] ...@@ -1413,13 +1413,19 @@ const aom_tree_index av1_ext_tx_intra_tree[EXT_TX_SETS_INTRA]
static const aom_prob static const aom_prob
default_inter_ext_tx_prob[EXT_TX_SETS_INTER][EXT_TX_SIZES][TX_TYPES - 1] = { default_inter_ext_tx_prob[EXT_TX_SETS_INTER][EXT_TX_SIZES][TX_TYPES - 1] = {
{ {
// ToDo(yaowu): remove unused entry 0. // ToDo(yaowu): remove unused entry 0.
#if CONFIG_CB4X4
{ 0 },
#endif
{ 0 }, { 0 },
{ 0 }, { 0 },
{ 0 }, { 0 },
{ 0 }, { 0 },
}, },
{ {
#if CONFIG_CB4X4
{ 0 },
#endif
{ 10, 24, 30, 128, 128, 128, 128, 112, 160, 128, 128, 128, 128, 128, { 10, 24, 30, 128, 128, 128, 128, 112, 160, 128, 128, 128, 128, 128,
128 }, 128 },
{ 10, 24, 30, 128, 128, 128, 128, 112, 160, 128, 128, 128, 128, 128, { 10, 24, 30, 128, 128, 128, 128, 112, 160, 128, 128, 128, 128, 128,
...@@ -1430,13 +1436,22 @@ static const aom_prob ...@@ -1430,13 +1436,22 @@ static const aom_prob
128 }, 128 },
}, },
{ {
#if CONFIG_CB4X4
{ 0 },
#endif
{ 10, 30, 128, 112, 160, 128, 128, 128, 128, 128, 128 }, { 10, 30, 128, 112, 160, 128, 128, 128, 128, 128, 128 },
{ 10, 30, 128, 112, 160, 128, 128, 128, 128, 128, 128 }, { 10, 30, 128, 112, 160, 128, 128, 128, 128, 128, 128 },
{ 10, 30, 128, 112, 160, 128, 128, 128, 128, 128, 128 }, { 10, 30, 128, 112, 160, 128, 128, 128, 128, 128, 128 },
{ 10, 30, 128, 112, 160, 128, 128, 128, 128, 128, 128 }, { 10, 30, 128, 112, 160, 128, 128, 128, 128, 128, 128 },
}, },
{ {
{ 12 }, { 12 }, { 12 }, { 12 }, #if CONFIG_CB4X4
{ 0 },
#endif
{ 12 },
{ 12 },
{ 12 },
{ 12 },
} }
}; };
...@@ -1444,7 +1459,12 @@ static const aom_prob ...@@ -1444,7 +1459,12 @@ static const aom_prob
default_intra_ext_tx_prob[EXT_TX_SETS_INTRA][EXT_TX_SIZES][INTRA_MODES] default_intra_ext_tx_prob[EXT_TX_SETS_INTRA][EXT_TX_SIZES][INTRA_MODES]
[TX_TYPES - 1] = { [TX_TYPES - 1] = {
{ {
// ToDo(yaowu): remove unused entry 0. // ToDo(yaowu): remove unused entry 0.
#if CONFIG_CB4X4
{
{ 0 },
},
#endif
{ {
{ 0 }, { 0 },
{ 0 }, { 0 },
...@@ -1495,6 +1515,11 @@ static const aom_prob ...@@ -1495,6 +1515,11 @@ static const aom_prob
}, },
}, },
{ {
#if CONFIG_CB4X4
{
{ 0 },
},
#endif
{ {
{ 8, 224, 32, 128, 64, 128 }, { 8, 224, 32, 128, 64, 128 },
{ 10, 32, 32, 128, 16, 192 }, { 10, 32, 32, 128, 16, 192 },
...@@ -1545,6 +1570,11 @@ static const aom_prob ...@@ -1545,6 +1570,11 @@ static const aom_prob
}, },
}, },
{ {
#if CONFIG_CB4X4
{
{ 0 },
},
#endif
{ {
{ 8, 224, 64, 128 }, { 8, 224, 64, 128 },
{ 10, 32, 16, 192 }, { 10, 32, 16, 192 },
......
...@@ -232,7 +232,11 @@ typedef enum { ...@@ -232,7 +232,11 @@ typedef enum {
#endif // CONFIG_DEBLOCKING_ACROSS_TILES #endif // CONFIG_DEBLOCKING_ACROSS_TILES
#if CONFIG_EXT_TX #if CONFIG_EXT_TX
#if CONFIG_CB4X4
#define EXT_TX_SIZES 5 // number of sizes that use extended transforms
#else
#define EXT_TX_SIZES 4 // number of sizes that use extended transforms #define EXT_TX_SIZES 4 // number of sizes that use extended transforms
#endif // CONFIG_CB4X4
#define EXT_TX_SETS_INTER 4 // Sets of transform selections for INTER #define EXT_TX_SETS_INTER 4 // Sets of transform selections for INTER
#define EXT_TX_SETS_INTRA 3 // Sets of transform selections for INTRA #define EXT_TX_SETS_INTRA 3 // Sets of transform selections for INTRA
#else #else
......
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