OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2013 The WebM project authors. All Rights Reserved. | 2 * Copyright (c) 2013 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 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
61 op[3] = (a1 - d1 + 4) >> 3; | 61 op[3] = (a1 - d1 + 4) >> 3; |
62 op[1] = (b1 + c1 + 4) >> 3; | 62 op[1] = (b1 + c1 + 4) >> 3; |
63 op[2] = (b1 - c1 + 4) >> 3; | 63 op[2] = (b1 - c1 + 4) >> 3; |
64 ip += 4; | 64 ip += 4; |
65 op += 4; | 65 op += 4; |
66 } | 66 } |
67 } | 67 } |
68 | 68 |
69 using libvpx_test::ACMRandom; | 69 using libvpx_test::ACMRandom; |
70 | 70 |
71 TEST(Vp8FdctTest, SignBiasCheck) { | 71 TEST(VP8FdctTest, SignBiasCheck) { |
72 ACMRandom rnd(ACMRandom::DeterministicSeed()); | 72 ACMRandom rnd(ACMRandom::DeterministicSeed()); |
73 int16_t test_input_block[16]; | 73 int16_t test_input_block[16]; |
74 int16_t test_output_block[16]; | 74 int16_t test_output_block[16]; |
75 const int pitch = 8; | 75 const int pitch = 8; |
76 int count_sign_block[16][2]; | 76 int count_sign_block[16][2]; |
77 const int count_test_block = 1000000; | 77 const int count_test_block = 1000000; |
78 | 78 |
79 memset(count_sign_block, 0, sizeof(count_sign_block)); | 79 memset(count_sign_block, 0, sizeof(count_sign_block)); |
80 | 80 |
81 for (int i = 0; i < count_test_block; ++i) { | 81 for (int i = 0; i < count_test_block; ++i) { |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
120 | 120 |
121 bias_acceptable = true; | 121 bias_acceptable = true; |
122 for (int j = 0; j < 16; ++j) | 122 for (int j = 0; j < 16; ++j) |
123 bias_acceptable = bias_acceptable && | 123 bias_acceptable = bias_acceptable && |
124 (abs(count_sign_block[j][0] - count_sign_block[j][1]) < 100000); | 124 (abs(count_sign_block[j][0] - count_sign_block[j][1]) < 100000); |
125 | 125 |
126 EXPECT_EQ(true, bias_acceptable) | 126 EXPECT_EQ(true, bias_acceptable) |
127 << "Error: 4x4 FDCT has a sign bias > 10% for input range [-15, 15]"; | 127 << "Error: 4x4 FDCT has a sign bias > 10% for input range [-15, 15]"; |
128 }; | 128 }; |
129 | 129 |
130 TEST(Vp8FdctTest, RoundTripErrorCheck) { | 130 TEST(VP8FdctTest, RoundTripErrorCheck) { |
131 ACMRandom rnd(ACMRandom::DeterministicSeed()); | 131 ACMRandom rnd(ACMRandom::DeterministicSeed()); |
132 int max_error = 0; | 132 int max_error = 0; |
133 double total_error = 0; | 133 double total_error = 0; |
134 const int count_test_block = 1000000; | 134 const int count_test_block = 1000000; |
135 for (int i = 0; i < count_test_block; ++i) { | 135 for (int i = 0; i < count_test_block; ++i) { |
136 int16_t test_input_block[16]; | 136 int16_t test_input_block[16]; |
137 int16_t test_temp_block[16]; | 137 int16_t test_temp_block[16]; |
138 int16_t test_output_block[16]; | 138 int16_t test_output_block[16]; |
139 | 139 |
140 // Initialize a test block with input range [-255, 255]. | 140 // Initialize a test block with input range [-255, 255]. |
(...skipping 14 matching lines...) Expand all Loading... |
155 } | 155 } |
156 | 156 |
157 EXPECT_GE(1, max_error ) | 157 EXPECT_GE(1, max_error ) |
158 << "Error: FDCT/IDCT has an individual roundtrip error > 1"; | 158 << "Error: FDCT/IDCT has an individual roundtrip error > 1"; |
159 | 159 |
160 EXPECT_GE(count_test_block, total_error) | 160 EXPECT_GE(count_test_block, total_error) |
161 << "Error: FDCT/IDCT has average roundtrip error > 1 per block"; | 161 << "Error: FDCT/IDCT has average roundtrip error > 1 per block"; |
162 }; | 162 }; |
163 | 163 |
164 } // namespace | 164 } // namespace |
OLD | NEW |