ref: 41bb11cf7e51c8fa471578817f41aa8f0ea2a406
parent: 9b5ab487b505e289ceef40bc9e71b944503b91a4
parent: 6234256646fe5f02defdc57a48bb8a81a7d4a6d6
author: Angie Chiang <angiebird@google.com>
date: Wed Nov 21 17:55:51 EST 2018
Merge changes I02279405,I87e1c3f0,Id70235c8,I62602aa4,I5722d262 * changes: Fix scan_build warnings in tiny_ssim.c Fix scan_build warnings in convolve_test.cc Fix scan_build warnings in vp9_loopfilter.c Fix scan_build warnings in variance_test.cc Fix scan_build warnings in vp9_resize.c
--- a/test/convolve_test.cc
+++ b/test/convolve_test.cc
@@ -214,6 +214,8 @@
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;
--- a/test/variance_test.cc
+++ b/test/variance_test.cc
@@ -561,7 +561,8 @@
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 *>(
@@ -568,8 +569,8 @@
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 @@
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
}
--- a/tools/tiny_ssim.c
+++ b/tools/tiny_ssim.c
@@ -34,6 +34,10 @@
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 @@
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 @@
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];
--- a/vp9/common/vp9_loopfilter.c
+++ b/vp9/common/vp9_loopfilter.c
@@ -1087,13 +1087,19 @@
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;
@@ -1329,6 +1335,8 @@
uint16_t mask_8x8 = lfm->left_uv[TX_8X8];
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);
--- a/vp9/encoder/vp9_resize.c
+++ b/vp9/encoder/vp9_resize.c
@@ -424,11 +424,11 @@
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);