Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1135)

Side by Side Diff: source/libvpx/test/idct8x8_test.cc

Issue 1339513003: libvpx: Pull from upstream (Closed) Base URL: https://chromium.googlesource.com/chromium/deps/libvpx.git@master
Patch Set: Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « source/libvpx/test/frame_size_tests.cc ('k') | source/libvpx/test/invalid_file_test.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
60 temp_in[j] = output[j + i*8]; 60 temp_in[j] = output[j + i*8];
61 reference_dct_1d(temp_in, temp_out); 61 reference_dct_1d(temp_in, temp_out);
62 for (int j = 0; j < 8; ++j) 62 for (int j = 0; j < 8; ++j)
63 output[j + i*8] = temp_out[j]; 63 output[j + i*8] = temp_out[j];
64 } 64 }
65 // Scale by some magic number 65 // Scale by some magic number
66 for (int i = 0; i < 64; ++i) 66 for (int i = 0; i < 64; ++i)
67 output[i] *= 2; 67 output[i] *= 2;
68 } 68 }
69 69
70 void reference_idct_1d(double input[8], double output[8]) {
71 const double kPi = 3.141592653589793238462643383279502884;
72 const double kSqrt2 = 1.414213562373095048801688724209698;
73 for (int k = 0; k < 8; k++) {
74 output[k] = 0.0;
75 for (int n = 0; n < 8; n++) {
76 output[k] += input[n]*cos(kPi*(2*k+1)*n/16.0);
77 if (n == 0)
78 output[k] = output[k]/kSqrt2;
79 }
80 }
81 }
82
83 void reference_idct_2d(double input[64], int16_t output[64]) {
84 double out[64], out2[64];
85 // First transform rows
86 for (int i = 0; i < 8; ++i) {
87 double temp_in[8], temp_out[8];
88 for (int j = 0; j < 8; ++j)
89 temp_in[j] = input[j + i*8];
90 reference_idct_1d(temp_in, temp_out);
91 for (int j = 0; j < 8; ++j)
92 out[j + i*8] = temp_out[j];
93 }
94 // Then transform columns
95 for (int i = 0; i < 8; ++i) {
96 double temp_in[8], temp_out[8];
97 for (int j = 0; j < 8; ++j)
98 temp_in[j] = out[j*8 + i];
99 reference_idct_1d(temp_in, temp_out);
100 for (int j = 0; j < 8; ++j)
101 out2[j*8 + i] = temp_out[j];
102 }
103 for (int i = 0; i < 64; ++i)
104 output[i] = round(out2[i]/32);
105 }
106
107 TEST(VP9Idct8x8Test, AccuracyCheck) { 70 TEST(VP9Idct8x8Test, AccuracyCheck) {
108 ACMRandom rnd(ACMRandom::DeterministicSeed()); 71 ACMRandom rnd(ACMRandom::DeterministicSeed());
109 const int count_test_block = 10000; 72 const int count_test_block = 10000;
110 for (int i = 0; i < count_test_block; ++i) { 73 for (int i = 0; i < count_test_block; ++i) {
111 int16_t input[64]; 74 int16_t input[64];
112 tran_low_t coeff[64]; 75 tran_low_t coeff[64];
113 double output_r[64]; 76 double output_r[64];
114 uint8_t dst[64], src[64]; 77 uint8_t dst[64], src[64];
115 78
116 for (int j = 0; j < 64; ++j) { 79 for (int j = 0; j < 64; ++j) {
(...skipping 12 matching lines...) Expand all
129 const int diff = dst[j] - src[j]; 92 const int diff = dst[j] - src[j];
130 const int error = diff * diff; 93 const int error = diff * diff;
131 EXPECT_GE(1, error) 94 EXPECT_GE(1, error)
132 << "Error: 8x8 FDCT/IDCT has error " << error 95 << "Error: 8x8 FDCT/IDCT has error " << error
133 << " at index " << j; 96 << " at index " << j;
134 } 97 }
135 } 98 }
136 } 99 }
137 100
138 } // namespace 101 } // namespace
OLDNEW
« no previous file with comments | « source/libvpx/test/frame_size_tests.cc ('k') | source/libvpx/test/invalid_file_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698