From 1a00cffdef2f2245c4bfb3904f896d8664245c4f Mon Sep 17 00:00:00 2001 From: Jingning Han Date: Wed, 28 Dec 2016 14:53:14 -0800 Subject: [PATCH] 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 --- av1/common/blockd.h | 32 +++++++++++++++++++++++++++++--- av1/common/entropymode.c | 36 +++++++++++++++++++++++++++++++++--- av1/common/enums.h | 4 ++++ 3 files changed, 66 insertions(+), 6 deletions(-) diff --git a/av1/common/blockd.h b/av1/common/blockd.h index 3fac8a110..63dfc61e8 100644 --- a/av1/common/blockd.h +++ b/av1/common/blockd.h @@ -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) { 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; +#endif if (tx_size == TX_32X32) return is_inter ? 3 : 0; return (tx_size == TX_16X16 ? 2 : 1); } static const int use_intra_ext_tx_for_txsize[EXT_TX_SETS_INTRA] [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, 0, 0 }, { 0, 0, 1, 0 }, +#endif // CONFIG_CB4X4 }; static const int use_inter_ext_tx_for_txsize[EXT_TX_SETS_INTER] [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, 0, 0 }, { 0, 0, 1, 0 }, { 0, 0, 0, 1 }, +#endif // CONFIG_CB4X4 }; // 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, #endif // ALLOW_INTRA_EXT_TX 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) ? DCT_DCT : mbmi->tx_type; + } } #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 // Sub8x8-Inter/Intra OR UV-Intra diff --git a/av1/common/entropymode.c b/av1/common/entropymode.c index 18f9a3ae4..95d34485c 100644 --- a/av1/common/entropymode.c +++ b/av1/common/entropymode.c @@ -1413,13 +1413,19 @@ const aom_tree_index av1_ext_tx_intra_tree[EXT_TX_SETS_INTRA] static const aom_prob 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 }, }, { +#if CONFIG_CB4X4 + { 0 }, +#endif { 10, 24, 30, 128, 128, 128, 128, 112, 160, 128, 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 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 }, }, { - { 12 }, { 12 }, { 12 }, { 12 }, +#if CONFIG_CB4X4 + { 0 }, +#endif + { 12 }, + { 12 }, + { 12 }, + { 12 }, } }; @@ -1444,7 +1459,12 @@ static const aom_prob default_intra_ext_tx_prob[EXT_TX_SETS_INTRA][EXT_TX_SIZES][INTRA_MODES] [TX_TYPES - 1] = { { - // ToDo(yaowu): remove unused entry 0. +// ToDo(yaowu): remove unused entry 0. +#if CONFIG_CB4X4 + { + { 0 }, + }, +#endif { { 0 }, { 0 }, @@ -1495,6 +1515,11 @@ static const aom_prob }, }, { +#if CONFIG_CB4X4 + { + { 0 }, + }, +#endif { { 8, 224, 32, 128, 64, 128 }, { 10, 32, 32, 128, 16, 192 }, @@ -1545,6 +1570,11 @@ static const aom_prob }, }, { +#if CONFIG_CB4X4 + { + { 0 }, + }, +#endif { { 8, 224, 64, 128 }, { 10, 32, 16, 192 }, diff --git a/av1/common/enums.h b/av1/common/enums.h index 6889935cc..cf1ca8a53 100644 --- a/av1/common/enums.h +++ b/av1/common/enums.h @@ -232,7 +232,11 @@ typedef enum { #endif // CONFIG_DEBLOCKING_ACROSS_TILES #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 +#endif // CONFIG_CB4X4 #define EXT_TX_SETS_INTER 4 // Sets of transform selections for INTER #define EXT_TX_SETS_INTRA 3 // Sets of transform selections for INTRA #else -- GitLab