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

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

Issue 1162573005: libvpx: Pull from upstream (Closed) Base URL: https://chromium.googlesource.com/chromium/deps/libvpx.git@master
Patch Set: Created 5 years, 6 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/fdct4x4_test.cc ('k') | source/libvpx/test/md5_helper.h » ('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
11 #include <math.h> 11 #include <math.h>
12 #include <stdlib.h> 12 #include <stdlib.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 #include "test/acm_random.h" 16 #include "test/acm_random.h"
17 #include "test/clear_system_state.h" 17 #include "test/clear_system_state.h"
18 #include "test/register_state_check.h" 18 #include "test/register_state_check.h"
19 #include "test/util.h" 19 #include "test/util.h"
20 20
21 #include "./vp9_rtcd.h" 21 #include "./vp9_rtcd.h"
22 #include "vp9/common/vp9_entropy.h" 22 #include "vp9/common/vp9_entropy.h"
23 #include "vp9/common/vp9_scan.h"
23 #include "vpx/vpx_codec.h" 24 #include "vpx/vpx_codec.h"
24 #include "vpx/vpx_integer.h" 25 #include "vpx/vpx_integer.h"
26 #include "vpx_ports/mem.h"
27
28 using libvpx_test::ACMRandom;
29
30 namespace {
25 31
26 const int kNumCoeffs = 64; 32 const int kNumCoeffs = 64;
27 const double kPi = 3.141592653589793238462643383279502884; 33 const double kPi = 3.141592653589793238462643383279502884;
34
35 const int kSignBiasMaxDiff255 = 1500;
36 const int kSignBiasMaxDiff15 = 10000;
37
38 typedef void (*FdctFunc)(const int16_t *in, tran_low_t *out, int stride);
39 typedef void (*IdctFunc)(const tran_low_t *in, uint8_t *out, int stride);
40 typedef void (*FhtFunc)(const int16_t *in, tran_low_t *out, int stride,
41 int tx_type);
42 typedef void (*IhtFunc)(const tran_low_t *in, uint8_t *out, int stride,
43 int tx_type);
44
45 typedef std::tr1::tuple<FdctFunc, IdctFunc, int, vpx_bit_depth_t> Dct8x8Param;
46 typedef std::tr1::tuple<FhtFunc, IhtFunc, int, vpx_bit_depth_t> Ht8x8Param;
47 typedef std::tr1::tuple<IdctFunc, IdctFunc, int, vpx_bit_depth_t> Idct8x8Param;
48
28 void reference_8x8_dct_1d(const double in[8], double out[8], int stride) { 49 void reference_8x8_dct_1d(const double in[8], double out[8], int stride) {
29 const double kInvSqrt2 = 0.707106781186547524400844362104; 50 const double kInvSqrt2 = 0.707106781186547524400844362104;
30 for (int k = 0; k < 8; k++) { 51 for (int k = 0; k < 8; k++) {
31 out[k] = 0.0; 52 out[k] = 0.0;
32 for (int n = 0; n < 8; n++) 53 for (int n = 0; n < 8; n++)
33 out[k] += in[n] * cos(kPi * (2 * n + 1) * k / 16.0); 54 out[k] += in[n] * cos(kPi * (2 * n + 1) * k / 16.0);
34 if (k == 0) 55 if (k == 0)
35 out[k] = out[k] * kInvSqrt2; 56 out[k] = out[k] * kInvSqrt2;
36 } 57 }
37 } 58 }
(...skipping 14 matching lines...) Expand all
52 double temp_in[8], temp_out[8]; 73 double temp_in[8], temp_out[8];
53 for (int j = 0; j < 8; ++j) 74 for (int j = 0; j < 8; ++j)
54 temp_in[j] = output[j + i*8]; 75 temp_in[j] = output[j + i*8];
55 reference_8x8_dct_1d(temp_in, temp_out, 1); 76 reference_8x8_dct_1d(temp_in, temp_out, 1);
56 // Scale by some magic number 77 // Scale by some magic number
57 for (int j = 0; j < 8; ++j) 78 for (int j = 0; j < 8; ++j)
58 output[j + i * 8] = temp_out[j] * 2; 79 output[j + i * 8] = temp_out[j] * 2;
59 } 80 }
60 } 81 }
61 82
62 using libvpx_test::ACMRandom;
63
64 namespace {
65
66 const int kSignBiasMaxDiff255 = 1500;
67 const int kSignBiasMaxDiff15 = 10000;
68
69 typedef void (*FdctFunc)(const int16_t *in, tran_low_t *out, int stride);
70 typedef void (*IdctFunc)(const tran_low_t *in, uint8_t *out, int stride);
71 typedef void (*FhtFunc)(const int16_t *in, tran_low_t *out, int stride,
72 int tx_type);
73 typedef void (*IhtFunc)(const tran_low_t *in, uint8_t *out, int stride,
74 int tx_type);
75
76 typedef std::tr1::tuple<FdctFunc, IdctFunc, int, vpx_bit_depth_t> Dct8x8Param;
77 typedef std::tr1::tuple<FhtFunc, IhtFunc, int, vpx_bit_depth_t> Ht8x8Param;
78 typedef std::tr1::tuple<IdctFunc, IdctFunc, int, vpx_bit_depth_t> Idct8x8Param;
79 83
80 void fdct8x8_ref(const int16_t *in, tran_low_t *out, int stride, int tx_type) { 84 void fdct8x8_ref(const int16_t *in, tran_low_t *out, int stride, int tx_type) {
81 vp9_fdct8x8_c(in, out, stride); 85 vp9_fdct8x8_c(in, out, stride);
82 } 86 }
83 87
84 void fht8x8_ref(const int16_t *in, tran_low_t *out, int stride, int tx_type) { 88 void fht8x8_ref(const int16_t *in, tran_low_t *out, int stride, int tx_type) {
85 vp9_fht8x8_c(in, out, stride, tx_type); 89 vp9_fht8x8_c(in, out, stride, tx_type);
86 } 90 }
87 91
88 #if CONFIG_VP9_HIGHBITDEPTH 92 #if CONFIG_VP9_HIGHBITDEPTH
(...skipping 681 matching lines...) Expand 10 before | Expand all | Expand 10 after
770 #if HAVE_SSSE3 && ARCH_X86_64 && !CONFIG_VP9_HIGHBITDEPTH && \ 774 #if HAVE_SSSE3 && ARCH_X86_64 && !CONFIG_VP9_HIGHBITDEPTH && \
771 !CONFIG_EMULATE_HARDWARE 775 !CONFIG_EMULATE_HARDWARE
772 // TODO(jingning): re-enable after this handles the expanded range [0, 65535] 776 // TODO(jingning): re-enable after this handles the expanded range [0, 65535]
773 // returned from Rand16(). 777 // returned from Rand16().
774 INSTANTIATE_TEST_CASE_P( 778 INSTANTIATE_TEST_CASE_P(
775 SSSE3, FwdTrans8x8DCT, 779 SSSE3, FwdTrans8x8DCT,
776 ::testing::Values( 780 ::testing::Values(
777 make_tuple(&vp9_fdct8x8_ssse3, &vp9_idct8x8_64_add_ssse3, 0, 781 make_tuple(&vp9_fdct8x8_ssse3, &vp9_idct8x8_64_add_ssse3, 0,
778 VPX_BITS_8))); 782 VPX_BITS_8)));
779 #endif 783 #endif
784
785 #if HAVE_MSA && !CONFIG_VP9_HIGHBITDEPTH && !CONFIG_EMULATE_HARDWARE
786 INSTANTIATE_TEST_CASE_P(
787 MSA, FwdTrans8x8DCT,
788 ::testing::Values(
789 make_tuple(&vp9_fdct8x8_c, &vp9_idct8x8_64_add_msa, 0, VPX_BITS_8)));
790 INSTANTIATE_TEST_CASE_P(
791 MSA, FwdTrans8x8HT,
792 ::testing::Values(
793 make_tuple(&vp9_fht8x8_c, &vp9_iht8x8_64_add_msa, 0, VPX_BITS_8),
794 make_tuple(&vp9_fht8x8_c, &vp9_iht8x8_64_add_msa, 1, VPX_BITS_8),
795 make_tuple(&vp9_fht8x8_c, &vp9_iht8x8_64_add_msa, 2, VPX_BITS_8),
796 make_tuple(&vp9_fht8x8_c, &vp9_iht8x8_64_add_msa, 3, VPX_BITS_8)));
797 #endif // HAVE_MSA && !CONFIG_VP9_HIGHBITDEPTH && !CONFIG_EMULATE_HARDWARE
780 } // namespace 798 } // namespace
OLDNEW
« no previous file with comments | « source/libvpx/test/fdct4x4_test.cc ('k') | source/libvpx/test/md5_helper.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698