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

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

Issue 554673004: libvpx: Pull from upstream (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/deps/third_party/libvpx/
Patch Set: Created 6 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 | Annotate | Revision Log
« no previous file with comments | « source/libvpx/test/dct16x16_test.cc ('k') | source/libvpx/test/decode_perf_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 19 matching lines...) Expand all
30 static int round(double x) { 30 static int round(double x) {
31 if (x < 0) 31 if (x < 0)
32 return static_cast<int>(ceil(x - 0.5)); 32 return static_cast<int>(ceil(x - 0.5));
33 else 33 else
34 return static_cast<int>(floor(x + 0.5)); 34 return static_cast<int>(floor(x + 0.5));
35 } 35 }
36 #endif 36 #endif
37 37
38 const int kNumCoeffs = 1024; 38 const int kNumCoeffs = 1024;
39 const double kPi = 3.141592653589793238462643383279502884; 39 const double kPi = 3.141592653589793238462643383279502884;
40 void reference_32x32_dct_1d(const double in[32], double out[32], int stride) { 40 void reference_32x32_dct_1d(const double in[32], double out[32]) {
41 const double kInvSqrt2 = 0.707106781186547524400844362104; 41 const double kInvSqrt2 = 0.707106781186547524400844362104;
42 for (int k = 0; k < 32; k++) { 42 for (int k = 0; k < 32; k++) {
43 out[k] = 0.0; 43 out[k] = 0.0;
44 for (int n = 0; n < 32; n++) 44 for (int n = 0; n < 32; n++)
45 out[k] += in[n] * cos(kPi * (2 * n + 1) * k / 64.0); 45 out[k] += in[n] * cos(kPi * (2 * n + 1) * k / 64.0);
46 if (k == 0) 46 if (k == 0)
47 out[k] = out[k] * kInvSqrt2; 47 out[k] = out[k] * kInvSqrt2;
48 } 48 }
49 } 49 }
50 50
51 void reference_32x32_dct_2d(const int16_t input[kNumCoeffs], 51 void reference_32x32_dct_2d(const int16_t input[kNumCoeffs],
52 double output[kNumCoeffs]) { 52 double output[kNumCoeffs]) {
53 // First transform columns 53 // First transform columns
54 for (int i = 0; i < 32; ++i) { 54 for (int i = 0; i < 32; ++i) {
55 double temp_in[32], temp_out[32]; 55 double temp_in[32], temp_out[32];
56 for (int j = 0; j < 32; ++j) 56 for (int j = 0; j < 32; ++j)
57 temp_in[j] = input[j*32 + i]; 57 temp_in[j] = input[j*32 + i];
58 reference_32x32_dct_1d(temp_in, temp_out, 1); 58 reference_32x32_dct_1d(temp_in, temp_out);
59 for (int j = 0; j < 32; ++j) 59 for (int j = 0; j < 32; ++j)
60 output[j * 32 + i] = temp_out[j]; 60 output[j * 32 + i] = temp_out[j];
61 } 61 }
62 // Then transform rows 62 // Then transform rows
63 for (int i = 0; i < 32; ++i) { 63 for (int i = 0; i < 32; ++i) {
64 double temp_in[32], temp_out[32]; 64 double temp_in[32], temp_out[32];
65 for (int j = 0; j < 32; ++j) 65 for (int j = 0; j < 32; ++j)
66 temp_in[j] = output[j + i*32]; 66 temp_in[j] = output[j + i*32];
67 reference_32x32_dct_1d(temp_in, temp_out, 1); 67 reference_32x32_dct_1d(temp_in, temp_out);
68 // Scale by some magic number 68 // Scale by some magic number
69 for (int j = 0; j < 32; ++j) 69 for (int j = 0; j < 32; ++j)
70 output[j + i * 32] = temp_out[j] / 4; 70 output[j + i * 32] = temp_out[j] / 4;
71 } 71 }
72 } 72 }
73 73
74 typedef void (*FwdTxfmFunc)(const int16_t *in, int16_t *out, int stride); 74 typedef void (*FwdTxfmFunc)(const int16_t *in, int16_t *out, int stride);
75 typedef void (*InvTxfmFunc)(const int16_t *in, uint8_t *out, int stride); 75 typedef void (*InvTxfmFunc)(const int16_t *in, uint8_t *out, int stride);
76 76
77 typedef std::tr1::tuple<FwdTxfmFunc, InvTxfmFunc, int> Trans32x32Param; 77 typedef std::tr1::tuple<FwdTxfmFunc, InvTxfmFunc, int> Trans32x32Param;
(...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after
273 #if HAVE_AVX2 273 #if HAVE_AVX2
274 INSTANTIATE_TEST_CASE_P( 274 INSTANTIATE_TEST_CASE_P(
275 AVX2, Trans32x32Test, 275 AVX2, Trans32x32Test,
276 ::testing::Values( 276 ::testing::Values(
277 make_tuple(&vp9_fdct32x32_avx2, 277 make_tuple(&vp9_fdct32x32_avx2,
278 &vp9_idct32x32_1024_add_sse2, 0), 278 &vp9_idct32x32_1024_add_sse2, 0),
279 make_tuple(&vp9_fdct32x32_rd_avx2, 279 make_tuple(&vp9_fdct32x32_rd_avx2,
280 &vp9_idct32x32_1024_add_sse2, 1))); 280 &vp9_idct32x32_1024_add_sse2, 1)));
281 #endif 281 #endif
282 } // namespace 282 } // namespace
OLDNEW
« no previous file with comments | « source/libvpx/test/dct16x16_test.cc ('k') | source/libvpx/test/decode_perf_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698