diff options
-rw-r--r-- | test/convolve_test.cc | 2 | ||||
-rw-r--r-- | test/variance_test.cc | 11 | ||||
-rw-r--r-- | tools/tiny_ssim.c | 11 | ||||
-rw-r--r-- | vp9/common/vp9_loopfilter.c | 16 | ||||
-rw-r--r-- | vp9/encoder/vp9_resize.c | 8 |
5 files changed, 34 insertions, 14 deletions
diff --git a/test/convolve_test.cc b/test/convolve_test.cc index 29a040abc..0b718a511 100644 --- a/test/convolve_test.cc +++ b/test/convolve_test.cc @@ -214,6 +214,8 @@ void highbd_filter_block2d_8_c(const uint16_t *src_ptr, const int intermediate_next_stride = 1 - static_cast<int>(intermediate_height * output_width); + vp9_zero(intermediate_buffer); + // Horizontal pass (src -> transposed intermediate). { uint16_t *output_ptr = intermediate_buffer; diff --git a/test/variance_test.cc b/test/variance_test.cc index fce7a1475..e9fa03c68 100644 --- a/test/variance_test.cc +++ b/test/variance_test.cc @@ -561,15 +561,16 @@ class SubpelVarianceTest if (!use_high_bit_depth()) { src_ = reinterpret_cast<uint8_t *>(vpx_memalign(16, block_size())); sec_ = reinterpret_cast<uint8_t *>(vpx_memalign(16, block_size())); - ref_ = new uint8_t[block_size() + width() + height() + 1]; + ref_ = reinterpret_cast<uint8_t *>( + vpx_malloc(block_size() + width() + height() + 1)); #if CONFIG_VP9_HIGHBITDEPTH } else { src_ = CONVERT_TO_BYTEPTR(reinterpret_cast<uint16_t *>( vpx_memalign(16, block_size() * sizeof(uint16_t)))); sec_ = CONVERT_TO_BYTEPTR(reinterpret_cast<uint16_t *>( vpx_memalign(16, block_size() * sizeof(uint16_t)))); - ref_ = CONVERT_TO_BYTEPTR( - new uint16_t[block_size() + width() + height() + 1]); + ref_ = CONVERT_TO_BYTEPTR(reinterpret_cast<uint16_t *>(vpx_malloc( + (block_size() + width() + height() + 1) * sizeof(uint16_t)))); #endif // CONFIG_VP9_HIGHBITDEPTH } ASSERT_TRUE(src_ != NULL); @@ -580,12 +581,12 @@ class SubpelVarianceTest virtual void TearDown() { if (!use_high_bit_depth()) { vpx_free(src_); - delete[] ref_; vpx_free(sec_); + vpx_free(ref_); #if CONFIG_VP9_HIGHBITDEPTH } else { vpx_free(CONVERT_TO_SHORTPTR(src_)); - delete[] CONVERT_TO_SHORTPTR(ref_); + vpx_free(CONVERT_TO_SHORTPTR(ref_)); vpx_free(CONVERT_TO_SHORTPTR(sec_)); #endif // CONFIG_VP9_HIGHBITDEPTH } diff --git a/tools/tiny_ssim.c b/tools/tiny_ssim.c index 75ef569ce..36961b355 100644 --- a/tools/tiny_ssim.c +++ b/tools/tiny_ssim.c @@ -34,6 +34,10 @@ static uint64_t calc_plane_error16(uint16_t *orig, int orig_stride, unsigned int row, col; uint64_t total_sse = 0; int diff; + if (orig == NULL || recon == NULL) { + assert(0); + return 0; + } for (row = 0; row < rows; row++) { for (col = 0; col < cols; col++) { @@ -195,7 +199,7 @@ void ssim_parms_8x8(const uint8_t *s, int sp, const uint8_t *r, int rp, uint32_t *sum_sq_r, uint32_t *sum_sxr) { int i, j; if (s == NULL || r == NULL || sum_s == NULL || sum_r == NULL || - sum_sq_s == NULL || sum_sq_r || sum_sxr == NULL) { + sum_sq_s == NULL || sum_sq_r == NULL || sum_sxr == NULL) { assert(0); return; } @@ -214,6 +218,11 @@ void highbd_ssim_parms_8x8(const uint16_t *s, int sp, const uint16_t *r, int rp, uint32_t *sum_s, uint32_t *sum_r, uint32_t *sum_sq_s, uint32_t *sum_sq_r, uint32_t *sum_sxr) { int i, j; + if (s == NULL || r == NULL || sum_s == NULL || sum_r == NULL || + sum_sq_s == NULL || sum_sq_r == NULL || sum_sxr == NULL) { + assert(0); + return; + } for (i = 0; i < 8; i++, s += sp, r += rp) { for (j = 0; j < 8; j++) { *sum_s += s[j]; diff --git a/vp9/common/vp9_loopfilter.c b/vp9/common/vp9_loopfilter.c index 04a93f3b9..95d6029f3 100644 --- a/vp9/common/vp9_loopfilter.c +++ b/vp9/common/vp9_loopfilter.c @@ -1087,13 +1087,19 @@ void vp9_filter_block_plane_non420(VP9_COMMON *cm, const int row_step_stride = cm->mi_stride * row_step; struct buf_2d *const dst = &plane->dst; uint8_t *const dst0 = dst->buf; - unsigned int mask_16x16[MI_BLOCK_SIZE] = { 0 }; - unsigned int mask_8x8[MI_BLOCK_SIZE] = { 0 }; - unsigned int mask_4x4[MI_BLOCK_SIZE] = { 0 }; - unsigned int mask_4x4_int[MI_BLOCK_SIZE] = { 0 }; + unsigned int mask_16x16[MI_BLOCK_SIZE]; + unsigned int mask_8x8[MI_BLOCK_SIZE]; + unsigned int mask_4x4[MI_BLOCK_SIZE]; + unsigned int mask_4x4_int[MI_BLOCK_SIZE]; uint8_t lfl[MI_BLOCK_SIZE * MI_BLOCK_SIZE]; int r, c; + vp9_zero(mask_16x16); + vp9_zero(mask_8x8); + vp9_zero(mask_4x4); + vp9_zero(mask_4x4_int); + vp9_zero(lfl); + for (r = 0; r < MI_BLOCK_SIZE && mi_row + r < cm->mi_rows; r += row_step) { unsigned int mask_16x16_c = 0; unsigned int mask_8x8_c = 0; @@ -1330,6 +1336,8 @@ void vp9_filter_block_plane_ss11(VP9_COMMON *const cm, uint16_t mask_4x4 = lfm->left_uv[TX_4X4]; uint16_t mask_4x4_int = lfm->int_4x4_uv; + vp9_zero(lfl_uv); + assert(plane->subsampling_x == 1 && plane->subsampling_y == 1); // Vertical pass: do 2 rows at one time diff --git a/vp9/encoder/vp9_resize.c b/vp9/encoder/vp9_resize.c index 6ac77aeef..23a320ae5 100644 --- a/vp9/encoder/vp9_resize.c +++ b/vp9/encoder/vp9_resize.c @@ -424,11 +424,11 @@ void vp9_resize_plane(const uint8_t *const input, int height, int width, int in_stride, uint8_t *output, int height2, int width2, int out_stride) { int i; - uint8_t *intbuf = (uint8_t *)malloc(sizeof(uint8_t) * width2 * height); + uint8_t *intbuf = (uint8_t *)calloc(width2 * height, sizeof(*intbuf)); uint8_t *tmpbuf = - (uint8_t *)malloc(sizeof(uint8_t) * (width < height ? height : width)); - uint8_t *arrbuf = (uint8_t *)malloc(sizeof(uint8_t) * height); - uint8_t *arrbuf2 = (uint8_t *)malloc(sizeof(uint8_t) * height2); + (uint8_t *)calloc(width < height ? height : width, sizeof(*tmpbuf)); + uint8_t *arrbuf = (uint8_t *)calloc(height, sizeof(*arrbuf)); + uint8_t *arrbuf2 = (uint8_t *)calloc(height2, sizeof(*arrbuf2)); if (intbuf == NULL || tmpbuf == NULL || arrbuf == NULL || arrbuf2 == NULL) goto Error; assert(width > 0); |