Enable rectangular transforms for UV

Uses an array to map block sizes, y tx sizes, and subsampling
factors to various transform sizes for UV.

Results improve by 0.1-0.2%

Change-Id: Icb58fd96bc7c01a72cbf1332fe2be4d55a0feedc
This commit is contained in:
Debargha Mukherjee 2016-08-30 17:43:38 -07:00
Родитель 01bade1064
Коммит 2f12340ff0
10 изменённых файлов: 306 добавлений и 61 удалений

Просмотреть файл

@ -684,25 +684,18 @@ static INLINE TX_TYPE get_tx_type(PLANE_TYPE plane_type, const MACROBLOCKD *xd,
void av1_setup_block_planes(MACROBLOCKD *xd, int ss_x, int ss_y); void av1_setup_block_planes(MACROBLOCKD *xd, int ss_x, int ss_y);
static INLINE TX_SIZE get_uv_tx_size_impl(TX_SIZE y_tx_size, BLOCK_SIZE bsize,
int xss, int yss) {
if (bsize < BLOCK_8X8) {
return TX_4X4;
} else {
const BLOCK_SIZE plane_bsize = ss_size_lookup[bsize][xss][yss];
return AOMMIN(txsize_sqr_map[y_tx_size], max_txsize_lookup[plane_bsize]);
}
}
static INLINE TX_SIZE get_uv_tx_size(const MB_MODE_INFO *mbmi, static INLINE TX_SIZE get_uv_tx_size(const MB_MODE_INFO *mbmi,
const struct macroblockd_plane *pd) { const struct macroblockd_plane *pd) {
TX_SIZE uv_txsize;
#if CONFIG_SUPERTX #if CONFIG_SUPERTX
if (supertx_enabled(mbmi)) if (supertx_enabled(mbmi))
return uvsupertx_size_lookup[txsize_sqr_map[mbmi->tx_size]] return uvsupertx_size_lookup[txsize_sqr_map[mbmi->tx_size]]
[pd->subsampling_x][pd->subsampling_y]; [pd->subsampling_x][pd->subsampling_y];
#endif // CONFIG_SUPERTX #endif // CONFIG_SUPERTX
return get_uv_tx_size_impl(mbmi->tx_size, mbmi->sb_type, pd->subsampling_x, uv_txsize = uv_txsize_lookup[mbmi->sb_type][mbmi->tx_size][pd->subsampling_x]
pd->subsampling_y); [pd->subsampling_y];
assert(uv_txsize != TX_INVALID);
return uv_txsize;
} }
static INLINE BLOCK_SIZE static INLINE BLOCK_SIZE

Просмотреть файл

@ -518,6 +518,270 @@ static const BLOCK_SIZE ss_size_lookup[BLOCK_SIZES][2][2] = {
#endif // CONFIG_EXT_PARTITION #endif // CONFIG_EXT_PARTITION
}; };
#define USE_UV_RECT_TX 1
static const TX_SIZE uv_txsize_lookup[BLOCK_SIZES][TX_SIZES_ALL][2][2] = {
// ss_x == 0 ss_x == 0 ss_x == 1 ss_x == 1
// ss_y == 0 ss_y == 1 ss_y == 0 ss_y == 1
{
// BLOCK_4X4
{ { TX_4X4, TX_4X4 }, { TX_4X4, TX_4X4 } },
{ { TX_4X4, TX_4X4 }, { TX_4X4, TX_4X4 } },
{ { TX_4X4, TX_4X4 }, { TX_4X4, TX_4X4 } },
{ { TX_4X4, TX_4X4 }, { TX_4X4, TX_4X4 } },
#if CONFIG_EXT_TX
{ { TX_4X4, TX_4X4 }, { TX_4X4, TX_4X4 } },
{ { TX_4X4, TX_4X4 }, { TX_4X4, TX_4X4 } },
{ { TX_4X4, TX_4X4 }, { TX_4X4, TX_4X4 } },
{ { TX_4X4, TX_4X4 }, { TX_4X4, TX_4X4 } },
{ { TX_4X4, TX_4X4 }, { TX_4X4, TX_4X4 } },
{ { TX_4X4, TX_4X4 }, { TX_4X4, TX_4X4 } },
#endif // CONFIG_EXT_TX
},
{
// BLOCK_4X8
{ { TX_4X4, TX_4X4 }, { TX_4X4, TX_4X4 } },
{ { TX_4X4, TX_4X4 }, { TX_4X4, TX_4X4 } },
{ { TX_4X4, TX_4X4 }, { TX_4X4, TX_4X4 } },
{ { TX_4X4, TX_4X4 }, { TX_4X4, TX_4X4 } },
#if CONFIG_EXT_TX
#if CONFIG_RECT_TX && USE_UV_RECT_TX
{ { TX_4X8, TX_4X4 }, { TX_4X4, TX_4X4 } }, // used
#else
{ { TX_4X4, TX_4X4 }, { TX_4X4, TX_4X4 } }, // used
#endif // CONFIG_RECT_TX && USE_UV_RECT_TX
{ { TX_INVALID, TX_INVALID }, { TX_INVALID, TX_INVALID } },
{ { TX_INVALID, TX_INVALID }, { TX_INVALID, TX_INVALID } },
{ { TX_INVALID, TX_INVALID }, { TX_INVALID, TX_INVALID } },
{ { TX_INVALID, TX_INVALID }, { TX_INVALID, TX_INVALID } },
{ { TX_INVALID, TX_INVALID }, { TX_INVALID, TX_INVALID } },
#endif // CONFIG_EXT_TX
},
{
// BLOCK_8X4
{ { TX_4X4, TX_4X4 }, { TX_4X4, TX_4X4 } },
{ { TX_4X4, TX_4X4 }, { TX_4X4, TX_4X4 } },
{ { TX_4X4, TX_4X4 }, { TX_4X4, TX_4X4 } },
{ { TX_4X4, TX_4X4 }, { TX_4X4, TX_4X4 } },
#if CONFIG_EXT_TX
{ { TX_INVALID, TX_INVALID }, { TX_INVALID, TX_INVALID } },
#if CONFIG_RECT_TX && USE_UV_RECT_TX
{ { TX_8X4, TX_4X4 }, { TX_4X4, TX_4X4 } }, // used
#else
{ { TX_4X4, TX_4X4 }, { TX_4X4, TX_4X4 } }, // used
#endif // CONFIG_RECT_TX && USE_UV_RECT_TX
{ { TX_INVALID, TX_INVALID }, { TX_INVALID, TX_INVALID } },
{ { TX_INVALID, TX_INVALID }, { TX_INVALID, TX_INVALID } },
{ { TX_INVALID, TX_INVALID }, { TX_INVALID, TX_INVALID } },
{ { TX_INVALID, TX_INVALID }, { TX_INVALID, TX_INVALID } },
#endif // CONFIG_EXT_TX
},
{
// BLOCK_8X8
{ { TX_4X4, TX_4X4 }, { TX_4X4, TX_4X4 } },
{ { TX_8X8, TX_8X8 }, { TX_4X4, TX_4X4 } },
{ { TX_8X8, TX_8X8 }, { TX_4X4, TX_4X4 } },
{ { TX_8X8, TX_8X8 }, { TX_4X4, TX_4X4 } },
#if CONFIG_EXT_TX
{ { TX_4X8, TX_4X4 }, { TX_4X8, TX_4X4 } },
{ { TX_8X4, TX_8X4 }, { TX_4X4, TX_4X4 } },
{ { TX_8X8, TX_8X4 }, { TX_4X8, TX_4X4 } },
{ { TX_8X8, TX_8X4 }, { TX_4X8, TX_4X4 } },
{ { TX_8X8, TX_8X4 }, { TX_4X8, TX_4X4 } },
{ { TX_8X8, TX_8X4 }, { TX_4X8, TX_4X4 } },
#endif // CONFIG_EXT_TX
},
{
// BLOCK_8X16
{ { TX_4X4, TX_4X4 }, { TX_4X4, TX_4X4 } },
{ { TX_8X8, TX_8X8 }, { TX_4X4, TX_4X4 } },
{ { TX_8X8, TX_8X8 }, { TX_4X4, TX_4X4 } },
{ { TX_8X8, TX_8X8 }, { TX_4X4, TX_4X4 } },
#if CONFIG_EXT_TX
{ { TX_4X8, TX_4X8 }, { TX_4X8, TX_4X8 } },
{ { TX_8X4, TX_8X4 }, { TX_4X4, TX_4X4 } },
#if CONFIG_RECT_TX && USE_UV_RECT_TX
{ { TX_8X16, TX_8X8 }, { TX_4X8, TX_4X8 } }, // used
#else
{ { TX_8X8, TX_8X8 }, { TX_4X4, TX_4X4 } }, // used
#endif // CONFIG_RECT_TX && USE_UV_RECT_TX
{ { TX_INVALID, TX_INVALID }, { TX_INVALID, TX_INVALID } },
{ { TX_INVALID, TX_INVALID }, { TX_INVALID, TX_INVALID } },
{ { TX_INVALID, TX_INVALID }, { TX_INVALID, TX_INVALID } },
#endif // CONFIG_EXT_TX
},
{
// BLOCK_16X8
{ { TX_4X4, TX_4X4 }, { TX_4X4, TX_4X4 } },
{ { TX_8X8, TX_4X4 }, { TX_8X8, TX_4X4 } },
{ { TX_8X8, TX_4X4 }, { TX_8X8, TX_8X8 } },
{ { TX_8X8, TX_4X4 }, { TX_8X8, TX_8X8 } },
#if CONFIG_EXT_TX
{ { TX_4X8, TX_4X4 }, { TX_4X8, TX_4X4 } },
{ { TX_8X4, TX_8X4 }, { TX_8X4, TX_8X4 } },
{ { TX_INVALID, TX_INVALID }, { TX_INVALID, TX_INVALID } },
#if CONFIG_RECT_TX && USE_UV_RECT_TX
{ { TX_16X8, TX_8X4 }, { TX_8X8, TX_8X4 } }, // used
#else
{ { TX_8X8, TX_4X4 }, { TX_8X8, TX_4X4 } }, // used
#endif // CONFIG_RECT_TX && USE_UV_RECT_TX
{ { TX_INVALID, TX_INVALID }, { TX_INVALID, TX_INVALID } },
{ { TX_INVALID, TX_INVALID }, { TX_INVALID, TX_INVALID } },
#endif // CONFIG_EXT_TX
},
{
// BLOCK_16X16
{ { TX_4X4, TX_4X4 }, { TX_4X4, TX_4X4 } },
{ { TX_8X8, TX_8X8 }, { TX_8X8, TX_8X8 } },
{ { TX_16X16, TX_8X8 }, { TX_8X8, TX_8X8 } },
{ { TX_16X16, TX_8X8 }, { TX_8X8, TX_8X8 } },
#if CONFIG_EXT_TX
{ { TX_4X8, TX_4X8 }, { TX_4X8, TX_4X8 } },
{ { TX_8X4, TX_8X4 }, { TX_8X4, TX_8X4 } },
{ { TX_8X16, TX_8X8 }, { TX_8X16, TX_8X8 } },
{ { TX_16X8, TX_16X8 }, { TX_8X8, TX_8X8 } },
{ { TX_16X16, TX_16X8 }, { TX_8X16, TX_8X8 } },
{ { TX_16X16, TX_16X8 }, { TX_8X16, TX_8X8 } },
#endif // CONFIG_EXT_TX
},
{
// BLOCK_16X32
{ { TX_4X4, TX_4X4 }, { TX_4X4, TX_4X4 } },
{ { TX_8X8, TX_8X8 }, { TX_8X8, TX_8X8 } },
{ { TX_16X16, TX_16X16 }, { TX_8X8, TX_8X8 } },
{ { TX_16X16, TX_16X16 }, { TX_8X8, TX_8X8 } },
#if CONFIG_EXT_TX
{ { TX_4X8, TX_4X8 }, { TX_4X8, TX_4X8 } },
{ { TX_8X4, TX_8X4 }, { TX_8X4, TX_8X4 } },
{ { TX_8X16, TX_8X16 }, { TX_8X16, TX_8X16 } },
{ { TX_16X8, TX_16X8 }, { TX_8X8, TX_8X8 } },
#if CONFIG_RECT_TX && USE_UV_RECT_TX
{ { TX_16X32, TX_16X16 }, { TX_8X16, TX_8X16 } }, // used
#else
{ { TX_16X16, TX_16X16 }, { TX_8X8, TX_8X8 } }, // used
#endif // CONFIG_RECT_TX && USE_UV_RECT_TX
{ { TX_INVALID, TX_INVALID }, { TX_INVALID, TX_INVALID } },
#endif // CONFIG_EXT_TX
},
{
// BLOCK_32X16
{ { TX_4X4, TX_4X4 }, { TX_4X4, TX_4X4 } },
{ { TX_8X8, TX_8X8 }, { TX_8X8, TX_8X8 } },
{ { TX_16X16, TX_8X8 }, { TX_16X16, TX_8X8 } },
{ { TX_16X16, TX_8X8 }, { TX_16X16, TX_8X8 } },
#if CONFIG_EXT_TX
{ { TX_4X8, TX_4X8 }, { TX_4X8, TX_4X8 } },
{ { TX_8X4, TX_8X4 }, { TX_8X4, TX_8X4 } },
{ { TX_8X16, TX_8X8 }, { TX_8X16, TX_8X8 } },
{ { TX_16X8, TX_16X8 }, { TX_16X8, TX_16X8 } },
{ { TX_INVALID, TX_INVALID }, { TX_INVALID, TX_INVALID } },
#if CONFIG_RECT_TX && USE_UV_RECT_TX
{ { TX_32X16, TX_16X8 }, { TX_16X16, TX_16X8 } }, // used
#else
{ { TX_16X16, TX_8X8 }, { TX_16X16, TX_8X8 } }, // used
#endif // CONFIG_RECT_TX && USE_UV_RECT_TX
#endif // CONFIG_EXT_TX
},
{
// BLOCK_32X32
{ { TX_4X4, TX_4X4 }, { TX_4X4, TX_4X4 } },
{ { TX_8X8, TX_8X8 }, { TX_8X8, TX_8X8 } },
{ { TX_16X16, TX_16X16 }, { TX_16X16, TX_16X16 } },
{ { TX_32X32, TX_16X16 }, { TX_16X16, TX_16X16 } },
#if CONFIG_EXT_TX
{ { TX_4X8, TX_4X8 }, { TX_4X8, TX_4X8 } },
{ { TX_8X4, TX_8X4 }, { TX_8X4, TX_8X4 } },
{ { TX_8X16, TX_8X16 }, { TX_8X16, TX_8X16 } },
{ { TX_16X8, TX_16X8 }, { TX_16X8, TX_16X8 } },
{ { TX_16X32, TX_16X16 }, { TX_16X32, TX_16X16 } },
{ { TX_32X16, TX_32X16 }, { TX_16X16, TX_16X16 } },
#endif // CONFIG_EXT_TX
},
{
// BLOCK_32X64
{ { TX_4X4, TX_4X4 }, { TX_4X4, TX_4X4 } },
{ { TX_8X8, TX_8X8 }, { TX_8X8, TX_8X8 } },
{ { TX_16X16, TX_16X16 }, { TX_16X16, TX_16X16 } },
{ { TX_32X32, TX_32X32 }, { TX_16X16, TX_16X16 } },
#if CONFIG_EXT_TX
{ { TX_4X8, TX_4X8 }, { TX_4X8, TX_4X8 } },
{ { TX_8X4, TX_8X4 }, { TX_8X4, TX_8X4 } },
{ { TX_8X16, TX_8X16 }, { TX_8X16, TX_8X16 } },
{ { TX_16X8, TX_16X8 }, { TX_16X8, TX_16X8 } },
{ { TX_16X32, TX_16X32 }, { TX_16X16, TX_16X16 } },
{ { TX_32X16, TX_32X16 }, { TX_16X16, TX_16X16 } },
#endif // CONFIG_EXT_TX
},
{
// BLOCK_64X32
{ { TX_4X4, TX_4X4 }, { TX_4X4, TX_4X4 } },
{ { TX_8X8, TX_8X8 }, { TX_8X8, TX_8X8 } },
{ { TX_16X16, TX_16X16 }, { TX_16X16, TX_16X16 } },
{ { TX_32X32, TX_16X16 }, { TX_32X32, TX_16X16 } },
#if CONFIG_EXT_TX
{ { TX_4X8, TX_4X8 }, { TX_4X8, TX_4X8 } },
{ { TX_8X4, TX_8X4 }, { TX_8X4, TX_8X4 } },
{ { TX_8X16, TX_8X16 }, { TX_8X16, TX_8X16 } },
{ { TX_16X8, TX_16X8 }, { TX_16X8, TX_16X8 } },
{ { TX_16X32, TX_16X16 }, { TX_16X32, TX_16X16 } },
{ { TX_32X16, TX_16X16 }, { TX_32X16, TX_16X16 } },
#endif // CONFIG_EXT_TX
},
{
// BLOCK_64X64
{ { TX_4X4, TX_4X4 }, { TX_4X4, TX_4X4 } },
{ { TX_8X8, TX_8X8 }, { TX_8X8, TX_8X8 } },
{ { TX_16X16, TX_16X16 }, { TX_16X16, TX_16X16 } },
{ { TX_32X32, TX_32X32 }, { TX_32X32, TX_32X32 } },
#if CONFIG_EXT_PARTITION
},
{
// BLOCK_64X128
{ { TX_4X4, TX_4X4 }, { TX_4X4, TX_4X4 } },
{ { TX_8X8, TX_8X8 }, { TX_8X8, TX_8X8 } },
{ { TX_16X16, TX_16X16 }, { TX_16X16, TX_16X16 } },
{ { TX_32X32, TX_32X32 }, { TX_32X32, TX_32X32 } },
#if CONFIG_EXT_TX
{ { TX_4X8, TX_4X8 }, { TX_4X8, TX_4X8 } },
{ { TX_8X4, TX_8X4 }, { TX_8X4, TX_8X4 } },
{ { TX_8X16, TX_8X16 }, { TX_8X16, TX_8X16 } },
{ { TX_16X8, TX_16X8 }, { TX_16X8, TX_16X8 } },
{ { TX_16X32, TX_16X32 }, { TX_16X32, TX_16X32 } },
{ { TX_32X16, TX_32X16 }, { TX_32X16, TX_32X16 } },
#endif // CONFIG_EXT_TX
},
{
// BLOCK_128X64
{ { TX_4X4, TX_4X4 }, { TX_4X4, TX_4X4 } },
{ { TX_8X8, TX_8X8 }, { TX_8X8, TX_8X8 } },
{ { TX_16X16, TX_16X16 }, { TX_16X16, TX_16X16 } },
{ { TX_32X32, TX_32X32 }, { TX_32X32, TX_32X32 } },
#if CONFIG_EXT_TX
{ { TX_4X8, TX_4X8 }, { TX_4X8, TX_4X8 } },
{ { TX_8X4, TX_8X4 }, { TX_8X4, TX_8X4 } },
{ { TX_8X16, TX_8X16 }, { TX_8X16, TX_8X16 } },
{ { TX_16X8, TX_16X8 }, { TX_16X8, TX_16X8 } },
{ { TX_16X32, TX_16X32 }, { TX_16X32, TX_16X32 } },
{ { TX_32X16, TX_32X16 }, { TX_32X16, TX_32X16 } },
#endif // CONFIG_EXT_TX
},
{
// BLOCK_128X128
{ { TX_4X4, TX_4X4 }, { TX_4X4, TX_4X4 } },
{ { TX_8X8, TX_8X8 }, { TX_8X8, TX_8X8 } },
{ { TX_16X16, TX_16X16 }, { TX_16X16, TX_16X16 } },
{ { TX_32X32, TX_32X32 }, { TX_32X32, TX_32X32 } },
#if CONFIG_EXT_TX
{ { TX_4X8, TX_4X8 }, { TX_4X8, TX_4X8 } },
{ { TX_8X4, TX_8X4 }, { TX_8X4, TX_8X4 } },
{ { TX_8X16, TX_8X16 }, { TX_8X16, TX_8X16 } },
{ { TX_16X8, TX_16X8 }, { TX_16X8, TX_16X8 } },
{ { TX_16X32, TX_16X32 }, { TX_16X32, TX_16X32 } },
{ { TX_32X16, TX_32X16 }, { TX_32X16, TX_32X16 } },
#endif // CONFIG_EXT_TX
#endif // CONFIG_EXT_PARTITION
},
};
// Generates 4 bit field in which each bit set to 1 represents // Generates 4 bit field in which each bit set to 1 represents
// a blocksize partition 1111 means we split 64x64, 32x32, 16x16 // a blocksize partition 1111 means we split 64x64, 32x32, 16x16
// and 8x8. 1000 means we just split the 64x64 to 32x32 // and 8x8. 1000 means we just split the 64x64 to 32x32

Просмотреть файл

@ -137,6 +137,7 @@ typedef uint8_t TX_SIZE;
#define TX_16X16 ((TX_SIZE)2) // 16x16 transform #define TX_16X16 ((TX_SIZE)2) // 16x16 transform
#define TX_32X32 ((TX_SIZE)3) // 32x32 transform #define TX_32X32 ((TX_SIZE)3) // 32x32 transform
#define TX_SIZES ((TX_SIZE)4) #define TX_SIZES ((TX_SIZE)4)
#define TX_INVALID ((TX_SIZE)255) // Invalid transform size
#if CONFIG_EXT_TX #if CONFIG_EXT_TX
#define TX_4X8 ((TX_SIZE)4) // 4x8 transform #define TX_4X8 ((TX_SIZE)4) // 4x8 transform

Просмотреть файл

@ -713,7 +713,7 @@ static void build_masks(const loop_filter_info_n *const lfi_n,
// rectangular transfroms are used with the EXT_TX expt. // rectangular transfroms are used with the EXT_TX expt.
const TX_SIZE tx_size_y = txsize_sqr_up_map[mbmi->tx_size]; const TX_SIZE tx_size_y = txsize_sqr_up_map[mbmi->tx_size];
const TX_SIZE tx_size_uv = const TX_SIZE tx_size_uv =
get_uv_tx_size_impl(mbmi->tx_size, block_size, 1, 1); txsize_sqr_up_map[uv_txsize_lookup[block_size][mbmi->tx_size][1][1]];
const int filter_level = get_filter_level(lfi_n, mbmi); const int filter_level = get_filter_level(lfi_n, mbmi);
uint64_t *const left_y = &lfm->left_y[tx_size_y]; uint64_t *const left_y = &lfm->left_y[tx_size_y];
uint64_t *const above_y = &lfm->above_y[tx_size_y]; uint64_t *const above_y = &lfm->above_y[tx_size_y];
@ -1238,9 +1238,9 @@ void av1_filter_block_plane_non420(AV1_COMMON *cm,
// Filter level can vary per MI // Filter level can vary per MI
if (!(lfl[r][c >> ss_x] = get_filter_level(&cm->lf_info, mbmi))) continue; if (!(lfl[r][c >> ss_x] = get_filter_level(&cm->lf_info, mbmi))) continue;
if (tx_size == TX_32X32) if (txsize_sqr_up_map[tx_size] == TX_32X32)
tx_size_mask = 3; tx_size_mask = 3;
else if (tx_size == TX_16X16) else if (txsize_sqr_up_map[tx_size] == TX_16X16)
tx_size_mask = 1; tx_size_mask = 1;
else else
tx_size_mask = 0; tx_size_mask = 0;
@ -1249,8 +1249,8 @@ void av1_filter_block_plane_non420(AV1_COMMON *cm,
if (is_inter_block(mbmi) && !mbmi->skip) if (is_inter_block(mbmi) && !mbmi->skip)
tx_size = tx_size =
(plane->plane_type == PLANE_TYPE_UV) (plane->plane_type == PLANE_TYPE_UV)
? get_uv_tx_size_impl(mbmi->inter_tx_size[blk_row][blk_col], ? uv_txsize_lookup[sb_type][mbmi->inter_tx_size
sb_type, ss_x, ss_y) [blk_row][blk_col]][ss_x][ss_y]
: mbmi->inter_tx_size[blk_row][blk_col]; : mbmi->inter_tx_size[blk_row][blk_col];
#if CONFIG_EXT_TX && CONFIG_RECT_TX #if CONFIG_EXT_TX && CONFIG_RECT_TX

Просмотреть файл

@ -311,8 +311,7 @@ static void decode_reconstruct_tx(MACROBLOCKD *const xd, aom_reader *r,
const int tx_row = blk_row >> (1 - pd->subsampling_y); const int tx_row = blk_row >> (1 - pd->subsampling_y);
const int tx_col = blk_col >> (1 - pd->subsampling_x); const int tx_col = blk_col >> (1 - pd->subsampling_x);
const TX_SIZE plane_tx_size = const TX_SIZE plane_tx_size =
plane ? get_uv_tx_size_impl(mbmi->inter_tx_size[tx_row][tx_col], bsize, 0, plane ? uv_txsize_lookup[bsize][mbmi->inter_tx_size[tx_row][tx_col]][0][0]
0)
: mbmi->inter_tx_size[tx_row][tx_col]; : mbmi->inter_tx_size[tx_row][tx_col];
int max_blocks_high = num_4x4_blocks_high_lookup[plane_bsize]; int max_blocks_high = num_4x4_blocks_high_lookup[plane_bsize];
int max_blocks_wide = num_4x4_blocks_wide_lookup[plane_bsize]; int max_blocks_wide = num_4x4_blocks_wide_lookup[plane_bsize];
@ -381,13 +380,6 @@ static int reconstruct_inter_block(MACROBLOCKD *const xd,
} }
#endif // !CONFIG_VAR_TX || CONFIG_SUPER_TX #endif // !CONFIG_VAR_TX || CONFIG_SUPER_TX
static INLINE TX_SIZE dec_get_uv_tx_size(const MB_MODE_INFO *mbmi, int n4_wl,
int n4_hl) {
// get minimum log2 num4x4s dimension
const int x = AOMMIN(n4_wl, n4_hl);
return AOMMIN(txsize_sqr_map[mbmi->tx_size], x);
}
static INLINE void dec_reset_skip_context(MACROBLOCKD *xd) { static INLINE void dec_reset_skip_context(MACROBLOCKD *xd) {
int i; int i;
for (i = 0; i < MAX_MB_PLANE; i++) { for (i = 0; i < MAX_MB_PLANE; i++) {
@ -1225,9 +1217,7 @@ static void decode_block(AV1Decoder *const pbi, MACROBLOCKD *const xd,
} }
for (plane = 0; plane < MAX_MB_PLANE; ++plane) { for (plane = 0; plane < MAX_MB_PLANE; ++plane) {
const struct macroblockd_plane *const pd = &xd->plane[plane]; const struct macroblockd_plane *const pd = &xd->plane[plane];
const TX_SIZE tx_size = const TX_SIZE tx_size = plane ? get_uv_tx_size(mbmi, pd) : mbmi->tx_size;
plane ? dec_get_uv_tx_size(mbmi, pd->n4_wl, pd->n4_hl)
: mbmi->tx_size;
const int num_4x4_w = pd->n4_w; const int num_4x4_w = pd->n4_w;
const int num_4x4_h = pd->n4_h; const int num_4x4_h = pd->n4_h;
const int stepr = num_4x4_blocks_high_txsize_lookup[tx_size]; const int stepr = num_4x4_blocks_high_txsize_lookup[tx_size];
@ -1319,8 +1309,7 @@ static void decode_block(AV1Decoder *const pbi, MACROBLOCKD *const xd,
int block = 0; int block = 0;
#if CONFIG_EXT_TX && CONFIG_RECT_TX #if CONFIG_EXT_TX && CONFIG_RECT_TX
const TX_SIZE tx_size = const TX_SIZE tx_size =
plane ? dec_get_uv_tx_size(mbmi, pd->n4_wl, pd->n4_hl) plane ? get_uv_tx_size(mbmi, pd) : mbmi->tx_size;
: mbmi->tx_size;
if (tx_size >= TX_SIZES) { // rect txsize is used if (tx_size >= TX_SIZES) { // rect txsize is used
const int stepr = num_4x4_blocks_high_txsize_lookup[tx_size]; const int stepr = num_4x4_blocks_high_txsize_lookup[tx_size];
@ -1352,8 +1341,7 @@ static void decode_block(AV1Decoder *const pbi, MACROBLOCKD *const xd,
#endif #endif
#else #else
const TX_SIZE tx_size = const TX_SIZE tx_size =
plane ? dec_get_uv_tx_size(mbmi, pd->n4_wl, pd->n4_hl) plane ? get_uv_tx_size(mbmi, pd) : mbmi->tx_size;
: mbmi->tx_size;
const int stepr = num_4x4_blocks_high_txsize_lookup[tx_size]; const int stepr = num_4x4_blocks_high_txsize_lookup[tx_size];
const int stepc = num_4x4_blocks_wide_txsize_lookup[tx_size]; const int stepc = num_4x4_blocks_wide_txsize_lookup[tx_size];
const int max_blocks_wide = const int max_blocks_wide =
@ -1730,8 +1718,7 @@ static void decode_partition(AV1Decoder *const pbi, MACROBLOCKD *const xd,
const int num_4x4_w = pd->n4_w; const int num_4x4_w = pd->n4_w;
const int num_4x4_h = pd->n4_h; const int num_4x4_h = pd->n4_h;
int row, col; int row, col;
const TX_SIZE tx_size = const TX_SIZE tx_size = i ? get_uv_tx_size(mbmi, pd) : mbmi->tx_size;
i ? dec_get_uv_tx_size(mbmi, pd->n4_wl, pd->n4_hl) : mbmi->tx_size;
const int stepr = num_4x4_blocks_high_txsize_lookup[tx_size]; const int stepr = num_4x4_blocks_high_txsize_lookup[tx_size];
const int stepc = num_4x4_blocks_wide_txsize_lookup[tx_size]; const int stepc = num_4x4_blocks_wide_txsize_lookup[tx_size];
const int max_blocks_wide = const int max_blocks_wide =

Просмотреть файл

@ -796,8 +796,8 @@ static void pack_txb_tokens(aom_writer *w, const TOKENEXTRA **tp,
if (blk_row >= max_blocks_high || blk_col >= max_blocks_wide) return; if (blk_row >= max_blocks_high || blk_col >= max_blocks_wide) return;
plane_tx_size = plane ? get_uv_tx_size_impl( plane_tx_size =
mbmi->inter_tx_size[tx_row][tx_col], bsize, 0, 0) plane ? uv_txsize_lookup[bsize][mbmi->inter_tx_size[tx_row][tx_col]][0][0]
: mbmi->inter_tx_size[tx_row][tx_col]; : mbmi->inter_tx_size[tx_row][tx_col];
if (tx_size == plane_tx_size) { if (tx_size == plane_tx_size) {

Просмотреть файл

@ -5087,7 +5087,8 @@ static void encode_superblock(AV1_COMP *cpi, ThreadData *td, TOKENEXTRA **t,
mi_8x8[mis * y + x]->mbmi.tx_size = tx_size; mi_8x8[mis * y + x]->mbmi.tx_size = tx_size;
} }
++td->counts->tx_size_totals[txsize_sqr_map[mbmi->tx_size]]; ++td->counts->tx_size_totals[txsize_sqr_map[mbmi->tx_size]];
++td->counts->tx_size_totals[get_uv_tx_size(mbmi, &xd->plane[1])]; ++td->counts
->tx_size_totals[txsize_sqr_map[get_uv_tx_size(mbmi, &xd->plane[1])]];
#if CONFIG_EXT_TX #if CONFIG_EXT_TX
if (get_ext_tx_types(mbmi->tx_size, bsize, is_inter_block(mbmi)) > 1 && if (get_ext_tx_types(mbmi->tx_size, bsize, is_inter_block(mbmi)) > 1 &&
cm->base_qindex > 0 && !mbmi->skip && cm->base_qindex > 0 && !mbmi->skip &&
@ -5987,8 +5988,8 @@ static void rd_supertx_sb(AV1_COMP *cpi, ThreadData *td,
pnskip = 1; pnskip = 1;
tx_size = max_txsize_lookup[bsize]; tx_size = max_txsize_lookup[bsize];
tx_size = get_uv_tx_size_impl(tx_size, bsize, cm->subsampling_x, tx_size =
cm->subsampling_y); uv_txsize_lookup[bsize][tx_size][cm->subsampling_x][cm->subsampling_y];
av1_get_entropy_contexts(bsize, tx_size, pd, ctxa, ctxl); av1_get_entropy_contexts(bsize, tx_size, pd, ctxa, ctxl);
coeff_ctx = combine_entropy_contexts(ctxa[0], ctxl[0]); coeff_ctx = combine_entropy_contexts(ctxa[0], ctxl[0]);
@ -5998,8 +5999,8 @@ static void rd_supertx_sb(AV1_COMP *cpi, ThreadData *td,
&this_dist, &pnsse, &pnskip); &this_dist, &pnsse, &pnskip);
#else #else
tx_size = max_txsize_lookup[bsize]; tx_size = max_txsize_lookup[bsize];
tx_size = get_uv_tx_size_impl(tx_size, bsize, cm->subsampling_x, tx_size =
cm->subsampling_y); uv_txsize_lookup[bsize][tx_size][cm->subsampling_x][cm->subsampling_y];
av1_subtract_plane(x, bsize, plane); av1_subtract_plane(x, bsize, plane);
av1_txfm_rd_in_plane_supertx(x, cpi, &this_rate, &this_dist, &pnskip, av1_txfm_rd_in_plane_supertx(x, cpi, &this_rate, &this_dist, &pnskip,
&pnsse, INT64_MAX, plane, bsize, tx_size, 0); &pnsse, INT64_MAX, plane, bsize, tx_size, 0);

Просмотреть файл

@ -871,8 +871,8 @@ static void encode_block_inter(int plane, int block, int blk_row, int blk_col,
if (blk_row >= max_blocks_high || blk_col >= max_blocks_wide) return; if (blk_row >= max_blocks_high || blk_col >= max_blocks_wide) return;
plane_tx_size = plane ? get_uv_tx_size_impl( plane_tx_size =
mbmi->inter_tx_size[tx_row][tx_col], bsize, 0, 0) plane ? uv_txsize_lookup[bsize][mbmi->inter_tx_size[tx_row][tx_col]][0][0]
: mbmi->inter_tx_size[tx_row][tx_col]; : mbmi->inter_tx_size[tx_row][tx_col];
if (tx_size == plane_tx_size) { if (tx_size == plane_tx_size) {

Просмотреть файл

@ -3347,8 +3347,8 @@ static void tx_block_rd(const AV1_COMP *cpi, MACROBLOCK *x, int blk_row,
if (blk_row >= max_blocks_high || blk_col >= max_blocks_wide) return; if (blk_row >= max_blocks_high || blk_col >= max_blocks_wide) return;
plane_tx_size = plane ? get_uv_tx_size_impl( plane_tx_size =
mbmi->inter_tx_size[tx_row][tx_col], bsize, 0, 0) plane ? uv_txsize_lookup[bsize][mbmi->inter_tx_size[tx_row][tx_col]][0][0]
: mbmi->inter_tx_size[tx_row][tx_col]; : mbmi->inter_tx_size[tx_row][tx_col];
if (tx_size == plane_tx_size) { if (tx_size == plane_tx_size) {
@ -7750,8 +7750,8 @@ void av1_rd_pick_intra_mode_sb(AV1_COMP *cpi, MACROBLOCK *x, RD_COST *rd_cost,
return; return;
} }
} }
max_uv_tx_size = get_uv_tx_size_impl( max_uv_tx_size = uv_txsize_lookup[bsize][xd->mi[0]->mbmi.tx_size]
xd->mi[0]->mbmi.tx_size, bsize, pd[1].subsampling_x, pd[1].subsampling_y); [pd[1].subsampling_x][pd[1].subsampling_y];
rd_pick_intra_sbuv_mode(cpi, x, &rate_uv, &rate_uv_tokenonly, &dist_uv, rd_pick_intra_sbuv_mode(cpi, x, &rate_uv, &rate_uv_tokenonly, &dist_uv,
&uv_skip, AOMMAX(BLOCK_8X8, bsize), max_uv_tx_size); &uv_skip, AOMMAX(BLOCK_8X8, bsize), max_uv_tx_size);
@ -7971,8 +7971,8 @@ static void pick_ext_intra_interframe(
return; return;
if (rate_y == INT_MAX) return; if (rate_y == INT_MAX) return;
uv_tx = get_uv_tx_size_impl(mbmi->tx_size, bsize, xd->plane[1].subsampling_x, uv_tx = uv_txsize_lookup[bsize][mbmi->tx_size][xd->plane[1].subsampling_x]
xd->plane[1].subsampling_y); [xd->plane[1].subsampling_y];
if (rate_uv_intra[uv_tx] == INT_MAX) { if (rate_uv_intra[uv_tx] == INT_MAX) {
choose_intra_uv_mode(cpi, x, ctx, bsize, uv_tx, &rate_uv_intra[uv_tx], choose_intra_uv_mode(cpi, x, ctx, bsize, uv_tx, &rate_uv_intra[uv_tx],
&rate_uv_tokenonly[uv_tx], &dist_uv[uv_tx], &rate_uv_tokenonly[uv_tx], &dist_uv[uv_tx],
@ -8673,8 +8673,8 @@ void av1_rd_pick_inter_mode_sb(AV1_COMP *cpi, TileDataEnc *tile_data,
if (mbmi->mode == DC_PRED) dc_skipped = 0; if (mbmi->mode == DC_PRED) dc_skipped = 0;
#endif // CONFIG_EXT_INTRA #endif // CONFIG_EXT_INTRA
uv_tx = get_uv_tx_size_impl(mbmi->tx_size, bsize, pd->subsampling_x, uv_tx = uv_txsize_lookup[bsize][mbmi->tx_size][pd->subsampling_x]
pd->subsampling_y); [pd->subsampling_y];
if (rate_uv_intra[uv_tx] == INT_MAX) { if (rate_uv_intra[uv_tx] == INT_MAX) {
choose_intra_uv_mode(cpi, x, ctx, bsize, uv_tx, &rate_uv_intra[uv_tx], choose_intra_uv_mode(cpi, x, ctx, bsize, uv_tx, &rate_uv_intra[uv_tx],
&rate_uv_tokenonly[uv_tx], &dist_uv[uv_tx], &rate_uv_tokenonly[uv_tx], &dist_uv[uv_tx],
@ -9334,9 +9334,8 @@ void av1_rd_pick_inter_mode_sb(AV1_COMP *cpi, TileDataEnc *tile_data,
super_block_yrd(cpi, x, &rate_y, &distortion_y, &skippable, NULL, bsize, super_block_yrd(cpi, x, &rate_y, &distortion_y, &skippable, NULL, bsize,
best_rd); best_rd);
if (rate_y == INT_MAX) goto PALETTE_EXIT; if (rate_y == INT_MAX) goto PALETTE_EXIT;
uv_tx = uv_tx = uv_txsize_lookup[bsize][mbmi->tx_size][xd->plane[1].subsampling_x]
get_uv_tx_size_impl(mbmi->tx_size, bsize, xd->plane[1].subsampling_x, [xd->plane[1].subsampling_y];
xd->plane[1].subsampling_y);
if (rate_uv_intra[uv_tx] == INT_MAX) { if (rate_uv_intra[uv_tx] == INT_MAX) {
choose_intra_uv_mode(cpi, x, ctx, bsize, uv_tx, &rate_uv_intra[uv_tx], choose_intra_uv_mode(cpi, x, ctx, bsize, uv_tx, &rate_uv_intra[uv_tx],
&rate_uv_tokenonly[uv_tx], &dist_uv[uv_tx], &rate_uv_tokenonly[uv_tx], &dist_uv[uv_tx],

Просмотреть файл

@ -584,8 +584,8 @@ void tokenize_tx(ThreadData *td, TOKENEXTRA **t, int dry_run, TX_SIZE tx_size,
if (blk_row >= max_blocks_high || blk_col >= max_blocks_wide) return; if (blk_row >= max_blocks_high || blk_col >= max_blocks_wide) return;
plane_tx_size = plane ? get_uv_tx_size_impl( plane_tx_size =
mbmi->inter_tx_size[tx_row][tx_col], bsize, 0, 0) plane ? uv_txsize_lookup[bsize][mbmi->inter_tx_size[tx_row][tx_col]][0][0]
: mbmi->inter_tx_size[tx_row][tx_col]; : mbmi->inter_tx_size[tx_row][tx_col];
if (tx_size == plane_tx_size) { if (tx_size == plane_tx_size) {