]> granicus.if.org Git - libvpx/blobdiff - test/vp8_denoiser_sse2_test.cc
Merge changes from topic 'wextra'
[libvpx] / test / vp8_denoiser_sse2_test.cc
index d04a5051dbc8502e177f402194686bdd36c6c7fc..2cbcf041498708bd9e6357a561e7b3a17c7ce8b4 100644 (file)
@@ -28,19 +28,16 @@ using libvpx_test::ACMRandom;
 namespace {
 
 const int kNumPixels = 16 * 16;
-class VP8DenoiserTest
-    : public ::testing::TestWithParam<int> {
+class VP8DenoiserTest : public ::testing::TestWithParam<int> {
  public:
   virtual ~VP8DenoiserTest() {}
 
-  virtual void SetUp() {
-    increase_denoising = GetParam();
-  }
+  virtual void SetUp() { increase_denoising_ = GetParam(); }
 
   virtual void TearDown() { libvpx_test::ClearSystemState(); }
 
  protected:
-  int increase_denoising;
+  int increase_denoising_;
 };
 
 TEST_P(VP8DenoiserTest, BitexactCheck) {
@@ -53,18 +50,18 @@ TEST_P(VP8DenoiserTest, BitexactCheck) {
   // mc_avg_block is the denoised reference block,
   // avg_block_c is the denoised result from C code,
   // avg_block_sse2 is the denoised result from SSE2 code.
-  DECLARE_ALIGNED_ARRAY(16, uint8_t, sig_block_c, kNumPixels);
+  DECLARE_ALIGNED(16, uint8_t, sig_block_c[kNumPixels]);
   // Since in VP8 denoiser, the source signal will be changed,
   // we need another copy of the source signal as the input of sse2 code.
-  DECLARE_ALIGNED_ARRAY(16, uint8_t, sig_block_sse2, kNumPixels);
-  DECLARE_ALIGNED_ARRAY(16, uint8_t, mc_avg_block, kNumPixels);
-  DECLARE_ALIGNED_ARRAY(16, uint8_t, avg_block_c, kNumPixels);
-  DECLARE_ALIGNED_ARRAY(16, uint8_t, avg_block_sse2, kNumPixels);
+  DECLARE_ALIGNED(16, uint8_t, sig_block_sse2[kNumPixels]);
+  DECLARE_ALIGNED(16, uint8_t, mc_avg_block[kNumPixels]);
+  DECLARE_ALIGNED(16, uint8_t, avg_block_c[kNumPixels]);
+  DECLARE_ALIGNED(16, uint8_t, avg_block_sse2[kNumPixels]);
 
   for (int i = 0; i < count_test_block; ++i) {
     // Generate random motion magnitude, 20% of which exceed the threshold.
-    uint8_t motion_magnitude_random
-              = rnd.Rand8() % (uint8_t)(MOTION_MAGNITUDE_THRESHOLD * 1.2);
+    const int motion_magnitude_ran =
+        rnd.Rand8() % static_cast<int>(MOTION_MAGNITUDE_THRESHOLD * 1.2);
 
     // Initialize a test block with random number in range [0, 255].
     for (int j = 0; j < kNumPixels; ++j) {
@@ -72,20 +69,20 @@ TEST_P(VP8DenoiserTest, BitexactCheck) {
       sig_block_sse2[j] = sig_block_c[j] = rnd.Rand8();
       // The pixels in mc_avg_block are generated by adding a random
       // number in range [-19, 19] to corresponding pixels in sig_block.
-      temp = sig_block_c[j] + (rnd.Rand8() % 2 == 0? -1 : 1) *
-             (rnd.Rand8()%20);
+      temp =
+          sig_block_c[j] + (rnd.Rand8() % 2 == 0 ? -1 : 1) * (rnd.Rand8() % 20);
       // Clip.
-      mc_avg_block[j] = (temp < 0? 0 : (temp > 255? 255 : temp));
+      mc_avg_block[j] = (temp < 0) ? 0 : ((temp > 255) ? 255 : temp);
     }
 
     // Test denosiser on Y component.
-    ASM_REGISTER_STATE_CHECK(vp8_denoiser_filter_c(mc_avg_block, stride,
-                               avg_block_c, stride, sig_block_c, stride,
-                               motion_magnitude_random, increase_denoising));
+    ASM_REGISTER_STATE_CHECK(vp8_denoiser_filter_c(
+        mc_avg_block, stride, avg_block_c, stride, sig_block_c, stride,
+        motion_magnitude_ran, increase_denoising_));
 
-    ASM_REGISTER_STATE_CHECK(vp8_denoiser_filter_sse2(mc_avg_block, stride,
-                               avg_block_sse2, stride, sig_block_sse2, stride,
-                               motion_magnitude_random, increase_denoising));
+    ASM_REGISTER_STATE_CHECK(vp8_denoiser_filter_sse2(
+        mc_avg_block, stride, avg_block_sse2, stride, sig_block_sse2, stride,
+        motion_magnitude_ran, increase_denoising_));
 
     // Check bitexactness.
     for (int h = 0; h < 16; ++h) {
@@ -94,14 +91,14 @@ TEST_P(VP8DenoiserTest, BitexactCheck) {
       }
     }
 
-    // Test denosiser on UV component.
-    ASM_REGISTER_STATE_CHECK(vp8_denoiser_filter_uv_c(mc_avg_block, stride,
-                               avg_block_c, stride, sig_block_c, stride,
-                               motion_magnitude_random, increase_denoising));
+    // Test denoiser on UV component.
+    ASM_REGISTER_STATE_CHECK(vp8_denoiser_filter_uv_c(
+        mc_avg_block, stride, avg_block_c, stride, sig_block_c, stride,
+        motion_magnitude_ran, increase_denoising_));
 
-    ASM_REGISTER_STATE_CHECK(vp8_denoiser_filter_uv_sse2(mc_avg_block, stride,
-                               avg_block_sse2, stride, sig_block_sse2, stride,
-                               motion_magnitude_random, increase_denoising));
+    ASM_REGISTER_STATE_CHECK(vp8_denoiser_filter_uv_sse2(
+        mc_avg_block, stride, avg_block_sse2, stride, sig_block_sse2, stride,
+        motion_magnitude_ran, increase_denoising_));
 
     // Check bitexactness.
     for (int h = 0; h < 16; ++h) {
@@ -113,7 +110,5 @@ TEST_P(VP8DenoiserTest, BitexactCheck) {
 }
 
 // Test for all block size.
-INSTANTIATE_TEST_CASE_P(
-    SSE2, VP8DenoiserTest,
-    ::testing::Values(0, 1));
+INSTANTIATE_TEST_CASE_P(SSE2, VP8DenoiserTest, ::testing::Values(0, 1));
 }  // namespace