blob: 2ad1afc0471959f26612e10e5476b127928a4537 [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
Monty Montgomery359854f2017-10-31 04:08:10 -040032#if !CONFIG_DAALA_TX
James Zernc47d8682015-05-14 19:38:34 -070033namespace {
34
Deb Mukherjee10783d42014-09-02 16:34:09 -070035const int kNumCoeffs = 64;
36const double kPi = 3.141592653589793238462643383279502884;
James Zernc47d8682015-05-14 19:38:34 -070037
38const int kSignBiasMaxDiff255 = 1500;
39const int kSignBiasMaxDiff15 = 10000;
40
41typedef void (*FdctFunc)(const int16_t *in, tran_low_t *out, int stride);
42typedef void (*IdctFunc)(const tran_low_t *in, uint8_t *out, int stride);
43typedef void (*FhtFunc)(const int16_t *in, tran_low_t *out, int stride,
Lester Lu27319b62017-07-10 16:57:15 -070044 TxfmParam *txfm_param);
James Zernc47d8682015-05-14 19:38:34 -070045typedef void (*IhtFunc)(const tran_low_t *in, uint8_t *out, int stride,
Lester Lu27319b62017-07-10 16:57:15 -070046 const TxfmParam *txfm_param);
James Zernc47d8682015-05-14 19:38:34 -070047
Urvang Joshi2283d372017-10-02 17:16:45 -070048typedef std::tr1::tuple<FdctFunc, IdctFunc, TX_TYPE, aom_bit_depth_t>
49 Dct8x8Param;
50typedef std::tr1::tuple<FhtFunc, IhtFunc, TX_TYPE, aom_bit_depth_t> Ht8x8Param;
Yaowu Xuf883b422016-08-30 14:01:10 -070051typedef std::tr1::tuple<IdctFunc, IdctFunc, int, aom_bit_depth_t> Idct8x8Param;
James Zernc47d8682015-05-14 19:38:34 -070052
James Zerncffef112016-02-11 18:27:00 -080053void reference_8x8_dct_1d(const double in[8], double out[8]) {
Deb Mukherjee10783d42014-09-02 16:34:09 -070054 const double kInvSqrt2 = 0.707106781186547524400844362104;
55 for (int k = 0; k < 8; k++) {
56 out[k] = 0.0;
57 for (int n = 0; n < 8; n++)
58 out[k] += in[n] * cos(kPi * (2 * n + 1) * k / 16.0);
clang-format3a826f12016-08-11 17:46:05 -070059 if (k == 0) out[k] = out[k] * kInvSqrt2;
Deb Mukherjee10783d42014-09-02 16:34:09 -070060 }
61}
62
63void reference_8x8_dct_2d(const int16_t input[kNumCoeffs],
64 double output[kNumCoeffs]) {
65 // First transform columns
66 for (int i = 0; i < 8; ++i) {
67 double temp_in[8], temp_out[8];
clang-format3a826f12016-08-11 17:46:05 -070068 for (int j = 0; j < 8; ++j) temp_in[j] = input[j * 8 + i];
James Zerncffef112016-02-11 18:27:00 -080069 reference_8x8_dct_1d(temp_in, temp_out);
clang-format3a826f12016-08-11 17:46:05 -070070 for (int j = 0; j < 8; ++j) output[j * 8 + i] = temp_out[j];
Deb Mukherjee10783d42014-09-02 16:34:09 -070071 }
72 // Then transform rows
73 for (int i = 0; i < 8; ++i) {
74 double temp_in[8], temp_out[8];
clang-format3a826f12016-08-11 17:46:05 -070075 for (int j = 0; j < 8; ++j) temp_in[j] = output[j + i * 8];
James Zerncffef112016-02-11 18:27:00 -080076 reference_8x8_dct_1d(temp_in, temp_out);
Deb Mukherjee10783d42014-09-02 16:34:09 -070077 // Scale by some magic number
clang-format3a826f12016-08-11 17:46:05 -070078 for (int j = 0; j < 8; ++j) output[j + i * 8] = temp_out[j] * 2;
Deb Mukherjee10783d42014-09-02 16:34:09 -070079 }
Daniel Kang26641c72012-06-28 16:26:31 -070080}
Daniel Kang26641c72012-06-28 16:26:31 -070081
James Zerncffef112016-02-11 18:27:00 -080082void fdct8x8_ref(const int16_t *in, tran_low_t *out, int stride,
Lester Lu27319b62017-07-10 16:57:15 -070083 TxfmParam * /*txfm_param*/) {
Yaowu Xuf883b422016-08-30 14:01:10 -070084 aom_fdct8x8_c(in, out, stride);
Jingning Hanab362622013-06-21 11:45:47 -070085}
Jingning Han4bd17112013-09-16 16:01:50 -070086
Lester Lud8b1ddc2017-07-06 16:13:29 -070087void fht8x8_ref(const int16_t *in, tran_low_t *out, int stride,
Lester Lu27319b62017-07-10 16:57:15 -070088 TxfmParam *txfm_param) {
89 av1_fht8x8_c(in, out, stride, txfm_param);
Jingning Hanab362622013-06-21 11:45:47 -070090}
Daniel Kang26641c72012-06-28 16:26:31 -070091
Sebastien Alaiwan71e87842017-04-12 16:03:28 +020092#if CONFIG_HIGHBITDEPTH
Lester Lud8b1ddc2017-07-06 16:13:29 -070093void fht8x8_10(const int16_t *in, tran_low_t *out, int stride,
Lester Lu27319b62017-07-10 16:57:15 -070094 TxfmParam *txfm_param) {
95 av1_fwd_txfm2d_8x8_c(in, out, stride, txfm_param->tx_type, 10);
Sarah Parker31c66502017-05-19 16:51:07 -070096}
97
Lester Lud8b1ddc2017-07-06 16:13:29 -070098void fht8x8_12(const int16_t *in, tran_low_t *out, int stride,
Lester Lu27319b62017-07-10 16:57:15 -070099 TxfmParam *txfm_param) {
100 av1_fwd_txfm2d_8x8_c(in, out, stride, txfm_param->tx_type, 12);
Sarah Parker31c66502017-05-19 16:51:07 -0700101}
102
Lester Lud8b1ddc2017-07-06 16:13:29 -0700103void iht8x8_10(const tran_low_t *in, uint8_t *out, int stride,
Lester Lu27319b62017-07-10 16:57:15 -0700104 const TxfmParam *txfm_param) {
Lester Lud8b1ddc2017-07-06 16:13:29 -0700105 av1_inv_txfm2d_add_8x8_c(in, CONVERT_TO_SHORTPTR(out), stride,
Lester Lu27319b62017-07-10 16:57:15 -0700106 txfm_param->tx_type, 10);
Deb Mukherjee10783d42014-09-02 16:34:09 -0700107}
108
Lester Lud8b1ddc2017-07-06 16:13:29 -0700109void iht8x8_12(const tran_low_t *in, uint8_t *out, int stride,
Lester Lu27319b62017-07-10 16:57:15 -0700110 const TxfmParam *txfm_param) {
Lester Lud8b1ddc2017-07-06 16:13:29 -0700111 av1_inv_txfm2d_add_8x8_c(in, CONVERT_TO_SHORTPTR(out), stride,
Lester Lu27319b62017-07-10 16:57:15 -0700112 txfm_param->tx_type, 12);
Deb Mukherjee10783d42014-09-02 16:34:09 -0700113}
Peter de Rivaz7e40a552014-10-24 08:48:02 +0100114
Sebastien Alaiwan71e87842017-04-12 16:03:28 +0200115#endif // CONFIG_HIGHBITDEPTH
Deb Mukherjee10783d42014-09-02 16:34:09 -0700116
Jingning Han4bd17112013-09-16 16:01:50 -0700117class FwdTrans8x8TestBase {
Jingning Hanab362622013-06-21 11:45:47 -0700118 public:
Jingning Han4bd17112013-09-16 16:01:50 -0700119 virtual ~FwdTrans8x8TestBase() {}
Jingning Hanab362622013-06-21 11:45:47 -0700120
121 protected:
Deb Mukherjee10783d42014-09-02 16:34:09 -0700122 virtual void RunFwdTxfm(int16_t *in, tran_low_t *out, int stride) = 0;
123 virtual void RunInvTxfm(tran_low_t *out, uint8_t *dst, int stride) = 0;
Jingning Hanab362622013-06-21 11:45:47 -0700124
Jingning Han4bd17112013-09-16 16:01:50 -0700125 void RunSignBiasCheck() {
126 ACMRandom rnd(ACMRandom::DeterministicSeed());
James Zernfd3658b2015-05-02 13:24:16 -0700127 DECLARE_ALIGNED(16, int16_t, test_input_block[64]);
128 DECLARE_ALIGNED(16, tran_low_t, test_output_block[64]);
Jingning Han4bd17112013-09-16 16:01:50 -0700129 int count_sign_block[64][2];
130 const int count_test_block = 100000;
Jingning Hanab362622013-06-21 11:45:47 -0700131
Jingning Han4bd17112013-09-16 16:01:50 -0700132 memset(count_sign_block, 0, sizeof(count_sign_block));
Daniel Kang26641c72012-06-28 16:26:31 -0700133
Jingning Han4bd17112013-09-16 16:01:50 -0700134 for (int i = 0; i < count_test_block; ++i) {
135 // Initialize a test block with input range [-255, 255].
136 for (int j = 0; j < 64; ++j)
Deb Mukherjee10783d42014-09-02 16:34:09 -0700137 test_input_block[j] = ((rnd.Rand16() >> (16 - bit_depth_)) & mask_) -
138 ((rnd.Rand16() >> (16 - bit_depth_)) & mask_);
James Zern29e1b1a2014-07-09 21:02:02 -0700139 ASM_REGISTER_STATE_CHECK(
Jingning Han4bd17112013-09-16 16:01:50 -0700140 RunFwdTxfm(test_input_block, test_output_block, pitch_));
Daniel Kang26641c72012-06-28 16:26:31 -0700141
Jingning Han4bd17112013-09-16 16:01:50 -0700142 for (int j = 0; j < 64; ++j) {
143 if (test_output_block[j] < 0)
144 ++count_sign_block[j][0];
145 else if (test_output_block[j] > 0)
146 ++count_sign_block[j][1];
147 }
148 }
Daniel Kang26641c72012-06-28 16:26:31 -0700149
150 for (int j = 0; j < 64; ++j) {
Jingning Han4bd17112013-09-16 16:01:50 -0700151 const int diff = abs(count_sign_block[j][0] - count_sign_block[j][1]);
Deb Mukherjee1fe643c2014-12-04 16:46:06 -0800152 const int max_diff = kSignBiasMaxDiff255;
Deb Mukherjee10783d42014-09-02 16:34:09 -0700153 EXPECT_LT(diff, max_diff << (bit_depth_ - 8))
Jingning Han4bd17112013-09-16 16:01:50 -0700154 << "Error: 8x8 FDCT/FHT has a sign bias > "
155 << 1. * max_diff / count_test_block * 100 << "%"
156 << " for input range [-255, 255] at index " << j
157 << " count0: " << count_sign_block[j][0]
clang-format3a826f12016-08-11 17:46:05 -0700158 << " count1: " << count_sign_block[j][1] << " diff: " << diff;
Jingning Han4bd17112013-09-16 16:01:50 -0700159 }
160
161 memset(count_sign_block, 0, sizeof(count_sign_block));
162
163 for (int i = 0; i < count_test_block; ++i) {
Peter de Rivaz7e40a552014-10-24 08:48:02 +0100164 // Initialize a test block with input range [-mask_ / 16, mask_ / 16].
Jingning Han4bd17112013-09-16 16:01:50 -0700165 for (int j = 0; j < 64; ++j)
clang-format3a826f12016-08-11 17:46:05 -0700166 test_input_block[j] =
167 ((rnd.Rand16() & mask_) >> 4) - ((rnd.Rand16() & mask_) >> 4);
James Zern29e1b1a2014-07-09 21:02:02 -0700168 ASM_REGISTER_STATE_CHECK(
Jingning Han4bd17112013-09-16 16:01:50 -0700169 RunFwdTxfm(test_input_block, test_output_block, pitch_));
170
171 for (int j = 0; j < 64; ++j) {
172 if (test_output_block[j] < 0)
173 ++count_sign_block[j][0];
174 else if (test_output_block[j] > 0)
175 ++count_sign_block[j][1];
176 }
177 }
178
179 for (int j = 0; j < 64; ++j) {
180 const int diff = abs(count_sign_block[j][0] - count_sign_block[j][1]);
Deb Mukherjee1fe643c2014-12-04 16:46:06 -0800181 const int max_diff = kSignBiasMaxDiff15;
Deb Mukherjee10783d42014-09-02 16:34:09 -0700182 EXPECT_LT(diff, max_diff << (bit_depth_ - 8))
Deb Mukherjee1fe643c2014-12-04 16:46:06 -0800183 << "Error: 8x8 FDCT/FHT has a sign bias > "
Jingning Han4bd17112013-09-16 16:01:50 -0700184 << 1. * max_diff / count_test_block * 100 << "%"
185 << " for input range [-15, 15] at index " << j
186 << " count0: " << count_sign_block[j][0]
clang-format3a826f12016-08-11 17:46:05 -0700187 << " count1: " << count_sign_block[j][1] << " diff: " << diff;
Daniel Kang26641c72012-06-28 16:26:31 -0700188 }
189 }
190
Jingning Han4bd17112013-09-16 16:01:50 -0700191 void RunRoundTripErrorCheck() {
192 ACMRandom rnd(ACMRandom::DeterministicSeed());
193 int max_error = 0;
194 int total_error = 0;
195 const int count_test_block = 100000;
James Zernfd3658b2015-05-02 13:24:16 -0700196 DECLARE_ALIGNED(16, int16_t, test_input_block[64]);
197 DECLARE_ALIGNED(16, tran_low_t, test_temp_block[64]);
198 DECLARE_ALIGNED(16, uint8_t, dst[64]);
199 DECLARE_ALIGNED(16, uint8_t, src[64]);
Sebastien Alaiwan71e87842017-04-12 16:03:28 +0200200#if CONFIG_HIGHBITDEPTH
James Zernfd3658b2015-05-02 13:24:16 -0700201 DECLARE_ALIGNED(16, uint16_t, dst16[64]);
202 DECLARE_ALIGNED(16, uint16_t, src16[64]);
Deb Mukherjee10783d42014-09-02 16:34:09 -0700203#endif
Daniel Kang26641c72012-06-28 16:26:31 -0700204
Jingning Han4bd17112013-09-16 16:01:50 -0700205 for (int i = 0; i < count_test_block; ++i) {
Peter de Rivaz7e40a552014-10-24 08:48:02 +0100206 // Initialize a test block with input range [-mask_, mask_].
Jingning Han4bd17112013-09-16 16:01:50 -0700207 for (int j = 0; j < 64; ++j) {
Yaowu Xuf883b422016-08-30 14:01:10 -0700208 if (bit_depth_ == AOM_BITS_8) {
Deb Mukherjee10783d42014-09-02 16:34:09 -0700209 src[j] = rnd.Rand8();
210 dst[j] = rnd.Rand8();
211 test_input_block[j] = src[j] - dst[j];
Sebastien Alaiwan71e87842017-04-12 16:03:28 +0200212#if CONFIG_HIGHBITDEPTH
Deb Mukherjee10783d42014-09-02 16:34:09 -0700213 } else {
214 src16[j] = rnd.Rand16() & mask_;
215 dst16[j] = rnd.Rand16() & mask_;
216 test_input_block[j] = src16[j] - dst16[j];
217#endif
218 }
Jingning Han4bd17112013-09-16 16:01:50 -0700219 }
Daniel Kang26641c72012-06-28 16:26:31 -0700220
James Zern29e1b1a2014-07-09 21:02:02 -0700221 ASM_REGISTER_STATE_CHECK(
Jingning Han4bd17112013-09-16 16:01:50 -0700222 RunFwdTxfm(test_input_block, test_temp_block, pitch_));
223 for (int j = 0; j < 64; ++j) {
clang-format3a826f12016-08-11 17:46:05 -0700224 if (test_temp_block[j] > 0) {
225 test_temp_block[j] += 2;
226 test_temp_block[j] /= 4;
227 test_temp_block[j] *= 4;
228 } else {
229 test_temp_block[j] -= 2;
230 test_temp_block[j] /= 4;
231 test_temp_block[j] *= 4;
232 }
Jingning Han4bd17112013-09-16 16:01:50 -0700233 }
Yaowu Xuf883b422016-08-30 14:01:10 -0700234 if (bit_depth_ == AOM_BITS_8) {
clang-format3a826f12016-08-11 17:46:05 -0700235 ASM_REGISTER_STATE_CHECK(RunInvTxfm(test_temp_block, dst, pitch_));
Sebastien Alaiwan71e87842017-04-12 16:03:28 +0200236#if CONFIG_HIGHBITDEPTH
Deb Mukherjee10783d42014-09-02 16:34:09 -0700237 } else {
238 ASM_REGISTER_STATE_CHECK(
239 RunInvTxfm(test_temp_block, CONVERT_TO_BYTEPTR(dst16), pitch_));
240#endif
241 }
Daniel Kang26641c72012-06-28 16:26:31 -0700242
Jingning Han4bd17112013-09-16 16:01:50 -0700243 for (int j = 0; j < 64; ++j) {
Sebastien Alaiwan71e87842017-04-12 16:03:28 +0200244#if CONFIG_HIGHBITDEPTH
Deb Mukherjee10783d42014-09-02 16:34:09 -0700245 const int diff =
Yaowu Xuf883b422016-08-30 14:01:10 -0700246 bit_depth_ == AOM_BITS_8 ? dst[j] - src[j] : dst16[j] - src16[j];
Deb Mukherjee10783d42014-09-02 16:34:09 -0700247#else
Jingning Han4bd17112013-09-16 16:01:50 -0700248 const int diff = dst[j] - src[j];
Deb Mukherjee10783d42014-09-02 16:34:09 -0700249#endif
Jingning Han4bd17112013-09-16 16:01:50 -0700250 const int error = diff * diff;
clang-format3a826f12016-08-11 17:46:05 -0700251 if (max_error < error) max_error = error;
Jingning Han4bd17112013-09-16 16:01:50 -0700252 total_error += error;
253 }
Daniel Kang26641c72012-06-28 16:26:31 -0700254 }
255
Deb Mukherjee10783d42014-09-02 16:34:09 -0700256 EXPECT_GE(1 << 2 * (bit_depth_ - 8), max_error)
clang-format3a826f12016-08-11 17:46:05 -0700257 << "Error: 8x8 FDCT/IDCT or FHT/IHT has an individual"
258 << " roundtrip error > 1";
Daniel Kang26641c72012-06-28 16:26:31 -0700259
clang-format3a826f12016-08-11 17:46:05 -0700260 EXPECT_GE((count_test_block << 2 * (bit_depth_ - 8)) / 5, total_error)
261 << "Error: 8x8 FDCT/IDCT or FHT/IHT has average roundtrip "
262 << "error > 1/5 per block";
Daniel Kang26641c72012-06-28 16:26:31 -0700263 }
Jingning Han4bd17112013-09-16 16:01:50 -0700264
265 void RunExtremalCheck() {
266 ACMRandom rnd(ACMRandom::DeterministicSeed());
267 int max_error = 0;
268 int total_error = 0;
Jingning Han5c2696c2014-06-02 16:40:01 -0700269 int total_coeff_error = 0;
Jingning Han4bd17112013-09-16 16:01:50 -0700270 const int count_test_block = 100000;
James Zernfd3658b2015-05-02 13:24:16 -0700271 DECLARE_ALIGNED(16, int16_t, test_input_block[64]);
272 DECLARE_ALIGNED(16, tran_low_t, test_temp_block[64]);
273 DECLARE_ALIGNED(16, tran_low_t, ref_temp_block[64]);
274 DECLARE_ALIGNED(16, uint8_t, dst[64]);
275 DECLARE_ALIGNED(16, uint8_t, src[64]);
Sebastien Alaiwan71e87842017-04-12 16:03:28 +0200276#if CONFIG_HIGHBITDEPTH
James Zernfd3658b2015-05-02 13:24:16 -0700277 DECLARE_ALIGNED(16, uint16_t, dst16[64]);
278 DECLARE_ALIGNED(16, uint16_t, src16[64]);
Deb Mukherjee10783d42014-09-02 16:34:09 -0700279#endif
Jingning Han4bd17112013-09-16 16:01:50 -0700280
281 for (int i = 0; i < count_test_block; ++i) {
Deb Mukherjee10783d42014-09-02 16:34:09 -0700282 // Initialize a test block with input range [-mask_, mask_].
Jingning Han4bd17112013-09-16 16:01:50 -0700283 for (int j = 0; j < 64; ++j) {
Yaowu Xuf883b422016-08-30 14:01:10 -0700284 if (bit_depth_ == AOM_BITS_8) {
Deb Mukherjee10783d42014-09-02 16:34:09 -0700285 if (i == 0) {
286 src[j] = 255;
287 dst[j] = 0;
288 } else if (i == 1) {
289 src[j] = 0;
290 dst[j] = 255;
291 } else {
292 src[j] = rnd.Rand8() % 2 ? 255 : 0;
293 dst[j] = rnd.Rand8() % 2 ? 255 : 0;
294 }
295 test_input_block[j] = src[j] - dst[j];
Sebastien Alaiwan71e87842017-04-12 16:03:28 +0200296#if CONFIG_HIGHBITDEPTH
Jingning Han0343e302014-06-03 16:45:22 -0700297 } else {
Deb Mukherjee10783d42014-09-02 16:34:09 -0700298 if (i == 0) {
299 src16[j] = mask_;
300 dst16[j] = 0;
301 } else if (i == 1) {
302 src16[j] = 0;
303 dst16[j] = mask_;
304 } else {
305 src16[j] = rnd.Rand8() % 2 ? mask_ : 0;
306 dst16[j] = rnd.Rand8() % 2 ? mask_ : 0;
307 }
308 test_input_block[j] = src16[j] - dst16[j];
309#endif
Jingning Han5c2696c2014-06-02 16:40:01 -0700310 }
Jingning Han4bd17112013-09-16 16:01:50 -0700311 }
312
James Zern29e1b1a2014-07-09 21:02:02 -0700313 ASM_REGISTER_STATE_CHECK(
Jingning Han4bd17112013-09-16 16:01:50 -0700314 RunFwdTxfm(test_input_block, test_temp_block, pitch_));
Lester Lu27319b62017-07-10 16:57:15 -0700315 ASM_REGISTER_STATE_CHECK(
316 fwd_txfm_ref(test_input_block, ref_temp_block, pitch_, &txfm_param_));
Yaowu Xuf883b422016-08-30 14:01:10 -0700317 if (bit_depth_ == AOM_BITS_8) {
clang-format3a826f12016-08-11 17:46:05 -0700318 ASM_REGISTER_STATE_CHECK(RunInvTxfm(test_temp_block, dst, pitch_));
Sebastien Alaiwan71e87842017-04-12 16:03:28 +0200319#if CONFIG_HIGHBITDEPTH
Deb Mukherjee10783d42014-09-02 16:34:09 -0700320 } else {
321 ASM_REGISTER_STATE_CHECK(
322 RunInvTxfm(test_temp_block, CONVERT_TO_BYTEPTR(dst16), pitch_));
323#endif
324 }
Jingning Han4bd17112013-09-16 16:01:50 -0700325
326 for (int j = 0; j < 64; ++j) {
Sebastien Alaiwan71e87842017-04-12 16:03:28 +0200327#if CONFIG_HIGHBITDEPTH
Deb Mukherjee10783d42014-09-02 16:34:09 -0700328 const int diff =
Yaowu Xuf883b422016-08-30 14:01:10 -0700329 bit_depth_ == AOM_BITS_8 ? dst[j] - src[j] : dst16[j] - src16[j];
Deb Mukherjee10783d42014-09-02 16:34:09 -0700330#else
Jingning Han4bd17112013-09-16 16:01:50 -0700331 const int diff = dst[j] - src[j];
Deb Mukherjee10783d42014-09-02 16:34:09 -0700332#endif
Jingning Han4bd17112013-09-16 16:01:50 -0700333 const int error = diff * diff;
clang-format3a826f12016-08-11 17:46:05 -0700334 if (max_error < error) max_error = error;
Jingning Han4bd17112013-09-16 16:01:50 -0700335 total_error += error;
Jingning Han5c2696c2014-06-02 16:40:01 -0700336
337 const int coeff_diff = test_temp_block[j] - ref_temp_block[j];
338 total_coeff_error += abs(coeff_diff);
Jingning Han4bd17112013-09-16 16:01:50 -0700339 }
340
Deb Mukherjee10783d42014-09-02 16:34:09 -0700341 EXPECT_GE(1 << 2 * (bit_depth_ - 8), max_error)
Jingning Han4bd17112013-09-16 16:01:50 -0700342 << "Error: Extremal 8x8 FDCT/IDCT or FHT/IHT has"
343 << "an individual roundtrip error > 1";
344
clang-format3a826f12016-08-11 17:46:05 -0700345 EXPECT_GE((count_test_block << 2 * (bit_depth_ - 8)) / 5, total_error)
Jingning Han4bd17112013-09-16 16:01:50 -0700346 << "Error: Extremal 8x8 FDCT/IDCT or FHT/IHT has average"
347 << " roundtrip error > 1/5 per block";
Jingning Han5c2696c2014-06-02 16:40:01 -0700348
349 EXPECT_EQ(0, total_coeff_error)
350 << "Error: Extremal 8x8 FDCT/FHT has"
351 << "overflow issues in the intermediate steps > 1";
Jingning Han4bd17112013-09-16 16:01:50 -0700352 }
353 }
354
Deb Mukherjee10783d42014-09-02 16:34:09 -0700355 void RunInvAccuracyCheck() {
356 ACMRandom rnd(ACMRandom::DeterministicSeed());
357 const int count_test_block = 1000;
James Zernfd3658b2015-05-02 13:24:16 -0700358 DECLARE_ALIGNED(16, int16_t, in[kNumCoeffs]);
359 DECLARE_ALIGNED(16, tran_low_t, coeff[kNumCoeffs]);
360 DECLARE_ALIGNED(16, uint8_t, dst[kNumCoeffs]);
361 DECLARE_ALIGNED(16, uint8_t, src[kNumCoeffs]);
Sebastien Alaiwan71e87842017-04-12 16:03:28 +0200362#if CONFIG_HIGHBITDEPTH
James Zernfd3658b2015-05-02 13:24:16 -0700363 DECLARE_ALIGNED(16, uint16_t, src16[kNumCoeffs]);
364 DECLARE_ALIGNED(16, uint16_t, dst16[kNumCoeffs]);
Deb Mukherjee10783d42014-09-02 16:34:09 -0700365#endif
366
367 for (int i = 0; i < count_test_block; ++i) {
368 double out_r[kNumCoeffs];
369
370 // Initialize a test block with input range [-255, 255].
371 for (int j = 0; j < kNumCoeffs; ++j) {
Yaowu Xuf883b422016-08-30 14:01:10 -0700372 if (bit_depth_ == AOM_BITS_8) {
Deb Mukherjee10783d42014-09-02 16:34:09 -0700373 src[j] = rnd.Rand8() % 2 ? 255 : 0;
374 dst[j] = src[j] > 0 ? 0 : 255;
375 in[j] = src[j] - dst[j];
Sebastien Alaiwan71e87842017-04-12 16:03:28 +0200376#if CONFIG_HIGHBITDEPTH
Deb Mukherjee10783d42014-09-02 16:34:09 -0700377 } else {
378 src16[j] = rnd.Rand8() % 2 ? mask_ : 0;
379 dst16[j] = src16[j] > 0 ? 0 : mask_;
380 in[j] = src16[j] - dst16[j];
381#endif
382 }
383 }
384
385 reference_8x8_dct_2d(in, out_r);
386 for (int j = 0; j < kNumCoeffs; ++j)
Deb Mukherjee41e6ec42014-09-13 04:11:50 -0700387 coeff[j] = static_cast<tran_low_t>(round(out_r[j]));
Deb Mukherjee10783d42014-09-02 16:34:09 -0700388
Yaowu Xuf883b422016-08-30 14:01:10 -0700389 if (bit_depth_ == AOM_BITS_8) {
Deb Mukherjee10783d42014-09-02 16:34:09 -0700390 ASM_REGISTER_STATE_CHECK(RunInvTxfm(coeff, dst, pitch_));
Sebastien Alaiwan71e87842017-04-12 16:03:28 +0200391#if CONFIG_HIGHBITDEPTH
Deb Mukherjee10783d42014-09-02 16:34:09 -0700392 } else {
clang-format3a826f12016-08-11 17:46:05 -0700393 ASM_REGISTER_STATE_CHECK(
394 RunInvTxfm(coeff, CONVERT_TO_BYTEPTR(dst16), pitch_));
Deb Mukherjee10783d42014-09-02 16:34:09 -0700395#endif
396 }
397
398 for (int j = 0; j < kNumCoeffs; ++j) {
Sebastien Alaiwan71e87842017-04-12 16:03:28 +0200399#if CONFIG_HIGHBITDEPTH
James Zern95d2dc82016-06-08 17:33:34 -0700400 const int diff =
Yaowu Xuf883b422016-08-30 14:01:10 -0700401 bit_depth_ == AOM_BITS_8 ? dst[j] - src[j] : dst16[j] - src16[j];
Deb Mukherjee10783d42014-09-02 16:34:09 -0700402#else
James Zern95d2dc82016-06-08 17:33:34 -0700403 const int diff = dst[j] - src[j];
Deb Mukherjee10783d42014-09-02 16:34:09 -0700404#endif
405 const uint32_t error = diff * diff;
406 EXPECT_GE(1u << 2 * (bit_depth_ - 8), error)
clang-format3a826f12016-08-11 17:46:05 -0700407 << "Error: 8x8 IDCT has error " << error << " at index " << j;
Deb Mukherjee10783d42014-09-02 16:34:09 -0700408 }
409 }
410 }
411
412 void RunFwdAccuracyCheck() {
413 ACMRandom rnd(ACMRandom::DeterministicSeed());
414 const int count_test_block = 1000;
James Zernfd3658b2015-05-02 13:24:16 -0700415 DECLARE_ALIGNED(16, int16_t, in[kNumCoeffs]);
416 DECLARE_ALIGNED(16, tran_low_t, coeff_r[kNumCoeffs]);
417 DECLARE_ALIGNED(16, tran_low_t, coeff[kNumCoeffs]);
Deb Mukherjee10783d42014-09-02 16:34:09 -0700418
419 for (int i = 0; i < count_test_block; ++i) {
420 double out_r[kNumCoeffs];
421
422 // Initialize a test block with input range [-mask_, mask_].
423 for (int j = 0; j < kNumCoeffs; ++j)
424 in[j] = rnd.Rand8() % 2 == 0 ? mask_ : -mask_;
425
426 RunFwdTxfm(in, coeff, pitch_);
427 reference_8x8_dct_2d(in, out_r);
428 for (int j = 0; j < kNumCoeffs; ++j)
Deb Mukherjee41e6ec42014-09-13 04:11:50 -0700429 coeff_r[j] = static_cast<tran_low_t>(round(out_r[j]));
Deb Mukherjee10783d42014-09-02 16:34:09 -0700430
431 for (int j = 0; j < kNumCoeffs; ++j) {
Yaowu Xu63827272016-05-31 16:54:58 -0700432 const int32_t diff = coeff[j] - coeff_r[j];
Deb Mukherjee10783d42014-09-02 16:34:09 -0700433 const uint32_t error = diff * diff;
434 EXPECT_GE(9u << 2 * (bit_depth_ - 8), error)
clang-format3a826f12016-08-11 17:46:05 -0700435 << "Error: 8x8 DCT has error " << error << " at index " << j;
Deb Mukherjee10783d42014-09-02 16:34:09 -0700436 }
437 }
438 }
Peter de Rivaz7e40a552014-10-24 08:48:02 +0100439
clang-format3a826f12016-08-11 17:46:05 -0700440 void CompareInvReference(IdctFunc ref_txfm, int thresh) {
Peter de Rivaz7e40a552014-10-24 08:48:02 +0100441 ACMRandom rnd(ACMRandom::DeterministicSeed());
442 const int count_test_block = 10000;
443 const int eob = 12;
James Zernfd3658b2015-05-02 13:24:16 -0700444 DECLARE_ALIGNED(16, tran_low_t, coeff[kNumCoeffs]);
445 DECLARE_ALIGNED(16, uint8_t, dst[kNumCoeffs]);
446 DECLARE_ALIGNED(16, uint8_t, ref[kNumCoeffs]);
Sebastien Alaiwan71e87842017-04-12 16:03:28 +0200447#if CONFIG_HIGHBITDEPTH
James Zernfd3658b2015-05-02 13:24:16 -0700448 DECLARE_ALIGNED(16, uint16_t, dst16[kNumCoeffs]);
449 DECLARE_ALIGNED(16, uint16_t, ref16[kNumCoeffs]);
Peter de Rivaz7e40a552014-10-24 08:48:02 +0100450#endif
Yaowu Xuf883b422016-08-30 14:01:10 -0700451 const int16_t *scan = av1_default_scan_orders[TX_8X8].scan;
Peter de Rivaz7e40a552014-10-24 08:48:02 +0100452
453 for (int i = 0; i < count_test_block; ++i) {
454 for (int j = 0; j < kNumCoeffs; ++j) {
455 if (j < eob) {
456 // Random values less than the threshold, either positive or negative
clang-format3a826f12016-08-11 17:46:05 -0700457 coeff[scan[j]] = rnd(thresh) * (1 - 2 * (i % 2));
Peter de Rivaz7e40a552014-10-24 08:48:02 +0100458 } else {
459 coeff[scan[j]] = 0;
460 }
Yaowu Xuf883b422016-08-30 14:01:10 -0700461 if (bit_depth_ == AOM_BITS_8) {
Peter de Rivaz7e40a552014-10-24 08:48:02 +0100462 dst[j] = 0;
463 ref[j] = 0;
Sebastien Alaiwan71e87842017-04-12 16:03:28 +0200464#if CONFIG_HIGHBITDEPTH
Peter de Rivaz7e40a552014-10-24 08:48:02 +0100465 } else {
466 dst16[j] = 0;
467 ref16[j] = 0;
468#endif
469 }
470 }
Yaowu Xuf883b422016-08-30 14:01:10 -0700471 if (bit_depth_ == AOM_BITS_8) {
Peter de Rivaz7e40a552014-10-24 08:48:02 +0100472 ref_txfm(coeff, ref, pitch_);
473 ASM_REGISTER_STATE_CHECK(RunInvTxfm(coeff, dst, pitch_));
Sebastien Alaiwan71e87842017-04-12 16:03:28 +0200474#if CONFIG_HIGHBITDEPTH
Peter de Rivaz7e40a552014-10-24 08:48:02 +0100475 } else {
476 ref_txfm(coeff, CONVERT_TO_BYTEPTR(ref16), pitch_);
clang-format3a826f12016-08-11 17:46:05 -0700477 ASM_REGISTER_STATE_CHECK(
478 RunInvTxfm(coeff, CONVERT_TO_BYTEPTR(dst16), pitch_));
Peter de Rivaz7e40a552014-10-24 08:48:02 +0100479#endif
480 }
481
482 for (int j = 0; j < kNumCoeffs; ++j) {
Sebastien Alaiwan71e87842017-04-12 16:03:28 +0200483#if CONFIG_HIGHBITDEPTH
James Zern95d2dc82016-06-08 17:33:34 -0700484 const int diff =
Yaowu Xuf883b422016-08-30 14:01:10 -0700485 bit_depth_ == AOM_BITS_8 ? dst[j] - ref[j] : dst16[j] - ref16[j];
Peter de Rivaz7e40a552014-10-24 08:48:02 +0100486#else
James Zern95d2dc82016-06-08 17:33:34 -0700487 const int diff = dst[j] - ref[j];
Peter de Rivaz7e40a552014-10-24 08:48:02 +0100488#endif
489 const uint32_t error = diff * diff;
clang-format4eafefe2017-09-04 12:51:20 -0700490 EXPECT_EQ(0u, error)
491 << "Error: 8x8 IDCT has error " << error << " at index " << j;
Peter de Rivaz7e40a552014-10-24 08:48:02 +0100492 }
493 }
494 }
Jingning Han4bd17112013-09-16 16:01:50 -0700495 int pitch_;
James Zern54697d32014-07-16 18:56:22 -0700496 FhtFunc fwd_txfm_ref;
Yaowu Xuf883b422016-08-30 14:01:10 -0700497 aom_bit_depth_t bit_depth_;
Deb Mukherjee10783d42014-09-02 16:34:09 -0700498 int mask_;
Lester Lu27319b62017-07-10 16:57:15 -0700499 TxfmParam txfm_param_;
Jingning Han4bd17112013-09-16 16:01:50 -0700500};
501
clang-format3a826f12016-08-11 17:46:05 -0700502class FwdTrans8x8DCT : public FwdTrans8x8TestBase,
503 public ::testing::TestWithParam<Dct8x8Param> {
Jingning Han4bd17112013-09-16 16:01:50 -0700504 public:
505 virtual ~FwdTrans8x8DCT() {}
506
507 virtual void SetUp() {
508 fwd_txfm_ = GET_PARAM(0);
509 inv_txfm_ = GET_PARAM(1);
clang-format3a826f12016-08-11 17:46:05 -0700510 pitch_ = 8;
Jingning Han4bd17112013-09-16 16:01:50 -0700511 fwd_txfm_ref = fdct8x8_ref;
Deb Mukherjee10783d42014-09-02 16:34:09 -0700512 bit_depth_ = GET_PARAM(3);
513 mask_ = (1 << bit_depth_) - 1;
Lester Lu27319b62017-07-10 16:57:15 -0700514 txfm_param_.tx_type = GET_PARAM(2);
Jingning Han4bd17112013-09-16 16:01:50 -0700515 }
516
Yaowu Xuc27fc142016-08-22 16:08:15 -0700517 virtual void TearDown() { libaom_test::ClearSystemState(); }
Jingning Han4bd17112013-09-16 16:01:50 -0700518
519 protected:
Deb Mukherjee10783d42014-09-02 16:34:09 -0700520 void RunFwdTxfm(int16_t *in, tran_low_t *out, int stride) {
Jingning Han4bd17112013-09-16 16:01:50 -0700521 fwd_txfm_(in, out, stride);
522 }
Deb Mukherjee10783d42014-09-02 16:34:09 -0700523 void RunInvTxfm(tran_low_t *out, uint8_t *dst, int stride) {
Dmitry Kovaleve5fa44c2013-10-18 12:20:26 -0700524 inv_txfm_(out, dst, stride);
Jingning Han4bd17112013-09-16 16:01:50 -0700525 }
526
James Zern54697d32014-07-16 18:56:22 -0700527 FdctFunc fwd_txfm_;
528 IdctFunc inv_txfm_;
Jingning Han4bd17112013-09-16 16:01:50 -0700529};
530
clang-format3a826f12016-08-11 17:46:05 -0700531TEST_P(FwdTrans8x8DCT, SignBiasCheck) { RunSignBiasCheck(); }
Daniel Kang26641c72012-06-28 16:26:31 -0700532
clang-format3a826f12016-08-11 17:46:05 -0700533TEST_P(FwdTrans8x8DCT, RoundTripErrorCheck) { RunRoundTripErrorCheck(); }
Jingning Han4bd17112013-09-16 16:01:50 -0700534
clang-format3a826f12016-08-11 17:46:05 -0700535TEST_P(FwdTrans8x8DCT, ExtremalCheck) { RunExtremalCheck(); }
Jingning Han4bd17112013-09-16 16:01:50 -0700536
clang-format3a826f12016-08-11 17:46:05 -0700537TEST_P(FwdTrans8x8DCT, FwdAccuracyCheck) { RunFwdAccuracyCheck(); }
Deb Mukherjee10783d42014-09-02 16:34:09 -0700538
clang-format3a826f12016-08-11 17:46:05 -0700539TEST_P(FwdTrans8x8DCT, InvAccuracyCheck) { RunInvAccuracyCheck(); }
Deb Mukherjee10783d42014-09-02 16:34:09 -0700540
clang-format3a826f12016-08-11 17:46:05 -0700541class FwdTrans8x8HT : public FwdTrans8x8TestBase,
542 public ::testing::TestWithParam<Ht8x8Param> {
Jingning Han4bd17112013-09-16 16:01:50 -0700543 public:
544 virtual ~FwdTrans8x8HT() {}
545
546 virtual void SetUp() {
547 fwd_txfm_ = GET_PARAM(0);
548 inv_txfm_ = GET_PARAM(1);
clang-format3a826f12016-08-11 17:46:05 -0700549 pitch_ = 8;
Jingning Han4bd17112013-09-16 16:01:50 -0700550 fwd_txfm_ref = fht8x8_ref;
Deb Mukherjee10783d42014-09-02 16:34:09 -0700551 bit_depth_ = GET_PARAM(3);
552 mask_ = (1 << bit_depth_) - 1;
Lester Lu27319b62017-07-10 16:57:15 -0700553 txfm_param_.tx_type = GET_PARAM(2);
Sarah Parker31c66502017-05-19 16:51:07 -0700554#if CONFIG_HIGHBITDEPTH
555 switch (bit_depth_) {
556 case AOM_BITS_10: fwd_txfm_ref = fht8x8_10; break;
557 case AOM_BITS_12: fwd_txfm_ref = fht8x8_12; break;
558 default: fwd_txfm_ref = fht8x8_ref; break;
559 }
560#endif
Jingning Han4bd17112013-09-16 16:01:50 -0700561 }
562
Yaowu Xuc27fc142016-08-22 16:08:15 -0700563 virtual void TearDown() { libaom_test::ClearSystemState(); }
Jingning Han4bd17112013-09-16 16:01:50 -0700564
565 protected:
Deb Mukherjee10783d42014-09-02 16:34:09 -0700566 void RunFwdTxfm(int16_t *in, tran_low_t *out, int stride) {
Lester Lu27319b62017-07-10 16:57:15 -0700567 fwd_txfm_(in, out, stride, &txfm_param_);
Jingning Han4bd17112013-09-16 16:01:50 -0700568 }
Deb Mukherjee10783d42014-09-02 16:34:09 -0700569 void RunInvTxfm(tran_low_t *out, uint8_t *dst, int stride) {
Lester Lu27319b62017-07-10 16:57:15 -0700570 inv_txfm_(out, dst, stride, &txfm_param_);
Jingning Han4bd17112013-09-16 16:01:50 -0700571 }
572
James Zern54697d32014-07-16 18:56:22 -0700573 FhtFunc fwd_txfm_;
574 IhtFunc inv_txfm_;
Jingning Han4bd17112013-09-16 16:01:50 -0700575};
576
clang-format3a826f12016-08-11 17:46:05 -0700577TEST_P(FwdTrans8x8HT, SignBiasCheck) { RunSignBiasCheck(); }
Jingning Han4bd17112013-09-16 16:01:50 -0700578
clang-format3a826f12016-08-11 17:46:05 -0700579TEST_P(FwdTrans8x8HT, RoundTripErrorCheck) { RunRoundTripErrorCheck(); }
Jingning Han4bd17112013-09-16 16:01:50 -0700580
clang-format3a826f12016-08-11 17:46:05 -0700581TEST_P(FwdTrans8x8HT, ExtremalCheck) { RunExtremalCheck(); }
Jingning Han4bd17112013-09-16 16:01:50 -0700582
clang-format3a826f12016-08-11 17:46:05 -0700583class InvTrans8x8DCT : public FwdTrans8x8TestBase,
584 public ::testing::TestWithParam<Idct8x8Param> {
Peter de Rivaz7e40a552014-10-24 08:48:02 +0100585 public:
586 virtual ~InvTrans8x8DCT() {}
587
588 virtual void SetUp() {
589 ref_txfm_ = GET_PARAM(0);
590 inv_txfm_ = GET_PARAM(1);
591 thresh_ = GET_PARAM(2);
592 pitch_ = 8;
593 bit_depth_ = GET_PARAM(3);
594 mask_ = (1 << bit_depth_) - 1;
595 }
596
Yaowu Xuc27fc142016-08-22 16:08:15 -0700597 virtual void TearDown() { libaom_test::ClearSystemState(); }
Peter de Rivaz7e40a552014-10-24 08:48:02 +0100598
599 protected:
600 void RunInvTxfm(tran_low_t *out, uint8_t *dst, int stride) {
601 inv_txfm_(out, dst, stride);
602 }
James Zerncffef112016-02-11 18:27:00 -0800603 void RunFwdTxfm(int16_t * /*out*/, tran_low_t * /*dst*/, int /*stride*/) {}
Peter de Rivaz7e40a552014-10-24 08:48:02 +0100604
605 IdctFunc ref_txfm_;
606 IdctFunc inv_txfm_;
607 int thresh_;
608};
609
610TEST_P(InvTrans8x8DCT, CompareReference) {
611 CompareInvReference(ref_txfm_, thresh_);
612}
613
Jingning Han4bd17112013-09-16 16:01:50 -0700614using std::tr1::make_tuple;
615
Sebastien Alaiwan71e87842017-04-12 16:03:28 +0200616#if CONFIG_HIGHBITDEPTH
Frederic Barbierc756e4d2017-04-25 17:26:28 +0200617INSTANTIATE_TEST_CASE_P(C, FwdTrans8x8DCT,
618 ::testing::Values(make_tuple(&aom_fdct8x8_c,
Urvang Joshi2283d372017-10-02 17:16:45 -0700619 &aom_idct8x8_64_add_c,
620 DCT_DCT, AOM_BITS_8)));
Deb Mukherjee10783d42014-09-02 16:34:09 -0700621#else
clang-format3a826f12016-08-11 17:46:05 -0700622INSTANTIATE_TEST_CASE_P(C, FwdTrans8x8DCT,
Yaowu Xuf883b422016-08-30 14:01:10 -0700623 ::testing::Values(make_tuple(&aom_fdct8x8_c,
Urvang Joshi2283d372017-10-02 17:16:45 -0700624 &aom_idct8x8_64_add_c,
625 DCT_DCT, AOM_BITS_8)));
Sebastien Alaiwan71e87842017-04-12 16:03:28 +0200626#endif // CONFIG_HIGHBITDEPTH
Deb Mukherjee10783d42014-09-02 16:34:09 -0700627
Sebastien Alaiwan71e87842017-04-12 16:03:28 +0200628#if CONFIG_HIGHBITDEPTH
Jingning Han4bd17112013-09-16 16:01:50 -0700629INSTANTIATE_TEST_CASE_P(
630 C, FwdTrans8x8HT,
631 ::testing::Values(
Urvang Joshi2283d372017-10-02 17:16:45 -0700632 make_tuple(&av1_fht8x8_c, &av1_iht8x8_64_add_c, DCT_DCT, AOM_BITS_8),
633 make_tuple(&fht8x8_10, &iht8x8_10, DCT_DCT, AOM_BITS_10),
634 make_tuple(&fht8x8_10, &iht8x8_10, ADST_DCT, AOM_BITS_10),
635 make_tuple(&fht8x8_10, &iht8x8_10, DCT_ADST, AOM_BITS_10),
636 make_tuple(&fht8x8_10, &iht8x8_10, ADST_ADST, AOM_BITS_10),
637 make_tuple(&fht8x8_12, &iht8x8_12, DCT_DCT, AOM_BITS_12),
638 make_tuple(&fht8x8_12, &iht8x8_12, ADST_DCT, AOM_BITS_12),
639 make_tuple(&fht8x8_12, &iht8x8_12, DCT_ADST, AOM_BITS_12),
640 make_tuple(&fht8x8_12, &iht8x8_12, ADST_ADST, AOM_BITS_12),
641 make_tuple(&av1_fht8x8_c, &av1_iht8x8_64_add_c, ADST_DCT, AOM_BITS_8),
642 make_tuple(&av1_fht8x8_c, &av1_iht8x8_64_add_c, DCT_ADST, AOM_BITS_8),
643 make_tuple(&av1_fht8x8_c, &av1_iht8x8_64_add_c, ADST_ADST,
644 AOM_BITS_8)));
Deb Mukherjee10783d42014-09-02 16:34:09 -0700645#else
James Zern615230b2014-12-01 15:10:00 -0800646INSTANTIATE_TEST_CASE_P(
Deb Mukherjee10783d42014-09-02 16:34:09 -0700647 C, FwdTrans8x8HT,
648 ::testing::Values(
Urvang Joshi2283d372017-10-02 17:16:45 -0700649 make_tuple(&av1_fht8x8_c, &av1_iht8x8_64_add_c, DCT_DCT, AOM_BITS_8),
650 make_tuple(&av1_fht8x8_c, &av1_iht8x8_64_add_c, ADST_DCT, AOM_BITS_8),
651 make_tuple(&av1_fht8x8_c, &av1_iht8x8_64_add_c, DCT_ADST, AOM_BITS_8),
652 make_tuple(&av1_fht8x8_c, &av1_iht8x8_64_add_c, ADST_ADST,
653 AOM_BITS_8)));
Sebastien Alaiwan71e87842017-04-12 16:03:28 +0200654#endif // CONFIG_HIGHBITDEPTH
Jingning Han4bd17112013-09-16 16:01:50 -0700655
Sebastien Alaiwanc6a48a22017-04-20 10:12:43 +0200656#if HAVE_NEON_ASM && !CONFIG_HIGHBITDEPTH
clang-format3a826f12016-08-11 17:46:05 -0700657INSTANTIATE_TEST_CASE_P(NEON, FwdTrans8x8DCT,
Yaowu Xuf883b422016-08-30 14:01:10 -0700658 ::testing::Values(make_tuple(&aom_fdct8x8_neon,
659 &aom_idct8x8_64_add_neon,
Urvang Joshi2283d372017-10-02 17:16:45 -0700660 DCT_DCT, AOM_BITS_8)));
Sebastien Alaiwanc6a48a22017-04-20 10:12:43 +0200661#endif // HAVE_NEON_ASM && !CONFIG_HIGHBITDEPTH
James Yu4f856cd2014-01-29 01:31:07 +0800662
Sebastien Alaiwanc6a48a22017-04-20 10:12:43 +0200663#if HAVE_NEON && !CONFIG_HIGHBITDEPTH
James Zernc3331102014-02-25 23:11:49 -0800664INSTANTIATE_TEST_CASE_P(
Deb Mukherjee1fe643c2014-12-04 16:46:06 -0800665 NEON, FwdTrans8x8HT,
Urvang Joshi2283d372017-10-02 17:16:45 -0700666 ::testing::Values(make_tuple(&av1_fht8x8_c, &av1_iht8x8_64_add_neon,
667 DCT_DCT, AOM_BITS_8),
668 make_tuple(&av1_fht8x8_c, &av1_iht8x8_64_add_neon,
669 ADST_DCT, AOM_BITS_8),
670 make_tuple(&av1_fht8x8_c, &av1_iht8x8_64_add_neon,
671 DCT_ADST, AOM_BITS_8),
672 make_tuple(&av1_fht8x8_c, &av1_iht8x8_64_add_neon,
673 ADST_ADST, AOM_BITS_8)));
Sebastien Alaiwanc6a48a22017-04-20 10:12:43 +0200674#endif // HAVE_NEON && !CONFIG_HIGHBITDEPTH
James Zernc3331102014-02-25 23:11:49 -0800675
Sebastien Alaiwanc6a48a22017-04-20 10:12:43 +0200676#if HAVE_SSE2 && !CONFIG_HIGHBITDEPTH
clang-format3a826f12016-08-11 17:46:05 -0700677INSTANTIATE_TEST_CASE_P(SSE2, FwdTrans8x8DCT,
Yaowu Xuf883b422016-08-30 14:01:10 -0700678 ::testing::Values(make_tuple(&aom_fdct8x8_sse2,
679 &aom_idct8x8_64_add_sse2,
Urvang Joshi2283d372017-10-02 17:16:45 -0700680 DCT_DCT, AOM_BITS_8)));
Nathan E. Eggee554f362017-10-04 14:44:38 -0400681#if !CONFIG_DAALA_TX8
Jingning Han4bd17112013-09-16 16:01:50 -0700682INSTANTIATE_TEST_CASE_P(
683 SSE2, FwdTrans8x8HT,
Urvang Joshi2283d372017-10-02 17:16:45 -0700684 ::testing::Values(make_tuple(&av1_fht8x8_sse2, &av1_iht8x8_64_add_sse2,
685 DCT_DCT, AOM_BITS_8),
686 make_tuple(&av1_fht8x8_sse2, &av1_iht8x8_64_add_sse2,
687 ADST_DCT, AOM_BITS_8),
688 make_tuple(&av1_fht8x8_sse2, &av1_iht8x8_64_add_sse2,
689 DCT_ADST, AOM_BITS_8),
690 make_tuple(&av1_fht8x8_sse2, &av1_iht8x8_64_add_sse2,
691 ADST_ADST, AOM_BITS_8)));
Nathan E. Eggee554f362017-10-04 14:44:38 -0400692#endif // !CONFIG_DAALA_TX8
Sebastien Alaiwanc6a48a22017-04-20 10:12:43 +0200693#endif // HAVE_SSE2 && !CONFIG_HIGHBITDEPTH
Peter de Rivaz7e40a552014-10-24 08:48:02 +0100694
Sebastien Alaiwanc6a48a22017-04-20 10:12:43 +0200695#if HAVE_SSE2 && CONFIG_HIGHBITDEPTH
James Zern4a2e3b22017-04-25 16:34:55 -0700696INSTANTIATE_TEST_CASE_P(SSE2, FwdTrans8x8DCT,
697 ::testing::Values(make_tuple(&aom_fdct8x8_sse2,
Urvang Joshi2283d372017-10-02 17:16:45 -0700698 &aom_idct8x8_64_add_c,
699 DCT_DCT, AOM_BITS_8)));
Nathan E. Eggee554f362017-10-04 14:44:38 -0400700#if !CONFIG_DAALA_TX8
James Zern615230b2014-12-01 15:10:00 -0800701INSTANTIATE_TEST_CASE_P(
Peter de Rivaz7e40a552014-10-24 08:48:02 +0100702 SSE2, FwdTrans8x8HT,
Urvang Joshi2283d372017-10-02 17:16:45 -0700703 ::testing::Values(make_tuple(&av1_fht8x8_sse2, &av1_iht8x8_64_add_c,
704 DCT_DCT, AOM_BITS_8),
705 make_tuple(&av1_fht8x8_sse2, &av1_iht8x8_64_add_c,
706 ADST_DCT, AOM_BITS_8),
707 make_tuple(&av1_fht8x8_sse2, &av1_iht8x8_64_add_c,
708 DCT_ADST, AOM_BITS_8),
709 make_tuple(&av1_fht8x8_sse2, &av1_iht8x8_64_add_c,
710 ADST_ADST, AOM_BITS_8)));
Nathan E. Eggee554f362017-10-04 14:44:38 -0400711#endif // !CONFIG_DAALA_TX8
Sebastien Alaiwanc6a48a22017-04-20 10:12:43 +0200712#endif // HAVE_SSE2 && CONFIG_HIGHBITDEPTH
Jingning Hanb466ad52014-05-08 09:56:38 -0700713
Sebastien Alaiwanc6a48a22017-04-20 10:12:43 +0200714#if HAVE_SSSE3 && ARCH_X86_64
clang-format3a826f12016-08-11 17:46:05 -0700715INSTANTIATE_TEST_CASE_P(SSSE3, FwdTrans8x8DCT,
Yaowu Xuf883b422016-08-30 14:01:10 -0700716 ::testing::Values(make_tuple(&aom_fdct8x8_ssse3,
717 &aom_idct8x8_64_add_ssse3,
Urvang Joshi2283d372017-10-02 17:16:45 -0700718 DCT_DCT, AOM_BITS_8)));
Jingning Hanb466ad52014-05-08 09:56:38 -0700719#endif
Parag Salasakar7c5f00f2015-05-08 12:23:27 +0530720
Sebastien Alaiwanc6a48a22017-04-20 10:12:43 +0200721#if HAVE_MSA && !CONFIG_HIGHBITDEPTH
clang-format3a826f12016-08-11 17:46:05 -0700722INSTANTIATE_TEST_CASE_P(MSA, FwdTrans8x8DCT,
Yaowu Xuf883b422016-08-30 14:01:10 -0700723 ::testing::Values(make_tuple(&aom_fdct8x8_msa,
Urvang Joshi2283d372017-10-02 17:16:45 -0700724 &aom_idct8x8_64_add_msa,
725 DCT_DCT, AOM_BITS_8)));
Sebastien Alaiwanc6a48a22017-04-20 10:12:43 +0200726#endif // HAVE_MSA && !CONFIG_HIGHBITDEPTH
Daniel Kang26641c72012-06-28 16:26:31 -0700727} // namespace
Monty Montgomery359854f2017-10-31 04:08:10 -0400728#endif // !CONFIG_DAALA_TX