Use explicit block position in foreach_transformed_block
Add the row and column index to the argument list of unit functions
called by foreach_transformed_block wrapper. This avoids the
repeated internal parsing according to the block index.
Change-Id: Ie7508acdac0b498487564639bc5cc6378a8a0df7
diff --git a/vp10/encoder/rdopt.c b/vp10/encoder/rdopt.c
index 2e000af..cecc59c 100644
--- a/vp10/encoder/rdopt.c
+++ b/vp10/encoder/rdopt.c
@@ -451,18 +451,16 @@
*out_sse = this_sse >> shift;
}
-static int rate_block(int plane, int block, BLOCK_SIZE plane_bsize,
+static int rate_block(int plane, int block, int blk_row, int blk_col,
TX_SIZE tx_size, struct rdcost_block_args* args) {
- int x_idx, y_idx;
- txfrm_block_to_raster_xy(plane_bsize, tx_size, block, &x_idx, &y_idx);
-
- return cost_coeffs(args->x, plane, block, args->t_above + x_idx,
- args->t_left + y_idx, tx_size,
+ return cost_coeffs(args->x, plane, block, args->t_above + blk_col,
+ args->t_left + blk_row, tx_size,
args->so->scan, args->so->neighbors,
args->use_fast_coef_costing);
}
-static void block_rd_txfm(int plane, int block, BLOCK_SIZE plane_bsize,
+static void block_rd_txfm(int plane, int block, int blk_row, int blk_col,
+ BLOCK_SIZE plane_bsize,
TX_SIZE tx_size, void *arg) {
struct rdcost_block_args *args = arg;
MACROBLOCK *const x = args->x;
@@ -478,20 +476,23 @@
if (!is_inter_block(mbmi)) {
struct encode_b_args arg = {x, NULL, &mbmi->skip};
- vp10_encode_block_intra(plane, block, plane_bsize, tx_size, &arg);
+ vp10_encode_block_intra(plane, block, blk_row, blk_col,
+ plane_bsize, tx_size, &arg);
dist_block(x, plane, block, tx_size, &dist, &sse);
} else if (max_txsize_lookup[plane_bsize] == tx_size) {
if (x->skip_txfm[(plane << 2) + (block >> (tx_size << 1))] ==
SKIP_TXFM_NONE) {
// full forward transform and quantization
- vp10_xform_quant(x, plane, block, plane_bsize, tx_size);
+ vp10_xform_quant(x, plane, block, blk_row, blk_col,
+ plane_bsize, tx_size);
dist_block(x, plane, block, tx_size, &dist, &sse);
} else if (x->skip_txfm[(plane << 2) + (block >> (tx_size << 1))] ==
SKIP_TXFM_AC_ONLY) {
// compute DC coefficient
tran_low_t *const coeff = BLOCK_OFFSET(x->plane[plane].coeff, block);
tran_low_t *const dqcoeff = BLOCK_OFFSET(xd->plane[plane].dqcoeff, block);
- vp10_xform_quant_dc(x, plane, block, plane_bsize, tx_size);
+ vp10_xform_quant_dc(x, plane, block, blk_row, blk_col,
+ plane_bsize, tx_size);
sse = x->bsse[(plane << 2) + (block >> (tx_size << 1))] << 4;
dist = sse;
if (x->plane[plane].eobs[block]) {
@@ -515,7 +516,7 @@
}
} else {
// full forward transform and quantization
- vp10_xform_quant(x, plane, block, plane_bsize, tx_size);
+ vp10_xform_quant(x, plane, block, blk_row, blk_col, plane_bsize, tx_size);
dist_block(x, plane, block, tx_size, &dist, &sse);
}
@@ -525,7 +526,7 @@
return;
}
- rate = rate_block(plane, block, plane_bsize, tx_size, args);
+ rate = rate_block(plane, block, blk_row, blk_col, tx_size, args);
rd1 = RDCOST(x->rdmult, x->rddiv, rate, dist);
rd2 = RDCOST(x->rdmult, x->rddiv, 0, sse);