Passing scan & iscan as parameters, adding useful local variables.
Change-Id: Ia2a87906941db9557350d273669ce5c3cdb7235d
return res;
}
-void vp9_regular_quantize_b_4x4(MACROBLOCK *mb, int b_idx, TX_TYPE tx_type,
- int y_blocks) {
- MACROBLOCKD *const xd = &mb->e_mbd;
+void vp9_regular_quantize_b_4x4(MACROBLOCK *x, int y_blocks, int b_idx,
+ const int16_t *scan, const int16_t *iscan) {
+ MACROBLOCKD *const xd = &x->e_mbd;
const struct plane_block_idx pb_idx = plane_block_idx(y_blocks, b_idx);
- const int16_t *scan = get_scan_4x4(tx_type);
- const int16_t *iscan = get_iscan_4x4(tx_type);
-
- vp9_quantize_b(BLOCK_OFFSET(mb->plane[pb_idx.plane].coeff, pb_idx.block),
- 16, mb->skip_block,
- mb->plane[pb_idx.plane].zbin,
- mb->plane[pb_idx.plane].round,
- mb->plane[pb_idx.plane].quant,
- mb->plane[pb_idx.plane].quant_shift,
- BLOCK_OFFSET(xd->plane[pb_idx.plane].qcoeff, pb_idx.block),
- BLOCK_OFFSET(xd->plane[pb_idx.plane].dqcoeff, pb_idx.block),
- xd->plane[pb_idx.plane].dequant,
- mb->plane[pb_idx.plane].zbin_extra,
- &xd->plane[pb_idx.plane].eobs[pb_idx.block],
- scan, iscan);
+ struct macroblock_plane* p = &x->plane[pb_idx.plane];
+ struct macroblockd_plane* pd = &xd->plane[pb_idx.plane];
+
+ vp9_quantize_b(BLOCK_OFFSET(p->coeff, pb_idx.block),
+ 16, x->skip_block,
+ p->zbin, p->round, p->quant, p->quant_shift,
+ BLOCK_OFFSET(pd->qcoeff, pb_idx.block),
+ BLOCK_OFFSET(pd->dqcoeff, pb_idx.block),
+ pd->dequant, p->zbin_extra, &pd->eobs[pb_idx.block], scan, iscan);
}
static void invert_quant(int16_t *quant, int16_t *shift, int d) {
#include "vp9/encoder/vp9_block.h"
-void vp9_regular_quantize_b_4x4(MACROBLOCK *mb, int b_idx, TX_TYPE tx_type,
- int y_blocks);
+void vp9_regular_quantize_b_4x4(MACROBLOCK *x, int y_blocks, int b_idx,
+ const int16_t *scan, const int16_t *iscan);
+
struct VP9_COMP;
void vp9_set_quantizer(struct VP9_COMP *cpi, int q);
TX_TYPE tx_type = DCT_DCT;
const int num_4x4_blocks_wide = num_4x4_blocks_wide_lookup[bsize];
const int num_4x4_blocks_high = num_4x4_blocks_high_lookup[bsize];
- int idx, idy, block;
+ int idx, idy;
uint8_t best_dst[8 * 8];
assert(ib < 4);
const int16_t *nb;
uint8_t *src = src_init + idx * 4 + idy * 4 * src_stride;
uint8_t *dst = dst_init + idx * 4 + idy * 4 * dst_stride;
+ const int block = ib + idy * 2 + idx;
- block = ib + idy * 2 + idx;
+ get_scan_nb_4x4(tx_type, &scan, &nb);
xd->mi_8x8[0]->bmi[block].as_mode = mode;
src_diff = raster_block_offset_int16(BLOCK_8X8, block, p->src_diff);
coeff = BLOCK_OFFSET(x->plane[0].coeff, block);
vp9_short_fht4x4(src_diff, coeff, 8, tx_type);
else
x->fwd_txm4x4(src_diff, coeff, 8);
- vp9_regular_quantize_b_4x4(x, block, tx_type, 16);
+ vp9_regular_quantize_b_4x4(x, 16, block, scan, get_iscan_4x4(tx_type));
- get_scan_nb_4x4(tx_type, &scan, &nb);
ratey += cost_coeffs(x, 0, block,
tempa + idx, templ + idy, TX_4X4, scan, nb);
distortion += vp9_block_error(coeff, BLOCK_OFFSET(pd->dqcoeff, block),
coeff = BLOCK_OFFSET(p->coeff, k);
x->fwd_txm4x4(raster_block_offset_int16(BLOCK_8X8, k, p->src_diff),
coeff, 8);
- vp9_regular_quantize_b_4x4(x, k, DCT_DCT, 16);
+ vp9_regular_quantize_b_4x4(x, 16, k, get_scan_4x4(DCT_DCT),
+ get_iscan_4x4(DCT_DCT));
thisdistortion += vp9_block_error(coeff, BLOCK_OFFSET(pd->dqcoeff, k),
16, &ssz);
thissse += ssz;