Use block_idx rather than block_raster_idx
1) block_raster_idx is actually raster order only when tx_size
is TX_4x8.
It's very specific, so we should put it near to the place it's
actually used.
2) Sync the meaning of block_idx on encoder/decoder sides
Change-Id: I7d37a992cb773503e29f9c0d9d2586e580aa6173
diff --git a/av1/encoder/rdopt.c b/av1/encoder/rdopt.c
index a76eb09..3fa9302 100644
--- a/av1/encoder/rdopt.c
+++ b/av1/encoder/rdopt.c
@@ -1524,11 +1524,8 @@
(void)dst;
#endif // !CONFIG_PVQ
- const int block_raster_idx =
- av1_block_index_to_raster_order(tx_size, block);
const PLANE_TYPE plane_type = get_plane_type(plane);
- TX_TYPE tx_type =
- get_tx_type(plane_type, xd, block_raster_idx, tx_size);
+ TX_TYPE tx_type = get_tx_type(plane_type, xd, block, tx_size);
av1_inverse_transform_block(xd, dqcoeff, tx_type, tx_size, recon,
MAX_TX_SIZE, eob);
@@ -1574,15 +1571,12 @@
*(args->t_left + blk_row));
RD_STATS this_rd_stats;
- const int block_raster_idx = av1_block_index_to_raster_order(tx_size, block);
-
av1_init_rd_stats(&this_rd_stats);
if (args->exit_early) return;
if (!is_inter_block(mbmi)) {
- av1_predict_intra_block_facade(xd, plane, block_raster_idx, blk_col,
- blk_row, tx_size);
+ av1_predict_intra_block_facade(xd, plane, block, blk_col, blk_row, tx_size);
av1_subtract_txb(x, plane, plane_bsize, blk_col, blk_row, tx_size);
}
@@ -1597,8 +1591,7 @@
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 =
- get_tx_type(plane_type, xd, block_raster_idx, tx_size);
+ const TX_TYPE tx_type = get_tx_type(plane_type, xd, block, tx_size);
const int dst_stride = pd->dst.stride;
uint8_t *dst =
&pd->dst.buf[(blk_row * dst_stride + blk_col) << tx_size_wide_log2[0]];
@@ -2359,10 +2352,7 @@
int block = 0;
for (row = 0; row < max_blocks_high; row += stepr) {
for (col = 0; col < max_blocks_wide; col += stepc) {
- const int block_raster_idx =
- av1_block_index_to_raster_order(tx_size, block);
- av1_predict_intra_block_facade(xd, 0, block_raster_idx, col, row,
- tx_size);
+ av1_predict_intra_block_facade(xd, 0, block, col, row, tx_size);
block += step;
}
}
@@ -2701,8 +2691,7 @@
src_stride, dst, dst_stride, xd->bd);
#endif
if (is_lossless) {
- TX_TYPE tx_type =
- get_tx_type(PLANE_TYPE_Y, xd, block_raster_idx, tx_size);
+ TX_TYPE tx_type = get_tx_type(PLANE_TYPE_Y, xd, block, tx_size);
const SCAN_ORDER *scan_order = get_scan(cm, tx_size, tx_type, 0);
const int coeff_ctx =
combine_entropy_contexts(tempa[idx], templ[idy]);
@@ -2746,8 +2735,7 @@
} else {
int64_t dist;
unsigned int tmp;
- TX_TYPE tx_type =
- get_tx_type(PLANE_TYPE_Y, xd, block_raster_idx, tx_size);
+ TX_TYPE tx_type = get_tx_type(PLANE_TYPE_Y, xd, block, tx_size);
const SCAN_ORDER *scan_order = get_scan(cm, tx_size, tx_type, 0);
const int coeff_ctx =
combine_entropy_contexts(tempa[idx], templ[idy]);
@@ -2897,8 +2885,7 @@
#endif // !CONFIG_PVQ
if (is_lossless) {
- TX_TYPE tx_type =
- get_tx_type(PLANE_TYPE_Y, xd, block_raster_idx, tx_size);
+ TX_TYPE tx_type = get_tx_type(PLANE_TYPE_Y, xd, block, tx_size);
const SCAN_ORDER *scan_order = get_scan(cm, tx_size, tx_type, 0);
const int coeff_ctx =
combine_entropy_contexts(tempa[idx], templ[idy]);
@@ -2955,8 +2942,7 @@
} else {
int64_t dist;
unsigned int tmp;
- TX_TYPE tx_type =
- get_tx_type(PLANE_TYPE_Y, xd, block_raster_idx, tx_size);
+ TX_TYPE tx_type = get_tx_type(PLANE_TYPE_Y, xd, block, tx_size);
const SCAN_ORDER *scan_order = get_scan(cm, tx_size, tx_type, 0);
const int coeff_ctx =
combine_entropy_contexts(tempa[idx], templ[idy]);