Fix out-of-bound read in token_costs array
This resolves the unit test failure case at
AV1/AVxEncoderThreadTestLarge.EncoderResultTest/1
Change-Id: I9f3aaaf5498177cb3623cb8806a40f812e20609d
diff --git a/av1/encoder/rdopt.c b/av1/encoder/rdopt.c
index c63f87a..6114e5d 100644
--- a/av1/encoder/rdopt.c
+++ b/av1/encoder/rdopt.c
@@ -3265,6 +3265,7 @@
int tmp_eob = 0;
int zero_blk_rate;
RD_STATS sum_rd_stats;
+ const int tx_size_ctx = txsize_sqr_map[tx_size];
av1_init_rd_stats(&sum_rd_stats);
#if CONFIG_EXT_TX
@@ -3282,8 +3283,8 @@
if (blk_row >= max_blocks_high || blk_col >= max_blocks_wide) return;
- zero_blk_rate =
- x->token_costs[tx_size][pd->plane_type][1][0][0][coeff_ctx][EOB_TOKEN];
+ zero_blk_rate = x->token_costs[tx_size_ctx][pd->plane_type][1][0][0]
+ [coeff_ctx][EOB_TOKEN];
if (cpi->common.tx_mode == TX_MODE_SELECT || tx_size == TX_4X4) {
inter_tx_size[0][0] = tx_size;