shithub: libvpx

Download patch

ref: ba003455ab92894b8041eeee0f1e89bea3c1a0c7
parent: aae6c9317307cd6ab4d8119e84c5fce3be3f54c4
parent: ab5c8ff8a016153f9a6c03a9c0367a7910dbbc20
author: Angie Chiang <[email protected]>
date: Wed Nov 21 13:06:17 EST 2018

Merge changes Id47930b4,I4f423630,I277c159b

* changes:
  Replace assert by ASSERT_TRUE
  Fix scan_build warnings in temporal_filter_test.cc
  Fix scan_build warnings in dct_test.cc

--- a/test/comp_avg_pred_test.cc
+++ b/test/comp_avg_pred_test.cc
@@ -29,11 +29,10 @@
 
 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;
-  }
+  ASSERT_TRUE(avg->TopLeftPixel() != NULL);
+  ASSERT_TRUE(pred.TopLeftPixel() != NULL);
+  ASSERT_TRUE(ref.TopLeftPixel() != NULL);
+
   for (int y = 0; y < height; ++y) {
     for (int x = 0; x < width; ++x) {
       avg->TopLeftPixel()[y * avg->stride() + x] =
--- a/test/dct_test.cc
+++ b/test/dct_test.cc
@@ -210,6 +210,7 @@
     Buffer<int16_t> test_input_block =
         Buffer<int16_t>(size_, size_, 8, size_ == 4 ? 0 : 16);
     ASSERT_TRUE(test_input_block.Init());
+    ASSERT_TRUE(test_input_block.TopLeftPixel() != NULL);
     Buffer<tran_low_t> test_temp_block =
         Buffer<tran_low_t>(size_, size_, 0, 16);
     ASSERT_TRUE(test_temp_block.Init());
@@ -314,6 +315,7 @@
       } else if (i == 1) {
         input_extreme_block.Set(-max_pixel_value_);
       } else {
+        ASSERT_TRUE(input_extreme_block.TopLeftPixel() != NULL);
         for (int h = 0; h < size_; ++h) {
           for (int w = 0; w < size_; ++w) {
             input_extreme_block
@@ -328,6 +330,7 @@
 
       // The minimum quant value is 4.
       EXPECT_TRUE(output_block.CheckValues(output_ref_block));
+      ASSERT_TRUE(output_block.TopLeftPixel() != NULL);
       for (int h = 0; h < size_; ++h) {
         for (int w = 0; w < size_; ++w) {
           EXPECT_GE(
@@ -365,6 +368,7 @@
 
     for (int i = 0; i < count_test_block; ++i) {
       InitMem();
+      ASSERT_TRUE(in.TopLeftPixel() != NULL);
       // Initialize a test block with input range [-max_pixel_value_,
       // max_pixel_value_].
       for (int h = 0; h < size_; ++h) {
--- a/test/idct_test.cc
+++ b/test/idct_test.cc
@@ -72,21 +72,18 @@
 
 TEST_P(IDCTTest, TestAllOnes) {
   input->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);
+  ASSERT_TRUE(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());
-  } else {
-    assert(0);
-  }
+  ASSERT_TRUE(output->CheckValues(1));
+  ASSERT_TRUE(output->CheckPadding());
 }
 
 TEST_P(IDCTTest, TestAddOne) {
@@ -93,36 +90,33 @@
   // Set the transform output to '1' and make sure it gets added to the
   // prediction buffer.
   input->Set(0);
-  if (input->TopLeftPixel() != NULL) {
-    input->TopLeftPixel()[0] = 4;
-    output->Set(0);
+  ASSERT_TRUE(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();
-    }
-
-    ASSERT_TRUE(output->CheckPadding());
-  } else {
-    assert(0);
+  if (HasFailure()) {
+    output->DumpBuffer();
   }
+
+  ASSERT_TRUE(output->CheckPadding());
 }
 
 TEST_P(IDCTTest, TestWithData) {
--- a/test/temporal_filter_test.cc
+++ b/test/temporal_filter_test.cc
@@ -45,6 +45,9 @@
     rounding = 1 << (filter_strength - 1);
   }
 
+  ASSERT_TRUE(a.TopLeftPixel() != NULL);
+  ASSERT_TRUE(b.TopLeftPixel() != NULL);
+  ASSERT_TRUE(diff_sq.TopLeftPixel() != NULL);
   // Calculate all the differences. Avoids re-calculating a bunch of extra
   // values.
   for (int height = 0; height < h; ++height) {