OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2012 The WebM project authors. All Rights Reserved. | 2 * Copyright (c) 2012 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 |
11 #include <limits.h> | 11 #include <limits.h> |
12 #include <stdio.h> | 12 #include <stdio.h> |
13 #include <string.h> | 13 #include <string.h> |
14 | 14 |
15 #include "third_party/googletest/src/include/gtest/gtest.h" | 15 #include "third_party/googletest/src/include/gtest/gtest.h" |
16 | 16 |
17 #include "./vpx_config.h" | 17 #include "./vpx_config.h" |
18 #if CONFIG_VP9_ENCODER | 18 #if CONFIG_VP9_ENCODER |
19 #include "./vp9_rtcd.h" | 19 #include "./vp9_rtcd.h" |
20 #endif | 20 #endif |
21 | 21 |
22 #include "test/acm_random.h" | 22 #include "test/acm_random.h" |
23 #include "test/clear_system_state.h" | 23 #include "test/clear_system_state.h" |
24 #include "test/register_state_check.h" | 24 #include "test/register_state_check.h" |
25 #include "test/util.h" | 25 #include "test/util.h" |
26 #include "vp9/encoder/vp9_ssim.h" | 26 #include "vpx_dsp/ssim.h" |
27 #include "vpx_mem/vpx_mem.h" | 27 #include "vpx_mem/vpx_mem.h" |
28 | 28 |
29 extern "C" | 29 extern "C" |
30 double vp9_get_ssim_metrics(uint8_t *img1, int img1_pitch, | 30 double vpx_get_ssim_metrics(uint8_t *img1, int img1_pitch, |
31 uint8_t *img2, int img2_pitch, | 31 uint8_t *img2, int img2_pitch, |
32 int width, int height, | 32 int width, int height, |
33 Ssimv *sv2, Metrics *m, | 33 Ssimv *sv2, Metrics *m, |
34 int do_inconsistency); | 34 int do_inconsistency); |
35 | 35 |
36 using libvpx_test::ACMRandom; | 36 using libvpx_test::ACMRandom; |
37 | 37 |
38 namespace { | 38 namespace { |
39 class ConsistencyTestBase : public ::testing::Test { | 39 class ConsistencyTestBase : public ::testing::Test { |
40 public: | 40 public: |
(...skipping 17 matching lines...) Expand all Loading... |
58 static void TearDownTestCase() { | 58 static void TearDownTestCase() { |
59 vpx_free(source_data_[0]); | 59 vpx_free(source_data_[0]); |
60 source_data_[0] = NULL; | 60 source_data_[0] = NULL; |
61 vpx_free(reference_data_[0]); | 61 vpx_free(reference_data_[0]); |
62 reference_data_[0] = NULL; | 62 reference_data_[0] = NULL; |
63 vpx_free(source_data_[1]); | 63 vpx_free(source_data_[1]); |
64 source_data_[1] = NULL; | 64 source_data_[1] = NULL; |
65 vpx_free(reference_data_[1]); | 65 vpx_free(reference_data_[1]); |
66 reference_data_[1] = NULL; | 66 reference_data_[1] = NULL; |
67 | 67 |
68 delete ssim_array_; | 68 delete[] ssim_array_; |
69 } | 69 } |
70 | 70 |
71 virtual void TearDown() { | 71 virtual void TearDown() { |
72 libvpx_test::ClearSystemState(); | 72 libvpx_test::ClearSystemState(); |
73 } | 73 } |
74 | 74 |
75 protected: | 75 protected: |
76 // Handle frames up to 640x480 | 76 // Handle frames up to 640x480 |
77 static const int kDataAlignment = 16; | 77 static const int kDataAlignment = 16; |
78 static const int kDataBufferSize = 640*480; | 78 static const int kDataBufferSize = 640*480; |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
137 class ConsistencyVP9Test | 137 class ConsistencyVP9Test |
138 : public ConsistencyTestBase, | 138 : public ConsistencyTestBase, |
139 public ::testing::WithParamInterface<ConsistencyParam> { | 139 public ::testing::WithParamInterface<ConsistencyParam> { |
140 public: | 140 public: |
141 ConsistencyVP9Test() : ConsistencyTestBase(GET_PARAM(0), GET_PARAM(1)) {} | 141 ConsistencyVP9Test() : ConsistencyTestBase(GET_PARAM(0), GET_PARAM(1)) {} |
142 | 142 |
143 protected: | 143 protected: |
144 double CheckConsistency(int frame) { | 144 double CheckConsistency(int frame) { |
145 EXPECT_LT(frame, 2)<< "Frame to check has to be less than 2."; | 145 EXPECT_LT(frame, 2)<< "Frame to check has to be less than 2."; |
146 return | 146 return |
147 vp9_get_ssim_metrics(source_data_[frame], source_stride_, | 147 vpx_get_ssim_metrics(source_data_[frame], source_stride_, |
148 reference_data_[frame], reference_stride_, | 148 reference_data_[frame], reference_stride_, |
149 width_, height_, ssim_array_, &metrics_, 1); | 149 width_, height_, ssim_array_, &metrics_, 1); |
150 } | 150 } |
151 }; | 151 }; |
152 #endif // CONFIG_VP9_ENCODER | 152 #endif // CONFIG_VP9_ENCODER |
153 | 153 |
154 uint8_t* ConsistencyTestBase::source_data_[2] = {NULL, NULL}; | 154 uint8_t* ConsistencyTestBase::source_data_[2] = {NULL, NULL}; |
155 uint8_t* ConsistencyTestBase::reference_data_[2] = {NULL, NULL}; | 155 uint8_t* ConsistencyTestBase::reference_data_[2] = {NULL, NULL}; |
156 Ssimv* ConsistencyTestBase::ssim_array_ = NULL; | 156 Ssimv* ConsistencyTestBase::ssim_array_ = NULL; |
157 | 157 |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
215 const ConsistencyParam c_vp9_tests[] = { | 215 const ConsistencyParam c_vp9_tests[] = { |
216 make_tuple(320, 240), | 216 make_tuple(320, 240), |
217 make_tuple(318, 242), | 217 make_tuple(318, 242), |
218 make_tuple(318, 238), | 218 make_tuple(318, 238), |
219 }; | 219 }; |
220 INSTANTIATE_TEST_CASE_P(C, ConsistencyVP9Test, | 220 INSTANTIATE_TEST_CASE_P(C, ConsistencyVP9Test, |
221 ::testing::ValuesIn(c_vp9_tests)); | 221 ::testing::ValuesIn(c_vp9_tests)); |
222 #endif | 222 #endif |
223 | 223 |
224 } // namespace | 224 } // namespace |
OLD | NEW |