Prefer using get_tx_size()
Change-Id: Ifcdd3ce2953c1ecb1d0962da412a4b5ba2cda912
diff --git a/av1/common/blockd.c b/av1/common/blockd.c
index 65842dd..e38f62a 100644
--- a/av1/common/blockd.c
+++ b/av1/common/blockd.c
@@ -126,11 +126,10 @@
const MACROBLOCKD *const xd, BLOCK_SIZE bsize, int plane,
foreach_transformed_block_visitor visit, void *arg) {
const struct macroblockd_plane *const pd = &xd->plane[plane];
- const MB_MODE_INFO *mbmi = &xd->mi[0]->mbmi;
// block and transform sizes, in number of 4x4 blocks log 2 ("*_b")
// 4x4=0, 8x8=2, 16x16=4, 32x32=6, 64x64=8
// transform size varies per plane, look it up in a common way.
- const TX_SIZE tx_size = plane ? get_uv_tx_size(mbmi, pd) : mbmi->tx_size;
+ const TX_SIZE tx_size = get_tx_size(plane, xd);
#if CONFIG_CB4X4 && !CONFIG_CHROMA_2X2
const BLOCK_SIZE plane_bsize =
AOMMAX(BLOCK_4X4, get_plane_block_size(bsize, pd));
@@ -165,11 +164,10 @@
foreach_transformed_block_visitor visit,
foreach_transformed_block_visitor mi_visit, void *arg) {
const struct macroblockd_plane *const pd = &xd->plane[plane];
- const MB_MODE_INFO *mbmi = &xd->mi[0]->mbmi;
// block and transform sizes, in number of 4x4 blocks log 2 ("*_b")
// 4x4=0, 8x8=2, 16x16=4, 32x32=6, 64x64=8
// transform size varies per plane, look it up in a common way.
- const TX_SIZE tx_size = plane ? get_uv_tx_size(mbmi, pd) : mbmi->tx_size;
+ const TX_SIZE tx_size = get_tx_size(plane, xd);
const BLOCK_SIZE plane_bsize = get_plane_block_size(bsize, pd);
const uint8_t txw_unit = tx_size_wide_unit[tx_size];
const uint8_t txh_unit = tx_size_high_unit[tx_size];
diff --git a/av1/common/blockd.h b/av1/common/blockd.h
index 9616e39..dad002b 100644
--- a/av1/common/blockd.h
+++ b/av1/common/blockd.h
@@ -933,12 +933,10 @@
return uv_txsize;
}
-static INLINE TX_SIZE get_tx_size(int plane, const MACROBLOCKD *xd,
- int block_idx) {
+static INLINE TX_SIZE get_tx_size(int plane, const MACROBLOCKD *xd) {
const MB_MODE_INFO *mbmi = &xd->mi[0]->mbmi;
const MACROBLOCKD_PLANE *pd = &xd->plane[plane];
const TX_SIZE tx_size = plane ? get_uv_tx_size(mbmi, pd) : mbmi->tx_size;
- (void)block_idx;
return tx_size;
}
diff --git a/av1/decoder/decodeframe.c b/av1/decoder/decodeframe.c
index 24451db..1a49341 100644
--- a/av1/decoder/decodeframe.c
+++ b/av1/decoder/decodeframe.c
@@ -708,6 +708,7 @@
return &xd->mi[0]->mbmi;
}
+#if CONFIG_SUPERTX
static MB_MODE_INFO *set_mb_offsets(AV1_COMMON *const cm, MACROBLOCKD *const xd,
BLOCK_SIZE bsize, int mi_row, int mi_col,
int bw, int bh, int x_mis, int y_mis) {
@@ -729,6 +730,7 @@
#endif
return &xd->mi[0]->mbmi;
}
+#endif
static void set_offsets_topblock(AV1_COMMON *const cm, MACROBLOCKD *const xd,
const TileInfo *const tile, BLOCK_SIZE bsize,
@@ -1660,7 +1662,7 @@
#endif // CONFIG_PALETTE && !CONFIG_PALETTE_THROUGHPUT
for (plane = 0; plane < MAX_MB_PLANE; ++plane) {
const struct macroblockd_plane *const pd = &xd->plane[plane];
- const TX_SIZE tx_size = plane ? get_uv_tx_size(mbmi, pd) : mbmi->tx_size;
+ const TX_SIZE tx_size = get_tx_size(plane, xd);
const int stepr = tx_size_high_unit[tx_size];
const int stepc = tx_size_wide_unit[tx_size];
#if CONFIG_CB4X4
@@ -1780,8 +1782,7 @@
decode_reconstruct_tx(cm, xd, r, mbmi, plane, plane_bsize, row, col,
max_tx_size, &eobtotal);
#else
- const TX_SIZE tx_size =
- plane ? get_uv_tx_size(mbmi, pd) : mbmi->tx_size;
+ const TX_SIZE tx_size = get_tx_size(plane, xd);
const int stepr = tx_size_high_unit[tx_size];
const int stepc = tx_size_wide_unit[tx_size];
for (row = 0; row < max_blocks_high; row += stepr)
@@ -2289,7 +2290,7 @@
for (i = 0; i < MAX_MB_PLANE; ++i) {
const struct macroblockd_plane *const pd = &xd->plane[i];
int row, col;
- const TX_SIZE tx_size = i ? get_uv_tx_size(mbmi, pd) : mbmi->tx_size;
+ const TX_SIZE tx_size = get_tx_size(i, xd);
const BLOCK_SIZE plane_bsize = get_plane_block_size(bsize, pd);
const int stepr = tx_size_high_unit[tx_size];
const int stepc = tx_size_wide_unit[tx_size];
diff --git a/av1/decoder/decodetxb.c b/av1/decoder/decodetxb.c
index ab805a2..7b72c90 100644
--- a/av1/decoder/decodetxb.c
+++ b/av1/decoder/decodetxb.c
@@ -37,7 +37,7 @@
aom_reader *r, int block, int plane,
tran_low_t *tcoeffs, TXB_CTX *txb_ctx) {
FRAME_COUNTS *counts = xd->counts;
- TX_SIZE tx_size = get_tx_size(plane, xd, block);
+ TX_SIZE tx_size = get_tx_size(plane, xd);
PLANE_TYPE plane_type = get_plane_type(plane);
aom_prob *nz_map = cm->fc->nz_map[tx_size][plane_type];
aom_prob *eob_flag = cm->fc->eob_flag[tx_size][plane_type];
diff --git a/av1/encoder/bitstream.c b/av1/encoder/bitstream.c
index 7a9f04d..d218eb0 100644
--- a/av1/encoder/bitstream.c
+++ b/av1/encoder/bitstream.c
@@ -2219,8 +2219,7 @@
}
#endif // CONFIG_RD_DEBUG
} else {
- TX_SIZE tx = plane ? get_uv_tx_size(&m->mbmi, &xd->plane[plane])
- : m->mbmi.tx_size;
+ TX_SIZE tx = get_tx_size(plane, xd);
const int bkw = tx_size_wide_unit[tx];
const int bkh = tx_size_high_unit[tx];
#if CONFIG_PALETTE && CONFIG_PALETTE_THROUGHPUT
@@ -2252,8 +2251,7 @@
}
}
#else
- TX_SIZE tx =
- plane ? get_uv_tx_size(&m->mbmi, &xd->plane[plane]) : m->mbmi.tx_size;
+ TX_SIZE tx = get_tx_size(plane, xd);
TOKEN_STATS token_stats;
#if CONFIG_PALETTE && CONFIG_PALETTE_THROUGHPUT
const struct macroblockd_plane *const pd = &xd->plane[plane];
@@ -2319,8 +2317,7 @@
if (!m->mbmi.skip) {
for (plane = 0; plane < MAX_MB_PLANE; ++plane) {
PVQ_INFO *pvq;
- TX_SIZE tx_size =
- plane ? get_uv_tx_size(&m->mbmi, &xd->plane[plane]) : m->mbmi.tx_size;
+ TX_SIZE tx_size = get_tx_size(plane, xd);
int idx, idy;
const struct macroblockd_plane *const pd = &xd->plane[plane];
int max_blocks_wide;
@@ -2731,8 +2728,7 @@
const int max_blocks_high = max_block_high(xd, plane_bsize, plane);
int row, col;
- TX_SIZE tx =
- plane ? get_uv_tx_size(mbmi, &xd->plane[plane]) : mbmi->tx_size;
+ TX_SIZE tx = get_tx_size(plane, xd);
BLOCK_SIZE txb_size = txsize_to_bsize[tx];
const int stepr = tx_size_high_unit[txb_size];
diff --git a/av1/encoder/encodemb.c b/av1/encoder/encodemb.c
index 506411c..d5ddbfa 100644
--- a/av1/encoder/encodemb.c
+++ b/av1/encoder/encodemb.c
@@ -912,7 +912,7 @@
av1_get_entropy_contexts(bsize, 0, pd, ctx.ta[plane], ctx.tl[plane]);
#else
const struct macroblockd_plane *const pd = &xd->plane[plane];
- const TX_SIZE tx_size = plane ? get_uv_tx_size(mbmi, pd) : mbmi->tx_size;
+ const TX_SIZE tx_size = get_tx_size(plane, xd);
av1_get_entropy_contexts(bsize, tx_size, pd, ctx.ta[plane], ctx.tl[plane]);
#endif
@@ -953,7 +953,7 @@
#if CONFIG_VAR_TX
const TX_SIZE tx_size = TX_4X4;
#else
- const TX_SIZE tx_size = plane ? get_uv_tx_size(mbmi, pd) : mbmi->tx_size;
+ const TX_SIZE tx_size = get_tx_size(plane, xd);
#endif
av1_subtract_plane(x, bsize, plane);
av1_get_entropy_contexts(bsize, tx_size, pd, ctx.ta[plane], ctx.tl[plane]);
@@ -1152,8 +1152,7 @@
if (enable_optimize_b) {
const struct macroblockd_plane *const pd = &xd->plane[plane];
- const TX_SIZE tx_size =
- plane ? get_uv_tx_size(&xd->mi[0]->mbmi, pd) : xd->mi[0]->mbmi.tx_size;
+ const TX_SIZE tx_size = get_tx_size(plane, xd);
av1_get_entropy_contexts(bsize, tx_size, pd, ta, tl);
}
av1_foreach_transformed_block_in_plane(xd, bsize, plane,
diff --git a/av1/encoder/encodetxb.c b/av1/encoder/encodetxb.c
index 024d7f8..62db8cb 100644
--- a/av1/encoder/encodetxb.c
+++ b/av1/encoder/encodetxb.c
@@ -36,7 +36,7 @@
aom_prob *eob_flag;
MB_MODE_INFO *mbmi = &xd->mi[0]->mbmi;
const PLANE_TYPE plane_type = get_plane_type(plane);
- const TX_SIZE tx_size = get_tx_size(plane, xd, block);
+ const TX_SIZE tx_size = get_tx_size(plane, xd);
const TX_TYPE tx_type = get_tx_type(plane_type, xd, block, tx_size);
const SCAN_ORDER *const scan_order =
get_scan(cm, tx_size, tx_type, is_inter_block(mbmi));
diff --git a/av1/encoder/rdopt.c b/av1/encoder/rdopt.c
index 9daa6c9..f721df0 100644
--- a/av1/encoder/rdopt.c
+++ b/av1/encoder/rdopt.c
@@ -1126,8 +1126,7 @@
#if !CONFIG_VAR_TX && !CONFIG_SUPERTX
// Check for consistency of tx_size with mode info
- assert(type == PLANE_TYPE_Y ? mbmi->tx_size == tx_size
- : get_uv_tx_size(mbmi, pd) == tx_size);
+ assert(tx_size == get_tx_size(plane, xd));
#endif // !CONFIG_VAR_TX && !CONFIG_SUPERTX
(void)cm;