dct16x16_test.cc 28.9 KB
Newer Older
Daniel Kang's avatar
Daniel Kang committed
1
/*
2
 * Copyright (c) 2016, Alliance for Open Media. All rights reserved
Daniel Kang's avatar
Daniel Kang committed
3
 *
4 5 6 7 8 9 10 11
 * This source code is subject to the terms of the BSD 2 Clause License and
 * the Alliance for Open Media Patent License 1.0. If the BSD 2 Clause License
 * was not distributed with this source code in the LICENSE file, you can
 * obtain it at www.aomedia.org/license/software. If the Alliance for Open
 * Media Patent License 1.0 was not distributed with this source code in the
 * PATENTS file, you can obtain it at www.aomedia.org/license/patent.
*/

Daniel Kang's avatar
Daniel Kang committed
12 13 14 15 16
#include <math.h>
#include <stdlib.h>
#include <string.h>

#include "third_party/googletest/src/include/gtest/gtest.h"
17

Yaowu Xu's avatar
Yaowu Xu committed
18
#include "./av1_rtcd.h"
Adrian Grange's avatar
Adrian Grange committed
19
#include "./aom_dsp_rtcd.h"
20 21 22 23
#include "test/acm_random.h"
#include "test/clear_system_state.h"
#include "test/register_state_check.h"
#include "test/util.h"
Yaowu Xu's avatar
Yaowu Xu committed
24 25
#include "av1/common/entropy.h"
#include "av1/common/scan.h"
Adrian Grange's avatar
Adrian Grange committed
26 27
#include "aom/aom_codec.h"
#include "aom/aom_integer.h"
Yaowu Xu's avatar
Yaowu Xu committed
28
#include "aom_ports/mem.h"
29

Yaowu Xu's avatar
Yaowu Xu committed
30
using libaom_test::ACMRandom;
Daniel Kang's avatar
Daniel Kang committed
31 32

namespace {
33 34 35 36

#ifdef _MSC_VER
static int round(double x) {
  if (x < 0)
Yaowu Xu's avatar
Yaowu Xu committed
37
    return static_cast<int>(ceil(x - 0.5));
38
  else
Yaowu Xu's avatar
Yaowu Xu committed
39
    return static_cast<int>(floor(x + 0.5));
40 41
}
#endif
Daniel Kang's avatar
Daniel Kang committed
42

43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58
const int kNumCoeffs = 256;
const double C1 = 0.995184726672197;
const double C2 = 0.98078528040323;
const double C3 = 0.956940335732209;
const double C4 = 0.923879532511287;
const double C5 = 0.881921264348355;
const double C6 = 0.831469612302545;
const double C7 = 0.773010453362737;
const double C8 = 0.707106781186548;
const double C9 = 0.634393284163646;
const double C10 = 0.555570233019602;
const double C11 = 0.471396736825998;
const double C12 = 0.38268343236509;
const double C13 = 0.290284677254462;
const double C14 = 0.195090322016128;
const double C15 = 0.098017140329561;
59

Jingning Han's avatar
Jingning Han committed
60
void butterfly_16x16_dct_1d(double input[16], double output[16]) {
Daniel Kang's avatar
Daniel Kang committed
61 62 63 64 65
  double step[16];
  double intermediate[16];
  double temp1, temp2;

  // step 1
clang-format's avatar
clang-format committed
66 67 68 69 70 71 72 73 74 75
  step[0] = input[0] + input[15];
  step[1] = input[1] + input[14];
  step[2] = input[2] + input[13];
  step[3] = input[3] + input[12];
  step[4] = input[4] + input[11];
  step[5] = input[5] + input[10];
  step[6] = input[6] + input[9];
  step[7] = input[7] + input[8];
  step[8] = input[7] - input[8];
  step[9] = input[6] - input[9];
Daniel Kang's avatar
Daniel Kang committed
76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92
  step[10] = input[5] - input[10];
  step[11] = input[4] - input[11];
  step[12] = input[3] - input[12];
  step[13] = input[2] - input[13];
  step[14] = input[1] - input[14];
  step[15] = input[0] - input[15];

  // step 2
  output[0] = step[0] + step[7];
  output[1] = step[1] + step[6];
  output[2] = step[2] + step[5];
  output[3] = step[3] + step[4];
  output[4] = step[3] - step[4];
  output[5] = step[2] - step[5];
  output[6] = step[1] - step[6];
  output[7] = step[0] - step[7];

clang-format's avatar
clang-format committed
93
  temp1 = step[8] * C7;
94
  temp2 = step[15] * C9;
clang-format's avatar
clang-format committed
95
  output[8] = temp1 + temp2;
Daniel Kang's avatar
Daniel Kang committed
96

clang-format's avatar
clang-format committed
97
  temp1 = step[9] * C11;
98
  temp2 = step[14] * C5;
clang-format's avatar
clang-format committed
99
  output[9] = temp1 - temp2;
Daniel Kang's avatar
Daniel Kang committed
100

101 102
  temp1 = step[10] * C3;
  temp2 = step[13] * C13;
Daniel Kang's avatar
Daniel Kang committed
103 104
  output[10] = temp1 + temp2;

105 106
  temp1 = step[11] * C15;
  temp2 = step[12] * C1;
Daniel Kang's avatar
Daniel Kang committed
107 108
  output[11] = temp1 - temp2;

109 110
  temp1 = step[11] * C1;
  temp2 = step[12] * C15;
Daniel Kang's avatar
Daniel Kang committed
111 112
  output[12] = temp2 + temp1;

113 114
  temp1 = step[10] * C13;
  temp2 = step[13] * C3;
Daniel Kang's avatar
Daniel Kang committed
115 116
  output[13] = temp2 - temp1;

clang-format's avatar
clang-format committed
117
  temp1 = step[9] * C5;
118
  temp2 = step[14] * C11;
Daniel Kang's avatar
Daniel Kang committed
119 120
  output[14] = temp2 + temp1;

clang-format's avatar
clang-format committed
121
  temp1 = step[8] * C9;
122
  temp2 = step[15] * C7;
Daniel Kang's avatar
Daniel Kang committed
123 124 125
  output[15] = temp2 - temp1;

  // step 3
clang-format's avatar
clang-format committed
126 127 128 129
  step[0] = output[0] + output[3];
  step[1] = output[1] + output[2];
  step[2] = output[1] - output[2];
  step[3] = output[0] - output[3];
Daniel Kang's avatar
Daniel Kang committed
130

131 132
  temp1 = output[4] * C14;
  temp2 = output[7] * C2;
clang-format's avatar
clang-format committed
133
  step[4] = temp1 + temp2;
Daniel Kang's avatar
Daniel Kang committed
134

135 136
  temp1 = output[5] * C10;
  temp2 = output[6] * C6;
clang-format's avatar
clang-format committed
137
  step[5] = temp1 + temp2;
Daniel Kang's avatar
Daniel Kang committed
138

139 140
  temp1 = output[5] * C6;
  temp2 = output[6] * C10;
clang-format's avatar
clang-format committed
141
  step[6] = temp2 - temp1;
Daniel Kang's avatar
Daniel Kang committed
142

143 144
  temp1 = output[4] * C2;
  temp2 = output[7] * C14;
clang-format's avatar
clang-format committed
145
  step[7] = temp2 - temp1;
Daniel Kang's avatar
Daniel Kang committed
146

clang-format's avatar
clang-format committed
147 148 149 150
  step[8] = output[8] + output[11];
  step[9] = output[9] + output[10];
  step[10] = output[9] - output[10];
  step[11] = output[8] - output[11];
Daniel Kang's avatar
Daniel Kang committed
151 152 153 154 155 156 157

  step[12] = output[12] + output[15];
  step[13] = output[13] + output[14];
  step[14] = output[13] - output[14];
  step[15] = output[12] - output[15];

  // step 4
clang-format's avatar
clang-format committed
158 159
  output[0] = (step[0] + step[1]);
  output[8] = (step[0] - step[1]);
Daniel Kang's avatar
Daniel Kang committed
160

161 162
  temp1 = step[2] * C12;
  temp2 = step[3] * C4;
Daniel Kang's avatar
Daniel Kang committed
163
  temp1 = temp1 + temp2;
clang-format's avatar
clang-format committed
164
  output[4] = 2 * (temp1 * C8);
Daniel Kang's avatar
Daniel Kang committed
165

166 167
  temp1 = step[2] * C4;
  temp2 = step[3] * C12;
Daniel Kang's avatar
Daniel Kang committed
168
  temp1 = temp2 - temp1;
169
  output[12] = 2 * (temp1 * C8);
Daniel Kang's avatar
Daniel Kang committed
170

clang-format's avatar
clang-format committed
171 172
  output[2] = 2 * ((step[4] + step[5]) * C8);
  output[14] = 2 * ((step[7] - step[6]) * C8);
Daniel Kang's avatar
Daniel Kang committed
173 174 175

  temp1 = step[4] - step[5];
  temp2 = step[6] + step[7];
clang-format's avatar
clang-format committed
176
  output[6] = (temp1 + temp2);
Daniel Kang's avatar
Daniel Kang committed
177 178 179 180 181
  output[10] = (temp1 - temp2);

  intermediate[8] = step[8] + step[14];
  intermediate[9] = step[9] + step[15];

182 183
  temp1 = intermediate[8] * C12;
  temp2 = intermediate[9] * C4;
Daniel Kang's avatar
Daniel Kang committed
184
  temp1 = temp1 - temp2;
185
  output[3] = 2 * (temp1 * C8);
Daniel Kang's avatar
Daniel Kang committed
186

187 188
  temp1 = intermediate[8] * C4;
  temp2 = intermediate[9] * C12;
Daniel Kang's avatar
Daniel Kang committed
189
  temp1 = temp2 + temp1;
190
  output[13] = 2 * (temp1 * C8);
Daniel Kang's avatar
Daniel Kang committed
191

clang-format's avatar
clang-format committed
192
  output[9] = 2 * ((step[10] + step[11]) * C8);
Daniel Kang's avatar
Daniel Kang committed
193 194 195 196

  intermediate[11] = step[10] - step[11];
  intermediate[12] = step[12] + step[13];
  intermediate[13] = step[12] - step[13];
clang-format's avatar
clang-format committed
197 198
  intermediate[14] = step[8] - step[14];
  intermediate[15] = step[9] - step[15];
Daniel Kang's avatar
Daniel Kang committed
199 200

  output[15] = (intermediate[11] + intermediate[12]);
clang-format's avatar
clang-format committed
201
  output[1] = -(intermediate[11] - intermediate[12]);
Daniel Kang's avatar
Daniel Kang committed
202

clang-format's avatar
clang-format committed
203
  output[7] = 2 * (intermediate[13] * C8);
Daniel Kang's avatar
Daniel Kang committed
204

205 206
  temp1 = intermediate[14] * C12;
  temp2 = intermediate[15] * C4;
Daniel Kang's avatar
Daniel Kang committed
207
  temp1 = temp1 - temp2;
208
  output[11] = -2 * (temp1 * C8);
Daniel Kang's avatar
Daniel Kang committed
209

210 211
  temp1 = intermediate[14] * C4;
  temp2 = intermediate[15] * C12;
Daniel Kang's avatar
Daniel Kang committed
212
  temp1 = temp2 + temp1;
clang-format's avatar
clang-format committed
213
  output[5] = 2 * (temp1 * C8);
Daniel Kang's avatar
Daniel Kang committed
214 215
}

216
void reference_16x16_dct_2d(int16_t input[256], double output[256]) {
Daniel Kang's avatar
Daniel Kang committed
217 218 219
  // First transform columns
  for (int i = 0; i < 16; ++i) {
    double temp_in[16], temp_out[16];
clang-format's avatar
clang-format committed
220
    for (int j = 0; j < 16; ++j) temp_in[j] = input[j * 16 + i];
Daniel Kang's avatar
Daniel Kang committed
221
    butterfly_16x16_dct_1d(temp_in, temp_out);
clang-format's avatar
clang-format committed
222
    for (int j = 0; j < 16; ++j) output[j * 16 + i] = temp_out[j];
Daniel Kang's avatar
Daniel Kang committed
223 224 225 226
  }
  // Then transform rows
  for (int i = 0; i < 16; ++i) {
    double temp_in[16], temp_out[16];
clang-format's avatar
clang-format committed
227
    for (int j = 0; j < 16; ++j) temp_in[j] = output[j + i * 16];
Daniel Kang's avatar
Daniel Kang committed
228 229
    butterfly_16x16_dct_1d(temp_in, temp_out);
    // Scale by some magic number
clang-format's avatar
clang-format committed
230
    for (int j = 0; j < 16; ++j) output[j + i * 16] = temp_out[j] / 2;
Daniel Kang's avatar
Daniel Kang committed
231 232 233
  }
}

234 235 236
typedef void (*FdctFunc)(const int16_t *in, tran_low_t *out, int stride);
typedef void (*IdctFunc)(const tran_low_t *in, uint8_t *out, int stride);
typedef void (*FhtFunc)(const int16_t *in, tran_low_t *out, int stride,
237
                        int tx_type);
238
typedef void (*IhtFunc)(const tran_low_t *in, uint8_t *out, int stride,
239
                        int tx_type);
Daniel Kang's avatar
Daniel Kang committed
240

Adrian Grange's avatar
Adrian Grange committed
241 242 243
typedef std::tr1::tuple<FdctFunc, IdctFunc, int, aom_bit_depth_t> Dct16x16Param;
typedef std::tr1::tuple<FhtFunc, IhtFunc, int, aom_bit_depth_t> Ht16x16Param;
typedef std::tr1::tuple<IdctFunc, IdctFunc, int, aom_bit_depth_t>
244
    Idct16x16Param;
245

246
void fdct16x16_ref(const int16_t *in, tran_low_t *out, int stride,
247
                   int /*tx_type*/) {
Adrian Grange's avatar
Adrian Grange committed
248
  aom_fdct16x16_c(in, out, stride);
249 250
}

251
void idct16x16_ref(const tran_low_t *in, uint8_t *dest, int stride,
252
                   int /*tx_type*/) {
Adrian Grange's avatar
Adrian Grange committed
253
  aom_idct16x16_256_add_c(in, dest, stride);
254 255
}

clang-format's avatar
clang-format committed
256
void fht16x16_ref(const int16_t *in, tran_low_t *out, int stride, int tx_type) {
257
  av1_fht16x16_c(in, out, stride, tx_type);
258 259
}

260 261
void iht16x16_ref(const tran_low_t *in, uint8_t *dest, int stride,
                  int tx_type) {
262
  av1_iht16x16_256_add_c(in, dest, stride, tx_type);
263 264
}

265
#if CONFIG_AOM_HIGHBITDEPTH
266
void idct16x16_10(const tran_low_t *in, uint8_t *out, int stride) {
Adrian Grange's avatar
Adrian Grange committed
267
  aom_highbd_idct16x16_256_add_c(in, out, stride, 10);
268 269 270
}

void idct16x16_12(const tran_low_t *in, uint8_t *out, int stride) {
Adrian Grange's avatar
Adrian Grange committed
271
  aom_highbd_idct16x16_256_add_c(in, out, stride, 12);
272 273 274
}

void idct16x16_10_ref(const tran_low_t *in, uint8_t *out, int stride,
275
                      int /*tx_type*/) {
276 277 278 279
  idct16x16_10(in, out, stride);
}

void idct16x16_12_ref(const tran_low_t *in, uint8_t *out, int stride,
280
                      int /*tx_type*/) {
281 282 283 284
  idct16x16_12(in, out, stride);
}

void iht16x16_10(const tran_low_t *in, uint8_t *out, int stride, int tx_type) {
285
  av1_highbd_iht16x16_256_add_c(in, out, stride, tx_type, 10);
286 287 288
}

void iht16x16_12(const tran_low_t *in, uint8_t *out, int stride, int tx_type) {
289
  av1_highbd_iht16x16_256_add_c(in, out, stride, tx_type, 12);
290
}
291

292 293
#if HAVE_SSE2

294
void idct16x16_10_add_10_c(const tran_low_t *in, uint8_t *out, int stride) {
Adrian Grange's avatar
Adrian Grange committed
295
  aom_highbd_idct16x16_10_add_c(in, out, stride, 10);
296 297 298
}

void idct16x16_10_add_12_c(const tran_low_t *in, uint8_t *out, int stride) {
Adrian Grange's avatar
Adrian Grange committed
299
  aom_highbd_idct16x16_10_add_c(in, out, stride, 12);
300 301 302
}

void idct16x16_256_add_10_sse2(const tran_low_t *in, uint8_t *out, int stride) {
Adrian Grange's avatar
Adrian Grange committed
303
  aom_highbd_idct16x16_256_add_sse2(in, out, stride, 10);
304 305 306
}

void idct16x16_256_add_12_sse2(const tran_low_t *in, uint8_t *out, int stride) {
Adrian Grange's avatar
Adrian Grange committed
307
  aom_highbd_idct16x16_256_add_sse2(in, out, stride, 12);
308 309 310
}

void idct16x16_10_add_10_sse2(const tran_low_t *in, uint8_t *out, int stride) {
Adrian Grange's avatar
Adrian Grange committed
311
  aom_highbd_idct16x16_10_add_sse2(in, out, stride, 10);
312 313 314
}

void idct16x16_10_add_12_sse2(const tran_low_t *in, uint8_t *out, int stride) {
Adrian Grange's avatar
Adrian Grange committed
315
  aom_highbd_idct16x16_10_add_sse2(in, out, stride, 12);
316 317
}
#endif  // HAVE_SSE2
318
#endif  // CONFIG_AOM_HIGHBITDEPTH
319

320
class Trans16x16TestBase {
321
 public:
322
  virtual ~Trans16x16TestBase() {}
323

324
 protected:
325
  virtual void RunFwdTxfm(int16_t *in, tran_low_t *out, int stride) = 0;
326

327
  virtual void RunInvTxfm(tran_low_t *out, uint8_t *dst, int stride) = 0;
328 329 330

  void RunAccuracyCheck() {
    ACMRandom rnd(ACMRandom::DeterministicSeed());
331 332
    uint32_t max_error = 0;
    int64_t total_error = 0;
333 334
    const int count_test_block = 10000;
    for (int i = 0; i < count_test_block; ++i) {
335 336 337 338
      DECLARE_ALIGNED(16, int16_t, test_input_block[kNumCoeffs]);
      DECLARE_ALIGNED(16, tran_low_t, test_temp_block[kNumCoeffs]);
      DECLARE_ALIGNED(16, uint8_t, dst[kNumCoeffs]);
      DECLARE_ALIGNED(16, uint8_t, src[kNumCoeffs]);
339
#if CONFIG_AOM_HIGHBITDEPTH
340 341
      DECLARE_ALIGNED(16, uint16_t, dst16[kNumCoeffs]);
      DECLARE_ALIGNED(16, uint16_t, src16[kNumCoeffs]);
342
#endif
343

344
      // Initialize a test block with input range [-mask_, mask_].
345
      for (int j = 0; j < kNumCoeffs; ++j) {
Adrian Grange's avatar
Adrian Grange committed
346
        if (bit_depth_ == AOM_BITS_8) {
347 348 349
          src[j] = rnd.Rand8();
          dst[j] = rnd.Rand8();
          test_input_block[j] = src[j] - dst[j];
350
#if CONFIG_AOM_HIGHBITDEPTH
351 352 353 354 355 356
        } else {
          src16[j] = rnd.Rand16() & mask_;
          dst16[j] = rnd.Rand16() & mask_;
          test_input_block[j] = src16[j] - dst16[j];
#endif
        }
357 358
      }

clang-format's avatar
clang-format committed
359 360
      ASM_REGISTER_STATE_CHECK(
          RunFwdTxfm(test_input_block, test_temp_block, pitch_));
Adrian Grange's avatar
Adrian Grange committed
361
      if (bit_depth_ == AOM_BITS_8) {
clang-format's avatar
clang-format committed
362
        ASM_REGISTER_STATE_CHECK(RunInvTxfm(test_temp_block, dst, pitch_));
363
#if CONFIG_AOM_HIGHBITDEPTH
364 365 366 367 368
      } else {
        ASM_REGISTER_STATE_CHECK(
            RunInvTxfm(test_temp_block, CONVERT_TO_BYTEPTR(dst16), pitch_));
#endif
      }
369 370

      for (int j = 0; j < kNumCoeffs; ++j) {
371
#if CONFIG_AOM_HIGHBITDEPTH
Yaowu Xu's avatar
Yaowu Xu committed
372
        const int32_t diff =
Adrian Grange's avatar
Adrian Grange committed
373
            bit_depth_ == AOM_BITS_8 ? dst[j] - src[j] : dst16[j] - src16[j];
374
#else
Yaowu Xu's avatar
Yaowu Xu committed
375
        const int32_t diff = dst[j] - src[j];
376
#endif
377
        const uint32_t error = diff * diff;
clang-format's avatar
clang-format committed
378
        if (max_error < error) max_error = error;
379 380
        total_error += error;
      }
Scott LaVarnway's avatar
Scott LaVarnway committed
381
    }
Daniel Kang's avatar
Daniel Kang committed
382

clang-format's avatar
clang-format committed
383
    EXPECT_GE(1u << 2 * (bit_depth_ - 8), max_error)
384 385
        << "Error: 16x16 FHT/IHT has an individual round trip error > 1";

386
    EXPECT_GE(count_test_block << 2 * (bit_depth_ - 8), total_error)
387
        << "Error: 16x16 FHT/IHT has average round trip error > 1 per block";
388 389
  }

390
  void RunCoeffCheck() {
391 392
    ACMRandom rnd(ACMRandom::DeterministicSeed());
    const int count_test_block = 1000;
393 394 395
    DECLARE_ALIGNED(16, int16_t, input_block[kNumCoeffs]);
    DECLARE_ALIGNED(16, tran_low_t, output_ref_block[kNumCoeffs]);
    DECLARE_ALIGNED(16, tran_low_t, output_block[kNumCoeffs]);
396

397
    for (int i = 0; i < count_test_block; ++i) {
398
      // Initialize a test block with input range [-mask_, mask_].
399
      for (int j = 0; j < kNumCoeffs; ++j)
400
        input_block[j] = (rnd.Rand16() & mask_) - (rnd.Rand16() & mask_);
401 402

      fwd_txfm_ref(input_block, output_ref_block, pitch_, tx_type_);
403
      ASM_REGISTER_STATE_CHECK(RunFwdTxfm(input_block, output_block, pitch_));
404 405 406 407 408 409 410 411 412 413

      // The minimum quant value is 4.
      for (int j = 0; j < kNumCoeffs; ++j)
        EXPECT_EQ(output_block[j], output_ref_block[j]);
    }
  }

  void RunMemCheck() {
    ACMRandom rnd(ACMRandom::DeterministicSeed());
    const int count_test_block = 1000;
414 415 416
    DECLARE_ALIGNED(16, int16_t, input_extreme_block[kNumCoeffs]);
    DECLARE_ALIGNED(16, tran_low_t, output_ref_block[kNumCoeffs]);
    DECLARE_ALIGNED(16, tran_low_t, output_block[kNumCoeffs]);
Scott LaVarnway's avatar
Scott LaVarnway committed
417

418
    for (int i = 0; i < count_test_block; ++i) {
419
      // Initialize a test block with input range [-mask_, mask_].
420
      for (int j = 0; j < kNumCoeffs; ++j) {
421
        input_extreme_block[j] = rnd.Rand8() % 2 ? mask_ : -mask_;
422
      }
423
      if (i == 0) {
clang-format's avatar
clang-format committed
424
        for (int j = 0; j < kNumCoeffs; ++j) input_extreme_block[j] = mask_;
425
      } else if (i == 1) {
clang-format's avatar
clang-format committed
426
        for (int j = 0; j < kNumCoeffs; ++j) input_extreme_block[j] = -mask_;
427
      }
428

429
      fwd_txfm_ref(input_extreme_block, output_ref_block, pitch_, tx_type_);
clang-format's avatar
clang-format committed
430 431
      ASM_REGISTER_STATE_CHECK(
          RunFwdTxfm(input_extreme_block, output_block, pitch_));
432 433 434

      // The minimum quant value is 4.
      for (int j = 0; j < kNumCoeffs; ++j) {
435
        EXPECT_EQ(output_block[j], output_ref_block[j]);
436
        EXPECT_GE(4 * DCT_MAX_VALUE << (bit_depth_ - 8), abs(output_block[j]))
437 438
            << "Error: 16x16 FDCT has coefficient larger than 4*DCT_MAX_VALUE";
      }
439
    }
440 441
  }

442 443
  void RunQuantCheck(int dc_thred, int ac_thred) {
    ACMRandom rnd(ACMRandom::DeterministicSeed());
444
    const int count_test_block = 100000;
445 446
    DECLARE_ALIGNED(16, int16_t, input_extreme_block[kNumCoeffs]);
    DECLARE_ALIGNED(16, tran_low_t, output_ref_block[kNumCoeffs]);
447

448 449
    DECLARE_ALIGNED(16, uint8_t, dst[kNumCoeffs]);
    DECLARE_ALIGNED(16, uint8_t, ref[kNumCoeffs]);
450
#if CONFIG_AOM_HIGHBITDEPTH
451 452
    DECLARE_ALIGNED(16, uint16_t, dst16[kNumCoeffs]);
    DECLARE_ALIGNED(16, uint16_t, ref16[kNumCoeffs]);
453
#endif
454 455

    for (int i = 0; i < count_test_block; ++i) {
456
      // Initialize a test block with input range [-mask_, mask_].
457
      for (int j = 0; j < kNumCoeffs; ++j) {
458
        input_extreme_block[j] = rnd.Rand8() % 2 ? mask_ : -mask_;
459 460
      }
      if (i == 0)
clang-format's avatar
clang-format committed
461
        for (int j = 0; j < kNumCoeffs; ++j) input_extreme_block[j] = mask_;
462
      if (i == 1)
clang-format's avatar
clang-format committed
463
        for (int j = 0; j < kNumCoeffs; ++j) input_extreme_block[j] = -mask_;
464 465 466 467

      fwd_txfm_ref(input_extreme_block, output_ref_block, pitch_, tx_type_);

      // clear reconstructed pixel buffers
James Zern's avatar
James Zern committed
468 469
      memset(dst, 0, kNumCoeffs * sizeof(uint8_t));
      memset(ref, 0, kNumCoeffs * sizeof(uint8_t));
470
#if CONFIG_AOM_HIGHBITDEPTH
James Zern's avatar
James Zern committed
471 472
      memset(dst16, 0, kNumCoeffs * sizeof(uint16_t));
      memset(ref16, 0, kNumCoeffs * sizeof(uint16_t));
473
#endif
474 475 476 477 478

      // quantization with maximum allowed step sizes
      output_ref_block[0] = (output_ref_block[0] / dc_thred) * dc_thred;
      for (int j = 1; j < kNumCoeffs; ++j)
        output_ref_block[j] = (output_ref_block[j] / ac_thred) * ac_thred;
Adrian Grange's avatar
Adrian Grange committed
479
      if (bit_depth_ == AOM_BITS_8) {
480 481
        inv_txfm_ref(output_ref_block, ref, pitch_, tx_type_);
        ASM_REGISTER_STATE_CHECK(RunInvTxfm(output_ref_block, dst, pitch_));
482
#if CONFIG_AOM_HIGHBITDEPTH
483 484 485
      } else {
        inv_txfm_ref(output_ref_block, CONVERT_TO_BYTEPTR(ref16), pitch_,
                     tx_type_);
clang-format's avatar
clang-format committed
486 487
        ASM_REGISTER_STATE_CHECK(
            RunInvTxfm(output_ref_block, CONVERT_TO_BYTEPTR(dst16), pitch_));
488 489
#endif
      }
Adrian Grange's avatar
Adrian Grange committed
490
      if (bit_depth_ == AOM_BITS_8) {
clang-format's avatar
clang-format committed
491
        for (int j = 0; j < kNumCoeffs; ++j) EXPECT_EQ(ref[j], dst[j]);
492
#if CONFIG_AOM_HIGHBITDEPTH
493
      } else {
clang-format's avatar
clang-format committed
494
        for (int j = 0; j < kNumCoeffs; ++j) EXPECT_EQ(ref16[j], dst16[j]);
495 496
#endif
      }
497 498 499
    }
  }

500 501 502
  void RunInvAccuracyCheck() {
    ACMRandom rnd(ACMRandom::DeterministicSeed());
    const int count_test_block = 1000;
503 504 505 506
    DECLARE_ALIGNED(16, int16_t, in[kNumCoeffs]);
    DECLARE_ALIGNED(16, tran_low_t, coeff[kNumCoeffs]);
    DECLARE_ALIGNED(16, uint8_t, dst[kNumCoeffs]);
    DECLARE_ALIGNED(16, uint8_t, src[kNumCoeffs]);
507
#if CONFIG_AOM_HIGHBITDEPTH
508 509
    DECLARE_ALIGNED(16, uint16_t, dst16[kNumCoeffs]);
    DECLARE_ALIGNED(16, uint16_t, src16[kNumCoeffs]);
510
#endif  // CONFIG_AOM_HIGHBITDEPTH
Daniel Kang's avatar
Daniel Kang committed
511

512 513
    for (int i = 0; i < count_test_block; ++i) {
      double out_r[kNumCoeffs];
Daniel Kang's avatar
Daniel Kang committed
514

515 516
      // Initialize a test block with input range [-255, 255].
      for (int j = 0; j < kNumCoeffs; ++j) {
Adrian Grange's avatar
Adrian Grange committed
517
        if (bit_depth_ == AOM_BITS_8) {
518 519 520
          src[j] = rnd.Rand8();
          dst[j] = rnd.Rand8();
          in[j] = src[j] - dst[j];
521
#if CONFIG_AOM_HIGHBITDEPTH
522 523 524 525
        } else {
          src16[j] = rnd.Rand16() & mask_;
          dst16[j] = rnd.Rand16() & mask_;
          in[j] = src16[j] - dst16[j];
526
#endif  // CONFIG_AOM_HIGHBITDEPTH
527
        }
528 529 530 531
      }

      reference_16x16_dct_2d(in, out_r);
      for (int j = 0; j < kNumCoeffs; ++j)
532
        coeff[j] = static_cast<tran_low_t>(round(out_r[j]));
533

Adrian Grange's avatar
Adrian Grange committed
534
      if (bit_depth_ == AOM_BITS_8) {
535
        ASM_REGISTER_STATE_CHECK(RunInvTxfm(coeff, dst, 16));
536
#if CONFIG_AOM_HIGHBITDEPTH
537
      } else {
clang-format's avatar
clang-format committed
538 539
        ASM_REGISTER_STATE_CHECK(
            RunInvTxfm(coeff, CONVERT_TO_BYTEPTR(dst16), 16));
540
#endif  // CONFIG_AOM_HIGHBITDEPTH
541
      }
542 543

      for (int j = 0; j < kNumCoeffs; ++j) {
544
#if CONFIG_AOM_HIGHBITDEPTH
545
        const uint32_t diff =
Adrian Grange's avatar
Adrian Grange committed
546
            bit_depth_ == AOM_BITS_8 ? dst[j] - src[j] : dst16[j] - src16[j];
547
#else
548
        const uint32_t diff = dst[j] - src[j];
549
#endif  // CONFIG_AOM_HIGHBITDEPTH
550
        const uint32_t error = diff * diff;
clang-format's avatar
clang-format committed
551 552
        EXPECT_GE(1u, error) << "Error: 16x16 IDCT has error " << error
                             << " at index " << j;
553
      }
Daniel Kang's avatar
Daniel Kang committed
554 555
    }
  }
556 557 558 559 560

  void CompareInvReference(IdctFunc ref_txfm, int thresh) {
    ACMRandom rnd(ACMRandom::DeterministicSeed());
    const int count_test_block = 10000;
    const int eob = 10;
561
    const int16_t *scan = av1_default_scan_orders[TX_16X16].scan;
562 563 564
    DECLARE_ALIGNED(16, tran_low_t, coeff[kNumCoeffs]);
    DECLARE_ALIGNED(16, uint8_t, dst[kNumCoeffs]);
    DECLARE_ALIGNED(16, uint8_t, ref[kNumCoeffs]);
565
#if CONFIG_AOM_HIGHBITDEPTH
566 567
    DECLARE_ALIGNED(16, uint16_t, dst16[kNumCoeffs]);
    DECLARE_ALIGNED(16, uint16_t, ref16[kNumCoeffs]);
568
#endif  // CONFIG_AOM_HIGHBITDEPTH
569 570 571 572 573 574 575 576 577

    for (int i = 0; i < count_test_block; ++i) {
      for (int j = 0; j < kNumCoeffs; ++j) {
        if (j < eob) {
          // Random values less than the threshold, either positive or negative
          coeff[scan[j]] = rnd(thresh) * (1 - 2 * (i % 2));
        } else {
          coeff[scan[j]] = 0;
        }
Adrian Grange's avatar
Adrian Grange committed
578
        if (bit_depth_ == AOM_BITS_8) {
579 580
          dst[j] = 0;
          ref[j] = 0;
581
#if CONFIG_AOM_HIGHBITDEPTH
582 583 584
        } else {
          dst16[j] = 0;
          ref16[j] = 0;
585
#endif  // CONFIG_AOM_HIGHBITDEPTH
586 587
        }
      }
Adrian Grange's avatar
Adrian Grange committed
588
      if (bit_depth_ == AOM_BITS_8) {
589 590 591
        ref_txfm(coeff, ref, pitch_);
        ASM_REGISTER_STATE_CHECK(RunInvTxfm(coeff, dst, pitch_));
      } else {
592
#if CONFIG_AOM_HIGHBITDEPTH
593
        ref_txfm(coeff, CONVERT_TO_BYTEPTR(ref16), pitch_);
clang-format's avatar
clang-format committed
594 595
        ASM_REGISTER_STATE_CHECK(
            RunInvTxfm(coeff, CONVERT_TO_BYTEPTR(dst16), pitch_));
596
#endif  // CONFIG_AOM_HIGHBITDEPTH
597 598 599
      }

      for (int j = 0; j < kNumCoeffs; ++j) {
600
#if CONFIG_AOM_HIGHBITDEPTH
601
        const uint32_t diff =
Adrian Grange's avatar
Adrian Grange committed
602
            bit_depth_ == AOM_BITS_8 ? dst[j] - ref[j] : dst16[j] - ref16[j];
603 604
#else
        const uint32_t diff = dst[j] - ref[j];
605
#endif  // CONFIG_AOM_HIGHBITDEPTH
606
        const uint32_t error = diff * diff;
clang-format's avatar
clang-format committed
607 608
        EXPECT_EQ(0u, error) << "Error: 16x16 IDCT Comparison has error "
                             << error << " at index " << j;
609 610 611 612
      }
    }
  }

613 614
  int pitch_;
  int tx_type_;
Adrian Grange's avatar
Adrian Grange committed
615
  aom_bit_depth_t bit_depth_;
616
  int mask_;
617 618
  FhtFunc fwd_txfm_ref;
  IhtFunc inv_txfm_ref;
619
};
Daniel Kang's avatar
Daniel Kang committed
620

clang-format's avatar
clang-format committed
621 622
class Trans16x16DCT : public Trans16x16TestBase,
                      public ::testing::TestWithParam<Dct16x16Param> {
623 624
 public:
  virtual ~Trans16x16DCT() {}
Daniel Kang's avatar
Daniel Kang committed
625

626 627 628
  virtual void SetUp() {
    fwd_txfm_ = GET_PARAM(0);
    inv_txfm_ = GET_PARAM(1);
clang-format's avatar
clang-format committed
629
    tx_type_ = GET_PARAM(2);
630
    bit_depth_ = GET_PARAM(3);
clang-format's avatar
clang-format committed
631
    pitch_ = 16;
632
    fwd_txfm_ref = fdct16x16_ref;
633
    inv_txfm_ref = idct16x16_ref;
634
    mask_ = (1 << bit_depth_) - 1;
635
#if CONFIG_AOM_HIGHBITDEPTH
636
    switch (bit_depth_) {
Adrian Grange's avatar
Adrian Grange committed
637 638
      case AOM_BITS_10: inv_txfm_ref = idct16x16_10_ref; break;
      case AOM_BITS_12: inv_txfm_ref = idct16x16_12_ref; break;
clang-format's avatar
clang-format committed
639
      default: inv_txfm_ref = idct16x16_ref; break;
640 641 642 643
    }
#else
    inv_txfm_ref = idct16x16_ref;
#endif
644
  }
Yaowu Xu's avatar
Yaowu Xu committed
645
  virtual void TearDown() { libaom_test::ClearSystemState(); }
Daniel Kang's avatar
Daniel Kang committed
646

647
 protected:
648
  void RunFwdTxfm(int16_t *in, tran_low_t *out, int stride) {
649 650
    fwd_txfm_(in, out, stride);
  }
651
  void RunInvTxfm(tran_low_t *out, uint8_t *dst, int stride) {
652
    inv_txfm_(out, dst, stride);
Daniel Kang's avatar
Daniel Kang committed
653
  }
654

655 656
  FdctFunc fwd_txfm_;
  IdctFunc inv_txfm_;
657 658
};

clang-format's avatar
clang-format committed
659
TEST_P(Trans16x16DCT, AccuracyCheck) { RunAccuracyCheck(); }
660

clang-format's avatar
clang-format committed
661
TEST_P(Trans16x16DCT, CoeffCheck) { RunCoeffCheck(); }
662

clang-format's avatar
clang-format committed
663
TEST_P(Trans16x16DCT, MemCheck) { RunMemCheck(); }
664

665 666 667 668 669 670
TEST_P(Trans16x16DCT, QuantCheck) {
  // Use maximally allowed quantization step sizes for DC and AC
  // coefficients respectively.
  RunQuantCheck(1336, 1828);
}

clang-format's avatar
clang-format committed
671
TEST_P(Trans16x16DCT, InvAccuracyCheck) { RunInvAccuracyCheck(); }
672

clang-format's avatar
clang-format committed
673 674
class Trans16x16HT : public Trans16x16TestBase,
                     public ::testing::TestWithParam<Ht16x16Param> {
675 676 677 678 679 680
 public:
  virtual ~Trans16x16HT() {}

  virtual void SetUp() {
    fwd_txfm_ = GET_PARAM(0);
    inv_txfm_ = GET_PARAM(1);
clang-format's avatar
clang-format committed
681
    tx_type_ = GET_PARAM(2);
682
    bit_depth_ = GET_PARAM(3);
clang-format's avatar
clang-format committed
683
    pitch_ = 16;
684
    fwd_txfm_ref = fht16x16_ref;
685
    inv_txfm_ref = iht16x16_ref;
686
    mask_ = (1 << bit_depth_) - 1;
687
#if CONFIG_AOM_HIGHBITDEPTH
688
    switch (bit_depth_) {
Adrian Grange's avatar
Adrian Grange committed
689 690
      case AOM_BITS_10: inv_txfm_ref = iht16x16_10; break;
      case AOM_BITS_12: inv_txfm_ref = iht16x16_12; break;
clang-format's avatar
clang-format committed
691
      default: inv_txfm_ref = iht16x16_ref; break;
692 693 694 695
    }
#else
    inv_txfm_ref = iht16x16_ref;
#endif
696
  }
Yaowu Xu's avatar
Yaowu Xu committed
697
  virtual void TearDown() { libaom_test::ClearSystemState(); }
698 699

 protected:
700
  void RunFwdTxfm(int16_t *in, tran_low_t *out, int stride) {
701
    fwd_txfm_(in, out, stride, tx_type_);
702
  }
703
  void RunInvTxfm(tran_low_t *out, uint8_t *dst, int stride) {
704
    inv_txfm_(out, dst, stride, tx_type_);
705 706
  }

707 708
  FhtFunc fwd_txfm_;
  IhtFunc inv_txfm_;
709 710
};

clang-format's avatar
clang-format committed
711
TEST_P(Trans16x16HT, AccuracyCheck) { RunAccuracyCheck(); }
712

clang-format's avatar
clang-format committed
713
TEST_P(Trans16x16HT, CoeffCheck) { RunCoeffCheck(); }
714

clang-format's avatar
clang-format committed
715
TEST_P(Trans16x16HT, MemCheck) { RunMemCheck(); }
716

717 718 719
TEST_P(Trans16x16HT, QuantCheck) {
  // The encoder skips any non-DC intra prediction modes,
  // when the quantization step size goes beyond 988.
720
  RunQuantCheck(429, 729);
721 722
}

clang-format's avatar
clang-format committed
723 724
class InvTrans16x16DCT : public Trans16x16TestBase,
                         public ::testing::TestWithParam<Idct16x16Param> {
725 726 727 728 729 730 731 732 733 734
 public:
  virtual ~InvTrans16x16DCT() {}

  virtual void SetUp() {
    ref_txfm_ = GET_PARAM(0);
    inv_txfm_ = GET_PARAM(1);
    thresh_ = GET_PARAM(2);
    bit_depth_ = GET_PARAM(3);
    pitch_ = 16;
    mask_ = (1 << bit_depth_) - 1;
clang-format's avatar
clang-format committed
735
  }
Yaowu Xu's avatar
Yaowu Xu committed
736
  virtual void TearDown() { libaom_test::ClearSystemState(); }
737 738

 protected:
739
  void RunFwdTxfm(int16_t * /*in*/, tran_low_t * /*out*/, int /*stride*/) {}
740 741 742 743 744 745 746 747 748 749 750 751 752
  void RunInvTxfm(tran_low_t *out, uint8_t *dst, int stride) {
    inv_txfm_(out, dst, stride);
  }

  IdctFunc ref_txfm_;
  IdctFunc inv_txfm_;
  int thresh_;
};

TEST_P(InvTrans16x16DCT, CompareReference) {
  CompareInvReference(ref_txfm_, thresh_);
}

753 754
using std::tr1::make_tuple;

755
#if CONFIG_AOM_HIGHBITDEPTH
756 757 758
INSTANTIATE_TEST_CASE_P(
    C, Trans16x16DCT,
    ::testing::Values(
Adrian Grange's avatar
Adrian Grange committed
759 760 761
        make_tuple(&aom_highbd_fdct16x16_c, &idct16x16_10, 0, AOM_BITS_10),
        make_tuple(&aom_highbd_fdct16x16_c, &idct16x16_12, 0, AOM_BITS_12),
        make_tuple(&aom_fdct16x16_c, &aom_idct16x16_256_add_c, 0, AOM_BITS_8)));
762
#else
clang-format's avatar
clang-format committed
763
INSTANTIATE_TEST_CASE_P(C, Trans16x16DCT,
Adrian Grange's avatar
Adrian Grange committed
764 765
                        ::testing::Values(make_tuple(&aom_fdct16x16_c,
                                                     &aom_idct16x16_256_add_c,
Adrian Grange's avatar
Adrian Grange committed
766
                                                     0, AOM_BITS_8)));
767
#endif  // CONFIG_AOM_HIGHBITDEPTH
768

769
#if CONFIG_AOM_HIGHBITDEPTH
770 771 772
INSTANTIATE_TEST_CASE_P(
    C, Trans16x16HT,
    ::testing::Values(
Adrian Grange's avatar
Adrian Grange committed
773 774 775 776 777 778 779 780 781 782 783 784
        make_tuple(&av1_highbd_fht16x16_c, &iht16x16_10, 0, AOM_BITS_10),
        make_tuple(&av1_highbd_fht16x16_c, &iht16x16_10, 1, AOM_BITS_10),
        make_tuple(&av1_highbd_fht16x16_c, &iht16x16_10, 2, AOM_BITS_10),
        make_tuple(&av1_highbd_fht16x16_c, &iht16x16_10, 3, AOM_BITS_10),
        make_tuple(&av1_highbd_fht16x16_c, &iht16x16_12, 0, AOM_BITS_12),
        make_tuple(&av1_highbd_fht16x16_c, &iht16x16_12, 1, AOM_BITS_12),
        make_tuple(&av1_highbd_fht16x16_c, &iht16x16_12, 2, AOM_BITS_12),
        make_tuple(&av1_highbd_fht16x16_c, &iht16x16_12, 3, AOM_BITS_12),
        make_tuple(&av1_fht16x16_c, &av1_iht16x16_256_add_c, 0, AOM_BITS_8),
        make_tuple(&av1_fht16x16_c, &av1_iht16x16_256_add_c, 1, AOM_BITS_8),
        make_tuple(&av1_fht16x16_c, &av1_iht16x16_256_add_c, 2, AOM_BITS_8),
        make_tuple(&av1_fht16x16_c, &av1_iht16x16_256_add_c, 3, AOM_BITS_8)));
785 786 787 788
#else
INSTANTIATE_TEST_CASE_P(
    C, Trans16x16HT,
    ::testing::Values(
Adrian Grange's avatar
Adrian Grange committed
789 790 791 792
        make_tuple(&av1_fht16x16_c, &av1_iht16x16_256_add_c, 0, AOM_BITS_8),
        make_tuple(&av1_fht16x16_c, &av1_iht16x16_256_add_c, 1, AOM_BITS_8),
        make_tuple(&av1_fht16x16_c, &av1_iht16x16_256_add_c, 2, AOM_BITS_8),
        make_tuple(&av1_fht16x16_c, &av1_iht16x16_256_add_c, 3, AOM_BITS_8)));
793
#endif  // CONFIG_AOM_HIGHBITDEPTH
794

795
#if HAVE_NEON_ASM && !CONFIG_AOM_HIGHBITDEPTH && !CONFIG_EMULATE_HARDWARE
James Zern's avatar
James Zern committed
796 797
INSTANTIATE_TEST_CASE_P(
    NEON, Trans16x16DCT,
Adrian Grange's avatar
Adrian Grange committed
798
    ::testing::Values(make_tuple(&aom_fdct16x16_c, &aom_idct16x16_256_add_neon,
Adrian Grange's avatar
Adrian Grange committed
799
                                 0, AOM_BITS_8)));
James Zern's avatar
James Zern committed
800 801
#endif

802
#if HAVE_SSE2 && !CONFIG_AOM_HIGHBITDEPTH && !CONFIG_EMULATE_HARDWARE
803 804
INSTANTIATE_TEST_CASE_P(
    SSE2, Trans16x16DCT,
Adrian Grange's avatar
Adrian Grange committed
805
    ::testing::Values(make_tuple(&aom_fdct16x16_sse2,
Adrian Grange's avatar
Adrian Grange committed
806
                                 &aom_idct16x16_256_add_sse2, 0, AOM_BITS_8)));
807 808
INSTANTIATE_TEST_CASE_P(
    SSE2, Trans16x16HT,
clang-format's avatar
clang-format committed
809 810 811 812 813 814 815 816
    ::testing::Values(make_tuple(&av1_fht16x16_sse2, &av1_iht16x16_256_add_sse2,
                                 0, AOM_BITS_8),
                      make_tuple(&av1_fht16x16_sse2, &av1_iht16x16_256_add_sse2,
                                 1, AOM_BITS_8),
                      make_tuple(&av1_fht16x16_sse2, &av1_iht16x16_256_add_sse2,
                                 2, AOM_BITS_8),
                      make_tuple(&av1_fht16x16_sse2, &av1_iht16x16_256_add_sse2,
                                 3, AOM_BITS_8)));
817 818 819
#endif  // HAVE_SSE2 && !CONFIG_AOM_HIGHBITDEPTH && !CONFIG_EMULATE_HARDWARE

#if HAVE_SSE2 && CONFIG_AOM_HIGHBITDEPTH && !CONFIG_EMULATE_HARDWARE
820 821 822
INSTANTIATE_TEST_CASE_P(
    SSE2, Trans16x16DCT,
    ::testing::Values(
Adrian Grange's avatar
Adrian Grange committed
823
        make_tuple(&aom_highbd_fdct16x16_sse2, &idct16x16_10, 0, AOM_BITS_10),
Adrian Grange's avatar
Adrian Grange committed
824
        make_tuple(&aom_highbd_fdct16x16_c, &idct16x16_256_add_10_sse2, 0,
Adrian Grange's avatar
Adrian Grange committed
825 826
                   AOM_BITS_10),
        make_tuple(&aom_highbd_fdct16x16_sse2, &idct16x16_12, 0, AOM_BITS_12),
Adrian Grange's avatar
Adrian Grange committed
827
        make_tuple(&aom_highbd_fdct16x16_c, &idct16x16_256_add_12_sse2, 0,
Adrian Grange's avatar
Adrian Grange committed
828
                   AOM_BITS_12),
Adrian Grange's avatar
Adrian Grange committed
829
        make_tuple(&aom_fdct16x16_sse2, &aom_idct16x16_256_add_c, 0,
Adrian Grange's avatar
Adrian Grange committed
830
                   AOM_BITS_8)));
831 832
INSTANTIATE_TEST_CASE_P(
    SSE2, Trans16x16HT,
clang-format's avatar
clang-format committed
833 834 835 836 837 838
    ::testing::Values(
        make_tuple(&av1_fht16x16_sse2, &av1_iht16x16_256_add_c, 0, AOM_BITS_8),
        make_tuple(&av1_fht16x16_sse2, &av1_iht16x16_256_add_c, 1, AOM_BITS_8),
        make_tuple(&av1_fht16x16_sse2, &av1_iht16x16_256_add_c, 2, AOM_BITS_8),
        make_tuple(&av1_fht16x16_sse2, &av1_iht16x16_256_add_c, 3,
                   AOM_BITS_8)));
839 840 841 842
// Optimizations take effect at a threshold of 3155, so we use a value close to
// that to test both branches.
INSTANTIATE_TEST_CASE_P(
    SSE2, InvTrans16x16DCT,
clang-format's avatar
clang-format committed
843
    ::testing::Values(make_tuple(&idct16x16_10_add_10_c,
Adrian Grange's avatar
Adrian Grange committed
844
                                 &idct16x16_10_add_10_sse2, 3167, AOM_BITS_10),
clang-format's avatar
clang-format committed
845
                      make_tuple(&idct16x16_10, &idct16x16_256_add_10_sse2,
Adrian Grange's avatar
Adrian Grange committed
846
                                 3167, AOM_BITS_10),
clang-format's avatar
clang-format committed
847
                      make_tuple(&idct16x16_10_add_12_c,
Adrian Grange's avatar
Adrian Grange committed
848
                                 &idct16x16_10_add_12_sse2, 3167, AOM_BITS_12),
clang-format's avatar
clang-format committed
849
                      make_tuple(&idct16x16_12, &idct16x16_256_add_12_sse2,
Adrian Grange's avatar
Adrian Grange committed
850
                                 3167, AOM_BITS_12)));
851
#endif  // HAVE_SSE2 && CONFIG_AOM_HIGHBITDEPTH && !CONFIG_EMULATE_HARDWARE
852

853
#if HAVE_MSA && !CONFIG_AOM_HIGHBITDEPTH && !CONFIG_EMULATE_HARDWARE
clang-format's avatar
clang-format committed
854
INSTANTIATE_TEST_CASE_P(MSA, Trans16x16DCT,
Adrian Grange's avatar
Adrian Grange committed
855 856
                        ::testing::Values(make_tuple(&aom_fdct16x16_msa,
                                                     &aom_idct16x16_256_add_msa,
Adrian Grange's avatar
Adrian Grange committed
857
                                                     0, AOM_BITS_8)));
858 859
INSTANTIATE_TEST_CASE_P(
    MSA, Trans16x16HT,
clang-format's avatar
clang-format committed
860 861 862 863 864 865
    ::testing::Values(
        make_tuple(&av1_fht16x16_msa, &av1_iht16x16_256_add_msa, 0, AOM_BITS_8),
        make_tuple(&av1_fht16x16_msa, &av1_iht16x16_256_add_msa, 1, AOM_BITS_8),
        make_tuple(&av1_fht16x16_msa, &av1_iht16x16_256_add_msa, 2, AOM_BITS_8),
        make_tuple(&av1_fht16x16_msa, &av1_iht16x16_256_add_msa, 3,
                   AOM_BITS_8)));