From 8f75ea6b5c0a72c233d1ff9a75e16e6fe43fda77 Mon Sep 17 00:00:00 2001 From: "Timothy B. Terriberry" Date: Thu, 21 Oct 2010 17:04:30 -0700 Subject: [PATCH] Convert [4][4] matrices to [16] arrays. Most of the code that actually uses these matrices indexes them as if they were a single contiguous array, and coverity produces reports about the resulting accesses that overflow the static bounds of the first row. This is perfectly legal in C, but converting them to actual [16] arrays should eliminate the report, and removes a good deal of extraneous indexing and address operators from the code. Change-Id: Ibda479e2232b3e51f9edf3b355b8640520fdbf23 --- vp8/common/blockd.h | 2 +- vp8/common/onyxc_int.h | 6 +- vp8/decoder/arm/dequantize_arm.c | 4 +- vp8/decoder/decodframe.c | 25 +++--- vp8/decoder/dequantize.c | 2 +- vp8/decoder/threading.c | 10 +-- vp8/encoder/arm/quantize_arm.c | 2 +- vp8/encoder/block.h | 10 +-- vp8/encoder/encodeframe.c | 120 ++++++++++++------------- vp8/encoder/encodemb.c | 4 +- vp8/encoder/onyx_int.h | 28 +++--- vp8/encoder/quantize.c | 76 ++++++++-------- vp8/encoder/x86/x86_csystemdependent.c | 44 ++++----- 13 files changed, 162 insertions(+), 171 deletions(-) diff --git a/vp8/common/blockd.h b/vp8/common/blockd.h index db8400ae4..a81bc8b95 100644 --- a/vp8/common/blockd.h +++ b/vp8/common/blockd.h @@ -195,7 +195,7 @@ typedef struct short *diff; short *reference; - short(*dequant)[4]; + short *dequant; // 16 Y blocks, 4 U blocks, 4 V blocks each with 16 entries unsigned char **base_pre; diff --git a/vp8/common/onyxc_int.h b/vp8/common/onyxc_int.h index 132765d18..4966002f5 100644 --- a/vp8/common/onyxc_int.h +++ b/vp8/common/onyxc_int.h @@ -83,9 +83,9 @@ typedef struct VP8Common { struct vpx_internal_error_info error; - DECLARE_ALIGNED(16, short, Y1dequant[QINDEX_RANGE][4][4]); - DECLARE_ALIGNED(16, short, Y2dequant[QINDEX_RANGE][4][4]); - DECLARE_ALIGNED(16, short, UVdequant[QINDEX_RANGE][4][4]); + DECLARE_ALIGNED(16, short, Y1dequant[QINDEX_RANGE][16]); + DECLARE_ALIGNED(16, short, Y2dequant[QINDEX_RANGE][16]); + DECLARE_ALIGNED(16, short, UVdequant[QINDEX_RANGE][16]); int Width; int Height; diff --git a/vp8/decoder/arm/dequantize_arm.c b/vp8/decoder/arm/dequantize_arm.c index 39265879b..b3e14b793 100644 --- a/vp8/decoder/arm/dequantize_arm.c +++ b/vp8/decoder/arm/dequantize_arm.c @@ -30,7 +30,7 @@ void vp8_dequantize_b_neon(BLOCKD *d) int i; short *DQ = d->dqcoeff; short *Q = d->qcoeff; - short *DQC = &d->dequant[0][0]; + short *DQC = d->dequant; vp8_dequantize_b_loop_neon(Q, DQC, DQ); } @@ -42,7 +42,7 @@ void vp8_dequantize_b_v6(BLOCKD *d) int i; short *DQ = d->dqcoeff; short *Q = d->qcoeff; - short *DQC = &d->dequant[0][0]; + short *DQC = d->dequant; vp8_dequantize_b_loop_v6(Q, DQC, DQ); } diff --git a/vp8/decoder/decodframe.c b/vp8/decoder/decodframe.c index efe0ad8e2..ebfda663c 100644 --- a/vp8/decoder/decodframe.c +++ b/vp8/decoder/decodframe.c @@ -40,27 +40,24 @@ void vp8cx_init_de_quantizer(VP8D_COMP *pbi) { - int r, c; int i; int Q; VP8_COMMON *const pc = & pbi->common; for (Q = 0; Q < QINDEX_RANGE; Q++) { - pc->Y1dequant[Q][0][0] = (short)vp8_dc_quant(Q, pc->y1dc_delta_q); - pc->Y2dequant[Q][0][0] = (short)vp8_dc2quant(Q, pc->y2dc_delta_q); - pc->UVdequant[Q][0][0] = (short)vp8_dc_uv_quant(Q, pc->uvdc_delta_q); + pc->Y1dequant[Q][0] = (short)vp8_dc_quant(Q, pc->y1dc_delta_q); + pc->Y2dequant[Q][0] = (short)vp8_dc2quant(Q, pc->y2dc_delta_q); + pc->UVdequant[Q][0] = (short)vp8_dc_uv_quant(Q, pc->uvdc_delta_q); // all the ac values = ; for (i = 1; i < 16; i++) { int rc = vp8_default_zig_zag1d[i]; - r = (rc >> 2); - c = (rc & 3); - pc->Y1dequant[Q][r][c] = (short)vp8_ac_yquant(Q); - pc->Y2dequant[Q][r][c] = (short)vp8_ac2quant(Q, pc->y2ac_delta_q); - pc->UVdequant[Q][r][c] = (short)vp8_ac_uv_quant(Q, pc->uvac_delta_q); + pc->Y1dequant[Q][rc] = (short)vp8_ac_yquant(Q); + pc->Y2dequant[Q][rc] = (short)vp8_ac2quant(Q, pc->y2ac_delta_q); + pc->UVdequant[Q][rc] = (short)vp8_ac_uv_quant(Q, pc->uvac_delta_q); } } } @@ -253,7 +250,7 @@ void vp8_decode_macroblock(VP8D_COMP *pbi, MACROBLOCKD *xd) } DEQUANT_INVOKE (&pbi->dequant, dc_idct_add_y_block) - (xd->qcoeff, &xd->block[0].dequant[0][0], + (xd->qcoeff, xd->block[0].dequant, xd->predictor, xd->dst.y_buffer, xd->dst.y_stride, xd->eobs, xd->block[24].diff); } @@ -268,13 +265,13 @@ void vp8_decode_macroblock(VP8D_COMP *pbi, MACROBLOCKD *xd) if (xd->eobs[i] > 1) { DEQUANT_INVOKE(&pbi->dequant, idct_add) - (b->qcoeff, &b->dequant[0][0], b->predictor, + (b->qcoeff, b->dequant, b->predictor, *(b->base_dst) + b->dst, 16, b->dst_stride); } else { IDCT_INVOKE(RTCD_VTABLE(idct), idct1_scalar_add) - (b->qcoeff[0] * b->dequant[0][0], b->predictor, + (b->qcoeff[0] * b->dequant[0], b->predictor, *(b->base_dst) + b->dst, 16, b->dst_stride); ((int *)b->qcoeff)[0] = 0; } @@ -284,13 +281,13 @@ void vp8_decode_macroblock(VP8D_COMP *pbi, MACROBLOCKD *xd) else { DEQUANT_INVOKE (&pbi->dequant, idct_add_y_block) - (xd->qcoeff, &xd->block[0].dequant[0][0], + (xd->qcoeff, xd->block[0].dequant, xd->predictor, xd->dst.y_buffer, xd->dst.y_stride, xd->eobs); } DEQUANT_INVOKE (&pbi->dequant, idct_add_uv_block) - (xd->qcoeff+16*16, &xd->block[16].dequant[0][0], + (xd->qcoeff+16*16, xd->block[16].dequant, xd->predictor+16*16, xd->dst.u_buffer, xd->dst.v_buffer, xd->dst.uv_stride, xd->eobs+16); } diff --git a/vp8/decoder/dequantize.c b/vp8/decoder/dequantize.c index 8cfa2a32e..f5d576ac7 100644 --- a/vp8/decoder/dequantize.c +++ b/vp8/decoder/dequantize.c @@ -24,7 +24,7 @@ void vp8_dequantize_b_c(BLOCKD *d) int i; short *DQ = d->dqcoeff; short *Q = d->qcoeff; - short *DQC = &d->dequant[0][0]; + short *DQC = d->dequant; for (i = 0; i < 16; i++) { diff --git a/vp8/decoder/threading.c b/vp8/decoder/threading.c index 56dd5ef8e..2d7f7b9b8 100644 --- a/vp8/decoder/threading.c +++ b/vp8/decoder/threading.c @@ -184,7 +184,7 @@ void vp8mt_decode_macroblock(VP8D_COMP *pbi, MACROBLOCKD *xd, int mb_row, int mb } DEQUANT_INVOKE (&pbi->dequant, dc_idct_add_y_block) - (xd->qcoeff, &xd->block[0].dequant[0][0], + (xd->qcoeff, xd->block[0].dequant, xd->predictor, xd->dst.y_buffer, xd->dst.y_stride, xd->eobs, xd->block[24].diff); } @@ -198,13 +198,13 @@ void vp8mt_decode_macroblock(VP8D_COMP *pbi, MACROBLOCKD *xd, int mb_row, int mb if (xd->eobs[i] > 1) { DEQUANT_INVOKE(&pbi->dequant, idct_add) - (b->qcoeff, &b->dequant[0][0], b->predictor, + (b->qcoeff, b->dequant, b->predictor, *(b->base_dst) + b->dst, 16, b->dst_stride); } else { IDCT_INVOKE(RTCD_VTABLE(idct), idct1_scalar_add) - (b->qcoeff[0] * b->dequant[0][0], b->predictor, + (b->qcoeff[0] * b->dequant[0], b->predictor, *(b->base_dst) + b->dst, 16, b->dst_stride); ((int *)b->qcoeff)[0] = 0; } @@ -213,13 +213,13 @@ void vp8mt_decode_macroblock(VP8D_COMP *pbi, MACROBLOCKD *xd, int mb_row, int mb else { DEQUANT_INVOKE (&pbi->dequant, idct_add_y_block) - (xd->qcoeff, &xd->block[0].dequant[0][0], + (xd->qcoeff, xd->block[0].dequant, xd->predictor, xd->dst.y_buffer, xd->dst.y_stride, xd->eobs); } DEQUANT_INVOKE (&pbi->dequant, idct_add_uv_block) - (xd->qcoeff+16*16, &xd->block[16].dequant[0][0], + (xd->qcoeff+16*16, xd->block[16].dequant, xd->predictor+16*16, xd->dst.u_buffer, xd->dst.v_buffer, xd->dst.uv_stride, xd->eobs+16); #else diff --git a/vp8/encoder/arm/quantize_arm.c b/vp8/encoder/arm/quantize_arm.c index 50f58bf08..65c616614 100644 --- a/vp8/encoder/arm/quantize_arm.c +++ b/vp8/encoder/arm/quantize_arm.c @@ -29,7 +29,7 @@ extern int vp8_fast_quantize_b_neon_func(short *coeff_ptr, short *zbin_ptr, shor void vp8_fast_quantize_b_neon(BLOCK *b, BLOCKD *d) { - d->eob = vp8_fast_quantize_b_neon_func(b->coeff, &b->zbin[0][0], d->qcoeff, d->dqcoeff, d->dequant[0], vp8_rvsplus1_default_zig_zag1d, &b->round[0][0], &b->quant[0][0]); + d->eob = vp8_fast_quantize_b_neon_func(b->coeff, b->zbin, d->qcoeff, d->dqcoeff, d->dequant, vp8_rvsplus1_default_zig_zag1d, b->round, b->quant); } /* diff --git a/vp8/encoder/block.h b/vp8/encoder/block.h index ffb88904e..e94e54976 100644 --- a/vp8/encoder/block.h +++ b/vp8/encoder/block.h @@ -32,11 +32,11 @@ typedef struct short *coeff; // 16 Y blocks, 4 U blocks, 4 V blocks each with 16 entries - short(*quant)[4]; - short(*quant_shift)[4]; - short(*zbin)[4]; - short(*zrun_zbin_boost); - short(*round)[4]; + short *quant; + short *quant_shift; + short *zbin; + short *zrun_zbin_boost; + short *round; // Zbin Over Quant value short zbin_extra; diff --git a/vp8/encoder/encodeframe.c b/vp8/encoder/encodeframe.c index 91384c73f..85e121be3 100644 --- a/vp8/encoder/encodeframe.c +++ b/vp8/encoder/encodeframe.c @@ -160,7 +160,6 @@ static void vp8cx_invert_quant(short *quant, short *shift, short d) void vp8cx_init_quantizer(VP8_COMP *cpi) { - int r, c; int i; int quant_val; int Q; @@ -171,58 +170,56 @@ void vp8cx_init_quantizer(VP8_COMP *cpi) { // dc values quant_val = vp8_dc_quant(Q, cpi->common.y1dc_delta_q); - vp8cx_invert_quant(cpi->Y1quant[Q][0] + 0, - cpi->Y1quant_shift[Q][0] + 0, quant_val); - cpi->Y1zbin[Q][0][0] = ((qzbin_factors[Q] * quant_val) + 64) >> 7; - cpi->Y1round[Q][0][0] = (qrounding_factors[Q] * quant_val) >> 7; - cpi->common.Y1dequant[Q][0][0] = quant_val; + vp8cx_invert_quant(cpi->Y1quant[Q] + 0, + cpi->Y1quant_shift[Q] + 0, quant_val); + cpi->Y1zbin[Q][0] = ((qzbin_factors[Q] * quant_val) + 64) >> 7; + cpi->Y1round[Q][0] = (qrounding_factors[Q] * quant_val) >> 7; + cpi->common.Y1dequant[Q][0] = quant_val; cpi->zrun_zbin_boost_y1[Q][0] = (quant_val * zbin_boost[0]) >> 7; quant_val = vp8_dc2quant(Q, cpi->common.y2dc_delta_q); - vp8cx_invert_quant(cpi->Y2quant[Q][0] + 0, - cpi->Y2quant_shift[Q][0] + 0, quant_val); - cpi->Y2zbin[Q][0][0] = ((qzbin_factors_y2[Q] * quant_val) + 64) >> 7; - cpi->Y2round[Q][0][0] = (qrounding_factors_y2[Q] * quant_val) >> 7; - cpi->common.Y2dequant[Q][0][0] = quant_val; + vp8cx_invert_quant(cpi->Y2quant[Q] + 0, + cpi->Y2quant_shift[Q] + 0, quant_val); + cpi->Y2zbin[Q][0] = ((qzbin_factors_y2[Q] * quant_val) + 64) >> 7; + cpi->Y2round[Q][0] = (qrounding_factors_y2[Q] * quant_val) >> 7; + cpi->common.Y2dequant[Q][0] = quant_val; cpi->zrun_zbin_boost_y2[Q][0] = (quant_val * zbin_boost[0]) >> 7; quant_val = vp8_dc_uv_quant(Q, cpi->common.uvdc_delta_q); - vp8cx_invert_quant(cpi->UVquant[Q][0] + 0, - cpi->UVquant_shift[Q][0] + 0, quant_val); - cpi->UVzbin[Q][0][0] = ((qzbin_factors[Q] * quant_val) + 64) >> 7;; - cpi->UVround[Q][0][0] = (qrounding_factors[Q] * quant_val) >> 7; - cpi->common.UVdequant[Q][0][0] = quant_val; + vp8cx_invert_quant(cpi->UVquant[Q] + 0, + cpi->UVquant_shift[Q] + 0, quant_val); + cpi->UVzbin[Q][0] = ((qzbin_factors[Q] * quant_val) + 64) >> 7;; + cpi->UVround[Q][0] = (qrounding_factors[Q] * quant_val) >> 7; + cpi->common.UVdequant[Q][0] = quant_val; cpi->zrun_zbin_boost_uv[Q][0] = (quant_val * zbin_boost[0]) >> 7; // all the ac values = ; for (i = 1; i < 16; i++) { int rc = vp8_default_zig_zag1d[i]; - r = (rc >> 2); - c = (rc & 3); quant_val = vp8_ac_yquant(Q); - vp8cx_invert_quant(cpi->Y1quant[Q][r] + c, - cpi->Y1quant_shift[Q][r] + c, quant_val); - cpi->Y1zbin[Q][r][c] = ((qzbin_factors[Q] * quant_val) + 64) >> 7; - cpi->Y1round[Q][r][c] = (qrounding_factors[Q] * quant_val) >> 7; - cpi->common.Y1dequant[Q][r][c] = quant_val; + vp8cx_invert_quant(cpi->Y1quant[Q] + rc, + cpi->Y1quant_shift[Q] + rc, quant_val); + cpi->Y1zbin[Q][rc] = ((qzbin_factors[Q] * quant_val) + 64) >> 7; + cpi->Y1round[Q][rc] = (qrounding_factors[Q] * quant_val) >> 7; + cpi->common.Y1dequant[Q][rc] = quant_val; cpi->zrun_zbin_boost_y1[Q][i] = (quant_val * zbin_boost[i]) >> 7; quant_val = vp8_ac2quant(Q, cpi->common.y2ac_delta_q); - vp8cx_invert_quant(cpi->Y2quant[Q][r] + c, - cpi->Y2quant_shift[Q][r] + c, quant_val); - cpi->Y2zbin[Q][r][c] = ((qzbin_factors_y2[Q] * quant_val) + 64) >> 7; - cpi->Y2round[Q][r][c] = (qrounding_factors_y2[Q] * quant_val) >> 7; - cpi->common.Y2dequant[Q][r][c] = quant_val; + vp8cx_invert_quant(cpi->Y2quant[Q] + rc, + cpi->Y2quant_shift[Q] + rc, quant_val); + cpi->Y2zbin[Q][rc] = ((qzbin_factors_y2[Q] * quant_val) + 64) >> 7; + cpi->Y2round[Q][rc] = (qrounding_factors_y2[Q] * quant_val) >> 7; + cpi->common.Y2dequant[Q][rc] = quant_val; cpi->zrun_zbin_boost_y2[Q][i] = (quant_val * zbin_boost[i]) >> 7; quant_val = vp8_ac_uv_quant(Q, cpi->common.uvac_delta_q); - vp8cx_invert_quant(cpi->UVquant[Q][r] + c, - cpi->UVquant_shift[Q][r] + c, quant_val); - cpi->UVzbin[Q][r][c] = ((qzbin_factors[Q] * quant_val) + 64) >> 7; - cpi->UVround[Q][r][c] = (qrounding_factors[Q] * quant_val) >> 7; - cpi->common.UVdequant[Q][r][c] = quant_val; + vp8cx_invert_quant(cpi->UVquant[Q] + rc, + cpi->UVquant_shift[Q] + rc, quant_val); + cpi->UVzbin[Q][rc] = ((qzbin_factors[Q] * quant_val) + 64) >> 7; + cpi->UVround[Q][rc] = (qrounding_factors[Q] * quant_val) >> 7; + cpi->common.UVdequant[Q][rc] = quant_val; cpi->zrun_zbin_boost_uv[Q][i] = (quant_val * zbin_boost[i]) >> 7; } } @@ -230,7 +227,6 @@ void vp8cx_init_quantizer(VP8_COMP *cpi) #else void vp8cx_init_quantizer(VP8_COMP *cpi) { - int r, c; int i; int quant_val; int Q; @@ -241,52 +237,50 @@ void vp8cx_init_quantizer(VP8_COMP *cpi) { // dc values quant_val = vp8_dc_quant(Q, cpi->common.y1dc_delta_q); - cpi->Y1quant[Q][0][0] = (1 << 16) / quant_val; - cpi->Y1zbin[Q][0][0] = ((qzbin_factors[Q] * quant_val) + 64) >> 7; - cpi->Y1round[Q][0][0] = (qrounding_factors[Q] * quant_val) >> 7; - cpi->common.Y1dequant[Q][0][0] = quant_val; + cpi->Y1quant[Q][0] = (1 << 16) / quant_val; + cpi->Y1zbin[Q][0] = ((qzbin_factors[Q] * quant_val) + 64) >> 7; + cpi->Y1round[Q][0] = (qrounding_factors[Q] * quant_val) >> 7; + cpi->common.Y1dequant[Q][0] = quant_val; cpi->zrun_zbin_boost_y1[Q][0] = (quant_val * zbin_boost[0]) >> 7; quant_val = vp8_dc2quant(Q, cpi->common.y2dc_delta_q); - cpi->Y2quant[Q][0][0] = (1 << 16) / quant_val; - cpi->Y2zbin[Q][0][0] = ((qzbin_factors_y2[Q] * quant_val) + 64) >> 7; - cpi->Y2round[Q][0][0] = (qrounding_factors_y2[Q] * quant_val) >> 7; - cpi->common.Y2dequant[Q][0][0] = quant_val; + cpi->Y2quant[Q][0] = (1 << 16) / quant_val; + cpi->Y2zbin[Q][0] = ((qzbin_factors_y2[Q] * quant_val) + 64) >> 7; + cpi->Y2round[Q][0] = (qrounding_factors_y2[Q] * quant_val) >> 7; + cpi->common.Y2dequant[Q][0] = quant_val; cpi->zrun_zbin_boost_y2[Q][0] = (quant_val * zbin_boost[0]) >> 7; quant_val = vp8_dc_uv_quant(Q, cpi->common.uvdc_delta_q); - cpi->UVquant[Q][0][0] = (1 << 16) / quant_val; - cpi->UVzbin[Q][0][0] = ((qzbin_factors[Q] * quant_val) + 64) >> 7;; - cpi->UVround[Q][0][0] = (qrounding_factors[Q] * quant_val) >> 7; - cpi->common.UVdequant[Q][0][0] = quant_val; + cpi->UVquant[Q][0] = (1 << 16) / quant_val; + cpi->UVzbin[Q][0] = ((qzbin_factors[Q] * quant_val) + 64) >> 7;; + cpi->UVround[Q][0] = (qrounding_factors[Q] * quant_val) >> 7; + cpi->common.UVdequant[Q][0] = quant_val; cpi->zrun_zbin_boost_uv[Q][0] = (quant_val * zbin_boost[0]) >> 7; // all the ac values = ; for (i = 1; i < 16; i++) { int rc = vp8_default_zig_zag1d[i]; - r = (rc >> 2); - c = (rc & 3); quant_val = vp8_ac_yquant(Q); - cpi->Y1quant[Q][r][c] = (1 << 16) / quant_val; - cpi->Y1zbin[Q][r][c] = ((qzbin_factors[Q] * quant_val) + 64) >> 7; - cpi->Y1round[Q][r][c] = (qrounding_factors[Q] * quant_val) >> 7; - cpi->common.Y1dequant[Q][r][c] = quant_val; + cpi->Y1quant[Q][rc] = (1 << 16) / quant_val; + cpi->Y1zbin[Q][rc] = ((qzbin_factors[Q] * quant_val) + 64) >> 7; + cpi->Y1round[Q][rc] = (qrounding_factors[Q] * quant_val) >> 7; + cpi->common.Y1dequant[Q][rc] = quant_val; cpi->zrun_zbin_boost_y1[Q][i] = (quant_val * zbin_boost[i]) >> 7; quant_val = vp8_ac2quant(Q, cpi->common.y2ac_delta_q); - cpi->Y2quant[Q][r][c] = (1 << 16) / quant_val; - cpi->Y2zbin[Q][r][c] = ((qzbin_factors_y2[Q] * quant_val) + 64) >> 7; - cpi->Y2round[Q][r][c] = (qrounding_factors_y2[Q] * quant_val) >> 7; - cpi->common.Y2dequant[Q][r][c] = quant_val; + cpi->Y2quant[Q][rc] = (1 << 16) / quant_val; + cpi->Y2zbin[Q][rc] = ((qzbin_factors_y2[Q] * quant_val) + 64) >> 7; + cpi->Y2round[Q][rc] = (qrounding_factors_y2[Q] * quant_val) >> 7; + cpi->common.Y2dequant[Q][rc] = quant_val; cpi->zrun_zbin_boost_y2[Q][i] = (quant_val * zbin_boost[i]) >> 7; quant_val = vp8_ac_uv_quant(Q, cpi->common.uvac_delta_q); - cpi->UVquant[Q][r][c] = (1 << 16) / quant_val; - cpi->UVzbin[Q][r][c] = ((qzbin_factors[Q] * quant_val) + 64) >> 7; - cpi->UVround[Q][r][c] = (qrounding_factors[Q] * quant_val) >> 7; - cpi->common.UVdequant[Q][r][c] = quant_val; + cpi->UVquant[Q][rc] = (1 << 16) / quant_val; + cpi->UVzbin[Q][rc] = ((qzbin_factors[Q] * quant_val) + 64) >> 7; + cpi->UVround[Q][rc] = (qrounding_factors[Q] * quant_val) >> 7; + cpi->common.UVdequant[Q][rc] = quant_val; cpi->zrun_zbin_boost_uv[Q][i] = (quant_val * zbin_boost[i]) >> 7; } } @@ -317,7 +311,7 @@ void vp8cx_mb_init_quantizer(VP8_COMP *cpi, MACROBLOCK *x) QIndex = cpi->common.base_qindex; // Y - zbin_extra = (cpi->common.Y1dequant[QIndex][0][1] * (cpi->zbin_over_quant + cpi->zbin_mode_boost)) >> 7; + zbin_extra = (cpi->common.Y1dequant[QIndex][1] * (cpi->zbin_over_quant + cpi->zbin_mode_boost)) >> 7; for (i = 0; i < 16; i++) { @@ -331,7 +325,7 @@ void vp8cx_mb_init_quantizer(VP8_COMP *cpi, MACROBLOCK *x) } // UV - zbin_extra = (cpi->common.UVdequant[QIndex][0][1] * (cpi->zbin_over_quant + cpi->zbin_mode_boost)) >> 7; + zbin_extra = (cpi->common.UVdequant[QIndex][1] * (cpi->zbin_over_quant + cpi->zbin_mode_boost)) >> 7; for (i = 16; i < 24; i++) { @@ -345,7 +339,7 @@ void vp8cx_mb_init_quantizer(VP8_COMP *cpi, MACROBLOCK *x) } // Y2 - zbin_extra = (cpi->common.Y2dequant[QIndex][0][1] * ((cpi->zbin_over_quant / 2) + cpi->zbin_mode_boost)) >> 7; + zbin_extra = (cpi->common.Y2dequant[QIndex][1] * ((cpi->zbin_over_quant / 2) + cpi->zbin_mode_boost)) >> 7; x->block[24].quant = cpi->Y2quant[QIndex]; x->block[24].quant_shift = cpi->Y2quant_shift[QIndex]; x->block[24].zbin = cpi->Y2zbin[QIndex]; diff --git a/vp8/encoder/encodemb.c b/vp8/encoder/encodemb.c index 782b6fd2d..99ee2b806 100644 --- a/vp8/encoder/encodemb.c +++ b/vp8/encoder/encodemb.c @@ -301,8 +301,8 @@ void vp8_optimize_b(MACROBLOCK *mb, int ib, int type, vp8_strict_quantize_b(b, d); #endif - dequant_ptr = &d->dequant[0][0]; - coeff_ptr = &b->coeff[0]; + dequant_ptr = d->dequant; + coeff_ptr = b->coeff; qcoeff_ptr = d->qcoeff; dqcoeff_ptr = d->dqcoeff; i0 = !type; diff --git a/vp8/encoder/onyx_int.h b/vp8/encoder/onyx_int.h index 51b62c6eb..eb516e927 100644 --- a/vp8/encoder/onyx_int.h +++ b/vp8/encoder/onyx_int.h @@ -232,20 +232,20 @@ typedef struct VP8_ENCODER_RTCD typedef struct { - DECLARE_ALIGNED(16, short, Y1quant[QINDEX_RANGE][4][4]); - DECLARE_ALIGNED(16, short, Y1quant_shift[QINDEX_RANGE][4][4]); - DECLARE_ALIGNED(16, short, Y1zbin[QINDEX_RANGE][4][4]); - DECLARE_ALIGNED(16, short, Y1round[QINDEX_RANGE][4][4]); - - DECLARE_ALIGNED(16, short, Y2quant[QINDEX_RANGE][4][4]); - DECLARE_ALIGNED(16, short, Y2quant_shift[QINDEX_RANGE][4][4]); - DECLARE_ALIGNED(16, short, Y2zbin[QINDEX_RANGE][4][4]); - DECLARE_ALIGNED(16, short, Y2round[QINDEX_RANGE][4][4]); - - DECLARE_ALIGNED(16, short, UVquant[QINDEX_RANGE][4][4]); - DECLARE_ALIGNED(16, short, UVquant_shift[QINDEX_RANGE][4][4]); - DECLARE_ALIGNED(16, short, UVzbin[QINDEX_RANGE][4][4]); - DECLARE_ALIGNED(16, short, UVround[QINDEX_RANGE][4][4]); + DECLARE_ALIGNED(16, short, Y1quant[QINDEX_RANGE][16]); + DECLARE_ALIGNED(16, short, Y1quant_shift[QINDEX_RANGE][16]); + DECLARE_ALIGNED(16, short, Y1zbin[QINDEX_RANGE][16]); + DECLARE_ALIGNED(16, short, Y1round[QINDEX_RANGE][16]); + + DECLARE_ALIGNED(16, short, Y2quant[QINDEX_RANGE][16]); + DECLARE_ALIGNED(16, short, Y2quant_shift[QINDEX_RANGE][16]); + DECLARE_ALIGNED(16, short, Y2zbin[QINDEX_RANGE][16]); + DECLARE_ALIGNED(16, short, Y2round[QINDEX_RANGE][16]); + + DECLARE_ALIGNED(16, short, UVquant[QINDEX_RANGE][16]); + DECLARE_ALIGNED(16, short, UVquant_shift[QINDEX_RANGE][16]); + DECLARE_ALIGNED(16, short, UVzbin[QINDEX_RANGE][16]); + DECLARE_ALIGNED(16, short, UVround[QINDEX_RANGE][16]); DECLARE_ALIGNED(16, short, zrun_zbin_boost_y1[QINDEX_RANGE][16]); DECLARE_ALIGNED(16, short, zrun_zbin_boost_y2[QINDEX_RANGE][16]); diff --git a/vp8/encoder/quantize.c b/vp8/encoder/quantize.c index 6cc224494..5e65fadb3 100644 --- a/vp8/encoder/quantize.c +++ b/vp8/encoder/quantize.c @@ -23,14 +23,14 @@ void vp8_fast_quantize_b_c(BLOCK *b, BLOCKD *d) int i, rc, eob; int zbin; int x, y, z, sz; - short *coeff_ptr = &b->coeff[0]; - short *zbin_ptr = &b->zbin[0][0]; - short *round_ptr = &b->round[0][0]; - short *quant_ptr = &b->quant[0][0]; - short *quant_shift_ptr = &b->quant_shift[0][0]; - short *qcoeff_ptr = d->qcoeff; - short *dqcoeff_ptr = d->dqcoeff; - short *dequant_ptr = &d->dequant[0][0]; + short *coeff_ptr = b->coeff; + short *zbin_ptr = b->zbin; + short *round_ptr = b->round; + short *quant_ptr = b->quant; + short *quant_shift_ptr = b->quant_shift; + short *qcoeff_ptr = d->qcoeff; + short *dqcoeff_ptr = d->dqcoeff; + short *dequant_ptr = d->dequant; vpx_memset(qcoeff_ptr, 0, 32); vpx_memset(dqcoeff_ptr, 0, 32); @@ -69,16 +69,16 @@ void vp8_regular_quantize_b(BLOCK *b, BLOCKD *d) int i, rc, eob; int zbin; int x, y, z, sz; - short *zbin_boost_ptr = &b->zrun_zbin_boost[0]; - short *coeff_ptr = &b->coeff[0]; - short *zbin_ptr = &b->zbin[0][0]; - short *round_ptr = &b->round[0][0]; - short *quant_ptr = &b->quant[0][0]; - short *quant_shift_ptr = &b->quant_shift[0][0]; - short *qcoeff_ptr = d->qcoeff; - short *dqcoeff_ptr = d->dqcoeff; - short *dequant_ptr = &d->dequant[0][0]; - short zbin_oq_value = b->zbin_extra; + short *zbin_boost_ptr = b->zrun_zbin_boost; + short *coeff_ptr = b->coeff; + short *zbin_ptr = b->zbin; + short *round_ptr = b->round; + short *quant_ptr = b->quant; + short *quant_shift_ptr = b->quant_shift; + short *qcoeff_ptr = d->qcoeff; + short *dqcoeff_ptr = d->dqcoeff; + short *dequant_ptr = d->dequant; + short zbin_oq_value = b->zbin_extra; vpx_memset(qcoeff_ptr, 0, 32); vpx_memset(dqcoeff_ptr, 0, 32); @@ -136,12 +136,12 @@ void vp8_strict_quantize_b(BLOCK *b, BLOCKD *d) short *dqcoeff_ptr; short *dequant_ptr; - coeff_ptr = &b->coeff[0]; - quant_ptr = &b->quant[0][0]; - quant_shift_ptr = &b->quant_shift[0][0]; - qcoeff_ptr = d->qcoeff; - dqcoeff_ptr = d->dqcoeff; - dequant_ptr = &d->dequant[0][0]; + coeff_ptr = b->coeff; + quant_ptr = b->quant; + quant_shift_ptr = b->quant_shift; + qcoeff_ptr = d->qcoeff; + dqcoeff_ptr = d->dqcoeff; + dequant_ptr = d->dequant; eob = - 1; vpx_memset(qcoeff_ptr, 0, 32); vpx_memset(dqcoeff_ptr, 0, 32); @@ -183,12 +183,12 @@ void vp8_fast_quantize_b_c(BLOCK *b, BLOCKD *d) int i, rc, eob; int zbin; int x, y, z, sz; - short *coeff_ptr = &b->coeff[0]; - short *round_ptr = &b->round[0][0]; - short *quant_ptr = &b->quant[0][0]; - short *qcoeff_ptr = d->qcoeff; + short *coeff_ptr = b->coeff; + short *round_ptr = b->round; + short *quant_ptr = b->quant; + short *qcoeff_ptr = d->qcoeff; short *dqcoeff_ptr = d->dqcoeff; - short *dequant_ptr = &d->dequant[0][0]; + short *dequant_ptr = d->dequant; eob = -1; for (i = 0; i < 16; i++) @@ -217,15 +217,15 @@ void vp8_regular_quantize_b(BLOCK *b, BLOCKD *d) int i, rc, eob; int zbin; int x, y, z, sz; - short *zbin_boost_ptr = &b->zrun_zbin_boost[0]; - short *coeff_ptr = &b->coeff[0]; - short *zbin_ptr = &b->zbin[0][0]; - short *round_ptr = &b->round[0][0]; - short *quant_ptr = &b->quant[0][0]; - short *qcoeff_ptr = d->qcoeff; - short *dqcoeff_ptr = d->dqcoeff; - short *dequant_ptr = &d->dequant[0][0]; - short zbin_oq_value = b->zbin_extra; + short *zbin_boost_ptr = b->zrun_zbin_boost; + short *coeff_ptr = b->coeff; + short *zbin_ptr = b->zbin; + short *round_ptr = b->round; + short *quant_ptr = b->quant; + short *qcoeff_ptr = d->qcoeff; + short *dqcoeff_ptr = d->dqcoeff; + short *dequant_ptr = d->dequant; + short zbin_oq_value = b->zbin_extra; vpx_memset(qcoeff_ptr, 0, 32); vpx_memset(dqcoeff_ptr, 0, 32); diff --git a/vp8/encoder/x86/x86_csystemdependent.c b/vp8/encoder/x86/x86_csystemdependent.c index b4035ff53..3e5a8abf9 100644 --- a/vp8/encoder/x86/x86_csystemdependent.c +++ b/vp8/encoder/x86/x86_csystemdependent.c @@ -29,14 +29,14 @@ int vp8_fast_quantize_b_impl_mmx(short *coeff_ptr, short *zbin_ptr, short *quant_ptr, short *dqcoeff_ptr); void vp8_fast_quantize_b_mmx(BLOCK *b, BLOCKD *d) { - short *scan_mask = vp8_default_zig_zag_mask;//d->scan_order_mask_ptr; - short *coeff_ptr = &b->coeff[0]; - short *zbin_ptr = &b->zbin[0][0]; - short *round_ptr = &b->round[0][0]; - short *quant_ptr = &b->quant[0][0]; - short *qcoeff_ptr = d->qcoeff; + short *scan_mask = vp8_default_zig_zag_mask;//d->scan_order_mask_ptr; + short *coeff_ptr = b->coeff; + short *zbin_ptr = b->zbin; + short *round_ptr = b->round; + short *quant_ptr = b->quant; + short *qcoeff_ptr = d->qcoeff; short *dqcoeff_ptr = d->dqcoeff; - short *dequant_ptr = &d->dequant[0][0]; + short *dequant_ptr = d->dequant; d->eob = vp8_fast_quantize_b_impl_mmx( coeff_ptr, @@ -94,13 +94,13 @@ int vp8_fast_quantize_b_impl_sse2(short *coeff_ptr, short *quant_ptr, short *dqcoeff_ptr); void vp8_fast_quantize_b_sse2(BLOCK *b, BLOCKD *d) { - short *scan_mask = vp8_default_zig_zag_mask;//d->scan_order_mask_ptr; - short *coeff_ptr = &b->coeff[0]; - short *round_ptr = &b->round[0][0]; - short *quant_ptr = &b->quant[0][0]; - short *qcoeff_ptr = d->qcoeff; + short *scan_mask = vp8_default_zig_zag_mask;//d->scan_order_mask_ptr; + short *coeff_ptr = b->coeff; + short *round_ptr = b->round; + short *quant_ptr = b->quant; + short *qcoeff_ptr = d->qcoeff; short *dqcoeff_ptr = d->dqcoeff; - short *dequant_ptr = &d->dequant[0][0]; + short *dequant_ptr = d->dequant; d->eob = vp8_fast_quantize_b_impl_sse2( coeff_ptr, @@ -124,15 +124,15 @@ int vp8_regular_quantize_b_impl_sse2(short *coeff_ptr, short *zbin_ptr, void vp8_regular_quantize_b_sse2(BLOCK *b,BLOCKD *d) { - short *zbin_boost_ptr = &b->zrun_zbin_boost[0]; - short *coeff_ptr = &b->coeff[0]; - short *zbin_ptr = &b->zbin[0][0]; - short *round_ptr = &b->round[0][0]; - short *quant_ptr = &b->quant[0][0]; - short *qcoeff_ptr = d->qcoeff; - short *dqcoeff_ptr = d->dqcoeff; - short *dequant_ptr = &d->dequant[0][0]; - short zbin_oq_value = b->zbin_extra; + short *zbin_boost_ptr = b->zrun_zbin_boost; + short *coeff_ptr = b->coeff; + short *zbin_ptr = b->zbin; + short *round_ptr = b->round; + short *quant_ptr = b->quant; + short *qcoeff_ptr = d->qcoeff; + short *dqcoeff_ptr = d->dqcoeff; + short *dequant_ptr = d->dequant; + short zbin_oq_value = b->zbin_extra; d->eob = vp8_regular_quantize_b_impl_sse2( coeff_ptr, -- 2.40.0