| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (c) 2014 The WebM project authors. All Rights Reserved. | 2 * Copyright (c) 2014 The WebM project authors. All Rights Reserved. |
| 3 * | 3 * |
| 4 * Use of this source code is governed by a BSD-style license | 4 * Use of this source code is governed by a BSD-style license |
| 5 * that can be found in the LICENSE file in the root of the source | 5 * that can be found in the LICENSE file in the root of the source |
| 6 * tree. An additional intellectual property rights grant can be found | 6 * tree. An additional intellectual property rights grant can be found |
| 7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
| 8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
| 9 */ | 9 */ |
| 10 | 10 |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 45 TEST_P(VP8DenoiserTest, BitexactCheck) { | 45 TEST_P(VP8DenoiserTest, BitexactCheck) { |
| 46 ACMRandom rnd(ACMRandom::DeterministicSeed()); | 46 ACMRandom rnd(ACMRandom::DeterministicSeed()); |
| 47 const int count_test_block = 4000; | 47 const int count_test_block = 4000; |
| 48 const int stride = 16; | 48 const int stride = 16; |
| 49 | 49 |
| 50 // Allocate the space for input and output, | 50 // Allocate the space for input and output, |
| 51 // where sig_block_c/_sse2 is the block to be denoised, | 51 // where sig_block_c/_sse2 is the block to be denoised, |
| 52 // mc_avg_block is the denoised reference block, | 52 // mc_avg_block is the denoised reference block, |
| 53 // avg_block_c is the denoised result from C code, | 53 // avg_block_c is the denoised result from C code, |
| 54 // avg_block_sse2 is the denoised result from SSE2 code. | 54 // avg_block_sse2 is the denoised result from SSE2 code. |
| 55 DECLARE_ALIGNED_ARRAY(16, uint8_t, sig_block_c, kNumPixels); | 55 DECLARE_ALIGNED(16, uint8_t, sig_block_c[kNumPixels]); |
| 56 // Since in VP8 denoiser, the source signal will be changed, | 56 // Since in VP8 denoiser, the source signal will be changed, |
| 57 // we need another copy of the source signal as the input of sse2 code. | 57 // we need another copy of the source signal as the input of sse2 code. |
| 58 DECLARE_ALIGNED_ARRAY(16, uint8_t, sig_block_sse2, kNumPixels); | 58 DECLARE_ALIGNED(16, uint8_t, sig_block_sse2[kNumPixels]); |
| 59 DECLARE_ALIGNED_ARRAY(16, uint8_t, mc_avg_block, kNumPixels); | 59 DECLARE_ALIGNED(16, uint8_t, mc_avg_block[kNumPixels]); |
| 60 DECLARE_ALIGNED_ARRAY(16, uint8_t, avg_block_c, kNumPixels); | 60 DECLARE_ALIGNED(16, uint8_t, avg_block_c[kNumPixels]); |
| 61 DECLARE_ALIGNED_ARRAY(16, uint8_t, avg_block_sse2, kNumPixels); | 61 DECLARE_ALIGNED(16, uint8_t, avg_block_sse2[kNumPixels]); |
| 62 | 62 |
| 63 for (int i = 0; i < count_test_block; ++i) { | 63 for (int i = 0; i < count_test_block; ++i) { |
| 64 // Generate random motion magnitude, 20% of which exceed the threshold. | 64 // Generate random motion magnitude, 20% of which exceed the threshold. |
| 65 const int motion_magnitude_ran = | 65 const int motion_magnitude_ran = |
| 66 rnd.Rand8() % static_cast<int>(MOTION_MAGNITUDE_THRESHOLD * 1.2); | 66 rnd.Rand8() % static_cast<int>(MOTION_MAGNITUDE_THRESHOLD * 1.2); |
| 67 | 67 |
| 68 // Initialize a test block with random number in range [0, 255]. | 68 // Initialize a test block with random number in range [0, 255]. |
| 69 for (int j = 0; j < kNumPixels; ++j) { | 69 for (int j = 0; j < kNumPixels; ++j) { |
| 70 int temp = 0; | 70 int temp = 0; |
| 71 sig_block_sse2[j] = sig_block_c[j] = rnd.Rand8(); | 71 sig_block_sse2[j] = sig_block_c[j] = rnd.Rand8(); |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 107 for (int w = 0; w < 16; ++w) { | 107 for (int w = 0; w < 16; ++w) { |
| 108 EXPECT_EQ(avg_block_c[h * stride + w], avg_block_sse2[h * stride + w]); | 108 EXPECT_EQ(avg_block_c[h * stride + w], avg_block_sse2[h * stride + w]); |
| 109 } | 109 } |
| 110 } | 110 } |
| 111 } | 111 } |
| 112 } | 112 } |
| 113 | 113 |
| 114 // Test for all block size. | 114 // Test for all block size. |
| 115 INSTANTIATE_TEST_CASE_P(SSE2, VP8DenoiserTest, ::testing::Values(0, 1)); | 115 INSTANTIATE_TEST_CASE_P(SSE2, VP8DenoiserTest, ::testing::Values(0, 1)); |
| 116 } // namespace | 116 } // namespace |
| OLD | NEW |