| 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 |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 102 out2[j*8 + i] = temp_out[j]; | 102 out2[j*8 + i] = temp_out[j]; |
| 103 } | 103 } |
| 104 for (int i = 0; i < 64; ++i) | 104 for (int i = 0; i < 64; ++i) |
| 105 output[i] = round(out2[i]/32); | 105 output[i] = round(out2[i]/32); |
| 106 } | 106 } |
| 107 | 107 |
| 108 TEST(VP9Idct8x8Test, AccuracyCheck) { | 108 TEST(VP9Idct8x8Test, AccuracyCheck) { |
| 109 ACMRandom rnd(ACMRandom::DeterministicSeed()); | 109 ACMRandom rnd(ACMRandom::DeterministicSeed()); |
| 110 const int count_test_block = 10000; | 110 const int count_test_block = 10000; |
| 111 for (int i = 0; i < count_test_block; ++i) { | 111 for (int i = 0; i < count_test_block; ++i) { |
| 112 int16_t input[64], coeff[64]; | 112 int16_t input[64]; |
| 113 tran_low_t coeff[64]; |
| 113 double output_r[64]; | 114 double output_r[64]; |
| 114 uint8_t dst[64], src[64]; | 115 uint8_t dst[64], src[64]; |
| 115 | 116 |
| 116 for (int j = 0; j < 64; ++j) { | 117 for (int j = 0; j < 64; ++j) { |
| 117 src[j] = rnd.Rand8(); | 118 src[j] = rnd.Rand8(); |
| 118 dst[j] = rnd.Rand8(); | 119 dst[j] = rnd.Rand8(); |
| 119 } | 120 } |
| 120 // Initialize a test block with input range [-255, 255]. | 121 // Initialize a test block with input range [-255, 255]. |
| 121 for (int j = 0; j < 64; ++j) | 122 for (int j = 0; j < 64; ++j) |
| 122 input[j] = src[j] - dst[j]; | 123 input[j] = src[j] - dst[j]; |
| 123 | 124 |
| 124 reference_dct_2d(input, output_r); | 125 reference_dct_2d(input, output_r); |
| 125 for (int j = 0; j < 64; ++j) | 126 for (int j = 0; j < 64; ++j) |
| 126 coeff[j] = round(output_r[j]); | 127 coeff[j] = round(output_r[j]); |
| 127 vp9_idct8x8_64_add_c(coeff, dst, 8); | 128 vp9_idct8x8_64_add_c(coeff, dst, 8); |
| 128 for (int j = 0; j < 64; ++j) { | 129 for (int j = 0; j < 64; ++j) { |
| 129 const int diff = dst[j] - src[j]; | 130 const int diff = dst[j] - src[j]; |
| 130 const int error = diff * diff; | 131 const int error = diff * diff; |
| 131 EXPECT_GE(1, error) | 132 EXPECT_GE(1, error) |
| 132 << "Error: 8x8 FDCT/IDCT has error " << error | 133 << "Error: 8x8 FDCT/IDCT has error " << error |
| 133 << " at index " << j; | 134 << " at index " << j; |
| 134 } | 135 } |
| 135 } | 136 } |
| 136 } | 137 } |
| 137 | 138 |
| 138 } // namespace | 139 } // namespace |
| OLD | NEW |