Refactor supertx implementation
Replace hard coded numbers with table access. Avoid comparing
values from different enums.
Change-Id: I43216db4a9b13ee317e8e517683946f526e5ca0e
diff --git a/av1/common/blockd.h b/av1/common/blockd.h
index cf646bf..b71c997 100644
--- a/av1/common/blockd.h
+++ b/av1/common/blockd.h
@@ -555,9 +555,9 @@
#if CONFIG_SUPERTX
static INLINE int supertx_enabled(const MB_MODE_INFO *mbmi) {
- return (int)txsize_sqr_map[mbmi->tx_size] >
- AOMMIN(b_width_log2_lookup[mbmi->sb_type],
- b_height_log2_lookup[mbmi->sb_type]);
+ TX_SIZE max_tx_size = txsize_sqr_map[mbmi->tx_size];
+ return tx_size_wide[max_tx_size] >
+ AOMMIN(block_size_wide[mbmi->sb_type], block_size_high[mbmi->sb_type]);
}
#endif // CONFIG_SUPERTX
@@ -869,16 +869,16 @@
static INLINE TX_SIZE get_uv_tx_size(const MB_MODE_INFO *mbmi,
const struct macroblockd_plane *pd) {
TX_SIZE uv_txsize;
+#if CONFIG_CB4X4
+ assert(mbmi->tx_size > TX_2X2);
+#endif
+
#if CONFIG_SUPERTX
if (supertx_enabled(mbmi))
return uvsupertx_size_lookup[txsize_sqr_map[mbmi->tx_size]]
[pd->subsampling_x][pd->subsampling_y];
#endif // CONFIG_SUPERTX
-#if CONFIG_CB4X4
- assert(mbmi->tx_size > TX_2X2);
-#endif
-
uv_txsize = uv_txsize_lookup[mbmi->sb_type][mbmi->tx_size][pd->subsampling_x]
[pd->subsampling_y];
assert(uv_txsize != TX_INVALID);
diff --git a/av1/common/entropymode.c b/av1/common/entropymode.c
index f7dbf7e..7949d2a 100644
--- a/av1/common/entropymode.c
+++ b/av1/common/entropymode.c
@@ -1910,7 +1910,7 @@
#if CONFIG_SUPERTX
for (i = 0; i < PARTITION_SUPERTX_CONTEXTS; ++i) {
- for (j = 1; j < TX_SIZES; ++j) {
+ for (j = TX_8X8; j < TX_SIZES; ++j) {
fc->supertx_prob[i][j] = av1_mode_mv_merge_probs(
pre_fc->supertx_prob[i][j], counts->supertx[i][j]);
}
diff --git a/av1/common/reconinter.c b/av1/common/reconinter.c
index 7881f90..f7d4c65 100644
--- a/av1/common/reconinter.c
+++ b/av1/common/reconinter.c
@@ -1043,10 +1043,10 @@
const struct macroblockd_plane *pd = &xd->plane[plane];
const int ssx = pd->subsampling_x;
const int ssy = pd->subsampling_y;
- const int top_w = (4 << b_width_log2_lookup[top_bsize]) >> ssx;
- const int top_h = (4 << b_height_log2_lookup[top_bsize]) >> ssy;
- const int w = (4 << b_width_log2_lookup[bsize]) >> ssx;
- const int h = (4 << b_height_log2_lookup[bsize]) >> ssy;
+ const int top_w = block_size_wide[top_bsize] >> ssx;
+ const int top_h = block_size_high[top_bsize] >> ssy;
+ const int w = block_size_wide[bsize] >> ssx;
+ const int h = block_size_high[bsize] >> ssy;
const int w_offset = ((mi_col - mi_col_ori) * MI_SIZE) >> ssx;
const int h_offset = ((mi_row - mi_row_ori) * MI_SIZE) >> ssy;