ref: 41071cadec1ad24d3c37ce3a81b5ec36801bec2e
parent: 1e58bdb41d886be6246f85913b2cd5ec6aae57bd
parent: cf6a57692058dc3f1b15668ab613970ed376d2b3
author: Angie Chiang <angiebird@google.com>
date: Tue Nov 20 13:02:46 EST 2018
Merge changes I9b5f8b08,Ic90b09e5,Ib2380aaf,I3ad3af49,Ib5d1a411 * changes: Fix scan_build_warnings in comp_avg_pred_test.cc Fix scan_build warnings in convolve_test.cc Fix scan_build warnings in idct_test.cc Fix scan_build warnings in tiny_ssim.c Fix scan_build warning in dct_partial_test.cc
--- a/test/comp_avg_pred_test.cc
+++ b/test/comp_avg_pred_test.cc
@@ -29,6 +29,11 @@
void reference_pred(const Buffer<uint8_t> &pred, const Buffer<uint8_t> &ref,
int width, int height, Buffer<uint8_t> *avg) {+ if (avg->TopLeftPixel() == NULL || pred.TopLeftPixel() == NULL ||
+ ref.TopLeftPixel() == NULL) {+ assert(0);
+ return;
+ }
for (int y = 0; y < height; ++y) { for (int x = 0; x < width; ++x) {avg->TopLeftPixel()[y * avg->stride() + x] =
--- a/test/convolve_test.cc
+++ b/test/convolve_test.cc
@@ -114,6 +114,7 @@
// and filter_max_width = 16
//
uint8_t intermediate_buffer[71 * kMaxDimension];
+ vp9_zero(intermediate_buffer);
const int intermediate_next_stride =
1 - static_cast<int>(intermediate_height * output_width);
--- a/test/dct_partial_test.cc
+++ b/test/dct_partial_test.cc
@@ -39,10 +39,14 @@
tran_low_t partial_fdct_ref(const Buffer<int16_t> &in, int size) {int64_t sum = 0;
- for (int y = 0; y < size; ++y) {- for (int x = 0; x < size; ++x) {- sum += in.TopLeftPixel()[y * in.stride() + x];
+ if (in.TopLeftPixel() != NULL) {+ for (int y = 0; y < size; ++y) {+ for (int x = 0; x < size; ++x) {+ sum += in.TopLeftPixel()[y * in.stride() + x];
+ }
}
+ } else {+ assert(0);
}
switch (size) {@@ -77,21 +81,25 @@
Buffer<tran_low_t> output_block = Buffer<tran_low_t>(size_, size_, 0, 16);
ASSERT_TRUE(output_block.Init());
- for (int i = 0; i < 100; ++i) {- if (i == 0) {- input_block.Set(maxvalue);
- } else if (i == 1) {- input_block.Set(minvalue);
- } else {- input_block.Set(&rnd, minvalue, maxvalue);
- }
+ if (output_block.TopLeftPixel() != NULL) {+ for (int i = 0; i < 100; ++i) {+ if (i == 0) {+ input_block.Set(maxvalue);
+ } else if (i == 1) {+ input_block.Set(minvalue);
+ } else {+ input_block.Set(&rnd, minvalue, maxvalue);
+ }
- ASM_REGISTER_STATE_CHECK(fwd_txfm_(input_block.TopLeftPixel(),
- output_block.TopLeftPixel(),
- input_block.stride()));
+ ASM_REGISTER_STATE_CHECK(fwd_txfm_(input_block.TopLeftPixel(),
+ output_block.TopLeftPixel(),
+ input_block.stride()));
- EXPECT_EQ(partial_fdct_ref(input_block, size_),
- output_block.TopLeftPixel()[0]);
+ EXPECT_EQ(partial_fdct_ref(input_block, size_),
+ output_block.TopLeftPixel()[0]);
+ }
+ } else {+ assert(0);
}
}
--- a/test/idct_test.cc
+++ b/test/idct_test.cc
@@ -72,17 +72,21 @@
TEST_P(IDCTTest, TestAllOnes) {input->Set(0);
- // When the first element is '4' it will fill the output buffer with '1'.
- input->TopLeftPixel()[0] = 4;
- predict->Set(0);
- output->Set(0);
+ if (input->TopLeftPixel() != NULL) {+ // When the first element is '4' it will fill the output buffer with '1'.
+ input->TopLeftPixel()[0] = 4;
+ predict->Set(0);
+ output->Set(0);
- ASM_REGISTER_STATE_CHECK(UUT(input->TopLeftPixel(), predict->TopLeftPixel(),
- predict->stride(), output->TopLeftPixel(),
- output->stride()));
+ ASM_REGISTER_STATE_CHECK(UUT(input->TopLeftPixel(), predict->TopLeftPixel(),
+ predict->stride(), output->TopLeftPixel(),
+ output->stride()));
- ASSERT_TRUE(output->CheckValues(1));
- ASSERT_TRUE(output->CheckPadding());
+ ASSERT_TRUE(output->CheckValues(1));
+ ASSERT_TRUE(output->CheckPadding());
+ } else {+ assert(0);
+ }
}
TEST_P(IDCTTest, TestAddOne) {@@ -89,32 +93,36 @@
// Set the transform output to '1' and make sure it gets added to the
// prediction buffer.
input->Set(0);
- input->TopLeftPixel()[0] = 4;
- output->Set(0);
+ if (input->TopLeftPixel() != NULL) {+ input->TopLeftPixel()[0] = 4;
+ output->Set(0);
- uint8_t *pred = predict->TopLeftPixel();
- for (int y = 0; y < 4; ++y) {- for (int x = 0; x < 4; ++x) {- pred[y * predict->stride() + x] = y * 4 + x;
+ uint8_t *pred = predict->TopLeftPixel();
+ for (int y = 0; y < 4; ++y) {+ for (int x = 0; x < 4; ++x) {+ pred[y * predict->stride() + x] = y * 4 + x;
+ }
}
- }
- ASM_REGISTER_STATE_CHECK(UUT(input->TopLeftPixel(), predict->TopLeftPixel(),
- predict->stride(), output->TopLeftPixel(),
- output->stride()));
+ ASM_REGISTER_STATE_CHECK(UUT(input->TopLeftPixel(), predict->TopLeftPixel(),
+ predict->stride(), output->TopLeftPixel(),
+ output->stride()));
- uint8_t const *out = output->TopLeftPixel();
- for (int y = 0; y < 4; ++y) {- for (int x = 0; x < 4; ++x) {- EXPECT_EQ(1 + y * 4 + x, out[y * output->stride() + x]);
+ uint8_t const *out = output->TopLeftPixel();
+ for (int y = 0; y < 4; ++y) {+ for (int x = 0; x < 4; ++x) {+ EXPECT_EQ(1 + y * 4 + x, out[y * output->stride() + x]);
+ }
}
- }
- if (HasFailure()) {- output->DumpBuffer();
- }
+ if (HasFailure()) {+ output->DumpBuffer();
+ }
- ASSERT_TRUE(output->CheckPadding());
+ ASSERT_TRUE(output->CheckPadding());
+ } else {+ assert(0);
+ }
}
TEST_P(IDCTTest, TestWithData) {--- a/tools/tiny_ssim.c
+++ b/tools/tiny_ssim.c
@@ -53,6 +53,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++) {@@ -99,6 +103,9 @@
int h, int bit_depth) {char y4m_buf[4];
size_t r1;
+ input->w = w;
+ input->h = h;
+ input->bit_depth = bit_depth;
input->type = RAW_YUV;
input->buf = NULL;
input->file = strcmp(file_name, "-") ? fopen(file_name, "rb") : stdin;
@@ -187,6 +194,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 || 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];
--
⑨