Rework txk_type indexing system for chroma component
Use the row and column indexes to fetch txk_type, which allows the
chroma components to derive the tx type from the corresponding luma
components. It improves the coding performance of txk-sel by 0.18%.
Change-Id: I3f4bca5839e13ae95e51053e76cd86fe58202ac9
diff --git a/av1/encoder/encodemb.c b/av1/encoder/encodemb.c
index b397f73..e7b136a 100644
--- a/av1/encoder/encodemb.c
+++ b/av1/encoder/encodemb.c
@@ -125,7 +125,8 @@
#if !CONFIG_LV_MAP
static int optimize_b_greedy(const AV1_COMMON *cm, MACROBLOCK *mb, int plane,
- int block, TX_SIZE tx_size, int ctx) {
+ int blk_row, int blk_col, int block,
+ TX_SIZE tx_size, int ctx) {
MACROBLOCKD *const xd = &mb->e_mbd;
struct macroblock_plane *const p = &mb->plane[plane];
struct macroblockd_plane *const pd = &xd->plane[plane];
@@ -138,7 +139,8 @@
const PLANE_TYPE plane_type = pd->plane_type;
const int16_t *const dequant_ptr = pd->dequant;
const uint8_t *const band_translate = get_band_translate(tx_size);
- const TX_TYPE tx_type = av1_get_tx_type(plane_type, xd, block, tx_size);
+ TX_TYPE tx_type =
+ av1_get_tx_type(plane_type, xd, blk_row, blk_col, block, tx_size);
const SCAN_ORDER *const scan_order =
get_scan(cm, tx_size, tx_type, &xd->mi[0]->mbmi);
const int16_t *const scan = scan_order->scan;
@@ -458,7 +460,8 @@
#else
int ctx = combine_entropy_contexts(*a, *l);
#endif // CONFIG_VAR_TX
- return optimize_b_greedy(cm, mb, plane, block, tx_size, ctx);
+ return optimize_b_greedy(cm, mb, plane, blk_row, blk_col, block, tx_size,
+ ctx);
#else // !CONFIG_LV_MAP
TXB_CTX txb_ctx;
get_txb_ctx(plane_bsize, tx_size, plane, a, l, &txb_ctx);
@@ -508,7 +511,8 @@
struct macroblockd_plane *const pd = &xd->plane[plane];
#endif
PLANE_TYPE plane_type = get_plane_type(plane);
- const TX_TYPE tx_type = av1_get_tx_type(plane_type, xd, block, tx_size);
+ TX_TYPE tx_type =
+ av1_get_tx_type(plane_type, xd, blk_row, blk_col, block, tx_size);
#if CONFIG_AOM_QM || CONFIG_NEW_QUANT
const int is_inter = is_inter_block(mbmi);
@@ -753,7 +757,8 @@
if (x->pvq_skip[plane]) return;
#endif
- const TX_TYPE tx_type = av1_get_tx_type(pd->plane_type, xd, block, tx_size);
+ TX_TYPE tx_type =
+ av1_get_tx_type(pd->plane_type, xd, blk_row, blk_col, block, tx_size);
#if CONFIG_LGT
PREDICTION_MODE mode = get_prediction_mode(xd->mi[0], plane, tx_size, block);
av1_inverse_transform_block(xd, dqcoeff, mode, tx_type, tx_size, dst,
@@ -1345,7 +1350,8 @@
struct macroblockd_plane *const pd = &xd->plane[plane];
tran_low_t *dqcoeff = BLOCK_OFFSET(pd->dqcoeff, block);
PLANE_TYPE plane_type = get_plane_type(plane);
- const TX_TYPE tx_type = av1_get_tx_type(plane_type, xd, block, tx_size);
+ const TX_TYPE tx_type =
+ av1_get_tx_type(plane_type, xd, blk_row, blk_col, block, tx_size);
uint16_t *eob = &p->eobs[block];
const int dst_stride = pd->dst.stride;
uint8_t *dst =