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/decoder/decodeframe.c b/av1/decoder/decodeframe.c
index a0190d7..4a18776 100644
--- a/av1/decoder/decodeframe.c
+++ b/av1/decoder/decodeframe.c
@@ -610,9 +610,11 @@
av1_read_coeffs_txb_facade(cm, xd, r, row, col, block_idx, plane,
pd->dqcoeff, tx_size, &max_scan_line, &eob);
// tx_type will be read out in av1_read_coeffs_txb_facade
- const TX_TYPE tx_type = av1_get_tx_type(plane_type, xd, block_idx, tx_size);
+ const TX_TYPE tx_type =
+ av1_get_tx_type(plane_type, xd, row, col, block_idx, tx_size);
#else // CONFIG_LV_MAP
- const TX_TYPE tx_type = av1_get_tx_type(plane_type, xd, block_idx, tx_size);
+ const TX_TYPE tx_type =
+ av1_get_tx_type(plane_type, xd, row, col, block_idx, tx_size);
const SCAN_ORDER *scan_order = get_scan(cm, tx_size, tx_type, mbmi);
int16_t max_scan_line = 0;
const int eob =
@@ -643,7 +645,8 @@
#endif // CONFIG_DPCM_INTRA
}
#else // !CONFIG_PVQ
- const TX_TYPE tx_type = av1_get_tx_type(plane_type, xd, block_idx, tx_size);
+ const TX_TYPE tx_type =
+ av1_get_tx_type(plane_type, xd, row, col, block_idx, tx_size);
av1_pvq_decode_helper2(cm, xd, mbmi, plane, row, col, tx_size, tx_type);
#endif // !CONFIG_PVQ
}
@@ -693,10 +696,10 @@
pd->dqcoeff, tx_size, &max_scan_line, &eob);
// tx_type will be read out in av1_read_coeffs_txb_facade
const TX_TYPE tx_type =
- av1_get_tx_type(plane_type, xd, block, plane_tx_size);
+ av1_get_tx_type(plane_type, xd, blk_row, blk_col, block, plane_tx_size);
#else // CONFIG_LV_MAP
const TX_TYPE tx_type =
- av1_get_tx_type(plane_type, xd, block, plane_tx_size);
+ av1_get_tx_type(plane_type, xd, blk_row, blk_col, block, plane_tx_size);
const SCAN_ORDER *sc = get_scan(cm, plane_tx_size, tx_type, mbmi);
int16_t max_scan_line = 0;
const int eob = av1_decode_block_tokens(
@@ -759,10 +762,12 @@
av1_read_coeffs_txb_facade(cm, xd, r, row, col, block_idx, plane, pd->dqcoeff,
tx_size, &max_scan_line, &eob);
// tx_type will be read out in av1_read_coeffs_txb_facade
- const TX_TYPE tx_type = av1_get_tx_type(plane_type, xd, block_idx, tx_size);
+ const TX_TYPE tx_type =
+ av1_get_tx_type(plane_type, xd, row, col, block_idx, tx_size);
#else // CONFIG_LV_MAP
int16_t max_scan_line = 0;
- const TX_TYPE tx_type = av1_get_tx_type(plane_type, xd, block_idx, tx_size);
+ const TX_TYPE tx_type =
+ av1_get_tx_type(plane_type, xd, row, col, block_idx, tx_size);
const SCAN_ORDER *scan_order =
get_scan(cm, tx_size, tx_type, &xd->mi[0]->mbmi);
const int eob =
@@ -779,7 +784,8 @@
tx_type, tx_size, dst, pd->dst.stride,
max_scan_line, eob);
#else
- const TX_TYPE tx_type = av1_get_tx_type(plane_type, xd, block_idx, tx_size);
+ const TX_TYPE tx_type =
+ av1_get_tx_type(plane_type, xd, row, col, block_idx, tx_size);
eob = av1_pvq_decode_helper2(cm, xd, &xd->mi[0]->mbmi, plane, row, col,
tx_size, tx_type);
#endif
diff --git a/av1/decoder/decodemv.c b/av1/decoder/decodemv.c
index fe904de..166721b 100644
--- a/av1/decoder/decodemv.c
+++ b/av1/decoder/decodemv.c
@@ -985,7 +985,8 @@
int supertx_enabled,
#endif
#if CONFIG_TXK_SEL
- int block, int plane, TX_SIZE tx_size,
+ int blk_row, int blk_col, int block, int plane,
+ TX_SIZE tx_size,
#endif
aom_reader *r) {
MB_MODE_INFO *mbmi = &xd->mi[0]->mbmi;
@@ -1004,7 +1005,8 @@
#else
// only y plane's tx_type is transmitted
if (plane > 0) return;
- TX_TYPE *tx_type = &mbmi->txk_type[block];
+ (void)block;
+ TX_TYPE *tx_type = &mbmi->txk_type[(blk_row << 4) + blk_col];
#endif
if (!FIXED_TX_TYPE) {
diff --git a/av1/decoder/decodemv.h b/av1/decoder/decodemv.h
index 9538e96..162cf32 100644
--- a/av1/decoder/decodemv.h
+++ b/av1/decoder/decodemv.h
@@ -37,7 +37,8 @@
int supertx_enabled,
#endif
#if CONFIG_TXK_SEL
- int block, int plane, TX_SIZE tx_size,
+ int blk_row, int blk_col, int block, int plane,
+ TX_SIZE tx_size,
#endif
aom_reader *r);
diff --git a/av1/decoder/decodetxb.c b/av1/decoder/decodetxb.c
index d499a7d..bf4f01b 100644
--- a/av1/decoder/decodetxb.c
+++ b/av1/decoder/decodetxb.c
@@ -73,15 +73,20 @@
*eob = 0;
if (all_zero) {
*max_scan_line = 0;
+#if CONFIG_TXK_SEL
+ if (plane == 0) mbmi->txk_type[(blk_row << 4) + blk_col] = DCT_DCT;
+#endif
return 0;
}
(void)blk_row;
(void)blk_col;
#if CONFIG_TXK_SEL
- av1_read_tx_type(cm, xd, block, plane, get_min_tx_size(tx_size), r);
+ av1_read_tx_type(cm, xd, blk_row, blk_col, block, plane,
+ get_min_tx_size(tx_size), r);
#endif
- 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);
const SCAN_ORDER *const scan_order = get_scan(cm, tx_size, tx_type, mbmi);
const int16_t *scan = scan_order->scan;
const int16_t *iscan = scan_order->iscan;