From 3cddd81c6d7c0f11114cf73f25f3fadb3e46a59d Mon Sep 17 00:00:00 2001 From: Jingning Han Date: Thu, 10 Jul 2014 10:55:44 -0700 Subject: Fix chrome valgrind warning due to the use of mismatched bsize This commit fixes a mismatched use case of block size in non-RD intra prediction check. The residual SSE and variance should be calculated per transform block size, instead of operating block size, which caused chrome valgrind warning on conditional jump based on uninitialized value (webm issue 823). This commit resolves this issue. Change-Id: I595c06599c7e0fd0e4a08736519ba68fc14bc79a --- vp9/common/vp9_common_data.c | 7 +++++++ vp9/common/vp9_common_data.h | 1 + vp9/encoder/vp9_pickmode.c | 3 ++- 3 files changed, 10 insertions(+), 1 deletion(-) (limited to 'vp9') diff --git a/vp9/common/vp9_common_data.c b/vp9/common/vp9_common_data.c index a927823e0..d4c1b7124 100644 --- a/vp9/common/vp9_common_data.c +++ b/vp9/common/vp9_common_data.c @@ -107,6 +107,13 @@ const TX_SIZE max_txsize_lookup[BLOCK_SIZES] = { TX_32X32, TX_32X32, TX_32X32, TX_32X32 }; +const BLOCK_SIZE txsize_to_bsize[TX_SIZES] = { + BLOCK_4X4, // TX_4X4 + BLOCK_8X8, // TX_8X8 + BLOCK_16X16, // TX_16X16 + BLOCK_32X32, // TX_32X32 +}; + const TX_SIZE tx_mode_to_biggest_tx_size[TX_MODES] = { TX_4X4, // ONLY_4X4 TX_8X8, // ALLOW_8X8 diff --git a/vp9/common/vp9_common_data.h b/vp9/common/vp9_common_data.h index f41962747..a06c9bed8 100644 --- a/vp9/common/vp9_common_data.h +++ b/vp9/common/vp9_common_data.h @@ -29,6 +29,7 @@ extern const int num_pels_log2_lookup[BLOCK_SIZES]; extern const PARTITION_TYPE partition_lookup[][BLOCK_SIZES]; extern const BLOCK_SIZE subsize_lookup[PARTITION_TYPES][BLOCK_SIZES]; extern const TX_SIZE max_txsize_lookup[BLOCK_SIZES]; +extern const BLOCK_SIZE txsize_to_bsize[TX_SIZES]; extern const TX_SIZE tx_mode_to_biggest_tx_size[TX_MODES]; extern const BLOCK_SIZE ss_size_lookup[BLOCK_SIZES][2][2]; diff --git a/vp9/encoder/vp9_pickmode.c b/vp9/encoder/vp9_pickmode.c index c915e5c07..31e6fcb8d 100644 --- a/vp9/encoder/vp9_pickmode.c +++ b/vp9/encoder/vp9_pickmode.c @@ -681,6 +681,7 @@ int64_t vp9_pick_inter_mode(VP9_COMP *cpi, MACROBLOCK *x, int i, j; const int width = num_4x4_blocks_wide_lookup[bsize]; const int height = num_4x4_blocks_high_lookup[bsize]; + const BLOCK_SIZE bsize_tx = txsize_to_bsize[mbmi->tx_size]; int rate2 = 0; int64_t dist2 = 0; @@ -706,7 +707,7 @@ int64_t vp9_pick_inter_mode(VP9_COMP *cpi, MACROBLOCK *x, src_stride, &pd->dst.buf[4 * (j * dst_stride + i)], dst_stride, i, j, 0); - model_rd_for_sb_y(cpi, bsize, x, xd, &rate, &dist, &var_y, &sse_y); + model_rd_for_sb_y(cpi, bsize_tx, x, xd, &rate, &dist, &var_y, &sse_y); rate2 += rate; dist2 += dist; ++block_idx; -- cgit v1.2.3