blob: 2b8f524b7eb612206003118d06f467bc40a14cce [file] [log] [blame]
Daniel Kang26641c72012-06-28 16:26:31 -07001/*
Yaowu Xu2ab7ff02016-09-02 12:04:54 -07002 * Copyright (c) 2016, Alliance for Open Media. All rights reserved
Daniel Kang26641c72012-06-28 16:26:31 -07003 *
Yaowu Xu2ab7ff02016-09-02 12:04:54 -07004 * 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.
Lester Lud8b1ddc2017-07-06 16:13:29 -070010 */
Daniel Kang26641c72012-06-28 16:26:31 -070011
12#include <math.h>
13#include <stdlib.h>
14#include <string.h>
15
Tom Finegan7a07ece2017-02-07 17:14:05 -080016#include "third_party/googletest/src/googletest/include/gtest/gtest.h"
Jingning Han097d59c2015-07-29 14:51:36 -070017
Yaowu Xuf883b422016-08-30 14:01:10 -070018#include "./av1_rtcd.h"
19#include "./aom_dsp_rtcd.h"
Jingning Han4bd17112013-09-16 16:01:50 -070020#include "test/acm_random.h"
Yaowu Xue494df12013-09-03 13:50:17 -070021#include "test/clear_system_state.h"
22#include "test/register_state_check.h"
Jingning Han4bd17112013-09-16 16:01:50 -070023#include "test/util.h"
Yaowu Xuc27fc142016-08-22 16:08:15 -070024#include "av1/common/entropy.h"
25#include "av1/common/scan.h"
Yaowu Xuf883b422016-08-30 14:01:10 -070026#include "aom/aom_codec.h"
27#include "aom/aom_integer.h"
Yaowu Xuc27fc142016-08-22 16:08:15 -070028#include "aom_ports/mem.h"
James Zern002ad402014-01-18 13:03:31 -080029
Yaowu Xuc27fc142016-08-22 16:08:15 -070030using libaom_test::ACMRandom;
James Zernc47d8682015-05-14 19:38:34 -070031
32namespace {
33
Deb Mukherjee10783d42014-09-02 16:34:09 -070034const int kNumCoeffs = 64;
35const double kPi = 3.141592653589793238462643383279502884;
James Zernc47d8682015-05-14 19:38:34 -070036
37const int kSignBiasMaxDiff255 = 1500;
38const int kSignBiasMaxDiff15 = 10000;
39
40typedef void (*FdctFunc)(const int16_t *in, tran_low_t *out, int stride);
41typedef void (*IdctFunc)(const tran_low_t *in, uint8_t *out, int stride);
42typedef void (*FhtFunc)(const int16_t *in, tran_low_t *out, int stride,
Lester Lu27319b62017-07-10 16:57:15 -070043 TxfmParam *txfm_param);
James Zernc47d8682015-05-14 19:38:34 -070044typedef void (*IhtFunc)(const tran_low_t *in, uint8_t *out, int stride,
Lester Lu27319b62017-07-10 16:57:15 -070045 const TxfmParam *txfm_param);
James Zernc47d8682015-05-14 19:38:34 -070046
Urvang Joshi2283d372017-10-02 17:16:45 -070047typedef std::tr1::tuple<FdctFunc, IdctFunc, TX_TYPE, aom_bit_depth_t>
48 Dct8x8Param;
49typedef std::tr1::tuple<FhtFunc, IhtFunc, TX_TYPE, aom_bit_depth_t> Ht8x8Param;
Yaowu Xuf883b422016-08-30 14:01:10 -070050typedef std::tr1::tuple<IdctFunc, IdctFunc, int, aom_bit_depth_t> Idct8x8Param;
James Zernc47d8682015-05-14 19:38:34 -070051
James Zerncffef112016-02-11 18:27:00 -080052void reference_8x8_dct_1d(const double in[8], double out[8]) {
Deb Mukherjee10783d42014-09-02 16:34:09 -070053 const double kInvSqrt2 = 0.707106781186547524400844362104;
54 for (int k = 0; k < 8; k++) {
55 out[k] = 0.0;
56 for (int n = 0; n < 8; n++)
57 out[k] += in[n] * cos(kPi * (2 * n + 1) * k / 16.0);
clang-format3a826f12016-08-11 17:46:05 -070058 if (k == 0) out[k] = out[k] * kInvSqrt2;
Deb Mukherjee10783d42014-09-02 16:34:09 -070059 }
60}
61
62void reference_8x8_dct_2d(const int16_t input[kNumCoeffs],
63 double output[kNumCoeffs]) {
64 // First transform columns
65 for (int i = 0; i < 8; ++i) {
66 double temp_in[8], temp_out[8];
clang-format3a826f12016-08-11 17:46:05 -070067 for (int j = 0; j < 8; ++j) temp_in[j] = input[j * 8 + i];
James Zerncffef112016-02-11 18:27:00 -080068 reference_8x8_dct_1d(temp_in, temp_out);
clang-format3a826f12016-08-11 17:46:05 -070069 for (int j = 0; j < 8; ++j) output[j * 8 + i] = temp_out[j];
Deb Mukherjee10783d42014-09-02 16:34:09 -070070 }
71 // Then transform rows
72 for (int i = 0; i < 8; ++i) {
73 double temp_in[8], temp_out[8];
clang-format3a826f12016-08-11 17:46:05 -070074 for (int j = 0; j < 8; ++j) temp_in[j] = output[j + i * 8];
James Zerncffef112016-02-11 18:27:00 -080075 reference_8x8_dct_1d(temp_in, temp_out);
Deb Mukherjee10783d42014-09-02 16:34:09 -070076 // Scale by some magic number
clang-format3a826f12016-08-11 17:46:05 -070077 for (int j = 0; j < 8; ++j) output[j + i * 8] = temp_out[j] * 2;
Deb Mukherjee10783d42014-09-02 16:34:09 -070078 }
Daniel Kang26641c72012-06-28 16:26:31 -070079}
Daniel Kang26641c72012-06-28 16:26:31 -070080
James Zerncffef112016-02-11 18:27:00 -080081void fdct8x8_ref(const int16_t *in, tran_low_t *out, int stride,
Lester Lu27319b62017-07-10 16:57:15 -070082 TxfmParam * /*txfm_param*/) {
Yaowu Xuf883b422016-08-30 14:01:10 -070083 aom_fdct8x8_c(in, out, stride);
Jingning Hanab362622013-06-21 11:45:47 -070084}
Jingning Han4bd17112013-09-16 16:01:50 -070085
Lester Lud8b1ddc2017-07-06 16:13:29 -070086void fht8x8_ref(const int16_t *in, tran_low_t *out, int stride,
Lester Lu27319b62017-07-10 16:57:15 -070087 TxfmParam *txfm_param) {
88 av1_fht8x8_c(in, out, stride, txfm_param);
Jingning Hanab362622013-06-21 11:45:47 -070089}
Daniel Kang26641c72012-06-28 16:26:31 -070090
Sebastien Alaiwan71e87842017-04-12 16:03:28 +020091#if CONFIG_HIGHBITDEPTH
Lester Lud8b1ddc2017-07-06 16:13:29 -070092void fht8x8_10(const int16_t *in, tran_low_t *out, int stride,
Lester Lu27319b62017-07-10 16:57:15 -070093 TxfmParam *txfm_param) {
94 av1_fwd_txfm2d_8x8_c(in, out, stride, txfm_param->tx_type, 10);
Sarah Parker31c66502017-05-19 16:51:07 -070095}
96
Lester Lud8b1ddc2017-07-06 16:13:29 -070097void fht8x8_12(const int16_t *in, tran_low_t *out, int stride,
Lester Lu27319b62017-07-10 16:57:15 -070098 TxfmParam *txfm_param) {
99 av1_fwd_txfm2d_8x8_c(in, out, stride, txfm_param->tx_type, 12);
Sarah Parker31c66502017-05-19 16:51:07 -0700100}
101
Lester Lud8b1ddc2017-07-06 16:13:29 -0700102void iht8x8_10(const tran_low_t *in, uint8_t *out, int stride,
Lester Lu27319b62017-07-10 16:57:15 -0700103 const TxfmParam *txfm_param) {
Lester Lud8b1ddc2017-07-06 16:13:29 -0700104 av1_inv_txfm2d_add_8x8_c(in, CONVERT_TO_SHORTPTR(out), stride,
Lester Lu27319b62017-07-10 16:57:15 -0700105 txfm_param->tx_type, 10);
Deb Mukherjee10783d42014-09-02 16:34:09 -0700106}
107
Lester Lud8b1ddc2017-07-06 16:13:29 -0700108void iht8x8_12(const tran_low_t *in, uint8_t *out, int stride,
Lester Lu27319b62017-07-10 16:57:15 -0700109 const TxfmParam *txfm_param) {
Lester Lud8b1ddc2017-07-06 16:13:29 -0700110 av1_inv_txfm2d_add_8x8_c(in, CONVERT_TO_SHORTPTR(out), stride,
Lester Lu27319b62017-07-10 16:57:15 -0700111 txfm_param->tx_type, 12);
Deb Mukherjee10783d42014-09-02 16:34:09 -0700112}
Peter de Rivaz7e40a552014-10-24 08:48:02 +0100113
Sebastien Alaiwan71e87842017-04-12 16:03:28 +0200114#endif // CONFIG_HIGHBITDEPTH
Deb Mukherjee10783d42014-09-02 16:34:09 -0700115
Jingning Han4bd17112013-09-16 16:01:50 -0700116class FwdTrans8x8TestBase {
Jingning Hanab362622013-06-21 11:45:47 -0700117 public:
Jingning Han4bd17112013-09-16 16:01:50 -0700118 virtual ~FwdTrans8x8TestBase() {}
Jingning Hanab362622013-06-21 11:45:47 -0700119
120 protected:
Deb Mukherjee10783d42014-09-02 16:34:09 -0700121 virtual void RunFwdTxfm(int16_t *in, tran_low_t *out, int stride) = 0;
122 virtual void RunInvTxfm(tran_low_t *out, uint8_t *dst, int stride) = 0;
Jingning Hanab362622013-06-21 11:45:47 -0700123
Jingning Han4bd17112013-09-16 16:01:50 -0700124 void RunSignBiasCheck() {
125 ACMRandom rnd(ACMRandom::DeterministicSeed());
James Zernfd3658b2015-05-02 13:24:16 -0700126 DECLARE_ALIGNED(16, int16_t, test_input_block[64]);
127 DECLARE_ALIGNED(16, tran_low_t, test_output_block[64]);
Jingning Han4bd17112013-09-16 16:01:50 -0700128 int count_sign_block[64][2];
129 const int count_test_block = 100000;
Jingning Hanab362622013-06-21 11:45:47 -0700130
Jingning Han4bd17112013-09-16 16:01:50 -0700131 memset(count_sign_block, 0, sizeof(count_sign_block));
Daniel Kang26641c72012-06-28 16:26:31 -0700132
Jingning Han4bd17112013-09-16 16:01:50 -0700133 for (int i = 0; i < count_test_block; ++i) {
134 // Initialize a test block with input range [-255, 255].
135 for (int j = 0; j < 64; ++j)
Deb Mukherjee10783d42014-09-02 16:34:09 -0700136 test_input_block[j] = ((rnd.Rand16() >> (16 - bit_depth_)) & mask_) -
137 ((rnd.Rand16() >> (16 - bit_depth_)) & mask_);
James Zern29e1b1a2014-07-09 21:02:02 -0700138 ASM_REGISTER_STATE_CHECK(
Jingning Han4bd17112013-09-16 16:01:50 -0700139 RunFwdTxfm(test_input_block, test_output_block, pitch_));
Daniel Kang26641c72012-06-28 16:26:31 -0700140
Jingning Han4bd17112013-09-16 16:01:50 -0700141 for (int j = 0; j < 64; ++j) {
142 if (test_output_block[j] < 0)
143 ++count_sign_block[j][0];
144 else if (test_output_block[j] > 0)
145 ++count_sign_block[j][1];
146 }
147 }
Daniel Kang26641c72012-06-28 16:26:31 -0700148
149 for (int j = 0; j < 64; ++j) {
Jingning Han4bd17112013-09-16 16:01:50 -0700150 const int diff = abs(count_sign_block[j][0] - count_sign_block[j][1]);
Deb Mukherjee1fe643c2014-12-04 16:46:06 -0800151 const int max_diff = kSignBiasMaxDiff255;
Deb Mukherjee10783d42014-09-02 16:34:09 -0700152 EXPECT_LT(diff, max_diff << (bit_depth_ - 8))
Jingning Han4bd17112013-09-16 16:01:50 -0700153 << "Error: 8x8 FDCT/FHT has a sign bias > "
154 << 1. * max_diff / count_test_block * 100 << "%"
155 << " for input range [-255, 255] at index " << j
156 << " count0: " << count_sign_block[j][0]
clang-format3a826f12016-08-11 17:46:05 -0700157 << " count1: " << count_sign_block[j][1] << " diff: " << diff;
Jingning Han4bd17112013-09-16 16:01:50 -0700158 }
159
160 memset(count_sign_block, 0, sizeof(count_sign_block));
161
162 for (int i = 0; i < count_test_block; ++i) {
Peter de Rivaz7e40a552014-10-24 08:48:02 +0100163 // Initialize a test block with input range [-mask_ / 16, mask_ / 16].
Jingning Han4bd17112013-09-16 16:01:50 -0700164 for (int j = 0; j < 64; ++j)
clang-format3a826f12016-08-11 17:46:05 -0700165 test_input_block[j] =
166 ((rnd.Rand16() & mask_) >> 4) - ((rnd.Rand16() & mask_) >> 4);
James Zern29e1b1a2014-07-09 21:02:02 -0700167 ASM_REGISTER_STATE_CHECK(
Jingning Han4bd17112013-09-16 16:01:50 -0700168 RunFwdTxfm(test_input_block, test_output_block, pitch_));
169
170 for (int j = 0; j < 64; ++j) {
171 if (test_output_block[j] < 0)
172 ++count_sign_block[j][0];
173 else if (test_output_block[j] > 0)
174 ++count_sign_block[j][1];
175 }
176 }
177
178 for (int j = 0; j < 64; ++j) {
179 const int diff = abs(count_sign_block[j][0] - count_sign_block[j][1]);
Deb Mukherjee1fe643c2014-12-04 16:46:06 -0800180 const int max_diff = kSignBiasMaxDiff15;
Deb Mukherjee10783d42014-09-02 16:34:09 -0700181 EXPECT_LT(diff, max_diff << (bit_depth_ - 8))
Deb Mukherjee1fe643c2014-12-04 16:46:06 -0800182 << "Error: 8x8 FDCT/FHT has a sign bias > "
Jingning Han4bd17112013-09-16 16:01:50 -0700183 << 1. * max_diff / count_test_block * 100 << "%"
184 << " for input range [-15, 15] at index " << j
185 << " count0: " << count_sign_block[j][0]
clang-format3a826f12016-08-11 17:46:05 -0700186 << " count1: " << count_sign_block[j][1] << " diff: " << diff;
Daniel Kang26641c72012-06-28 16:26:31 -0700187 }
188 }
189
Jingning Han4bd17112013-09-16 16:01:50 -0700190 void RunRoundTripErrorCheck() {
191 ACMRandom rnd(ACMRandom::DeterministicSeed());
192 int max_error = 0;
193 int total_error = 0;
194 const int count_test_block = 100000;
James Zernfd3658b2015-05-02 13:24:16 -0700195 DECLARE_ALIGNED(16, int16_t, test_input_block[64]);
196 DECLARE_ALIGNED(16, tran_low_t, test_temp_block[64]);
197 DECLARE_ALIGNED(16, uint8_t, dst[64]);
198 DECLARE_ALIGNED(16, uint8_t, src[64]);
Sebastien Alaiwan71e87842017-04-12 16:03:28 +0200199#if CONFIG_HIGHBITDEPTH
James Zernfd3658b2015-05-02 13:24:16 -0700200 DECLARE_ALIGNED(16, uint16_t, dst16[64]);
201 DECLARE_ALIGNED(16, uint16_t, src16[64]);
Deb Mukherjee10783d42014-09-02 16:34:09 -0700202#endif
Daniel Kang26641c72012-06-28 16:26:31 -0700203
Jingning Han4bd17112013-09-16 16:01:50 -0700204 for (int i = 0; i < count_test_block; ++i) {
Peter de Rivaz7e40a552014-10-24 08:48:02 +0100205 // Initialize a test block with input range [-mask_, mask_].
Jingning Han4bd17112013-09-16 16:01:50 -0700206 for (int j = 0; j < 64; ++j) {
Yaowu Xuf883b422016-08-30 14:01:10 -0700207 if (bit_depth_ == AOM_BITS_8) {
Deb Mukherjee10783d42014-09-02 16:34:09 -0700208 src[j] = rnd.Rand8();
209 dst[j] = rnd.Rand8();
210 test_input_block[j] = src[j] - dst[j];
Sebastien Alaiwan71e87842017-04-12 16:03:28 +0200211#if CONFIG_HIGHBITDEPTH
Deb Mukherjee10783d42014-09-02 16:34:09 -0700212 } else {
213 src16[j] = rnd.Rand16() & mask_;
214 dst16[j] = rnd.Rand16() & mask_;
215 test_input_block[j] = src16[j] - dst16[j];
216#endif
217 }
Jingning Han4bd17112013-09-16 16:01:50 -0700218 }
Daniel Kang26641c72012-06-28 16:26:31 -0700219
James Zern29e1b1a2014-07-09 21:02:02 -0700220 ASM_REGISTER_STATE_CHECK(
Jingning Han4bd17112013-09-16 16:01:50 -0700221 RunFwdTxfm(test_input_block, test_temp_block, pitch_));
222 for (int j = 0; j < 64; ++j) {
clang-format3a826f12016-08-11 17:46:05 -0700223 if (test_temp_block[j] > 0) {
224 test_temp_block[j] += 2;
225 test_temp_block[j] /= 4;
226 test_temp_block[j] *= 4;
227 } else {
228 test_temp_block[j] -= 2;
229 test_temp_block[j] /= 4;
230 test_temp_block[j] *= 4;
231 }
Jingning Han4bd17112013-09-16 16:01:50 -0700232 }
Yaowu Xuf883b422016-08-30 14:01:10 -0700233 if (bit_depth_ == AOM_BITS_8) {
clang-format3a826f12016-08-11 17:46:05 -0700234 ASM_REGISTER_STATE_CHECK(RunInvTxfm(test_temp_block, dst, pitch_));
Sebastien Alaiwan71e87842017-04-12 16:03:28 +0200235#if CONFIG_HIGHBITDEPTH
Deb Mukherjee10783d42014-09-02 16:34:09 -0700236 } else {
237 ASM_REGISTER_STATE_CHECK(
238 RunInvTxfm(test_temp_block, CONVERT_TO_BYTEPTR(dst16), pitch_));
239#endif
240 }
Daniel Kang26641c72012-06-28 16:26:31 -0700241
Jingning Han4bd17112013-09-16 16:01:50 -0700242 for (int j = 0; j < 64; ++j) {
Sebastien Alaiwan71e87842017-04-12 16:03:28 +0200243#if CONFIG_HIGHBITDEPTH
Deb Mukherjee10783d42014-09-02 16:34:09 -0700244 const int diff =
Yaowu Xuf883b422016-08-30 14:01:10 -0700245 bit_depth_ == AOM_BITS_8 ? dst[j] - src[j] : dst16[j] - src16[j];
Deb Mukherjee10783d42014-09-02 16:34:09 -0700246#else
Jingning Han4bd17112013-09-16 16:01:50 -0700247 const int diff = dst[j] - src[j];
Deb Mukherjee10783d42014-09-02 16:34:09 -0700248#endif
Jingning Han4bd17112013-09-16 16:01:50 -0700249 const int error = diff * diff;
clang-format3a826f12016-08-11 17:46:05 -0700250 if (max_error < error) max_error = error;
Jingning Han4bd17112013-09-16 16:01:50 -0700251 total_error += error;
252 }
Daniel Kang26641c72012-06-28 16:26:31 -0700253 }
254
Deb Mukherjee10783d42014-09-02 16:34:09 -0700255 EXPECT_GE(1 << 2 * (bit_depth_ - 8), max_error)
clang-format3a826f12016-08-11 17:46:05 -0700256 << "Error: 8x8 FDCT/IDCT or FHT/IHT has an individual"
257 << " roundtrip error > 1";
Daniel Kang26641c72012-06-28 16:26:31 -0700258
clang-format3a826f12016-08-11 17:46:05 -0700259 EXPECT_GE((count_test_block << 2 * (bit_depth_ - 8)) / 5, total_error)
260 << "Error: 8x8 FDCT/IDCT or FHT/IHT has average roundtrip "
261 << "error > 1/5 per block";
Daniel Kang26641c72012-06-28 16:26:31 -0700262 }
Jingning Han4bd17112013-09-16 16:01:50 -0700263
264 void RunExtremalCheck() {
265 ACMRandom rnd(ACMRandom::DeterministicSeed());
266 int max_error = 0;
267 int total_error = 0;
Jingning Han5c2696c2014-06-02 16:40:01 -0700268 int total_coeff_error = 0;
Jingning Han4bd17112013-09-16 16:01:50 -0700269 const int count_test_block = 100000;
James Zernfd3658b2015-05-02 13:24:16 -0700270 DECLARE_ALIGNED(16, int16_t, test_input_block[64]);
271 DECLARE_ALIGNED(16, tran_low_t, test_temp_block[64]);
272 DECLARE_ALIGNED(16, tran_low_t, ref_temp_block[64]);
273 DECLARE_ALIGNED(16, uint8_t, dst[64]);
274 DECLARE_ALIGNED(16, uint8_t, src[64]);
Sebastien Alaiwan71e87842017-04-12 16:03:28 +0200275#if CONFIG_HIGHBITDEPTH
James Zernfd3658b2015-05-02 13:24:16 -0700276 DECLARE_ALIGNED(16, uint16_t, dst16[64]);
277 DECLARE_ALIGNED(16, uint16_t, src16[64]);
Deb Mukherjee10783d42014-09-02 16:34:09 -0700278#endif
Jingning Han4bd17112013-09-16 16:01:50 -0700279
280 for (int i = 0; i < count_test_block; ++i) {
Deb Mukherjee10783d42014-09-02 16:34:09 -0700281 // Initialize a test block with input range [-mask_, mask_].
Jingning Han4bd17112013-09-16 16:01:50 -0700282 for (int j = 0; j < 64; ++j) {
Yaowu Xuf883b422016-08-30 14:01:10 -0700283 if (bit_depth_ == AOM_BITS_8) {
Deb Mukherjee10783d42014-09-02 16:34:09 -0700284 if (i == 0) {
285 src[j] = 255;
286 dst[j] = 0;
287 } else if (i == 1) {
288 src[j] = 0;
289 dst[j] = 255;
290 } else {
291 src[j] = rnd.Rand8() % 2 ? 255 : 0;
292 dst[j] = rnd.Rand8() % 2 ? 255 : 0;
293 }
294 test_input_block[j] = src[j] - dst[j];
Sebastien Alaiwan71e87842017-04-12 16:03:28 +0200295#if CONFIG_HIGHBITDEPTH
Jingning Han0343e302014-06-03 16:45:22 -0700296 } else {
Deb Mukherjee10783d42014-09-02 16:34:09 -0700297 if (i == 0) {
298 src16[j] = mask_;
299 dst16[j] = 0;
300 } else if (i == 1) {
301 src16[j] = 0;
302 dst16[j] = mask_;
303 } else {
304 src16[j] = rnd.Rand8() % 2 ? mask_ : 0;
305 dst16[j] = rnd.Rand8() % 2 ? mask_ : 0;
306 }
307 test_input_block[j] = src16[j] - dst16[j];
308#endif
Jingning Han5c2696c2014-06-02 16:40:01 -0700309 }
Jingning Han4bd17112013-09-16 16:01:50 -0700310 }
311
James Zern29e1b1a2014-07-09 21:02:02 -0700312 ASM_REGISTER_STATE_CHECK(
Jingning Han4bd17112013-09-16 16:01:50 -0700313 RunFwdTxfm(test_input_block, test_temp_block, pitch_));
Lester Lu27319b62017-07-10 16:57:15 -0700314 ASM_REGISTER_STATE_CHECK(
315 fwd_txfm_ref(test_input_block, ref_temp_block, pitch_, &txfm_param_));
Yaowu Xuf883b422016-08-30 14:01:10 -0700316 if (bit_depth_ == AOM_BITS_8) {
clang-format3a826f12016-08-11 17:46:05 -0700317 ASM_REGISTER_STATE_CHECK(RunInvTxfm(test_temp_block, dst, pitch_));
Sebastien Alaiwan71e87842017-04-12 16:03:28 +0200318#if CONFIG_HIGHBITDEPTH
Deb Mukherjee10783d42014-09-02 16:34:09 -0700319 } else {
320 ASM_REGISTER_STATE_CHECK(
321 RunInvTxfm(test_temp_block, CONVERT_TO_BYTEPTR(dst16), pitch_));
322#endif
323 }
Jingning Han4bd17112013-09-16 16:01:50 -0700324
325 for (int j = 0; j < 64; ++j) {
Sebastien Alaiwan71e87842017-04-12 16:03:28 +0200326#if CONFIG_HIGHBITDEPTH
Deb Mukherjee10783d42014-09-02 16:34:09 -0700327 const int diff =
Yaowu Xuf883b422016-08-30 14:01:10 -0700328 bit_depth_ == AOM_BITS_8 ? dst[j] - src[j] : dst16[j] - src16[j];
Deb Mukherjee10783d42014-09-02 16:34:09 -0700329#else
Jingning Han4bd17112013-09-16 16:01:50 -0700330 const int diff = dst[j] - src[j];
Deb Mukherjee10783d42014-09-02 16:34:09 -0700331#endif
Jingning Han4bd17112013-09-16 16:01:50 -0700332 const int error = diff * diff;
clang-format3a826f12016-08-11 17:46:05 -0700333 if (max_error < error) max_error = error;
Jingning Han4bd17112013-09-16 16:01:50 -0700334 total_error += error;
Jingning Han5c2696c2014-06-02 16:40:01 -0700335
336 const int coeff_diff = test_temp_block[j] - ref_temp_block[j];
337 total_coeff_error += abs(coeff_diff);
Jingning Han4bd17112013-09-16 16:01:50 -0700338 }
339
Deb Mukherjee10783d42014-09-02 16:34:09 -0700340 EXPECT_GE(1 << 2 * (bit_depth_ - 8), max_error)
Jingning Han4bd17112013-09-16 16:01:50 -0700341 << "Error: Extremal 8x8 FDCT/IDCT or FHT/IHT has"
342 << "an individual roundtrip error > 1";
343
clang-format3a826f12016-08-11 17:46:05 -0700344 EXPECT_GE((count_test_block << 2 * (bit_depth_ - 8)) / 5, total_error)
Jingning Han4bd17112013-09-16 16:01:50 -0700345 << "Error: Extremal 8x8 FDCT/IDCT or FHT/IHT has average"
346 << " roundtrip error > 1/5 per block";
Jingning Han5c2696c2014-06-02 16:40:01 -0700347
348 EXPECT_EQ(0, total_coeff_error)
349 << "Error: Extremal 8x8 FDCT/FHT has"
350 << "overflow issues in the intermediate steps > 1";
Jingning Han4bd17112013-09-16 16:01:50 -0700351 }
352 }
353
Deb Mukherjee10783d42014-09-02 16:34:09 -0700354 void RunInvAccuracyCheck() {
355 ACMRandom rnd(ACMRandom::DeterministicSeed());
356 const int count_test_block = 1000;
James Zernfd3658b2015-05-02 13:24:16 -0700357 DECLARE_ALIGNED(16, int16_t, in[kNumCoeffs]);
358 DECLARE_ALIGNED(16, tran_low_t, coeff[kNumCoeffs]);
359 DECLARE_ALIGNED(16, uint8_t, dst[kNumCoeffs]);
360 DECLARE_ALIGNED(16, uint8_t, src[kNumCoeffs]);
Sebastien Alaiwan71e87842017-04-12 16:03:28 +0200361#if CONFIG_HIGHBITDEPTH
James Zernfd3658b2015-05-02 13:24:16 -0700362 DECLARE_ALIGNED(16, uint16_t, src16[kNumCoeffs]);
363 DECLARE_ALIGNED(16, uint16_t, dst16[kNumCoeffs]);
Deb Mukherjee10783d42014-09-02 16:34:09 -0700364#endif
365
366 for (int i = 0; i < count_test_block; ++i) {
367 double out_r[kNumCoeffs];
368
369 // Initialize a test block with input range [-255, 255].
370 for (int j = 0; j < kNumCoeffs; ++j) {
Yaowu Xuf883b422016-08-30 14:01:10 -0700371 if (bit_depth_ == AOM_BITS_8) {
Deb Mukherjee10783d42014-09-02 16:34:09 -0700372 src[j] = rnd.Rand8() % 2 ? 255 : 0;
373 dst[j] = src[j] > 0 ? 0 : 255;
374 in[j] = src[j] - dst[j];
Sebastien Alaiwan71e87842017-04-12 16:03:28 +0200375#if CONFIG_HIGHBITDEPTH
Deb Mukherjee10783d42014-09-02 16:34:09 -0700376 } else {
377 src16[j] = rnd.Rand8() % 2 ? mask_ : 0;
378 dst16[j] = src16[j] > 0 ? 0 : mask_;
379 in[j] = src16[j] - dst16[j];
380#endif
381 }
382 }
383
384 reference_8x8_dct_2d(in, out_r);
385 for (int j = 0; j < kNumCoeffs; ++j)
Deb Mukherjee41e6ec42014-09-13 04:11:50 -0700386 coeff[j] = static_cast<tran_low_t>(round(out_r[j]));
Deb Mukherjee10783d42014-09-02 16:34:09 -0700387
Yaowu Xuf883b422016-08-30 14:01:10 -0700388 if (bit_depth_ == AOM_BITS_8) {
Deb Mukherjee10783d42014-09-02 16:34:09 -0700389 ASM_REGISTER_STATE_CHECK(RunInvTxfm(coeff, dst, pitch_));
Sebastien Alaiwan71e87842017-04-12 16:03:28 +0200390#if CONFIG_HIGHBITDEPTH
Deb Mukherjee10783d42014-09-02 16:34:09 -0700391 } else {
clang-format3a826f12016-08-11 17:46:05 -0700392 ASM_REGISTER_STATE_CHECK(
393 RunInvTxfm(coeff, CONVERT_TO_BYTEPTR(dst16), pitch_));
Deb Mukherjee10783d42014-09-02 16:34:09 -0700394#endif
395 }
396
397 for (int j = 0; j < kNumCoeffs; ++j) {
Sebastien Alaiwan71e87842017-04-12 16:03:28 +0200398#if CONFIG_HIGHBITDEPTH
James Zern95d2dc82016-06-08 17:33:34 -0700399 const int diff =
Yaowu Xuf883b422016-08-30 14:01:10 -0700400 bit_depth_ == AOM_BITS_8 ? dst[j] - src[j] : dst16[j] - src16[j];
Deb Mukherjee10783d42014-09-02 16:34:09 -0700401#else
James Zern95d2dc82016-06-08 17:33:34 -0700402 const int diff = dst[j] - src[j];
Deb Mukherjee10783d42014-09-02 16:34:09 -0700403#endif
404 const uint32_t error = diff * diff;
405 EXPECT_GE(1u << 2 * (bit_depth_ - 8), error)
clang-format3a826f12016-08-11 17:46:05 -0700406 << "Error: 8x8 IDCT has error " << error << " at index " << j;
Deb Mukherjee10783d42014-09-02 16:34:09 -0700407 }
408 }
409 }
410
411 void RunFwdAccuracyCheck() {
412 ACMRandom rnd(ACMRandom::DeterministicSeed());
413 const int count_test_block = 1000;
James Zernfd3658b2015-05-02 13:24:16 -0700414 DECLARE_ALIGNED(16, int16_t, in[kNumCoeffs]);
415 DECLARE_ALIGNED(16, tran_low_t, coeff_r[kNumCoeffs]);
416 DECLARE_ALIGNED(16, tran_low_t, coeff[kNumCoeffs]);
Deb Mukherjee10783d42014-09-02 16:34:09 -0700417
418 for (int i = 0; i < count_test_block; ++i) {
419 double out_r[kNumCoeffs];
420
421 // Initialize a test block with input range [-mask_, mask_].
422 for (int j = 0; j < kNumCoeffs; ++j)
423 in[j] = rnd.Rand8() % 2 == 0 ? mask_ : -mask_;
424
425 RunFwdTxfm(in, coeff, pitch_);
426 reference_8x8_dct_2d(in, out_r);
427 for (int j = 0; j < kNumCoeffs; ++j)
Deb Mukherjee41e6ec42014-09-13 04:11:50 -0700428 coeff_r[j] = static_cast<tran_low_t>(round(out_r[j]));
Deb Mukherjee10783d42014-09-02 16:34:09 -0700429
430 for (int j = 0; j < kNumCoeffs; ++j) {
Yaowu Xu63827272016-05-31 16:54:58 -0700431 const int32_t diff = coeff[j] - coeff_r[j];
Deb Mukherjee10783d42014-09-02 16:34:09 -0700432 const uint32_t error = diff * diff;
433 EXPECT_GE(9u << 2 * (bit_depth_ - 8), error)
clang-format3a826f12016-08-11 17:46:05 -0700434 << "Error: 8x8 DCT has error " << error << " at index " << j;
Deb Mukherjee10783d42014-09-02 16:34:09 -0700435 }
436 }
437 }
Peter de Rivaz7e40a552014-10-24 08:48:02 +0100438
clang-format3a826f12016-08-11 17:46:05 -0700439 void CompareInvReference(IdctFunc ref_txfm, int thresh) {
Peter de Rivaz7e40a552014-10-24 08:48:02 +0100440 ACMRandom rnd(ACMRandom::DeterministicSeed());
441 const int count_test_block = 10000;
442 const int eob = 12;
James Zernfd3658b2015-05-02 13:24:16 -0700443 DECLARE_ALIGNED(16, tran_low_t, coeff[kNumCoeffs]);
444 DECLARE_ALIGNED(16, uint8_t, dst[kNumCoeffs]);
445 DECLARE_ALIGNED(16, uint8_t, ref[kNumCoeffs]);
Sebastien Alaiwan71e87842017-04-12 16:03:28 +0200446#if CONFIG_HIGHBITDEPTH
James Zernfd3658b2015-05-02 13:24:16 -0700447 DECLARE_ALIGNED(16, uint16_t, dst16[kNumCoeffs]);
448 DECLARE_ALIGNED(16, uint16_t, ref16[kNumCoeffs]);
Peter de Rivaz7e40a552014-10-24 08:48:02 +0100449#endif
Yaowu Xuf883b422016-08-30 14:01:10 -0700450 const int16_t *scan = av1_default_scan_orders[TX_8X8].scan;
Peter de Rivaz7e40a552014-10-24 08:48:02 +0100451
452 for (int i = 0; i < count_test_block; ++i) {
453 for (int j = 0; j < kNumCoeffs; ++j) {
454 if (j < eob) {
455 // Random values less than the threshold, either positive or negative
clang-format3a826f12016-08-11 17:46:05 -0700456 coeff[scan[j]] = rnd(thresh) * (1 - 2 * (i % 2));
Peter de Rivaz7e40a552014-10-24 08:48:02 +0100457 } else {
458 coeff[scan[j]] = 0;
459 }
Yaowu Xuf883b422016-08-30 14:01:10 -0700460 if (bit_depth_ == AOM_BITS_8) {
Peter de Rivaz7e40a552014-10-24 08:48:02 +0100461 dst[j] = 0;
462 ref[j] = 0;
Sebastien Alaiwan71e87842017-04-12 16:03:28 +0200463#if CONFIG_HIGHBITDEPTH
Peter de Rivaz7e40a552014-10-24 08:48:02 +0100464 } else {
465 dst16[j] = 0;
466 ref16[j] = 0;
467#endif
468 }
469 }
Yaowu Xuf883b422016-08-30 14:01:10 -0700470 if (bit_depth_ == AOM_BITS_8) {
Peter de Rivaz7e40a552014-10-24 08:48:02 +0100471 ref_txfm(coeff, ref, pitch_);
472 ASM_REGISTER_STATE_CHECK(RunInvTxfm(coeff, dst, pitch_));
Sebastien Alaiwan71e87842017-04-12 16:03:28 +0200473#if CONFIG_HIGHBITDEPTH
Peter de Rivaz7e40a552014-10-24 08:48:02 +0100474 } else {
475 ref_txfm(coeff, CONVERT_TO_BYTEPTR(ref16), pitch_);
clang-format3a826f12016-08-11 17:46:05 -0700476 ASM_REGISTER_STATE_CHECK(
477 RunInvTxfm(coeff, CONVERT_TO_BYTEPTR(dst16), pitch_));
Peter de Rivaz7e40a552014-10-24 08:48:02 +0100478#endif
479 }
480
481 for (int j = 0; j < kNumCoeffs; ++j) {
Sebastien Alaiwan71e87842017-04-12 16:03:28 +0200482#if CONFIG_HIGHBITDEPTH
James Zern95d2dc82016-06-08 17:33:34 -0700483 const int diff =
Yaowu Xuf883b422016-08-30 14:01:10 -0700484 bit_depth_ == AOM_BITS_8 ? dst[j] - ref[j] : dst16[j] - ref16[j];
Peter de Rivaz7e40a552014-10-24 08:48:02 +0100485#else
James Zern95d2dc82016-06-08 17:33:34 -0700486 const int diff = dst[j] - ref[j];
Peter de Rivaz7e40a552014-10-24 08:48:02 +0100487#endif
488 const uint32_t error = diff * diff;
clang-format4eafefe2017-09-04 12:51:20 -0700489 EXPECT_EQ(0u, error)
490 << "Error: 8x8 IDCT has error " << error << " at index " << j;
Peter de Rivaz7e40a552014-10-24 08:48:02 +0100491 }
492 }
493 }
Jingning Han4bd17112013-09-16 16:01:50 -0700494 int pitch_;
James Zern54697d32014-07-16 18:56:22 -0700495 FhtFunc fwd_txfm_ref;
Yaowu Xuf883b422016-08-30 14:01:10 -0700496 aom_bit_depth_t bit_depth_;
Deb Mukherjee10783d42014-09-02 16:34:09 -0700497 int mask_;
Lester Lu27319b62017-07-10 16:57:15 -0700498 TxfmParam txfm_param_;
Jingning Han4bd17112013-09-16 16:01:50 -0700499};
500
clang-format3a826f12016-08-11 17:46:05 -0700501class FwdTrans8x8DCT : public FwdTrans8x8TestBase,
502 public ::testing::TestWithParam<Dct8x8Param> {
Jingning Han4bd17112013-09-16 16:01:50 -0700503 public:
504 virtual ~FwdTrans8x8DCT() {}
505
506 virtual void SetUp() {
507 fwd_txfm_ = GET_PARAM(0);
508 inv_txfm_ = GET_PARAM(1);
clang-format3a826f12016-08-11 17:46:05 -0700509 pitch_ = 8;
Jingning Han4bd17112013-09-16 16:01:50 -0700510 fwd_txfm_ref = fdct8x8_ref;
Deb Mukherjee10783d42014-09-02 16:34:09 -0700511 bit_depth_ = GET_PARAM(3);
512 mask_ = (1 << bit_depth_) - 1;
Lester Lu27319b62017-07-10 16:57:15 -0700513 txfm_param_.tx_type = GET_PARAM(2);
Jingning Han4bd17112013-09-16 16:01:50 -0700514 }
515
Yaowu Xuc27fc142016-08-22 16:08:15 -0700516 virtual void TearDown() { libaom_test::ClearSystemState(); }
Jingning Han4bd17112013-09-16 16:01:50 -0700517
518 protected:
Deb Mukherjee10783d42014-09-02 16:34:09 -0700519 void RunFwdTxfm(int16_t *in, tran_low_t *out, int stride) {
Jingning Han4bd17112013-09-16 16:01:50 -0700520 fwd_txfm_(in, out, stride);
521 }
Deb Mukherjee10783d42014-09-02 16:34:09 -0700522 void RunInvTxfm(tran_low_t *out, uint8_t *dst, int stride) {
Dmitry Kovaleve5fa44c2013-10-18 12:20:26 -0700523 inv_txfm_(out, dst, stride);
Jingning Han4bd17112013-09-16 16:01:50 -0700524 }
525
James Zern54697d32014-07-16 18:56:22 -0700526 FdctFunc fwd_txfm_;
527 IdctFunc inv_txfm_;
Jingning Han4bd17112013-09-16 16:01:50 -0700528};
529
clang-format3a826f12016-08-11 17:46:05 -0700530TEST_P(FwdTrans8x8DCT, SignBiasCheck) { RunSignBiasCheck(); }
Daniel Kang26641c72012-06-28 16:26:31 -0700531
clang-format3a826f12016-08-11 17:46:05 -0700532TEST_P(FwdTrans8x8DCT, RoundTripErrorCheck) { RunRoundTripErrorCheck(); }
Jingning Han4bd17112013-09-16 16:01:50 -0700533
clang-format3a826f12016-08-11 17:46:05 -0700534TEST_P(FwdTrans8x8DCT, ExtremalCheck) { RunExtremalCheck(); }
Jingning Han4bd17112013-09-16 16:01:50 -0700535
clang-format3a826f12016-08-11 17:46:05 -0700536TEST_P(FwdTrans8x8DCT, FwdAccuracyCheck) { RunFwdAccuracyCheck(); }
Deb Mukherjee10783d42014-09-02 16:34:09 -0700537
clang-format3a826f12016-08-11 17:46:05 -0700538TEST_P(FwdTrans8x8DCT, InvAccuracyCheck) { RunInvAccuracyCheck(); }
Deb Mukherjee10783d42014-09-02 16:34:09 -0700539
clang-format3a826f12016-08-11 17:46:05 -0700540class FwdTrans8x8HT : public FwdTrans8x8TestBase,
541 public ::testing::TestWithParam<Ht8x8Param> {
Jingning Han4bd17112013-09-16 16:01:50 -0700542 public:
543 virtual ~FwdTrans8x8HT() {}
544
545 virtual void SetUp() {
546 fwd_txfm_ = GET_PARAM(0);
547 inv_txfm_ = GET_PARAM(1);
clang-format3a826f12016-08-11 17:46:05 -0700548 pitch_ = 8;
Jingning Han4bd17112013-09-16 16:01:50 -0700549 fwd_txfm_ref = fht8x8_ref;
Deb Mukherjee10783d42014-09-02 16:34:09 -0700550 bit_depth_ = GET_PARAM(3);
551 mask_ = (1 << bit_depth_) - 1;
Lester Lu27319b62017-07-10 16:57:15 -0700552 txfm_param_.tx_type = GET_PARAM(2);
Sarah Parker31c66502017-05-19 16:51:07 -0700553#if CONFIG_HIGHBITDEPTH
554 switch (bit_depth_) {
555 case AOM_BITS_10: fwd_txfm_ref = fht8x8_10; break;
556 case AOM_BITS_12: fwd_txfm_ref = fht8x8_12; break;
557 default: fwd_txfm_ref = fht8x8_ref; break;
558 }
559#endif
Jingning Han4bd17112013-09-16 16:01:50 -0700560 }
561
Yaowu Xuc27fc142016-08-22 16:08:15 -0700562 virtual void TearDown() { libaom_test::ClearSystemState(); }
Jingning Han4bd17112013-09-16 16:01:50 -0700563
564 protected:
Deb Mukherjee10783d42014-09-02 16:34:09 -0700565 void RunFwdTxfm(int16_t *in, tran_low_t *out, int stride) {
Lester Lu27319b62017-07-10 16:57:15 -0700566 fwd_txfm_(in, out, stride, &txfm_param_);
Jingning Han4bd17112013-09-16 16:01:50 -0700567 }
Deb Mukherjee10783d42014-09-02 16:34:09 -0700568 void RunInvTxfm(tran_low_t *out, uint8_t *dst, int stride) {
Lester Lu27319b62017-07-10 16:57:15 -0700569 inv_txfm_(out, dst, stride, &txfm_param_);
Jingning Han4bd17112013-09-16 16:01:50 -0700570 }
571
James Zern54697d32014-07-16 18:56:22 -0700572 FhtFunc fwd_txfm_;
573 IhtFunc inv_txfm_;
Jingning Han4bd17112013-09-16 16:01:50 -0700574};
575
clang-format3a826f12016-08-11 17:46:05 -0700576TEST_P(FwdTrans8x8HT, SignBiasCheck) { RunSignBiasCheck(); }
Jingning Han4bd17112013-09-16 16:01:50 -0700577
clang-format3a826f12016-08-11 17:46:05 -0700578TEST_P(FwdTrans8x8HT, RoundTripErrorCheck) { RunRoundTripErrorCheck(); }
Jingning Han4bd17112013-09-16 16:01:50 -0700579
clang-format3a826f12016-08-11 17:46:05 -0700580TEST_P(FwdTrans8x8HT, ExtremalCheck) { RunExtremalCheck(); }
Jingning Han4bd17112013-09-16 16:01:50 -0700581
clang-format3a826f12016-08-11 17:46:05 -0700582class InvTrans8x8DCT : public FwdTrans8x8TestBase,
583 public ::testing::TestWithParam<Idct8x8Param> {
Peter de Rivaz7e40a552014-10-24 08:48:02 +0100584 public:
585 virtual ~InvTrans8x8DCT() {}
586
587 virtual void SetUp() {
588 ref_txfm_ = GET_PARAM(0);
589 inv_txfm_ = GET_PARAM(1);
590 thresh_ = GET_PARAM(2);
591 pitch_ = 8;
592 bit_depth_ = GET_PARAM(3);
593 mask_ = (1 << bit_depth_) - 1;
594 }
595
Yaowu Xuc27fc142016-08-22 16:08:15 -0700596 virtual void TearDown() { libaom_test::ClearSystemState(); }
Peter de Rivaz7e40a552014-10-24 08:48:02 +0100597
598 protected:
599 void RunInvTxfm(tran_low_t *out, uint8_t *dst, int stride) {
600 inv_txfm_(out, dst, stride);
601 }
James Zerncffef112016-02-11 18:27:00 -0800602 void RunFwdTxfm(int16_t * /*out*/, tran_low_t * /*dst*/, int /*stride*/) {}
Peter de Rivaz7e40a552014-10-24 08:48:02 +0100603
604 IdctFunc ref_txfm_;
605 IdctFunc inv_txfm_;
606 int thresh_;
607};
608
609TEST_P(InvTrans8x8DCT, CompareReference) {
610 CompareInvReference(ref_txfm_, thresh_);
611}
612
Jingning Han4bd17112013-09-16 16:01:50 -0700613using std::tr1::make_tuple;
614
Sebastien Alaiwan71e87842017-04-12 16:03:28 +0200615#if CONFIG_HIGHBITDEPTH
Frederic Barbierc756e4d2017-04-25 17:26:28 +0200616INSTANTIATE_TEST_CASE_P(C, FwdTrans8x8DCT,
617 ::testing::Values(make_tuple(&aom_fdct8x8_c,
Urvang Joshi2283d372017-10-02 17:16:45 -0700618 &aom_idct8x8_64_add_c,
619 DCT_DCT, AOM_BITS_8)));
Deb Mukherjee10783d42014-09-02 16:34:09 -0700620#else
clang-format3a826f12016-08-11 17:46:05 -0700621INSTANTIATE_TEST_CASE_P(C, FwdTrans8x8DCT,
Yaowu Xuf883b422016-08-30 14:01:10 -0700622 ::testing::Values(make_tuple(&aom_fdct8x8_c,
Urvang Joshi2283d372017-10-02 17:16:45 -0700623 &aom_idct8x8_64_add_c,
624 DCT_DCT, AOM_BITS_8)));
Sebastien Alaiwan71e87842017-04-12 16:03:28 +0200625#endif // CONFIG_HIGHBITDEPTH
Deb Mukherjee10783d42014-09-02 16:34:09 -0700626
Sebastien Alaiwan71e87842017-04-12 16:03:28 +0200627#if CONFIG_HIGHBITDEPTH
Jingning Han4bd17112013-09-16 16:01:50 -0700628INSTANTIATE_TEST_CASE_P(
629 C, FwdTrans8x8HT,
630 ::testing::Values(
Urvang Joshi2283d372017-10-02 17:16:45 -0700631 make_tuple(&av1_fht8x8_c, &av1_iht8x8_64_add_c, DCT_DCT, AOM_BITS_8),
632 make_tuple(&fht8x8_10, &iht8x8_10, DCT_DCT, AOM_BITS_10),
633 make_tuple(&fht8x8_10, &iht8x8_10, ADST_DCT, AOM_BITS_10),
634 make_tuple(&fht8x8_10, &iht8x8_10, DCT_ADST, AOM_BITS_10),
635 make_tuple(&fht8x8_10, &iht8x8_10, ADST_ADST, AOM_BITS_10),
636 make_tuple(&fht8x8_12, &iht8x8_12, DCT_DCT, AOM_BITS_12),
637 make_tuple(&fht8x8_12, &iht8x8_12, ADST_DCT, AOM_BITS_12),
638 make_tuple(&fht8x8_12, &iht8x8_12, DCT_ADST, AOM_BITS_12),
639 make_tuple(&fht8x8_12, &iht8x8_12, ADST_ADST, AOM_BITS_12),
640 make_tuple(&av1_fht8x8_c, &av1_iht8x8_64_add_c, ADST_DCT, AOM_BITS_8),
641 make_tuple(&av1_fht8x8_c, &av1_iht8x8_64_add_c, DCT_ADST, AOM_BITS_8),
642 make_tuple(&av1_fht8x8_c, &av1_iht8x8_64_add_c, ADST_ADST,
643 AOM_BITS_8)));
Deb Mukherjee10783d42014-09-02 16:34:09 -0700644#else
James Zern615230b2014-12-01 15:10:00 -0800645INSTANTIATE_TEST_CASE_P(
Deb Mukherjee10783d42014-09-02 16:34:09 -0700646 C, FwdTrans8x8HT,
647 ::testing::Values(
Urvang Joshi2283d372017-10-02 17:16:45 -0700648 make_tuple(&av1_fht8x8_c, &av1_iht8x8_64_add_c, DCT_DCT, AOM_BITS_8),
649 make_tuple(&av1_fht8x8_c, &av1_iht8x8_64_add_c, ADST_DCT, AOM_BITS_8),
650 make_tuple(&av1_fht8x8_c, &av1_iht8x8_64_add_c, DCT_ADST, AOM_BITS_8),
651 make_tuple(&av1_fht8x8_c, &av1_iht8x8_64_add_c, ADST_ADST,
652 AOM_BITS_8)));
Sebastien Alaiwan71e87842017-04-12 16:03:28 +0200653#endif // CONFIG_HIGHBITDEPTH
Jingning Han4bd17112013-09-16 16:01:50 -0700654
Sebastien Alaiwanc6a48a22017-04-20 10:12:43 +0200655#if HAVE_NEON_ASM && !CONFIG_HIGHBITDEPTH
clang-format3a826f12016-08-11 17:46:05 -0700656INSTANTIATE_TEST_CASE_P(NEON, FwdTrans8x8DCT,
Yaowu Xuf883b422016-08-30 14:01:10 -0700657 ::testing::Values(make_tuple(&aom_fdct8x8_neon,
658 &aom_idct8x8_64_add_neon,
Urvang Joshi2283d372017-10-02 17:16:45 -0700659 DCT_DCT, AOM_BITS_8)));
Sebastien Alaiwanc6a48a22017-04-20 10:12:43 +0200660#endif // HAVE_NEON_ASM && !CONFIG_HIGHBITDEPTH
James Yu4f856cd2014-01-29 01:31:07 +0800661
Sebastien Alaiwanc6a48a22017-04-20 10:12:43 +0200662#if HAVE_NEON && !CONFIG_HIGHBITDEPTH
James Zernc3331102014-02-25 23:11:49 -0800663INSTANTIATE_TEST_CASE_P(
Deb Mukherjee1fe643c2014-12-04 16:46:06 -0800664 NEON, FwdTrans8x8HT,
Urvang Joshi2283d372017-10-02 17:16:45 -0700665 ::testing::Values(make_tuple(&av1_fht8x8_c, &av1_iht8x8_64_add_neon,
666 DCT_DCT, AOM_BITS_8),
667 make_tuple(&av1_fht8x8_c, &av1_iht8x8_64_add_neon,
668 ADST_DCT, AOM_BITS_8),
669 make_tuple(&av1_fht8x8_c, &av1_iht8x8_64_add_neon,
670 DCT_ADST, AOM_BITS_8),
671 make_tuple(&av1_fht8x8_c, &av1_iht8x8_64_add_neon,
672 ADST_ADST, AOM_BITS_8)));
Sebastien Alaiwanc6a48a22017-04-20 10:12:43 +0200673#endif // HAVE_NEON && !CONFIG_HIGHBITDEPTH
James Zernc3331102014-02-25 23:11:49 -0800674
Sebastien Alaiwanc6a48a22017-04-20 10:12:43 +0200675#if HAVE_SSE2 && !CONFIG_HIGHBITDEPTH
clang-format3a826f12016-08-11 17:46:05 -0700676INSTANTIATE_TEST_CASE_P(SSE2, FwdTrans8x8DCT,
Yaowu Xuf883b422016-08-30 14:01:10 -0700677 ::testing::Values(make_tuple(&aom_fdct8x8_sse2,
678 &aom_idct8x8_64_add_sse2,
Urvang Joshi2283d372017-10-02 17:16:45 -0700679 DCT_DCT, AOM_BITS_8)));
Nathan E. Eggee554f362017-10-04 14:44:38 -0400680#if !CONFIG_DAALA_TX8
Jingning Han4bd17112013-09-16 16:01:50 -0700681INSTANTIATE_TEST_CASE_P(
682 SSE2, FwdTrans8x8HT,
Urvang Joshi2283d372017-10-02 17:16:45 -0700683 ::testing::Values(make_tuple(&av1_fht8x8_sse2, &av1_iht8x8_64_add_sse2,
684 DCT_DCT, AOM_BITS_8),
685 make_tuple(&av1_fht8x8_sse2, &av1_iht8x8_64_add_sse2,
686 ADST_DCT, AOM_BITS_8),
687 make_tuple(&av1_fht8x8_sse2, &av1_iht8x8_64_add_sse2,
688 DCT_ADST, AOM_BITS_8),
689 make_tuple(&av1_fht8x8_sse2, &av1_iht8x8_64_add_sse2,
690 ADST_ADST, AOM_BITS_8)));
Nathan E. Eggee554f362017-10-04 14:44:38 -0400691#endif // !CONFIG_DAALA_TX8
Sebastien Alaiwanc6a48a22017-04-20 10:12:43 +0200692#endif // HAVE_SSE2 && !CONFIG_HIGHBITDEPTH
Peter de Rivaz7e40a552014-10-24 08:48:02 +0100693
Sebastien Alaiwanc6a48a22017-04-20 10:12:43 +0200694#if HAVE_SSE2 && CONFIG_HIGHBITDEPTH
James Zern4a2e3b22017-04-25 16:34:55 -0700695INSTANTIATE_TEST_CASE_P(SSE2, FwdTrans8x8DCT,
696 ::testing::Values(make_tuple(&aom_fdct8x8_sse2,
Urvang Joshi2283d372017-10-02 17:16:45 -0700697 &aom_idct8x8_64_add_c,
698 DCT_DCT, AOM_BITS_8)));
Nathan E. Eggee554f362017-10-04 14:44:38 -0400699#if !CONFIG_DAALA_TX8
James Zern615230b2014-12-01 15:10:00 -0800700INSTANTIATE_TEST_CASE_P(
Peter de Rivaz7e40a552014-10-24 08:48:02 +0100701 SSE2, FwdTrans8x8HT,
Urvang Joshi2283d372017-10-02 17:16:45 -0700702 ::testing::Values(make_tuple(&av1_fht8x8_sse2, &av1_iht8x8_64_add_c,
703 DCT_DCT, AOM_BITS_8),
704 make_tuple(&av1_fht8x8_sse2, &av1_iht8x8_64_add_c,
705 ADST_DCT, AOM_BITS_8),
706 make_tuple(&av1_fht8x8_sse2, &av1_iht8x8_64_add_c,
707 DCT_ADST, AOM_BITS_8),
708 make_tuple(&av1_fht8x8_sse2, &av1_iht8x8_64_add_c,
709 ADST_ADST, AOM_BITS_8)));
Nathan E. Eggee554f362017-10-04 14:44:38 -0400710#endif // !CONFIG_DAALA_TX8
Sebastien Alaiwanc6a48a22017-04-20 10:12:43 +0200711#endif // HAVE_SSE2 && CONFIG_HIGHBITDEPTH
Jingning Hanb466ad52014-05-08 09:56:38 -0700712
Sebastien Alaiwanc6a48a22017-04-20 10:12:43 +0200713#if HAVE_SSSE3 && ARCH_X86_64
clang-format3a826f12016-08-11 17:46:05 -0700714INSTANTIATE_TEST_CASE_P(SSSE3, FwdTrans8x8DCT,
Yaowu Xuf883b422016-08-30 14:01:10 -0700715 ::testing::Values(make_tuple(&aom_fdct8x8_ssse3,
716 &aom_idct8x8_64_add_ssse3,
Urvang Joshi2283d372017-10-02 17:16:45 -0700717 DCT_DCT, AOM_BITS_8)));
Jingning Hanb466ad52014-05-08 09:56:38 -0700718#endif
Parag Salasakar7c5f00f2015-05-08 12:23:27 +0530719
Sebastien Alaiwanc6a48a22017-04-20 10:12:43 +0200720#if HAVE_MSA && !CONFIG_HIGHBITDEPTH
clang-format3a826f12016-08-11 17:46:05 -0700721INSTANTIATE_TEST_CASE_P(MSA, FwdTrans8x8DCT,
Yaowu Xuf883b422016-08-30 14:01:10 -0700722 ::testing::Values(make_tuple(&aom_fdct8x8_msa,
Urvang Joshi2283d372017-10-02 17:16:45 -0700723 &aom_idct8x8_64_add_msa,
724 DCT_DCT, AOM_BITS_8)));
Sebastien Alaiwanc6a48a22017-04-20 10:12:43 +0200725#endif // HAVE_MSA && !CONFIG_HIGHBITDEPTH
Daniel Kang26641c72012-06-28 16:26:31 -0700726} // namespace