Daniel Kang | 26641c7 | 2012-06-28 16:26:31 -0700 | [diff] [blame] | 1 | /* |
Yaowu Xu | 2ab7ff0 | 2016-09-02 12:04:54 -0700 | [diff] [blame] | 2 | * Copyright (c) 2016, Alliance for Open Media. All rights reserved |
Daniel Kang | 26641c7 | 2012-06-28 16:26:31 -0700 | [diff] [blame] | 3 | * |
Yaowu Xu | 2ab7ff0 | 2016-09-02 12:04:54 -0700 | [diff] [blame] | 4 | * This source code is subject to the terms of the BSD 2 Clause License and |
| 5 | * the Alliance for Open Media Patent License 1.0. If the BSD 2 Clause License |
| 6 | * was not distributed with this source code in the LICENSE file, you can |
| 7 | * obtain it at www.aomedia.org/license/software. If the Alliance for Open |
| 8 | * Media Patent License 1.0 was not distributed with this source code in the |
| 9 | * PATENTS file, you can obtain it at www.aomedia.org/license/patent. |
| 10 | */ |
Daniel Kang | 26641c7 | 2012-06-28 16:26:31 -0700 | [diff] [blame] | 11 | |
| 12 | #include <math.h> |
| 13 | #include <stdlib.h> |
| 14 | #include <string.h> |
| 15 | |
| 16 | #include "third_party/googletest/src/include/gtest/gtest.h" |
Jingning Han | 097d59c | 2015-07-29 14:51:36 -0700 | [diff] [blame] | 17 | |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 18 | #include "./av1_rtcd.h" |
| 19 | #include "./aom_dsp_rtcd.h" |
Jingning Han | 4bd1711 | 2013-09-16 16:01:50 -0700 | [diff] [blame] | 20 | #include "test/acm_random.h" |
Yaowu Xu | e494df1 | 2013-09-03 13:50:17 -0700 | [diff] [blame] | 21 | #include "test/clear_system_state.h" |
| 22 | #include "test/register_state_check.h" |
Jingning Han | 4bd1711 | 2013-09-16 16:01:50 -0700 | [diff] [blame] | 23 | #include "test/util.h" |
Yaowu Xu | c27fc14 | 2016-08-22 16:08:15 -0700 | [diff] [blame] | 24 | #include "av1/common/entropy.h" |
| 25 | #include "av1/common/scan.h" |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 26 | #include "aom/aom_codec.h" |
| 27 | #include "aom/aom_integer.h" |
Yaowu Xu | c27fc14 | 2016-08-22 16:08:15 -0700 | [diff] [blame] | 28 | #include "aom_ports/mem.h" |
James Zern | 002ad40 | 2014-01-18 13:03:31 -0800 | [diff] [blame] | 29 | |
Yaowu Xu | c27fc14 | 2016-08-22 16:08:15 -0700 | [diff] [blame] | 30 | using libaom_test::ACMRandom; |
James Zern | c47d868 | 2015-05-14 19:38:34 -0700 | [diff] [blame] | 31 | |
| 32 | namespace { |
| 33 | |
Deb Mukherjee | 10783d4 | 2014-09-02 16:34:09 -0700 | [diff] [blame] | 34 | const int kNumCoeffs = 64; |
| 35 | const double kPi = 3.141592653589793238462643383279502884; |
James Zern | c47d868 | 2015-05-14 19:38:34 -0700 | [diff] [blame] | 36 | |
| 37 | const int kSignBiasMaxDiff255 = 1500; |
| 38 | const int kSignBiasMaxDiff15 = 10000; |
| 39 | |
| 40 | typedef void (*FdctFunc)(const int16_t *in, tran_low_t *out, int stride); |
| 41 | typedef void (*IdctFunc)(const tran_low_t *in, uint8_t *out, int stride); |
| 42 | typedef void (*FhtFunc)(const int16_t *in, tran_low_t *out, int stride, |
| 43 | int tx_type); |
| 44 | typedef void (*IhtFunc)(const tran_low_t *in, uint8_t *out, int stride, |
| 45 | int tx_type); |
| 46 | |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 47 | typedef std::tr1::tuple<FdctFunc, IdctFunc, int, aom_bit_depth_t> Dct8x8Param; |
| 48 | typedef std::tr1::tuple<FhtFunc, IhtFunc, int, aom_bit_depth_t> Ht8x8Param; |
| 49 | typedef std::tr1::tuple<IdctFunc, IdctFunc, int, aom_bit_depth_t> Idct8x8Param; |
James Zern | c47d868 | 2015-05-14 19:38:34 -0700 | [diff] [blame] | 50 | |
James Zern | cffef11 | 2016-02-11 18:27:00 -0800 | [diff] [blame] | 51 | void reference_8x8_dct_1d(const double in[8], double out[8]) { |
Deb Mukherjee | 10783d4 | 2014-09-02 16:34:09 -0700 | [diff] [blame] | 52 | const double kInvSqrt2 = 0.707106781186547524400844362104; |
| 53 | for (int k = 0; k < 8; k++) { |
| 54 | out[k] = 0.0; |
| 55 | for (int n = 0; n < 8; n++) |
| 56 | out[k] += in[n] * cos(kPi * (2 * n + 1) * k / 16.0); |
clang-format | 3a826f1 | 2016-08-11 17:46:05 -0700 | [diff] [blame] | 57 | if (k == 0) out[k] = out[k] * kInvSqrt2; |
Deb Mukherjee | 10783d4 | 2014-09-02 16:34:09 -0700 | [diff] [blame] | 58 | } |
| 59 | } |
| 60 | |
| 61 | void reference_8x8_dct_2d(const int16_t input[kNumCoeffs], |
| 62 | double output[kNumCoeffs]) { |
| 63 | // First transform columns |
| 64 | for (int i = 0; i < 8; ++i) { |
| 65 | double temp_in[8], temp_out[8]; |
clang-format | 3a826f1 | 2016-08-11 17:46:05 -0700 | [diff] [blame] | 66 | for (int j = 0; j < 8; ++j) temp_in[j] = input[j * 8 + i]; |
James Zern | cffef11 | 2016-02-11 18:27:00 -0800 | [diff] [blame] | 67 | reference_8x8_dct_1d(temp_in, temp_out); |
clang-format | 3a826f1 | 2016-08-11 17:46:05 -0700 | [diff] [blame] | 68 | for (int j = 0; j < 8; ++j) output[j * 8 + i] = temp_out[j]; |
Deb Mukherjee | 10783d4 | 2014-09-02 16:34:09 -0700 | [diff] [blame] | 69 | } |
| 70 | // Then transform rows |
| 71 | for (int i = 0; i < 8; ++i) { |
| 72 | double temp_in[8], temp_out[8]; |
clang-format | 3a826f1 | 2016-08-11 17:46:05 -0700 | [diff] [blame] | 73 | for (int j = 0; j < 8; ++j) temp_in[j] = output[j + i * 8]; |
James Zern | cffef11 | 2016-02-11 18:27:00 -0800 | [diff] [blame] | 74 | reference_8x8_dct_1d(temp_in, temp_out); |
Deb Mukherjee | 10783d4 | 2014-09-02 16:34:09 -0700 | [diff] [blame] | 75 | // Scale by some magic number |
clang-format | 3a826f1 | 2016-08-11 17:46:05 -0700 | [diff] [blame] | 76 | for (int j = 0; j < 8; ++j) output[j + i * 8] = temp_out[j] * 2; |
Deb Mukherjee | 10783d4 | 2014-09-02 16:34:09 -0700 | [diff] [blame] | 77 | } |
Daniel Kang | 26641c7 | 2012-06-28 16:26:31 -0700 | [diff] [blame] | 78 | } |
Daniel Kang | 26641c7 | 2012-06-28 16:26:31 -0700 | [diff] [blame] | 79 | |
James Zern | cffef11 | 2016-02-11 18:27:00 -0800 | [diff] [blame] | 80 | void fdct8x8_ref(const int16_t *in, tran_low_t *out, int stride, |
| 81 | int /*tx_type*/) { |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 82 | aom_fdct8x8_c(in, out, stride); |
Jingning Han | ab36262 | 2013-06-21 11:45:47 -0700 | [diff] [blame] | 83 | } |
Jingning Han | 4bd1711 | 2013-09-16 16:01:50 -0700 | [diff] [blame] | 84 | |
Deb Mukherjee | 10783d4 | 2014-09-02 16:34:09 -0700 | [diff] [blame] | 85 | void fht8x8_ref(const int16_t *in, tran_low_t *out, int stride, int tx_type) { |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 86 | av1_fht8x8_c(in, out, stride, tx_type); |
Jingning Han | ab36262 | 2013-06-21 11:45:47 -0700 | [diff] [blame] | 87 | } |
Daniel Kang | 26641c7 | 2012-06-28 16:26:31 -0700 | [diff] [blame] | 88 | |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 89 | #if CONFIG_AOM_HIGHBITDEPTH |
Deb Mukherjee | 10783d4 | 2014-09-02 16:34:09 -0700 | [diff] [blame] | 90 | void idct8x8_10(const tran_low_t *in, uint8_t *out, int stride) { |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 91 | aom_highbd_idct8x8_64_add_c(in, out, stride, 10); |
Deb Mukherjee | 10783d4 | 2014-09-02 16:34:09 -0700 | [diff] [blame] | 92 | } |
| 93 | |
| 94 | void idct8x8_12(const tran_low_t *in, uint8_t *out, int stride) { |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 95 | aom_highbd_idct8x8_64_add_c(in, out, stride, 12); |
Deb Mukherjee | 10783d4 | 2014-09-02 16:34:09 -0700 | [diff] [blame] | 96 | } |
| 97 | |
| 98 | void iht8x8_10(const tran_low_t *in, uint8_t *out, int stride, int tx_type) { |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 99 | av1_highbd_iht8x8_64_add_c(in, out, stride, tx_type, 10); |
Deb Mukherjee | 10783d4 | 2014-09-02 16:34:09 -0700 | [diff] [blame] | 100 | } |
| 101 | |
| 102 | void iht8x8_12(const tran_low_t *in, uint8_t *out, int stride, int tx_type) { |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 103 | av1_highbd_iht8x8_64_add_c(in, out, stride, tx_type, 12); |
Deb Mukherjee | 10783d4 | 2014-09-02 16:34:09 -0700 | [diff] [blame] | 104 | } |
Peter de Rivaz | 7e40a55 | 2014-10-24 08:48:02 +0100 | [diff] [blame] | 105 | |
James Zern | f74e04c | 2016-02-03 23:04:42 -0800 | [diff] [blame] | 106 | #if HAVE_SSE2 |
Peter de Rivaz | 7e40a55 | 2014-10-24 08:48:02 +0100 | [diff] [blame] | 107 | void idct8x8_10_add_10_c(const tran_low_t *in, uint8_t *out, int stride) { |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 108 | aom_highbd_idct8x8_10_add_c(in, out, stride, 10); |
Peter de Rivaz | 7e40a55 | 2014-10-24 08:48:02 +0100 | [diff] [blame] | 109 | } |
| 110 | |
| 111 | void idct8x8_10_add_12_c(const tran_low_t *in, uint8_t *out, int stride) { |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 112 | aom_highbd_idct8x8_10_add_c(in, out, stride, 12); |
Peter de Rivaz | 7e40a55 | 2014-10-24 08:48:02 +0100 | [diff] [blame] | 113 | } |
| 114 | |
Peter de Rivaz | 7e40a55 | 2014-10-24 08:48:02 +0100 | [diff] [blame] | 115 | void idct8x8_10_add_10_sse2(const tran_low_t *in, uint8_t *out, int stride) { |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 116 | aom_highbd_idct8x8_10_add_sse2(in, out, stride, 10); |
Peter de Rivaz | 7e40a55 | 2014-10-24 08:48:02 +0100 | [diff] [blame] | 117 | } |
| 118 | |
| 119 | void idct8x8_10_add_12_sse2(const tran_low_t *in, uint8_t *out, int stride) { |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 120 | aom_highbd_idct8x8_10_add_sse2(in, out, stride, 12); |
Peter de Rivaz | 7e40a55 | 2014-10-24 08:48:02 +0100 | [diff] [blame] | 121 | } |
| 122 | |
| 123 | void idct8x8_64_add_10_sse2(const tran_low_t *in, uint8_t *out, int stride) { |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 124 | aom_highbd_idct8x8_64_add_sse2(in, out, stride, 10); |
Peter de Rivaz | 7e40a55 | 2014-10-24 08:48:02 +0100 | [diff] [blame] | 125 | } |
| 126 | |
| 127 | void idct8x8_64_add_12_sse2(const tran_low_t *in, uint8_t *out, int stride) { |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 128 | aom_highbd_idct8x8_64_add_sse2(in, out, stride, 12); |
Peter de Rivaz | 7e40a55 | 2014-10-24 08:48:02 +0100 | [diff] [blame] | 129 | } |
| 130 | #endif // HAVE_SSE2 |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 131 | #endif // CONFIG_AOM_HIGHBITDEPTH |
Deb Mukherjee | 10783d4 | 2014-09-02 16:34:09 -0700 | [diff] [blame] | 132 | |
Jingning Han | 4bd1711 | 2013-09-16 16:01:50 -0700 | [diff] [blame] | 133 | class FwdTrans8x8TestBase { |
Jingning Han | ab36262 | 2013-06-21 11:45:47 -0700 | [diff] [blame] | 134 | public: |
Jingning Han | 4bd1711 | 2013-09-16 16:01:50 -0700 | [diff] [blame] | 135 | virtual ~FwdTrans8x8TestBase() {} |
Jingning Han | ab36262 | 2013-06-21 11:45:47 -0700 | [diff] [blame] | 136 | |
| 137 | protected: |
Deb Mukherjee | 10783d4 | 2014-09-02 16:34:09 -0700 | [diff] [blame] | 138 | virtual void RunFwdTxfm(int16_t *in, tran_low_t *out, int stride) = 0; |
| 139 | virtual void RunInvTxfm(tran_low_t *out, uint8_t *dst, int stride) = 0; |
Jingning Han | ab36262 | 2013-06-21 11:45:47 -0700 | [diff] [blame] | 140 | |
Jingning Han | 4bd1711 | 2013-09-16 16:01:50 -0700 | [diff] [blame] | 141 | void RunSignBiasCheck() { |
| 142 | ACMRandom rnd(ACMRandom::DeterministicSeed()); |
James Zern | fd3658b | 2015-05-02 13:24:16 -0700 | [diff] [blame] | 143 | DECLARE_ALIGNED(16, int16_t, test_input_block[64]); |
| 144 | DECLARE_ALIGNED(16, tran_low_t, test_output_block[64]); |
Jingning Han | 4bd1711 | 2013-09-16 16:01:50 -0700 | [diff] [blame] | 145 | int count_sign_block[64][2]; |
| 146 | const int count_test_block = 100000; |
Jingning Han | ab36262 | 2013-06-21 11:45:47 -0700 | [diff] [blame] | 147 | |
Jingning Han | 4bd1711 | 2013-09-16 16:01:50 -0700 | [diff] [blame] | 148 | memset(count_sign_block, 0, sizeof(count_sign_block)); |
Daniel Kang | 26641c7 | 2012-06-28 16:26:31 -0700 | [diff] [blame] | 149 | |
Jingning Han | 4bd1711 | 2013-09-16 16:01:50 -0700 | [diff] [blame] | 150 | for (int i = 0; i < count_test_block; ++i) { |
| 151 | // Initialize a test block with input range [-255, 255]. |
| 152 | for (int j = 0; j < 64; ++j) |
Deb Mukherjee | 10783d4 | 2014-09-02 16:34:09 -0700 | [diff] [blame] | 153 | test_input_block[j] = ((rnd.Rand16() >> (16 - bit_depth_)) & mask_) - |
| 154 | ((rnd.Rand16() >> (16 - bit_depth_)) & mask_); |
James Zern | 29e1b1a | 2014-07-09 21:02:02 -0700 | [diff] [blame] | 155 | ASM_REGISTER_STATE_CHECK( |
Jingning Han | 4bd1711 | 2013-09-16 16:01:50 -0700 | [diff] [blame] | 156 | RunFwdTxfm(test_input_block, test_output_block, pitch_)); |
Daniel Kang | 26641c7 | 2012-06-28 16:26:31 -0700 | [diff] [blame] | 157 | |
Jingning Han | 4bd1711 | 2013-09-16 16:01:50 -0700 | [diff] [blame] | 158 | for (int j = 0; j < 64; ++j) { |
| 159 | if (test_output_block[j] < 0) |
| 160 | ++count_sign_block[j][0]; |
| 161 | else if (test_output_block[j] > 0) |
| 162 | ++count_sign_block[j][1]; |
| 163 | } |
| 164 | } |
Daniel Kang | 26641c7 | 2012-06-28 16:26:31 -0700 | [diff] [blame] | 165 | |
| 166 | for (int j = 0; j < 64; ++j) { |
Jingning Han | 4bd1711 | 2013-09-16 16:01:50 -0700 | [diff] [blame] | 167 | const int diff = abs(count_sign_block[j][0] - count_sign_block[j][1]); |
Deb Mukherjee | 1fe643c | 2014-12-04 16:46:06 -0800 | [diff] [blame] | 168 | const int max_diff = kSignBiasMaxDiff255; |
Deb Mukherjee | 10783d4 | 2014-09-02 16:34:09 -0700 | [diff] [blame] | 169 | EXPECT_LT(diff, max_diff << (bit_depth_ - 8)) |
Jingning Han | 4bd1711 | 2013-09-16 16:01:50 -0700 | [diff] [blame] | 170 | << "Error: 8x8 FDCT/FHT has a sign bias > " |
| 171 | << 1. * max_diff / count_test_block * 100 << "%" |
| 172 | << " for input range [-255, 255] at index " << j |
| 173 | << " count0: " << count_sign_block[j][0] |
clang-format | 3a826f1 | 2016-08-11 17:46:05 -0700 | [diff] [blame] | 174 | << " count1: " << count_sign_block[j][1] << " diff: " << diff; |
Jingning Han | 4bd1711 | 2013-09-16 16:01:50 -0700 | [diff] [blame] | 175 | } |
| 176 | |
| 177 | memset(count_sign_block, 0, sizeof(count_sign_block)); |
| 178 | |
| 179 | for (int i = 0; i < count_test_block; ++i) { |
Peter de Rivaz | 7e40a55 | 2014-10-24 08:48:02 +0100 | [diff] [blame] | 180 | // Initialize a test block with input range [-mask_ / 16, mask_ / 16]. |
Jingning Han | 4bd1711 | 2013-09-16 16:01:50 -0700 | [diff] [blame] | 181 | for (int j = 0; j < 64; ++j) |
clang-format | 3a826f1 | 2016-08-11 17:46:05 -0700 | [diff] [blame] | 182 | test_input_block[j] = |
| 183 | ((rnd.Rand16() & mask_) >> 4) - ((rnd.Rand16() & mask_) >> 4); |
James Zern | 29e1b1a | 2014-07-09 21:02:02 -0700 | [diff] [blame] | 184 | ASM_REGISTER_STATE_CHECK( |
Jingning Han | 4bd1711 | 2013-09-16 16:01:50 -0700 | [diff] [blame] | 185 | RunFwdTxfm(test_input_block, test_output_block, pitch_)); |
| 186 | |
| 187 | for (int j = 0; j < 64; ++j) { |
| 188 | if (test_output_block[j] < 0) |
| 189 | ++count_sign_block[j][0]; |
| 190 | else if (test_output_block[j] > 0) |
| 191 | ++count_sign_block[j][1]; |
| 192 | } |
| 193 | } |
| 194 | |
| 195 | for (int j = 0; j < 64; ++j) { |
| 196 | const int diff = abs(count_sign_block[j][0] - count_sign_block[j][1]); |
Deb Mukherjee | 1fe643c | 2014-12-04 16:46:06 -0800 | [diff] [blame] | 197 | const int max_diff = kSignBiasMaxDiff15; |
Deb Mukherjee | 10783d4 | 2014-09-02 16:34:09 -0700 | [diff] [blame] | 198 | EXPECT_LT(diff, max_diff << (bit_depth_ - 8)) |
Deb Mukherjee | 1fe643c | 2014-12-04 16:46:06 -0800 | [diff] [blame] | 199 | << "Error: 8x8 FDCT/FHT has a sign bias > " |
Jingning Han | 4bd1711 | 2013-09-16 16:01:50 -0700 | [diff] [blame] | 200 | << 1. * max_diff / count_test_block * 100 << "%" |
| 201 | << " for input range [-15, 15] at index " << j |
| 202 | << " count0: " << count_sign_block[j][0] |
clang-format | 3a826f1 | 2016-08-11 17:46:05 -0700 | [diff] [blame] | 203 | << " count1: " << count_sign_block[j][1] << " diff: " << diff; |
Daniel Kang | 26641c7 | 2012-06-28 16:26:31 -0700 | [diff] [blame] | 204 | } |
| 205 | } |
| 206 | |
Jingning Han | 4bd1711 | 2013-09-16 16:01:50 -0700 | [diff] [blame] | 207 | void RunRoundTripErrorCheck() { |
| 208 | ACMRandom rnd(ACMRandom::DeterministicSeed()); |
| 209 | int max_error = 0; |
| 210 | int total_error = 0; |
| 211 | const int count_test_block = 100000; |
James Zern | fd3658b | 2015-05-02 13:24:16 -0700 | [diff] [blame] | 212 | DECLARE_ALIGNED(16, int16_t, test_input_block[64]); |
| 213 | DECLARE_ALIGNED(16, tran_low_t, test_temp_block[64]); |
| 214 | DECLARE_ALIGNED(16, uint8_t, dst[64]); |
| 215 | DECLARE_ALIGNED(16, uint8_t, src[64]); |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 216 | #if CONFIG_AOM_HIGHBITDEPTH |
James Zern | fd3658b | 2015-05-02 13:24:16 -0700 | [diff] [blame] | 217 | DECLARE_ALIGNED(16, uint16_t, dst16[64]); |
| 218 | DECLARE_ALIGNED(16, uint16_t, src16[64]); |
Deb Mukherjee | 10783d4 | 2014-09-02 16:34:09 -0700 | [diff] [blame] | 219 | #endif |
Daniel Kang | 26641c7 | 2012-06-28 16:26:31 -0700 | [diff] [blame] | 220 | |
Jingning Han | 4bd1711 | 2013-09-16 16:01:50 -0700 | [diff] [blame] | 221 | for (int i = 0; i < count_test_block; ++i) { |
Peter de Rivaz | 7e40a55 | 2014-10-24 08:48:02 +0100 | [diff] [blame] | 222 | // Initialize a test block with input range [-mask_, mask_]. |
Jingning Han | 4bd1711 | 2013-09-16 16:01:50 -0700 | [diff] [blame] | 223 | for (int j = 0; j < 64; ++j) { |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 224 | if (bit_depth_ == AOM_BITS_8) { |
Deb Mukherjee | 10783d4 | 2014-09-02 16:34:09 -0700 | [diff] [blame] | 225 | src[j] = rnd.Rand8(); |
| 226 | dst[j] = rnd.Rand8(); |
| 227 | test_input_block[j] = src[j] - dst[j]; |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 228 | #if CONFIG_AOM_HIGHBITDEPTH |
Deb Mukherjee | 10783d4 | 2014-09-02 16:34:09 -0700 | [diff] [blame] | 229 | } else { |
| 230 | src16[j] = rnd.Rand16() & mask_; |
| 231 | dst16[j] = rnd.Rand16() & mask_; |
| 232 | test_input_block[j] = src16[j] - dst16[j]; |
| 233 | #endif |
| 234 | } |
Jingning Han | 4bd1711 | 2013-09-16 16:01:50 -0700 | [diff] [blame] | 235 | } |
Daniel Kang | 26641c7 | 2012-06-28 16:26:31 -0700 | [diff] [blame] | 236 | |
James Zern | 29e1b1a | 2014-07-09 21:02:02 -0700 | [diff] [blame] | 237 | ASM_REGISTER_STATE_CHECK( |
Jingning Han | 4bd1711 | 2013-09-16 16:01:50 -0700 | [diff] [blame] | 238 | RunFwdTxfm(test_input_block, test_temp_block, pitch_)); |
| 239 | for (int j = 0; j < 64; ++j) { |
clang-format | 3a826f1 | 2016-08-11 17:46:05 -0700 | [diff] [blame] | 240 | if (test_temp_block[j] > 0) { |
| 241 | test_temp_block[j] += 2; |
| 242 | test_temp_block[j] /= 4; |
| 243 | test_temp_block[j] *= 4; |
| 244 | } else { |
| 245 | test_temp_block[j] -= 2; |
| 246 | test_temp_block[j] /= 4; |
| 247 | test_temp_block[j] *= 4; |
| 248 | } |
Jingning Han | 4bd1711 | 2013-09-16 16:01:50 -0700 | [diff] [blame] | 249 | } |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 250 | if (bit_depth_ == AOM_BITS_8) { |
clang-format | 3a826f1 | 2016-08-11 17:46:05 -0700 | [diff] [blame] | 251 | ASM_REGISTER_STATE_CHECK(RunInvTxfm(test_temp_block, dst, pitch_)); |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 252 | #if CONFIG_AOM_HIGHBITDEPTH |
Deb Mukherjee | 10783d4 | 2014-09-02 16:34:09 -0700 | [diff] [blame] | 253 | } else { |
| 254 | ASM_REGISTER_STATE_CHECK( |
| 255 | RunInvTxfm(test_temp_block, CONVERT_TO_BYTEPTR(dst16), pitch_)); |
| 256 | #endif |
| 257 | } |
Daniel Kang | 26641c7 | 2012-06-28 16:26:31 -0700 | [diff] [blame] | 258 | |
Jingning Han | 4bd1711 | 2013-09-16 16:01:50 -0700 | [diff] [blame] | 259 | for (int j = 0; j < 64; ++j) { |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 260 | #if CONFIG_AOM_HIGHBITDEPTH |
Deb Mukherjee | 10783d4 | 2014-09-02 16:34:09 -0700 | [diff] [blame] | 261 | const int diff = |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 262 | bit_depth_ == AOM_BITS_8 ? dst[j] - src[j] : dst16[j] - src16[j]; |
Deb Mukherjee | 10783d4 | 2014-09-02 16:34:09 -0700 | [diff] [blame] | 263 | #else |
Jingning Han | 4bd1711 | 2013-09-16 16:01:50 -0700 | [diff] [blame] | 264 | const int diff = dst[j] - src[j]; |
Deb Mukherjee | 10783d4 | 2014-09-02 16:34:09 -0700 | [diff] [blame] | 265 | #endif |
Jingning Han | 4bd1711 | 2013-09-16 16:01:50 -0700 | [diff] [blame] | 266 | const int error = diff * diff; |
clang-format | 3a826f1 | 2016-08-11 17:46:05 -0700 | [diff] [blame] | 267 | if (max_error < error) max_error = error; |
Jingning Han | 4bd1711 | 2013-09-16 16:01:50 -0700 | [diff] [blame] | 268 | total_error += error; |
| 269 | } |
Daniel Kang | 26641c7 | 2012-06-28 16:26:31 -0700 | [diff] [blame] | 270 | } |
| 271 | |
Deb Mukherjee | 10783d4 | 2014-09-02 16:34:09 -0700 | [diff] [blame] | 272 | EXPECT_GE(1 << 2 * (bit_depth_ - 8), max_error) |
clang-format | 3a826f1 | 2016-08-11 17:46:05 -0700 | [diff] [blame] | 273 | << "Error: 8x8 FDCT/IDCT or FHT/IHT has an individual" |
| 274 | << " roundtrip error > 1"; |
Daniel Kang | 26641c7 | 2012-06-28 16:26:31 -0700 | [diff] [blame] | 275 | |
clang-format | 3a826f1 | 2016-08-11 17:46:05 -0700 | [diff] [blame] | 276 | EXPECT_GE((count_test_block << 2 * (bit_depth_ - 8)) / 5, total_error) |
| 277 | << "Error: 8x8 FDCT/IDCT or FHT/IHT has average roundtrip " |
| 278 | << "error > 1/5 per block"; |
Daniel Kang | 26641c7 | 2012-06-28 16:26:31 -0700 | [diff] [blame] | 279 | } |
Jingning Han | 4bd1711 | 2013-09-16 16:01:50 -0700 | [diff] [blame] | 280 | |
| 281 | void RunExtremalCheck() { |
| 282 | ACMRandom rnd(ACMRandom::DeterministicSeed()); |
| 283 | int max_error = 0; |
| 284 | int total_error = 0; |
Jingning Han | 5c2696c | 2014-06-02 16:40:01 -0700 | [diff] [blame] | 285 | int total_coeff_error = 0; |
Jingning Han | 4bd1711 | 2013-09-16 16:01:50 -0700 | [diff] [blame] | 286 | const int count_test_block = 100000; |
James Zern | fd3658b | 2015-05-02 13:24:16 -0700 | [diff] [blame] | 287 | DECLARE_ALIGNED(16, int16_t, test_input_block[64]); |
| 288 | DECLARE_ALIGNED(16, tran_low_t, test_temp_block[64]); |
| 289 | DECLARE_ALIGNED(16, tran_low_t, ref_temp_block[64]); |
| 290 | DECLARE_ALIGNED(16, uint8_t, dst[64]); |
| 291 | DECLARE_ALIGNED(16, uint8_t, src[64]); |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 292 | #if CONFIG_AOM_HIGHBITDEPTH |
James Zern | fd3658b | 2015-05-02 13:24:16 -0700 | [diff] [blame] | 293 | DECLARE_ALIGNED(16, uint16_t, dst16[64]); |
| 294 | DECLARE_ALIGNED(16, uint16_t, src16[64]); |
Deb Mukherjee | 10783d4 | 2014-09-02 16:34:09 -0700 | [diff] [blame] | 295 | #endif |
Jingning Han | 4bd1711 | 2013-09-16 16:01:50 -0700 | [diff] [blame] | 296 | |
| 297 | for (int i = 0; i < count_test_block; ++i) { |
Deb Mukherjee | 10783d4 | 2014-09-02 16:34:09 -0700 | [diff] [blame] | 298 | // Initialize a test block with input range [-mask_, mask_]. |
Jingning Han | 4bd1711 | 2013-09-16 16:01:50 -0700 | [diff] [blame] | 299 | for (int j = 0; j < 64; ++j) { |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 300 | if (bit_depth_ == AOM_BITS_8) { |
Deb Mukherjee | 10783d4 | 2014-09-02 16:34:09 -0700 | [diff] [blame] | 301 | if (i == 0) { |
| 302 | src[j] = 255; |
| 303 | dst[j] = 0; |
| 304 | } else if (i == 1) { |
| 305 | src[j] = 0; |
| 306 | dst[j] = 255; |
| 307 | } else { |
| 308 | src[j] = rnd.Rand8() % 2 ? 255 : 0; |
| 309 | dst[j] = rnd.Rand8() % 2 ? 255 : 0; |
| 310 | } |
| 311 | test_input_block[j] = src[j] - dst[j]; |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 312 | #if CONFIG_AOM_HIGHBITDEPTH |
Jingning Han | 0343e30 | 2014-06-03 16:45:22 -0700 | [diff] [blame] | 313 | } else { |
Deb Mukherjee | 10783d4 | 2014-09-02 16:34:09 -0700 | [diff] [blame] | 314 | if (i == 0) { |
| 315 | src16[j] = mask_; |
| 316 | dst16[j] = 0; |
| 317 | } else if (i == 1) { |
| 318 | src16[j] = 0; |
| 319 | dst16[j] = mask_; |
| 320 | } else { |
| 321 | src16[j] = rnd.Rand8() % 2 ? mask_ : 0; |
| 322 | dst16[j] = rnd.Rand8() % 2 ? mask_ : 0; |
| 323 | } |
| 324 | test_input_block[j] = src16[j] - dst16[j]; |
| 325 | #endif |
Jingning Han | 5c2696c | 2014-06-02 16:40:01 -0700 | [diff] [blame] | 326 | } |
Jingning Han | 4bd1711 | 2013-09-16 16:01:50 -0700 | [diff] [blame] | 327 | } |
| 328 | |
James Zern | 29e1b1a | 2014-07-09 21:02:02 -0700 | [diff] [blame] | 329 | ASM_REGISTER_STATE_CHECK( |
Jingning Han | 4bd1711 | 2013-09-16 16:01:50 -0700 | [diff] [blame] | 330 | RunFwdTxfm(test_input_block, test_temp_block, pitch_)); |
James Zern | 29e1b1a | 2014-07-09 21:02:02 -0700 | [diff] [blame] | 331 | ASM_REGISTER_STATE_CHECK( |
Jingning Han | 5c2696c | 2014-06-02 16:40:01 -0700 | [diff] [blame] | 332 | fwd_txfm_ref(test_input_block, ref_temp_block, pitch_, tx_type_)); |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 333 | if (bit_depth_ == AOM_BITS_8) { |
clang-format | 3a826f1 | 2016-08-11 17:46:05 -0700 | [diff] [blame] | 334 | ASM_REGISTER_STATE_CHECK(RunInvTxfm(test_temp_block, dst, pitch_)); |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 335 | #if CONFIG_AOM_HIGHBITDEPTH |
Deb Mukherjee | 10783d4 | 2014-09-02 16:34:09 -0700 | [diff] [blame] | 336 | } else { |
| 337 | ASM_REGISTER_STATE_CHECK( |
| 338 | RunInvTxfm(test_temp_block, CONVERT_TO_BYTEPTR(dst16), pitch_)); |
| 339 | #endif |
| 340 | } |
Jingning Han | 4bd1711 | 2013-09-16 16:01:50 -0700 | [diff] [blame] | 341 | |
| 342 | for (int j = 0; j < 64; ++j) { |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 343 | #if CONFIG_AOM_HIGHBITDEPTH |
Deb Mukherjee | 10783d4 | 2014-09-02 16:34:09 -0700 | [diff] [blame] | 344 | const int diff = |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 345 | bit_depth_ == AOM_BITS_8 ? dst[j] - src[j] : dst16[j] - src16[j]; |
Deb Mukherjee | 10783d4 | 2014-09-02 16:34:09 -0700 | [diff] [blame] | 346 | #else |
Jingning Han | 4bd1711 | 2013-09-16 16:01:50 -0700 | [diff] [blame] | 347 | const int diff = dst[j] - src[j]; |
Deb Mukherjee | 10783d4 | 2014-09-02 16:34:09 -0700 | [diff] [blame] | 348 | #endif |
Jingning Han | 4bd1711 | 2013-09-16 16:01:50 -0700 | [diff] [blame] | 349 | const int error = diff * diff; |
clang-format | 3a826f1 | 2016-08-11 17:46:05 -0700 | [diff] [blame] | 350 | if (max_error < error) max_error = error; |
Jingning Han | 4bd1711 | 2013-09-16 16:01:50 -0700 | [diff] [blame] | 351 | total_error += error; |
Jingning Han | 5c2696c | 2014-06-02 16:40:01 -0700 | [diff] [blame] | 352 | |
| 353 | const int coeff_diff = test_temp_block[j] - ref_temp_block[j]; |
| 354 | total_coeff_error += abs(coeff_diff); |
Jingning Han | 4bd1711 | 2013-09-16 16:01:50 -0700 | [diff] [blame] | 355 | } |
| 356 | |
Deb Mukherjee | 10783d4 | 2014-09-02 16:34:09 -0700 | [diff] [blame] | 357 | EXPECT_GE(1 << 2 * (bit_depth_ - 8), max_error) |
Jingning Han | 4bd1711 | 2013-09-16 16:01:50 -0700 | [diff] [blame] | 358 | << "Error: Extremal 8x8 FDCT/IDCT or FHT/IHT has" |
| 359 | << "an individual roundtrip error > 1"; |
| 360 | |
clang-format | 3a826f1 | 2016-08-11 17:46:05 -0700 | [diff] [blame] | 361 | EXPECT_GE((count_test_block << 2 * (bit_depth_ - 8)) / 5, total_error) |
Jingning Han | 4bd1711 | 2013-09-16 16:01:50 -0700 | [diff] [blame] | 362 | << "Error: Extremal 8x8 FDCT/IDCT or FHT/IHT has average" |
| 363 | << " roundtrip error > 1/5 per block"; |
Jingning Han | 5c2696c | 2014-06-02 16:40:01 -0700 | [diff] [blame] | 364 | |
| 365 | EXPECT_EQ(0, total_coeff_error) |
| 366 | << "Error: Extremal 8x8 FDCT/FHT has" |
| 367 | << "overflow issues in the intermediate steps > 1"; |
Jingning Han | 4bd1711 | 2013-09-16 16:01:50 -0700 | [diff] [blame] | 368 | } |
| 369 | } |
| 370 | |
Deb Mukherjee | 10783d4 | 2014-09-02 16:34:09 -0700 | [diff] [blame] | 371 | void RunInvAccuracyCheck() { |
| 372 | ACMRandom rnd(ACMRandom::DeterministicSeed()); |
| 373 | const int count_test_block = 1000; |
James Zern | fd3658b | 2015-05-02 13:24:16 -0700 | [diff] [blame] | 374 | DECLARE_ALIGNED(16, int16_t, in[kNumCoeffs]); |
| 375 | DECLARE_ALIGNED(16, tran_low_t, coeff[kNumCoeffs]); |
| 376 | DECLARE_ALIGNED(16, uint8_t, dst[kNumCoeffs]); |
| 377 | DECLARE_ALIGNED(16, uint8_t, src[kNumCoeffs]); |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 378 | #if CONFIG_AOM_HIGHBITDEPTH |
James Zern | fd3658b | 2015-05-02 13:24:16 -0700 | [diff] [blame] | 379 | DECLARE_ALIGNED(16, uint16_t, src16[kNumCoeffs]); |
| 380 | DECLARE_ALIGNED(16, uint16_t, dst16[kNumCoeffs]); |
Deb Mukherjee | 10783d4 | 2014-09-02 16:34:09 -0700 | [diff] [blame] | 381 | #endif |
| 382 | |
| 383 | for (int i = 0; i < count_test_block; ++i) { |
| 384 | double out_r[kNumCoeffs]; |
| 385 | |
| 386 | // Initialize a test block with input range [-255, 255]. |
| 387 | for (int j = 0; j < kNumCoeffs; ++j) { |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 388 | if (bit_depth_ == AOM_BITS_8) { |
Deb Mukherjee | 10783d4 | 2014-09-02 16:34:09 -0700 | [diff] [blame] | 389 | src[j] = rnd.Rand8() % 2 ? 255 : 0; |
| 390 | dst[j] = src[j] > 0 ? 0 : 255; |
| 391 | in[j] = src[j] - dst[j]; |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 392 | #if CONFIG_AOM_HIGHBITDEPTH |
Deb Mukherjee | 10783d4 | 2014-09-02 16:34:09 -0700 | [diff] [blame] | 393 | } else { |
| 394 | src16[j] = rnd.Rand8() % 2 ? mask_ : 0; |
| 395 | dst16[j] = src16[j] > 0 ? 0 : mask_; |
| 396 | in[j] = src16[j] - dst16[j]; |
| 397 | #endif |
| 398 | } |
| 399 | } |
| 400 | |
| 401 | reference_8x8_dct_2d(in, out_r); |
| 402 | for (int j = 0; j < kNumCoeffs; ++j) |
Deb Mukherjee | 41e6ec4 | 2014-09-13 04:11:50 -0700 | [diff] [blame] | 403 | coeff[j] = static_cast<tran_low_t>(round(out_r[j])); |
Deb Mukherjee | 10783d4 | 2014-09-02 16:34:09 -0700 | [diff] [blame] | 404 | |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 405 | if (bit_depth_ == AOM_BITS_8) { |
Deb Mukherjee | 10783d4 | 2014-09-02 16:34:09 -0700 | [diff] [blame] | 406 | ASM_REGISTER_STATE_CHECK(RunInvTxfm(coeff, dst, pitch_)); |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 407 | #if CONFIG_AOM_HIGHBITDEPTH |
Deb Mukherjee | 10783d4 | 2014-09-02 16:34:09 -0700 | [diff] [blame] | 408 | } else { |
clang-format | 3a826f1 | 2016-08-11 17:46:05 -0700 | [diff] [blame] | 409 | ASM_REGISTER_STATE_CHECK( |
| 410 | RunInvTxfm(coeff, CONVERT_TO_BYTEPTR(dst16), pitch_)); |
Deb Mukherjee | 10783d4 | 2014-09-02 16:34:09 -0700 | [diff] [blame] | 411 | #endif |
| 412 | } |
| 413 | |
| 414 | for (int j = 0; j < kNumCoeffs; ++j) { |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 415 | #if CONFIG_AOM_HIGHBITDEPTH |
James Zern | 95d2dc8 | 2016-06-08 17:33:34 -0700 | [diff] [blame] | 416 | const int diff = |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 417 | bit_depth_ == AOM_BITS_8 ? dst[j] - src[j] : dst16[j] - src16[j]; |
Deb Mukherjee | 10783d4 | 2014-09-02 16:34:09 -0700 | [diff] [blame] | 418 | #else |
James Zern | 95d2dc8 | 2016-06-08 17:33:34 -0700 | [diff] [blame] | 419 | const int diff = dst[j] - src[j]; |
Deb Mukherjee | 10783d4 | 2014-09-02 16:34:09 -0700 | [diff] [blame] | 420 | #endif |
| 421 | const uint32_t error = diff * diff; |
| 422 | EXPECT_GE(1u << 2 * (bit_depth_ - 8), error) |
clang-format | 3a826f1 | 2016-08-11 17:46:05 -0700 | [diff] [blame] | 423 | << "Error: 8x8 IDCT has error " << error << " at index " << j; |
Deb Mukherjee | 10783d4 | 2014-09-02 16:34:09 -0700 | [diff] [blame] | 424 | } |
| 425 | } |
| 426 | } |
| 427 | |
| 428 | void RunFwdAccuracyCheck() { |
| 429 | ACMRandom rnd(ACMRandom::DeterministicSeed()); |
| 430 | const int count_test_block = 1000; |
James Zern | fd3658b | 2015-05-02 13:24:16 -0700 | [diff] [blame] | 431 | DECLARE_ALIGNED(16, int16_t, in[kNumCoeffs]); |
| 432 | DECLARE_ALIGNED(16, tran_low_t, coeff_r[kNumCoeffs]); |
| 433 | DECLARE_ALIGNED(16, tran_low_t, coeff[kNumCoeffs]); |
Deb Mukherjee | 10783d4 | 2014-09-02 16:34:09 -0700 | [diff] [blame] | 434 | |
| 435 | for (int i = 0; i < count_test_block; ++i) { |
| 436 | double out_r[kNumCoeffs]; |
| 437 | |
| 438 | // Initialize a test block with input range [-mask_, mask_]. |
| 439 | for (int j = 0; j < kNumCoeffs; ++j) |
| 440 | in[j] = rnd.Rand8() % 2 == 0 ? mask_ : -mask_; |
| 441 | |
| 442 | RunFwdTxfm(in, coeff, pitch_); |
| 443 | reference_8x8_dct_2d(in, out_r); |
| 444 | for (int j = 0; j < kNumCoeffs; ++j) |
Deb Mukherjee | 41e6ec4 | 2014-09-13 04:11:50 -0700 | [diff] [blame] | 445 | coeff_r[j] = static_cast<tran_low_t>(round(out_r[j])); |
Deb Mukherjee | 10783d4 | 2014-09-02 16:34:09 -0700 | [diff] [blame] | 446 | |
| 447 | for (int j = 0; j < kNumCoeffs; ++j) { |
Yaowu Xu | 6382727 | 2016-05-31 16:54:58 -0700 | [diff] [blame] | 448 | const int32_t diff = coeff[j] - coeff_r[j]; |
Deb Mukherjee | 10783d4 | 2014-09-02 16:34:09 -0700 | [diff] [blame] | 449 | const uint32_t error = diff * diff; |
| 450 | EXPECT_GE(9u << 2 * (bit_depth_ - 8), error) |
clang-format | 3a826f1 | 2016-08-11 17:46:05 -0700 | [diff] [blame] | 451 | << "Error: 8x8 DCT has error " << error << " at index " << j; |
Deb Mukherjee | 10783d4 | 2014-09-02 16:34:09 -0700 | [diff] [blame] | 452 | } |
| 453 | } |
| 454 | } |
Peter de Rivaz | 7e40a55 | 2014-10-24 08:48:02 +0100 | [diff] [blame] | 455 | |
clang-format | 3a826f1 | 2016-08-11 17:46:05 -0700 | [diff] [blame] | 456 | void CompareInvReference(IdctFunc ref_txfm, int thresh) { |
Peter de Rivaz | 7e40a55 | 2014-10-24 08:48:02 +0100 | [diff] [blame] | 457 | ACMRandom rnd(ACMRandom::DeterministicSeed()); |
| 458 | const int count_test_block = 10000; |
| 459 | const int eob = 12; |
James Zern | fd3658b | 2015-05-02 13:24:16 -0700 | [diff] [blame] | 460 | DECLARE_ALIGNED(16, tran_low_t, coeff[kNumCoeffs]); |
| 461 | DECLARE_ALIGNED(16, uint8_t, dst[kNumCoeffs]); |
| 462 | DECLARE_ALIGNED(16, uint8_t, ref[kNumCoeffs]); |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 463 | #if CONFIG_AOM_HIGHBITDEPTH |
James Zern | fd3658b | 2015-05-02 13:24:16 -0700 | [diff] [blame] | 464 | DECLARE_ALIGNED(16, uint16_t, dst16[kNumCoeffs]); |
| 465 | DECLARE_ALIGNED(16, uint16_t, ref16[kNumCoeffs]); |
Peter de Rivaz | 7e40a55 | 2014-10-24 08:48:02 +0100 | [diff] [blame] | 466 | #endif |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 467 | const int16_t *scan = av1_default_scan_orders[TX_8X8].scan; |
Peter de Rivaz | 7e40a55 | 2014-10-24 08:48:02 +0100 | [diff] [blame] | 468 | |
| 469 | for (int i = 0; i < count_test_block; ++i) { |
| 470 | for (int j = 0; j < kNumCoeffs; ++j) { |
| 471 | if (j < eob) { |
| 472 | // Random values less than the threshold, either positive or negative |
clang-format | 3a826f1 | 2016-08-11 17:46:05 -0700 | [diff] [blame] | 473 | coeff[scan[j]] = rnd(thresh) * (1 - 2 * (i % 2)); |
Peter de Rivaz | 7e40a55 | 2014-10-24 08:48:02 +0100 | [diff] [blame] | 474 | } else { |
| 475 | coeff[scan[j]] = 0; |
| 476 | } |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 477 | if (bit_depth_ == AOM_BITS_8) { |
Peter de Rivaz | 7e40a55 | 2014-10-24 08:48:02 +0100 | [diff] [blame] | 478 | dst[j] = 0; |
| 479 | ref[j] = 0; |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 480 | #if CONFIG_AOM_HIGHBITDEPTH |
Peter de Rivaz | 7e40a55 | 2014-10-24 08:48:02 +0100 | [diff] [blame] | 481 | } else { |
| 482 | dst16[j] = 0; |
| 483 | ref16[j] = 0; |
| 484 | #endif |
| 485 | } |
| 486 | } |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 487 | if (bit_depth_ == AOM_BITS_8) { |
Peter de Rivaz | 7e40a55 | 2014-10-24 08:48:02 +0100 | [diff] [blame] | 488 | ref_txfm(coeff, ref, pitch_); |
| 489 | ASM_REGISTER_STATE_CHECK(RunInvTxfm(coeff, dst, pitch_)); |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 490 | #if CONFIG_AOM_HIGHBITDEPTH |
Peter de Rivaz | 7e40a55 | 2014-10-24 08:48:02 +0100 | [diff] [blame] | 491 | } else { |
| 492 | ref_txfm(coeff, CONVERT_TO_BYTEPTR(ref16), pitch_); |
clang-format | 3a826f1 | 2016-08-11 17:46:05 -0700 | [diff] [blame] | 493 | ASM_REGISTER_STATE_CHECK( |
| 494 | RunInvTxfm(coeff, CONVERT_TO_BYTEPTR(dst16), pitch_)); |
Peter de Rivaz | 7e40a55 | 2014-10-24 08:48:02 +0100 | [diff] [blame] | 495 | #endif |
| 496 | } |
| 497 | |
| 498 | for (int j = 0; j < kNumCoeffs; ++j) { |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 499 | #if CONFIG_AOM_HIGHBITDEPTH |
James Zern | 95d2dc8 | 2016-06-08 17:33:34 -0700 | [diff] [blame] | 500 | const int diff = |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 501 | bit_depth_ == AOM_BITS_8 ? dst[j] - ref[j] : dst16[j] - ref16[j]; |
Peter de Rivaz | 7e40a55 | 2014-10-24 08:48:02 +0100 | [diff] [blame] | 502 | #else |
James Zern | 95d2dc8 | 2016-06-08 17:33:34 -0700 | [diff] [blame] | 503 | const int diff = dst[j] - ref[j]; |
Peter de Rivaz | 7e40a55 | 2014-10-24 08:48:02 +0100 | [diff] [blame] | 504 | #endif |
| 505 | const uint32_t error = diff * diff; |
clang-format | 3a826f1 | 2016-08-11 17:46:05 -0700 | [diff] [blame] | 506 | EXPECT_EQ(0u, error) << "Error: 8x8 IDCT has error " << error |
| 507 | << " at index " << j; |
Peter de Rivaz | 7e40a55 | 2014-10-24 08:48:02 +0100 | [diff] [blame] | 508 | } |
| 509 | } |
| 510 | } |
Jingning Han | 4bd1711 | 2013-09-16 16:01:50 -0700 | [diff] [blame] | 511 | int pitch_; |
| 512 | int tx_type_; |
James Zern | 54697d3 | 2014-07-16 18:56:22 -0700 | [diff] [blame] | 513 | FhtFunc fwd_txfm_ref; |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 514 | aom_bit_depth_t bit_depth_; |
Deb Mukherjee | 10783d4 | 2014-09-02 16:34:09 -0700 | [diff] [blame] | 515 | int mask_; |
Jingning Han | 4bd1711 | 2013-09-16 16:01:50 -0700 | [diff] [blame] | 516 | }; |
| 517 | |
clang-format | 3a826f1 | 2016-08-11 17:46:05 -0700 | [diff] [blame] | 518 | class FwdTrans8x8DCT : public FwdTrans8x8TestBase, |
| 519 | public ::testing::TestWithParam<Dct8x8Param> { |
Jingning Han | 4bd1711 | 2013-09-16 16:01:50 -0700 | [diff] [blame] | 520 | public: |
| 521 | virtual ~FwdTrans8x8DCT() {} |
| 522 | |
| 523 | virtual void SetUp() { |
| 524 | fwd_txfm_ = GET_PARAM(0); |
| 525 | inv_txfm_ = GET_PARAM(1); |
clang-format | 3a826f1 | 2016-08-11 17:46:05 -0700 | [diff] [blame] | 526 | tx_type_ = GET_PARAM(2); |
| 527 | pitch_ = 8; |
Jingning Han | 4bd1711 | 2013-09-16 16:01:50 -0700 | [diff] [blame] | 528 | fwd_txfm_ref = fdct8x8_ref; |
Deb Mukherjee | 10783d4 | 2014-09-02 16:34:09 -0700 | [diff] [blame] | 529 | bit_depth_ = GET_PARAM(3); |
| 530 | mask_ = (1 << bit_depth_) - 1; |
Jingning Han | 4bd1711 | 2013-09-16 16:01:50 -0700 | [diff] [blame] | 531 | } |
| 532 | |
Yaowu Xu | c27fc14 | 2016-08-22 16:08:15 -0700 | [diff] [blame] | 533 | virtual void TearDown() { libaom_test::ClearSystemState(); } |
Jingning Han | 4bd1711 | 2013-09-16 16:01:50 -0700 | [diff] [blame] | 534 | |
| 535 | protected: |
Deb Mukherjee | 10783d4 | 2014-09-02 16:34:09 -0700 | [diff] [blame] | 536 | void RunFwdTxfm(int16_t *in, tran_low_t *out, int stride) { |
Jingning Han | 4bd1711 | 2013-09-16 16:01:50 -0700 | [diff] [blame] | 537 | fwd_txfm_(in, out, stride); |
| 538 | } |
Deb Mukherjee | 10783d4 | 2014-09-02 16:34:09 -0700 | [diff] [blame] | 539 | void RunInvTxfm(tran_low_t *out, uint8_t *dst, int stride) { |
Dmitry Kovalev | e5fa44c | 2013-10-18 12:20:26 -0700 | [diff] [blame] | 540 | inv_txfm_(out, dst, stride); |
Jingning Han | 4bd1711 | 2013-09-16 16:01:50 -0700 | [diff] [blame] | 541 | } |
| 542 | |
James Zern | 54697d3 | 2014-07-16 18:56:22 -0700 | [diff] [blame] | 543 | FdctFunc fwd_txfm_; |
| 544 | IdctFunc inv_txfm_; |
Jingning Han | 4bd1711 | 2013-09-16 16:01:50 -0700 | [diff] [blame] | 545 | }; |
| 546 | |
clang-format | 3a826f1 | 2016-08-11 17:46:05 -0700 | [diff] [blame] | 547 | TEST_P(FwdTrans8x8DCT, SignBiasCheck) { RunSignBiasCheck(); } |
Daniel Kang | 26641c7 | 2012-06-28 16:26:31 -0700 | [diff] [blame] | 548 | |
clang-format | 3a826f1 | 2016-08-11 17:46:05 -0700 | [diff] [blame] | 549 | TEST_P(FwdTrans8x8DCT, RoundTripErrorCheck) { RunRoundTripErrorCheck(); } |
Jingning Han | 4bd1711 | 2013-09-16 16:01:50 -0700 | [diff] [blame] | 550 | |
clang-format | 3a826f1 | 2016-08-11 17:46:05 -0700 | [diff] [blame] | 551 | TEST_P(FwdTrans8x8DCT, ExtremalCheck) { RunExtremalCheck(); } |
Jingning Han | 4bd1711 | 2013-09-16 16:01:50 -0700 | [diff] [blame] | 552 | |
clang-format | 3a826f1 | 2016-08-11 17:46:05 -0700 | [diff] [blame] | 553 | TEST_P(FwdTrans8x8DCT, FwdAccuracyCheck) { RunFwdAccuracyCheck(); } |
Deb Mukherjee | 10783d4 | 2014-09-02 16:34:09 -0700 | [diff] [blame] | 554 | |
clang-format | 3a826f1 | 2016-08-11 17:46:05 -0700 | [diff] [blame] | 555 | TEST_P(FwdTrans8x8DCT, InvAccuracyCheck) { RunInvAccuracyCheck(); } |
Deb Mukherjee | 10783d4 | 2014-09-02 16:34:09 -0700 | [diff] [blame] | 556 | |
clang-format | 3a826f1 | 2016-08-11 17:46:05 -0700 | [diff] [blame] | 557 | class FwdTrans8x8HT : public FwdTrans8x8TestBase, |
| 558 | public ::testing::TestWithParam<Ht8x8Param> { |
Jingning Han | 4bd1711 | 2013-09-16 16:01:50 -0700 | [diff] [blame] | 559 | public: |
| 560 | virtual ~FwdTrans8x8HT() {} |
| 561 | |
| 562 | virtual void SetUp() { |
| 563 | fwd_txfm_ = GET_PARAM(0); |
| 564 | inv_txfm_ = GET_PARAM(1); |
clang-format | 3a826f1 | 2016-08-11 17:46:05 -0700 | [diff] [blame] | 565 | tx_type_ = GET_PARAM(2); |
| 566 | pitch_ = 8; |
Jingning Han | 4bd1711 | 2013-09-16 16:01:50 -0700 | [diff] [blame] | 567 | fwd_txfm_ref = fht8x8_ref; |
Deb Mukherjee | 10783d4 | 2014-09-02 16:34:09 -0700 | [diff] [blame] | 568 | bit_depth_ = GET_PARAM(3); |
| 569 | mask_ = (1 << bit_depth_) - 1; |
Jingning Han | 4bd1711 | 2013-09-16 16:01:50 -0700 | [diff] [blame] | 570 | } |
| 571 | |
Yaowu Xu | c27fc14 | 2016-08-22 16:08:15 -0700 | [diff] [blame] | 572 | virtual void TearDown() { libaom_test::ClearSystemState(); } |
Jingning Han | 4bd1711 | 2013-09-16 16:01:50 -0700 | [diff] [blame] | 573 | |
| 574 | protected: |
Deb Mukherjee | 10783d4 | 2014-09-02 16:34:09 -0700 | [diff] [blame] | 575 | void RunFwdTxfm(int16_t *in, tran_low_t *out, int stride) { |
Jingning Han | 4bd1711 | 2013-09-16 16:01:50 -0700 | [diff] [blame] | 576 | fwd_txfm_(in, out, stride, tx_type_); |
| 577 | } |
Deb Mukherjee | 10783d4 | 2014-09-02 16:34:09 -0700 | [diff] [blame] | 578 | void RunInvTxfm(tran_low_t *out, uint8_t *dst, int stride) { |
Jingning Han | 4bd1711 | 2013-09-16 16:01:50 -0700 | [diff] [blame] | 579 | inv_txfm_(out, dst, stride, tx_type_); |
| 580 | } |
| 581 | |
James Zern | 54697d3 | 2014-07-16 18:56:22 -0700 | [diff] [blame] | 582 | FhtFunc fwd_txfm_; |
| 583 | IhtFunc inv_txfm_; |
Jingning Han | 4bd1711 | 2013-09-16 16:01:50 -0700 | [diff] [blame] | 584 | }; |
| 585 | |
clang-format | 3a826f1 | 2016-08-11 17:46:05 -0700 | [diff] [blame] | 586 | TEST_P(FwdTrans8x8HT, SignBiasCheck) { RunSignBiasCheck(); } |
Jingning Han | 4bd1711 | 2013-09-16 16:01:50 -0700 | [diff] [blame] | 587 | |
clang-format | 3a826f1 | 2016-08-11 17:46:05 -0700 | [diff] [blame] | 588 | TEST_P(FwdTrans8x8HT, RoundTripErrorCheck) { RunRoundTripErrorCheck(); } |
Jingning Han | 4bd1711 | 2013-09-16 16:01:50 -0700 | [diff] [blame] | 589 | |
clang-format | 3a826f1 | 2016-08-11 17:46:05 -0700 | [diff] [blame] | 590 | TEST_P(FwdTrans8x8HT, ExtremalCheck) { RunExtremalCheck(); } |
Jingning Han | 4bd1711 | 2013-09-16 16:01:50 -0700 | [diff] [blame] | 591 | |
clang-format | 3a826f1 | 2016-08-11 17:46:05 -0700 | [diff] [blame] | 592 | class InvTrans8x8DCT : public FwdTrans8x8TestBase, |
| 593 | public ::testing::TestWithParam<Idct8x8Param> { |
Peter de Rivaz | 7e40a55 | 2014-10-24 08:48:02 +0100 | [diff] [blame] | 594 | public: |
| 595 | virtual ~InvTrans8x8DCT() {} |
| 596 | |
| 597 | virtual void SetUp() { |
| 598 | ref_txfm_ = GET_PARAM(0); |
| 599 | inv_txfm_ = GET_PARAM(1); |
| 600 | thresh_ = GET_PARAM(2); |
| 601 | pitch_ = 8; |
| 602 | bit_depth_ = GET_PARAM(3); |
| 603 | mask_ = (1 << bit_depth_) - 1; |
| 604 | } |
| 605 | |
Yaowu Xu | c27fc14 | 2016-08-22 16:08:15 -0700 | [diff] [blame] | 606 | virtual void TearDown() { libaom_test::ClearSystemState(); } |
Peter de Rivaz | 7e40a55 | 2014-10-24 08:48:02 +0100 | [diff] [blame] | 607 | |
| 608 | protected: |
| 609 | void RunInvTxfm(tran_low_t *out, uint8_t *dst, int stride) { |
| 610 | inv_txfm_(out, dst, stride); |
| 611 | } |
James Zern | cffef11 | 2016-02-11 18:27:00 -0800 | [diff] [blame] | 612 | void RunFwdTxfm(int16_t * /*out*/, tran_low_t * /*dst*/, int /*stride*/) {} |
Peter de Rivaz | 7e40a55 | 2014-10-24 08:48:02 +0100 | [diff] [blame] | 613 | |
| 614 | IdctFunc ref_txfm_; |
| 615 | IdctFunc inv_txfm_; |
| 616 | int thresh_; |
| 617 | }; |
| 618 | |
| 619 | TEST_P(InvTrans8x8DCT, CompareReference) { |
| 620 | CompareInvReference(ref_txfm_, thresh_); |
| 621 | } |
| 622 | |
Jingning Han | 4bd1711 | 2013-09-16 16:01:50 -0700 | [diff] [blame] | 623 | using std::tr1::make_tuple; |
| 624 | |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 625 | #if CONFIG_AOM_HIGHBITDEPTH |
Jingning Han | 4bd1711 | 2013-09-16 16:01:50 -0700 | [diff] [blame] | 626 | INSTANTIATE_TEST_CASE_P( |
| 627 | C, FwdTrans8x8DCT, |
| 628 | ::testing::Values( |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 629 | make_tuple(&aom_fdct8x8_c, &aom_idct8x8_64_add_c, 0, AOM_BITS_8), |
| 630 | make_tuple(&aom_highbd_fdct8x8_c, &idct8x8_10, 0, AOM_BITS_10), |
| 631 | make_tuple(&aom_highbd_fdct8x8_c, &idct8x8_12, 0, AOM_BITS_12))); |
Deb Mukherjee | 10783d4 | 2014-09-02 16:34:09 -0700 | [diff] [blame] | 632 | #else |
clang-format | 3a826f1 | 2016-08-11 17:46:05 -0700 | [diff] [blame] | 633 | INSTANTIATE_TEST_CASE_P(C, FwdTrans8x8DCT, |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 634 | ::testing::Values(make_tuple(&aom_fdct8x8_c, |
| 635 | &aom_idct8x8_64_add_c, 0, |
| 636 | AOM_BITS_8))); |
| 637 | #endif // CONFIG_AOM_HIGHBITDEPTH |
Deb Mukherjee | 10783d4 | 2014-09-02 16:34:09 -0700 | [diff] [blame] | 638 | |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 639 | #if CONFIG_AOM_HIGHBITDEPTH |
Jingning Han | 4bd1711 | 2013-09-16 16:01:50 -0700 | [diff] [blame] | 640 | INSTANTIATE_TEST_CASE_P( |
| 641 | C, FwdTrans8x8HT, |
| 642 | ::testing::Values( |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 643 | make_tuple(&av1_fht8x8_c, &av1_iht8x8_64_add_c, 0, AOM_BITS_8), |
| 644 | make_tuple(&av1_highbd_fht8x8_c, &iht8x8_10, 0, AOM_BITS_10), |
| 645 | make_tuple(&av1_highbd_fht8x8_c, &iht8x8_10, 1, AOM_BITS_10), |
| 646 | make_tuple(&av1_highbd_fht8x8_c, &iht8x8_10, 2, AOM_BITS_10), |
| 647 | make_tuple(&av1_highbd_fht8x8_c, &iht8x8_10, 3, AOM_BITS_10), |
| 648 | make_tuple(&av1_highbd_fht8x8_c, &iht8x8_12, 0, AOM_BITS_12), |
| 649 | make_tuple(&av1_highbd_fht8x8_c, &iht8x8_12, 1, AOM_BITS_12), |
| 650 | make_tuple(&av1_highbd_fht8x8_c, &iht8x8_12, 2, AOM_BITS_12), |
| 651 | make_tuple(&av1_highbd_fht8x8_c, &iht8x8_12, 3, AOM_BITS_12), |
| 652 | make_tuple(&av1_fht8x8_c, &av1_iht8x8_64_add_c, 1, AOM_BITS_8), |
| 653 | make_tuple(&av1_fht8x8_c, &av1_iht8x8_64_add_c, 2, AOM_BITS_8), |
| 654 | make_tuple(&av1_fht8x8_c, &av1_iht8x8_64_add_c, 3, AOM_BITS_8))); |
Deb Mukherjee | 10783d4 | 2014-09-02 16:34:09 -0700 | [diff] [blame] | 655 | #else |
James Zern | 615230b | 2014-12-01 15:10:00 -0800 | [diff] [blame] | 656 | INSTANTIATE_TEST_CASE_P( |
Deb Mukherjee | 10783d4 | 2014-09-02 16:34:09 -0700 | [diff] [blame] | 657 | C, FwdTrans8x8HT, |
| 658 | ::testing::Values( |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 659 | make_tuple(&av1_fht8x8_c, &av1_iht8x8_64_add_c, 0, AOM_BITS_8), |
| 660 | make_tuple(&av1_fht8x8_c, &av1_iht8x8_64_add_c, 1, AOM_BITS_8), |
| 661 | make_tuple(&av1_fht8x8_c, &av1_iht8x8_64_add_c, 2, AOM_BITS_8), |
| 662 | make_tuple(&av1_fht8x8_c, &av1_iht8x8_64_add_c, 3, AOM_BITS_8))); |
| 663 | #endif // CONFIG_AOM_HIGHBITDEPTH |
Jingning Han | 4bd1711 | 2013-09-16 16:01:50 -0700 | [diff] [blame] | 664 | |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 665 | #if HAVE_NEON_ASM && !CONFIG_AOM_HIGHBITDEPTH && !CONFIG_EMULATE_HARDWARE |
clang-format | 3a826f1 | 2016-08-11 17:46:05 -0700 | [diff] [blame] | 666 | INSTANTIATE_TEST_CASE_P(NEON, FwdTrans8x8DCT, |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 667 | ::testing::Values(make_tuple(&aom_fdct8x8_neon, |
| 668 | &aom_idct8x8_64_add_neon, |
| 669 | 0, AOM_BITS_8))); |
| 670 | #endif // HAVE_NEON_ASM && !CONFIG_AOM_HIGHBITDEPTH && !CONFIG_EMULATE_HARDWARE |
James Yu | 4f856cd | 2014-01-29 01:31:07 +0800 | [diff] [blame] | 671 | |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 672 | #if HAVE_NEON && !CONFIG_AOM_HIGHBITDEPTH && !CONFIG_EMULATE_HARDWARE |
James Zern | c333110 | 2014-02-25 23:11:49 -0800 | [diff] [blame] | 673 | INSTANTIATE_TEST_CASE_P( |
Deb Mukherjee | 1fe643c | 2014-12-04 16:46:06 -0800 | [diff] [blame] | 674 | NEON, FwdTrans8x8HT, |
James Zern | c333110 | 2014-02-25 23:11:49 -0800 | [diff] [blame] | 675 | ::testing::Values( |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 676 | make_tuple(&av1_fht8x8_c, &av1_iht8x8_64_add_neon, 0, AOM_BITS_8), |
| 677 | make_tuple(&av1_fht8x8_c, &av1_iht8x8_64_add_neon, 1, AOM_BITS_8), |
| 678 | make_tuple(&av1_fht8x8_c, &av1_iht8x8_64_add_neon, 2, AOM_BITS_8), |
| 679 | make_tuple(&av1_fht8x8_c, &av1_iht8x8_64_add_neon, 3, AOM_BITS_8))); |
| 680 | #endif // HAVE_NEON && !CONFIG_AOM_HIGHBITDEPTH && !CONFIG_EMULATE_HARDWARE |
James Zern | c333110 | 2014-02-25 23:11:49 -0800 | [diff] [blame] | 681 | |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 682 | #if HAVE_SSE2 && !CONFIG_AOM_HIGHBITDEPTH && !CONFIG_EMULATE_HARDWARE |
clang-format | 3a826f1 | 2016-08-11 17:46:05 -0700 | [diff] [blame] | 683 | INSTANTIATE_TEST_CASE_P(SSE2, FwdTrans8x8DCT, |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 684 | ::testing::Values(make_tuple(&aom_fdct8x8_sse2, |
| 685 | &aom_idct8x8_64_add_sse2, |
| 686 | 0, AOM_BITS_8))); |
Jingning Han | 4bd1711 | 2013-09-16 16:01:50 -0700 | [diff] [blame] | 687 | INSTANTIATE_TEST_CASE_P( |
| 688 | SSE2, FwdTrans8x8HT, |
| 689 | ::testing::Values( |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 690 | make_tuple(&av1_fht8x8_sse2, &av1_iht8x8_64_add_sse2, 0, AOM_BITS_8), |
| 691 | make_tuple(&av1_fht8x8_sse2, &av1_iht8x8_64_add_sse2, 1, AOM_BITS_8), |
| 692 | make_tuple(&av1_fht8x8_sse2, &av1_iht8x8_64_add_sse2, 2, AOM_BITS_8), |
| 693 | make_tuple(&av1_fht8x8_sse2, &av1_iht8x8_64_add_sse2, 3, AOM_BITS_8))); |
| 694 | #endif // HAVE_SSE2 && !CONFIG_AOM_HIGHBITDEPTH && !CONFIG_EMULATE_HARDWARE |
Peter de Rivaz | 7e40a55 | 2014-10-24 08:48:02 +0100 | [diff] [blame] | 695 | |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 696 | #if HAVE_SSE2 && CONFIG_AOM_HIGHBITDEPTH && !CONFIG_EMULATE_HARDWARE |
Peter de Rivaz | 7e40a55 | 2014-10-24 08:48:02 +0100 | [diff] [blame] | 697 | INSTANTIATE_TEST_CASE_P( |
| 698 | SSE2, FwdTrans8x8DCT, |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 699 | ::testing::Values(make_tuple(&aom_fdct8x8_sse2, &aom_idct8x8_64_add_c, 0, |
| 700 | AOM_BITS_8), |
| 701 | make_tuple(&aom_highbd_fdct8x8_c, &idct8x8_64_add_10_sse2, |
| 702 | 12, AOM_BITS_10), |
| 703 | make_tuple(&aom_highbd_fdct8x8_sse2, |
| 704 | &idct8x8_64_add_10_sse2, 12, AOM_BITS_10), |
| 705 | make_tuple(&aom_highbd_fdct8x8_c, &idct8x8_64_add_12_sse2, |
| 706 | 12, AOM_BITS_12), |
| 707 | make_tuple(&aom_highbd_fdct8x8_sse2, |
| 708 | &idct8x8_64_add_12_sse2, 12, AOM_BITS_12))); |
Peter de Rivaz | 7e40a55 | 2014-10-24 08:48:02 +0100 | [diff] [blame] | 709 | |
James Zern | 615230b | 2014-12-01 15:10:00 -0800 | [diff] [blame] | 710 | INSTANTIATE_TEST_CASE_P( |
Peter de Rivaz | 7e40a55 | 2014-10-24 08:48:02 +0100 | [diff] [blame] | 711 | SSE2, FwdTrans8x8HT, |
| 712 | ::testing::Values( |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 713 | make_tuple(&av1_fht8x8_sse2, &av1_iht8x8_64_add_c, 0, AOM_BITS_8), |
| 714 | make_tuple(&av1_fht8x8_sse2, &av1_iht8x8_64_add_c, 1, AOM_BITS_8), |
| 715 | make_tuple(&av1_fht8x8_sse2, &av1_iht8x8_64_add_c, 2, AOM_BITS_8), |
| 716 | make_tuple(&av1_fht8x8_sse2, &av1_iht8x8_64_add_c, 3, AOM_BITS_8))); |
Peter de Rivaz | 7e40a55 | 2014-10-24 08:48:02 +0100 | [diff] [blame] | 717 | |
| 718 | // Optimizations take effect at a threshold of 6201, so we use a value close to |
| 719 | // that to test both branches. |
| 720 | INSTANTIATE_TEST_CASE_P( |
| 721 | SSE2, InvTrans8x8DCT, |
| 722 | ::testing::Values( |
clang-format | 3a826f1 | 2016-08-11 17:46:05 -0700 | [diff] [blame] | 723 | make_tuple(&idct8x8_10_add_10_c, &idct8x8_10_add_10_sse2, 6225, |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 724 | AOM_BITS_10), |
| 725 | make_tuple(&idct8x8_10, &idct8x8_64_add_10_sse2, 6225, AOM_BITS_10), |
clang-format | 3a826f1 | 2016-08-11 17:46:05 -0700 | [diff] [blame] | 726 | make_tuple(&idct8x8_10_add_12_c, &idct8x8_10_add_12_sse2, 6225, |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 727 | AOM_BITS_12), |
| 728 | make_tuple(&idct8x8_12, &idct8x8_64_add_12_sse2, 6225, AOM_BITS_12))); |
| 729 | #endif // HAVE_SSE2 && CONFIG_AOM_HIGHBITDEPTH && !CONFIG_EMULATE_HARDWARE |
Jingning Han | b466ad5 | 2014-05-08 09:56:38 -0700 | [diff] [blame] | 730 | |
David Barker | 0602edf | 2016-10-26 10:43:12 +0100 | [diff] [blame] | 731 | #if HAVE_SSSE3 && ARCH_X86_64 && !CONFIG_EMULATE_HARDWARE |
clang-format | 3a826f1 | 2016-08-11 17:46:05 -0700 | [diff] [blame] | 732 | INSTANTIATE_TEST_CASE_P(SSSE3, FwdTrans8x8DCT, |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 733 | ::testing::Values(make_tuple(&aom_fdct8x8_ssse3, |
| 734 | &aom_idct8x8_64_add_ssse3, |
| 735 | 0, AOM_BITS_8))); |
Jingning Han | b466ad5 | 2014-05-08 09:56:38 -0700 | [diff] [blame] | 736 | #endif |
Parag Salasakar | 7c5f00f | 2015-05-08 12:23:27 +0530 | [diff] [blame] | 737 | |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 738 | #if HAVE_MSA && !CONFIG_AOM_HIGHBITDEPTH && !CONFIG_EMULATE_HARDWARE |
clang-format | 3a826f1 | 2016-08-11 17:46:05 -0700 | [diff] [blame] | 739 | INSTANTIATE_TEST_CASE_P(MSA, FwdTrans8x8DCT, |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 740 | ::testing::Values(make_tuple(&aom_fdct8x8_msa, |
| 741 | &aom_idct8x8_64_add_msa, 0, |
| 742 | AOM_BITS_8))); |
James Zern | 1c25b7f | 2016-08-13 10:58:54 -0700 | [diff] [blame] | 743 | #if !CONFIG_EXT_TX |
Parag Salasakar | 7c5f00f | 2015-05-08 12:23:27 +0530 | [diff] [blame] | 744 | INSTANTIATE_TEST_CASE_P( |
| 745 | MSA, FwdTrans8x8HT, |
| 746 | ::testing::Values( |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 747 | make_tuple(&av1_fht8x8_msa, &av1_iht8x8_64_add_msa, 0, AOM_BITS_8), |
| 748 | make_tuple(&av1_fht8x8_msa, &av1_iht8x8_64_add_msa, 1, AOM_BITS_8), |
| 749 | make_tuple(&av1_fht8x8_msa, &av1_iht8x8_64_add_msa, 2, AOM_BITS_8), |
| 750 | make_tuple(&av1_fht8x8_msa, &av1_iht8x8_64_add_msa, 3, AOM_BITS_8))); |
James Zern | 1c25b7f | 2016-08-13 10:58:54 -0700 | [diff] [blame] | 751 | #endif // !CONFIG_EXT_TX |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 752 | #endif // HAVE_MSA && !CONFIG_AOM_HIGHBITDEPTH && !CONFIG_EMULATE_HARDWARE |
Daniel Kang | 26641c7 | 2012-06-28 16:26:31 -0700 | [diff] [blame] | 753 | } // namespace |