16fefe538d859300e7febe78271828198c10f1b52fgalligan@chromium.org/*
26fefe538d859300e7febe78271828198c10f1b52fgalligan@chromium.org *  Copyright (c) 2012 The WebM project authors. All Rights Reserved.
36fefe538d859300e7febe78271828198c10f1b52fgalligan@chromium.org *
46fefe538d859300e7febe78271828198c10f1b52fgalligan@chromium.org *  Use of this source code is governed by a BSD-style license
56fefe538d859300e7febe78271828198c10f1b52fgalligan@chromium.org *  that can be found in the LICENSE file in the root of the source
66fefe538d859300e7febe78271828198c10f1b52fgalligan@chromium.org *  tree. An additional intellectual property rights grant can be found
76fefe538d859300e7febe78271828198c10f1b52fgalligan@chromium.org *  in the file PATENTS.  All contributing project authors may
86fefe538d859300e7febe78271828198c10f1b52fgalligan@chromium.org *  be found in the AUTHORS file in the root of the source tree.
96fefe538d859300e7febe78271828198c10f1b52fgalligan@chromium.org */
106fefe538d859300e7febe78271828198c10f1b52fgalligan@chromium.org
116fefe538d859300e7febe78271828198c10f1b52fgalligan@chromium.org#include <math.h>
126fefe538d859300e7febe78271828198c10f1b52fgalligan@chromium.org#include <stdlib.h>
136fefe538d859300e7febe78271828198c10f1b52fgalligan@chromium.org#include <string.h>
146fefe538d859300e7febe78271828198c10f1b52fgalligan@chromium.org
156fefe538d859300e7febe78271828198c10f1b52fgalligan@chromium.org#include "third_party/googletest/src/include/gtest/gtest.h"
16f9586bb54d74c97d07b09eb2512f8569c9c1c025fgalligan@chromium.org#include "test/acm_random.h"
17f9586bb54d74c97d07b09eb2512f8569c9c1c025fgalligan@chromium.org#include "test/clear_system_state.h"
18f9586bb54d74c97d07b09eb2512f8569c9c1c025fgalligan@chromium.org#include "test/register_state_check.h"
19f9586bb54d74c97d07b09eb2512f8569c9c1c025fgalligan@chromium.org#include "test/util.h"
206fefe538d859300e7febe78271828198c10f1b52fgalligan@chromium.org
21f9586bb54d74c97d07b09eb2512f8569c9c1c025fgalligan@chromium.org#include "./vp9_rtcd.h"
22dddee1ec7cedf276305b107429f684539b105276johannkoenig@chromium.org#include "vp9/common/vp9_entropy.h"
2387997d490ae52aa962a985c95b3cddf7f8832641johannkoenig@chromium.org#include "vpx/vpx_codec.h"
24dddee1ec7cedf276305b107429f684539b105276johannkoenig@chromium.org#include "vpx/vpx_integer.h"
25dddee1ec7cedf276305b107429f684539b105276johannkoenig@chromium.org
266fefe538d859300e7febe78271828198c10f1b52fgalligan@chromium.orgusing libvpx_test::ACMRandom;
276fefe538d859300e7febe78271828198c10f1b52fgalligan@chromium.org
286fefe538d859300e7febe78271828198c10f1b52fgalligan@chromium.orgnamespace {
296fefe538d859300e7febe78271828198c10f1b52fgalligan@chromium.org
30923acb6a717b7f2719ed21184c1bc533b0a14888johannkoenig@chromium.org#ifdef _MSC_VER
31923acb6a717b7f2719ed21184c1bc533b0a14888johannkoenig@chromium.orgstatic int round(double x) {
32923acb6a717b7f2719ed21184c1bc533b0a14888johannkoenig@chromium.org  if (x < 0)
33f9586bb54d74c97d07b09eb2512f8569c9c1c025fgalligan@chromium.org    return static_cast<int>(ceil(x - 0.5));
34923acb6a717b7f2719ed21184c1bc533b0a14888johannkoenig@chromium.org  else
35f9586bb54d74c97d07b09eb2512f8569c9c1c025fgalligan@chromium.org    return static_cast<int>(floor(x + 0.5));
36923acb6a717b7f2719ed21184c1bc533b0a14888johannkoenig@chromium.org}
37923acb6a717b7f2719ed21184c1bc533b0a14888johannkoenig@chromium.org#endif
38923acb6a717b7f2719ed21184c1bc533b0a14888johannkoenig@chromium.org
39f9586bb54d74c97d07b09eb2512f8569c9c1c025fgalligan@chromium.orgconst int kNumCoeffs = 256;
406fefe538d859300e7febe78271828198c10f1b52fgalligan@chromium.orgconst double PI = 3.1415926535898;
416fefe538d859300e7febe78271828198c10f1b52fgalligan@chromium.orgvoid reference2_16x16_idct_2d(double *input, double *output) {
426fefe538d859300e7febe78271828198c10f1b52fgalligan@chromium.org  double x;
436fefe538d859300e7febe78271828198c10f1b52fgalligan@chromium.org  for (int l = 0; l < 16; ++l) {
446fefe538d859300e7febe78271828198c10f1b52fgalligan@chromium.org    for (int k = 0; k < 16; ++k) {
456fefe538d859300e7febe78271828198c10f1b52fgalligan@chromium.org      double s = 0;
466fefe538d859300e7febe78271828198c10f1b52fgalligan@chromium.org      for (int i = 0; i < 16; ++i) {
476fefe538d859300e7febe78271828198c10f1b52fgalligan@chromium.org        for (int j = 0; j < 16; ++j) {
48f9586bb54d74c97d07b09eb2512f8569c9c1c025fgalligan@chromium.org          x = cos(PI * j * (l + 0.5) / 16.0) *
49f9586bb54d74c97d07b09eb2512f8569c9c1c025fgalligan@chromium.org              cos(PI * i * (k + 0.5) / 16.0) *
50f9586bb54d74c97d07b09eb2512f8569c9c1c025fgalligan@chromium.org              input[i * 16 + j] / 256;
516fefe538d859300e7febe78271828198c10f1b52fgalligan@chromium.org          if (i != 0)
526fefe538d859300e7febe78271828198c10f1b52fgalligan@chromium.org            x *= sqrt(2.0);
536fefe538d859300e7febe78271828198c10f1b52fgalligan@chromium.org          if (j != 0)
546fefe538d859300e7febe78271828198c10f1b52fgalligan@chromium.org            x *= sqrt(2.0);
556fefe538d859300e7febe78271828198c10f1b52fgalligan@chromium.org          s += x;
566fefe538d859300e7febe78271828198c10f1b52fgalligan@chromium.org        }
576fefe538d859300e7febe78271828198c10f1b52fgalligan@chromium.org      }
586fefe538d859300e7febe78271828198c10f1b52fgalligan@chromium.org      output[k*16+l] = s;
596fefe538d859300e7febe78271828198c10f1b52fgalligan@chromium.org    }
606fefe538d859300e7febe78271828198c10f1b52fgalligan@chromium.org  }
616fefe538d859300e7febe78271828198c10f1b52fgalligan@chromium.org}
626fefe538d859300e7febe78271828198c10f1b52fgalligan@chromium.org
636fefe538d859300e7febe78271828198c10f1b52fgalligan@chromium.org
64f9586bb54d74c97d07b09eb2512f8569c9c1c025fgalligan@chromium.orgconst double C1 = 0.995184726672197;
65f9586bb54d74c97d07b09eb2512f8569c9c1c025fgalligan@chromium.orgconst double C2 = 0.98078528040323;
66f9586bb54d74c97d07b09eb2512f8569c9c1c025fgalligan@chromium.orgconst double C3 = 0.956940335732209;
67f9586bb54d74c97d07b09eb2512f8569c9c1c025fgalligan@chromium.orgconst double C4 = 0.923879532511287;
68f9586bb54d74c97d07b09eb2512f8569c9c1c025fgalligan@chromium.orgconst double C5 = 0.881921264348355;
69f9586bb54d74c97d07b09eb2512f8569c9c1c025fgalligan@chromium.orgconst double C6 = 0.831469612302545;
70f9586bb54d74c97d07b09eb2512f8569c9c1c025fgalligan@chromium.orgconst double C7 = 0.773010453362737;
71f9586bb54d74c97d07b09eb2512f8569c9c1c025fgalligan@chromium.orgconst double C8 = 0.707106781186548;
72f9586bb54d74c97d07b09eb2512f8569c9c1c025fgalligan@chromium.orgconst double C9 = 0.634393284163646;
73f9586bb54d74c97d07b09eb2512f8569c9c1c025fgalligan@chromium.orgconst double C10 = 0.555570233019602;
74f9586bb54d74c97d07b09eb2512f8569c9c1c025fgalligan@chromium.orgconst double C11 = 0.471396736825998;
75f9586bb54d74c97d07b09eb2512f8569c9c1c025fgalligan@chromium.orgconst double C12 = 0.38268343236509;
76f9586bb54d74c97d07b09eb2512f8569c9c1c025fgalligan@chromium.orgconst double C13 = 0.290284677254462;
77f9586bb54d74c97d07b09eb2512f8569c9c1c025fgalligan@chromium.orgconst double C14 = 0.195090322016128;
78f9586bb54d74c97d07b09eb2512f8569c9c1c025fgalligan@chromium.orgconst double C15 = 0.098017140329561;
79f9586bb54d74c97d07b09eb2512f8569c9c1c025fgalligan@chromium.org
80f9586bb54d74c97d07b09eb2512f8569c9c1c025fgalligan@chromium.orgvoid butterfly_16x16_dct_1d(double input[16], double output[16]) {
816fefe538d859300e7febe78271828198c10f1b52fgalligan@chromium.org  double step[16];
826fefe538d859300e7febe78271828198c10f1b52fgalligan@chromium.org  double intermediate[16];
836fefe538d859300e7febe78271828198c10f1b52fgalligan@chromium.org  double temp1, temp2;
846fefe538d859300e7febe78271828198c10f1b52fgalligan@chromium.org
856fefe538d859300e7febe78271828198c10f1b52fgalligan@chromium.org  // step 1
866fefe538d859300e7febe78271828198c10f1b52fgalligan@chromium.org  step[ 0] = input[0] + input[15];
876fefe538d859300e7febe78271828198c10f1b52fgalligan@chromium.org  step[ 1] = input[1] + input[14];
886fefe538d859300e7febe78271828198c10f1b52fgalligan@chromium.org  step[ 2] = input[2] + input[13];
896fefe538d859300e7febe78271828198c10f1b52fgalligan@chromium.org  step[ 3] = input[3] + input[12];
906fefe538d859300e7febe78271828198c10f1b52fgalligan@chromium.org  step[ 4] = input[4] + input[11];
916fefe538d859300e7febe78271828198c10f1b52fgalligan@chromium.org  step[ 5] = input[5] + input[10];
926fefe538d859300e7febe78271828198c10f1b52fgalligan@chromium.org  step[ 6] = input[6] + input[ 9];
936fefe538d859300e7febe78271828198c10f1b52fgalligan@chromium.org  step[ 7] = input[7] + input[ 8];
946fefe538d859300e7febe78271828198c10f1b52fgalligan@chromium.org  step[ 8] = input[7] - input[ 8];
956fefe538d859300e7febe78271828198c10f1b52fgalligan@chromium.org  step[ 9] = input[6] - input[ 9];
966fefe538d859300e7febe78271828198c10f1b52fgalligan@chromium.org  step[10] = input[5] - input[10];
976fefe538d859300e7febe78271828198c10f1b52fgalligan@chromium.org  step[11] = input[4] - input[11];
986fefe538d859300e7febe78271828198c10f1b52fgalligan@chromium.org  step[12] = input[3] - input[12];
996fefe538d859300e7febe78271828198c10f1b52fgalligan@chromium.org  step[13] = input[2] - input[13];
1006fefe538d859300e7febe78271828198c10f1b52fgalligan@chromium.org  step[14] = input[1] - input[14];
1016fefe538d859300e7febe78271828198c10f1b52fgalligan@chromium.org  step[15] = input[0] - input[15];
1026fefe538d859300e7febe78271828198c10f1b52fgalligan@chromium.org
1036fefe538d859300e7febe78271828198c10f1b52fgalligan@chromium.org  // step 2
1046fefe538d859300e7febe78271828198c10f1b52fgalligan@chromium.org  output[0] = step[0] + step[7];
1056fefe538d859300e7febe78271828198c10f1b52fgalligan@chromium.org  output[1] = step[1] + step[6];
1066fefe538d859300e7febe78271828198c10f1b52fgalligan@chromium.org  output[2] = step[2] + step[5];
1076fefe538d859300e7febe78271828198c10f1b52fgalligan@chromium.org  output[3] = step[3] + step[4];
1086fefe538d859300e7febe78271828198c10f1b52fgalligan@chromium.org  output[4] = step[3] - step[4];
1096fefe538d859300e7febe78271828198c10f1b52fgalligan@chromium.org  output[5] = step[2] - step[5];
1106fefe538d859300e7febe78271828198c10f1b52fgalligan@chromium.org  output[6] = step[1] - step[6];
1116fefe538d859300e7febe78271828198c10f1b52fgalligan@chromium.org  output[7] = step[0] - step[7];
1126fefe538d859300e7febe78271828198c10f1b52fgalligan@chromium.org
113f9586bb54d74c97d07b09eb2512f8569c9c1c025fgalligan@chromium.org  temp1 = step[ 8] * C7;
114f9586bb54d74c97d07b09eb2512f8569c9c1c025fgalligan@chromium.org  temp2 = step[15] * C9;
1156fefe538d859300e7febe78271828198c10f1b52fgalligan@chromium.org  output[ 8] = temp1 + temp2;
1166fefe538d859300e7febe78271828198c10f1b52fgalligan@chromium.org
117f9586bb54d74c97d07b09eb2512f8569c9c1c025fgalligan@chromium.org  temp1 = step[ 9] * C11;
118f9586bb54d74c97d07b09eb2512f8569c9c1c025fgalligan@chromium.org  temp2 = step[14] * C5;
1196fefe538d859300e7febe78271828198c10f1b52fgalligan@chromium.org  output[ 9] = temp1 - temp2;
1206fefe538d859300e7febe78271828198c10f1b52fgalligan@chromium.org
121f9586bb54d74c97d07b09eb2512f8569c9c1c025fgalligan@chromium.org  temp1 = step[10] * C3;
122f9586bb54d74c97d07b09eb2512f8569c9c1c025fgalligan@chromium.org  temp2 = step[13] * C13;
1236fefe538d859300e7febe78271828198c10f1b52fgalligan@chromium.org  output[10] = temp1 + temp2;
1246fefe538d859300e7febe78271828198c10f1b52fgalligan@chromium.org
125f9586bb54d74c97d07b09eb2512f8569c9c1c025fgalligan@chromium.org  temp1 = step[11] * C15;
126f9586bb54d74c97d07b09eb2512f8569c9c1c025fgalligan@chromium.org  temp2 = step[12] * C1;
1276fefe538d859300e7febe78271828198c10f1b52fgalligan@chromium.org  output[11] = temp1 - temp2;
1286fefe538d859300e7febe78271828198c10f1b52fgalligan@chromium.org
129f9586bb54d74c97d07b09eb2512f8569c9c1c025fgalligan@chromium.org  temp1 = step[11] * C1;
130f9586bb54d74c97d07b09eb2512f8569c9c1c025fgalligan@chromium.org  temp2 = step[12] * C15;
1316fefe538d859300e7febe78271828198c10f1b52fgalligan@chromium.org  output[12] = temp2 + temp1;
1326fefe538d859300e7febe78271828198c10f1b52fgalligan@chromium.org
133f9586bb54d74c97d07b09eb2512f8569c9c1c025fgalligan@chromium.org  temp1 = step[10] * C13;
134f9586bb54d74c97d07b09eb2512f8569c9c1c025fgalligan@chromium.org  temp2 = step[13] * C3;
1356fefe538d859300e7febe78271828198c10f1b52fgalligan@chromium.org  output[13] = temp2 - temp1;
1366fefe538d859300e7febe78271828198c10f1b52fgalligan@chromium.org
137f9586bb54d74c97d07b09eb2512f8569c9c1c025fgalligan@chromium.org  temp1 = step[ 9] * C5;
138f9586bb54d74c97d07b09eb2512f8569c9c1c025fgalligan@chromium.org  temp2 = step[14] * C11;
1396fefe538d859300e7febe78271828198c10f1b52fgalligan@chromium.org  output[14] = temp2 + temp1;
1406fefe538d859300e7febe78271828198c10f1b52fgalligan@chromium.org
141f9586bb54d74c97d07b09eb2512f8569c9c1c025fgalligan@chromium.org  temp1 = step[ 8] * C9;
142f9586bb54d74c97d07b09eb2512f8569c9c1c025fgalligan@chromium.org  temp2 = step[15] * C7;
1436fefe538d859300e7febe78271828198c10f1b52fgalligan@chromium.org  output[15] = temp2 - temp1;
1446fefe538d859300e7febe78271828198c10f1b52fgalligan@chromium.org
1456fefe538d859300e7febe78271828198c10f1b52fgalligan@chromium.org  // step 3
1466fefe538d859300e7febe78271828198c10f1b52fgalligan@chromium.org  step[ 0] = output[0] + output[3];
1476fefe538d859300e7febe78271828198c10f1b52fgalligan@chromium.org  step[ 1] = output[1] + output[2];
1486fefe538d859300e7febe78271828198c10f1b52fgalligan@chromium.org  step[ 2] = output[1] - output[2];
1496fefe538d859300e7febe78271828198c10f1b52fgalligan@chromium.org  step[ 3] = output[0] - output[3];
1506fefe538d859300e7febe78271828198c10f1b52fgalligan@chromium.org
151f9586bb54d74c97d07b09eb2512f8569c9c1c025fgalligan@chromium.org  temp1 = output[4] * C14;
152f9586bb54d74c97d07b09eb2512f8569c9c1c025fgalligan@chromium.org  temp2 = output[7] * C2;
1536fefe538d859300e7febe78271828198c10f1b52fgalligan@chromium.org  step[ 4] = temp1 + temp2;
1546fefe538d859300e7febe78271828198c10f1b52fgalligan@chromium.org
155f9586bb54d74c97d07b09eb2512f8569c9c1c025fgalligan@chromium.org  temp1 = output[5] * C10;
156f9586bb54d74c97d07b09eb2512f8569c9c1c025fgalligan@chromium.org  temp2 = output[6] * C6;
1576fefe538d859300e7febe78271828198c10f1b52fgalligan@chromium.org  step[ 5] = temp1 + temp2;
1586fefe538d859300e7febe78271828198c10f1b52fgalligan@chromium.org
159f9586bb54d74c97d07b09eb2512f8569c9c1c025fgalligan@chromium.org  temp1 = output[5] * C6;
160f9586bb54d74c97d07b09eb2512f8569c9c1c025fgalligan@chromium.org  temp2 = output[6] * C10;
1616fefe538d859300e7febe78271828198c10f1b52fgalligan@chromium.org  step[ 6] = temp2 - temp1;
1626fefe538d859300e7febe78271828198c10f1b52fgalligan@chromium.org
163f9586bb54d74c97d07b09eb2512f8569c9c1c025fgalligan@chromium.org  temp1 = output[4] * C2;
164f9586bb54d74c97d07b09eb2512f8569c9c1c025fgalligan@chromium.org  temp2 = output[7] * C14;
1656fefe538d859300e7febe78271828198c10f1b52fgalligan@chromium.org  step[ 7] = temp2 - temp1;
1666fefe538d859300e7febe78271828198c10f1b52fgalligan@chromium.org
1676fefe538d859300e7febe78271828198c10f1b52fgalligan@chromium.org  step[ 8] = output[ 8] + output[11];
1686fefe538d859300e7febe78271828198c10f1b52fgalligan@chromium.org  step[ 9] = output[ 9] + output[10];
1696fefe538d859300e7febe78271828198c10f1b52fgalligan@chromium.org  step[10] = output[ 9] - output[10];
1706fefe538d859300e7febe78271828198c10f1b52fgalligan@chromium.org  step[11] = output[ 8] - output[11];
1716fefe538d859300e7febe78271828198c10f1b52fgalligan@chromium.org
1726fefe538d859300e7febe78271828198c10f1b52fgalligan@chromium.org  step[12] = output[12] + output[15];
1736fefe538d859300e7febe78271828198c10f1b52fgalligan@chromium.org  step[13] = output[13] + output[14];
1746fefe538d859300e7febe78271828198c10f1b52fgalligan@chromium.org  step[14] = output[13] - output[14];
1756fefe538d859300e7febe78271828198c10f1b52fgalligan@chromium.org  step[15] = output[12] - output[15];
1766fefe538d859300e7febe78271828198c10f1b52fgalligan@chromium.org
1776fefe538d859300e7febe78271828198c10f1b52fgalligan@chromium.org  // step 4
1786fefe538d859300e7febe78271828198c10f1b52fgalligan@chromium.org  output[ 0] = (step[ 0] + step[ 1]);
1796fefe538d859300e7febe78271828198c10f1b52fgalligan@chromium.org  output[ 8] = (step[ 0] - step[ 1]);
1806fefe538d859300e7febe78271828198c10f1b52fgalligan@chromium.org
181f9586bb54d74c97d07b09eb2512f8569c9c1c025fgalligan@chromium.org  temp1 = step[2] * C12;
182f9586bb54d74c97d07b09eb2512f8569c9c1c025fgalligan@chromium.org  temp2 = step[3] * C4;
1836fefe538d859300e7febe78271828198c10f1b52fgalligan@chromium.org  temp1 = temp1 + temp2;
184f9586bb54d74c97d07b09eb2512f8569c9c1c025fgalligan@chromium.org  output[ 4] = 2*(temp1 * C8);
1856fefe538d859300e7febe78271828198c10f1b52fgalligan@chromium.org
186f9586bb54d74c97d07b09eb2512f8569c9c1c025fgalligan@chromium.org  temp1 = step[2] * C4;
187f9586bb54d74c97d07b09eb2512f8569c9c1c025fgalligan@chromium.org  temp2 = step[3] * C12;
1886fefe538d859300e7febe78271828198c10f1b52fgalligan@chromium.org  temp1 = temp2 - temp1;
189f9586bb54d74c97d07b09eb2512f8569c9c1c025fgalligan@chromium.org  output[12] = 2 * (temp1 * C8);
1906fefe538d859300e7febe78271828198c10f1b52fgalligan@chromium.org
191f9586bb54d74c97d07b09eb2512f8569c9c1c025fgalligan@chromium.org  output[ 2] = 2 * ((step[4] + step[ 5]) * C8);
192f9586bb54d74c97d07b09eb2512f8569c9c1c025fgalligan@chromium.org  output[14] = 2 * ((step[7] - step[ 6]) * C8);
1936fefe538d859300e7febe78271828198c10f1b52fgalligan@chromium.org
1946fefe538d859300e7febe78271828198c10f1b52fgalligan@chromium.org  temp1 = step[4] - step[5];
1956fefe538d859300e7febe78271828198c10f1b52fgalligan@chromium.org  temp2 = step[6] + step[7];
1966fefe538d859300e7febe78271828198c10f1b52fgalligan@chromium.org  output[ 6] = (temp1 + temp2);
1976fefe538d859300e7febe78271828198c10f1b52fgalligan@chromium.org  output[10] = (temp1 - temp2);
1986fefe538d859300e7febe78271828198c10f1b52fgalligan@chromium.org
1996fefe538d859300e7febe78271828198c10f1b52fgalligan@chromium.org  intermediate[8] = step[8] + step[14];
2006fefe538d859300e7febe78271828198c10f1b52fgalligan@chromium.org  intermediate[9] = step[9] + step[15];
2016fefe538d859300e7febe78271828198c10f1b52fgalligan@chromium.org
202f9586bb54d74c97d07b09eb2512f8569c9c1c025fgalligan@chromium.org  temp1 = intermediate[8] * C12;
203f9586bb54d74c97d07b09eb2512f8569c9c1c025fgalligan@chromium.org  temp2 = intermediate[9] * C4;
2046fefe538d859300e7febe78271828198c10f1b52fgalligan@chromium.org  temp1 = temp1 - temp2;
205f9586bb54d74c97d07b09eb2512f8569c9c1c025fgalligan@chromium.org  output[3] = 2 * (temp1 * C8);
2066fefe538d859300e7febe78271828198c10f1b52fgalligan@chromium.org
207f9586bb54d74c97d07b09eb2512f8569c9c1c025fgalligan@chromium.org  temp1 = intermediate[8] * C4;
208f9586bb54d74c97d07b09eb2512f8569c9c1c025fgalligan@chromium.org  temp2 = intermediate[9] * C12;
2096fefe538d859300e7febe78271828198c10f1b52fgalligan@chromium.org  temp1 = temp2 + temp1;
210f9586bb54d74c97d07b09eb2512f8569c9c1c025fgalligan@chromium.org  output[13] = 2 * (temp1 * C8);
2116fefe538d859300e7febe78271828198c10f1b52fgalligan@chromium.org
212f9586bb54d74c97d07b09eb2512f8569c9c1c025fgalligan@chromium.org  output[ 9] = 2 * ((step[10] + step[11]) * C8);
2136fefe538d859300e7febe78271828198c10f1b52fgalligan@chromium.org
2146fefe538d859300e7febe78271828198c10f1b52fgalligan@chromium.org  intermediate[11] = step[10] - step[11];
2156fefe538d859300e7febe78271828198c10f1b52fgalligan@chromium.org  intermediate[12] = step[12] + step[13];
2166fefe538d859300e7febe78271828198c10f1b52fgalligan@chromium.org  intermediate[13] = step[12] - step[13];
2176fefe538d859300e7febe78271828198c10f1b52fgalligan@chromium.org  intermediate[14] = step[ 8] - step[14];
2186fefe538d859300e7febe78271828198c10f1b52fgalligan@chromium.org  intermediate[15] = step[ 9] - step[15];
2196fefe538d859300e7febe78271828198c10f1b52fgalligan@chromium.org
2206fefe538d859300e7febe78271828198c10f1b52fgalligan@chromium.org  output[15] = (intermediate[11] + intermediate[12]);
2216fefe538d859300e7febe78271828198c10f1b52fgalligan@chromium.org  output[ 1] = -(intermediate[11] - intermediate[12]);
2226fefe538d859300e7febe78271828198c10f1b52fgalligan@chromium.org
223f9586bb54d74c97d07b09eb2512f8569c9c1c025fgalligan@chromium.org  output[ 7] = 2 * (intermediate[13] * C8);
2246fefe538d859300e7febe78271828198c10f1b52fgalligan@chromium.org
225f9586bb54d74c97d07b09eb2512f8569c9c1c025fgalligan@chromium.org  temp1 = intermediate[14] * C12;
226f9586bb54d74c97d07b09eb2512f8569c9c1c025fgalligan@chromium.org  temp2 = intermediate[15] * C4;
2276fefe538d859300e7febe78271828198c10f1b52fgalligan@chromium.org  temp1 = temp1 - temp2;
228f9586bb54d74c97d07b09eb2512f8569c9c1c025fgalligan@chromium.org  output[11] = -2 * (temp1 * C8);
2296fefe538d859300e7febe78271828198c10f1b52fgalligan@chromium.org
230f9586bb54d74c97d07b09eb2512f8569c9c1c025fgalligan@chromium.org  temp1 = intermediate[14] * C4;
231f9586bb54d74c97d07b09eb2512f8569c9c1c025fgalligan@chromium.org  temp2 = intermediate[15] * C12;
2326fefe538d859300e7febe78271828198c10f1b52fgalligan@chromium.org  temp1 = temp2 + temp1;
233f9586bb54d74c97d07b09eb2512f8569c9c1c025fgalligan@chromium.org  output[ 5] = 2 * (temp1 * C8);
2346fefe538d859300e7febe78271828198c10f1b52fgalligan@chromium.org}
2356fefe538d859300e7febe78271828198c10f1b52fgalligan@chromium.org
236f9586bb54d74c97d07b09eb2512f8569c9c1c025fgalligan@chromium.orgvoid reference_16x16_dct_2d(int16_t input[256], double output[256]) {
2376fefe538d859300e7febe78271828198c10f1b52fgalligan@chromium.org  // First transform columns
2386fefe538d859300e7febe78271828198c10f1b52fgalligan@chromium.org  for (int i = 0; i < 16; ++i) {
2396fefe538d859300e7febe78271828198c10f1b52fgalligan@chromium.org    double temp_in[16], temp_out[16];
2406fefe538d859300e7febe78271828198c10f1b52fgalligan@chromium.org    for (int j = 0; j < 16; ++j)
241f9586bb54d74c97d07b09eb2512f8569c9c1c025fgalligan@chromium.org      temp_in[j] = input[j * 16 + i];
2426fefe538d859300e7febe78271828198c10f1b52fgalligan@chromium.org    butterfly_16x16_dct_1d(temp_in, temp_out);
2436fefe538d859300e7febe78271828198c10f1b52fgalligan@chromium.org    for (int j = 0; j < 16; ++j)
244f9586bb54d74c97d07b09eb2512f8569c9c1c025fgalligan@chromium.org      output[j * 16 + i] = temp_out[j];
2456fefe538d859300e7febe78271828198c10f1b52fgalligan@chromium.org  }
2466fefe538d859300e7febe78271828198c10f1b52fgalligan@chromium.org  // Then transform rows
2476fefe538d859300e7febe78271828198c10f1b52fgalligan@chromium.org  for (int i = 0; i < 16; ++i) {
2486fefe538d859300e7febe78271828198c10f1b52fgalligan@chromium.org    double temp_in[16], temp_out[16];
2496fefe538d859300e7febe78271828198c10f1b52fgalligan@chromium.org    for (int j = 0; j < 16; ++j)
250f9586bb54d74c97d07b09eb2512f8569c9c1c025fgalligan@chromium.org      temp_in[j] = output[j + i * 16];
2516fefe538d859300e7febe78271828198c10f1b52fgalligan@chromium.org    butterfly_16x16_dct_1d(temp_in, temp_out);
2526fefe538d859300e7febe78271828198c10f1b52fgalligan@chromium.org    // Scale by some magic number
2536fefe538d859300e7febe78271828198c10f1b52fgalligan@chromium.org    for (int j = 0; j < 16; ++j)
254f9586bb54d74c97d07b09eb2512f8569c9c1c025fgalligan@chromium.org      output[j + i * 16] = temp_out[j]/2;
2556fefe538d859300e7febe78271828198c10f1b52fgalligan@chromium.org  }
2566fefe538d859300e7febe78271828198c10f1b52fgalligan@chromium.org}
2576fefe538d859300e7febe78271828198c10f1b52fgalligan@chromium.org
25887997d490ae52aa962a985c95b3cddf7f8832641johannkoenig@chromium.orgtypedef void (*FdctFunc)(const int16_t *in, tran_low_t *out, int stride);
25987997d490ae52aa962a985c95b3cddf7f8832641johannkoenig@chromium.orgtypedef void (*IdctFunc)(const tran_low_t *in, uint8_t *out, int stride);
26087997d490ae52aa962a985c95b3cddf7f8832641johannkoenig@chromium.orgtypedef void (*FhtFunc)(const int16_t *in, tran_low_t *out, int stride,
261ac4e313c19203132648a2a271703b6ee76fe4284johannkoenig@chromium.org                        int tx_type);
26287997d490ae52aa962a985c95b3cddf7f8832641johannkoenig@chromium.orgtypedef void (*IhtFunc)(const tran_low_t *in, uint8_t *out, int stride,
263ac4e313c19203132648a2a271703b6ee76fe4284johannkoenig@chromium.org                        int tx_type);
264f9586bb54d74c97d07b09eb2512f8569c9c1c025fgalligan@chromium.org
26587997d490ae52aa962a985c95b3cddf7f8832641johannkoenig@chromium.orgtypedef std::tr1::tuple<FdctFunc, IdctFunc, int, vpx_bit_depth_t> Dct16x16Param;
26687997d490ae52aa962a985c95b3cddf7f8832641johannkoenig@chromium.orgtypedef std::tr1::tuple<FhtFunc, IhtFunc, int, vpx_bit_depth_t> Ht16x16Param;
267d851b91d14ef0bd71acdce7b90c9a8f1af1181adjohannkoenig@chromium.org
26887997d490ae52aa962a985c95b3cddf7f8832641johannkoenig@chromium.orgvoid fdct16x16_ref(const int16_t *in, tran_low_t *out, int stride,
269d95585fb0ec024f6abd96f7b02e0df58019d46afjohannkoenig@chromium.org                   int /*tx_type*/) {
2700d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org  vp9_fdct16x16_c(in, out, stride);
27147265f8fe3a36a426773454ad90d20c9aa616c24johannkoenig@chromium.org}
272f9586bb54d74c97d07b09eb2512f8569c9c1c025fgalligan@chromium.org
27387997d490ae52aa962a985c95b3cddf7f8832641johannkoenig@chromium.orgvoid idct16x16_ref(const tran_low_t *in, uint8_t *dest, int stride,
274d95585fb0ec024f6abd96f7b02e0df58019d46afjohannkoenig@chromium.org                   int /*tx_type*/) {
27588b47b29cc274dd19cddc37c1ce1834d97df282efgalligan@chromium.org  vp9_idct16x16_256_add_c(in, dest, stride);
27688b47b29cc274dd19cddc37c1ce1834d97df282efgalligan@chromium.org}
27788b47b29cc274dd19cddc37c1ce1834d97df282efgalligan@chromium.org
27887997d490ae52aa962a985c95b3cddf7f8832641johannkoenig@chromium.orgvoid fht16x16_ref(const int16_t *in, tran_low_t *out, int stride,
27987997d490ae52aa962a985c95b3cddf7f8832641johannkoenig@chromium.org                  int tx_type) {
28076e516e2154f353aa02c504bac88afb0f95fefa7johannkoenig@chromium.org  vp9_fht16x16_c(in, out, stride, tx_type);
28147265f8fe3a36a426773454ad90d20c9aa616c24johannkoenig@chromium.org}
2826fefe538d859300e7febe78271828198c10f1b52fgalligan@chromium.org
28387997d490ae52aa962a985c95b3cddf7f8832641johannkoenig@chromium.orgvoid iht16x16_ref(const tran_low_t *in, uint8_t *dest, int stride,
28487997d490ae52aa962a985c95b3cddf7f8832641johannkoenig@chromium.org                  int tx_type) {
28588b47b29cc274dd19cddc37c1ce1834d97df282efgalligan@chromium.org  vp9_iht16x16_256_add_c(in, dest, stride, tx_type);
28688b47b29cc274dd19cddc37c1ce1834d97df282efgalligan@chromium.org}
28788b47b29cc274dd19cddc37c1ce1834d97df282efgalligan@chromium.org
28887997d490ae52aa962a985c95b3cddf7f8832641johannkoenig@chromium.org#if CONFIG_VP9_HIGHBITDEPTH
28987997d490ae52aa962a985c95b3cddf7f8832641johannkoenig@chromium.orgvoid idct16x16_10(const tran_low_t *in, uint8_t *out, int stride) {
29087997d490ae52aa962a985c95b3cddf7f8832641johannkoenig@chromium.org  vp9_high_idct16x16_256_add_c(in, out, stride, 10);
29187997d490ae52aa962a985c95b3cddf7f8832641johannkoenig@chromium.org}
29287997d490ae52aa962a985c95b3cddf7f8832641johannkoenig@chromium.org
29387997d490ae52aa962a985c95b3cddf7f8832641johannkoenig@chromium.orgvoid idct16x16_12(const tran_low_t *in, uint8_t *out, int stride) {
29487997d490ae52aa962a985c95b3cddf7f8832641johannkoenig@chromium.org  vp9_high_idct16x16_256_add_c(in, out, stride, 12);
29587997d490ae52aa962a985c95b3cddf7f8832641johannkoenig@chromium.org}
29687997d490ae52aa962a985c95b3cddf7f8832641johannkoenig@chromium.org
29787997d490ae52aa962a985c95b3cddf7f8832641johannkoenig@chromium.orgvoid idct16x16_10_ref(const tran_low_t *in, uint8_t *out, int stride,
29887997d490ae52aa962a985c95b3cddf7f8832641johannkoenig@chromium.org                      int tx_type) {
29987997d490ae52aa962a985c95b3cddf7f8832641johannkoenig@chromium.org  idct16x16_10(in, out, stride);
30087997d490ae52aa962a985c95b3cddf7f8832641johannkoenig@chromium.org}
30187997d490ae52aa962a985c95b3cddf7f8832641johannkoenig@chromium.org
30287997d490ae52aa962a985c95b3cddf7f8832641johannkoenig@chromium.orgvoid idct16x16_12_ref(const tran_low_t *in, uint8_t *out, int stride,
30387997d490ae52aa962a985c95b3cddf7f8832641johannkoenig@chromium.org                      int tx_type) {
30487997d490ae52aa962a985c95b3cddf7f8832641johannkoenig@chromium.org  idct16x16_12(in, out, stride);
30587997d490ae52aa962a985c95b3cddf7f8832641johannkoenig@chromium.org}
30687997d490ae52aa962a985c95b3cddf7f8832641johannkoenig@chromium.org
30787997d490ae52aa962a985c95b3cddf7f8832641johannkoenig@chromium.orgvoid iht16x16_10(const tran_low_t *in, uint8_t *out, int stride, int tx_type) {
30887997d490ae52aa962a985c95b3cddf7f8832641johannkoenig@chromium.org  vp9_high_iht16x16_256_add_c(in, out, stride, tx_type, 10);
30987997d490ae52aa962a985c95b3cddf7f8832641johannkoenig@chromium.org}
31087997d490ae52aa962a985c95b3cddf7f8832641johannkoenig@chromium.org
31187997d490ae52aa962a985c95b3cddf7f8832641johannkoenig@chromium.orgvoid iht16x16_12(const tran_low_t *in, uint8_t *out, int stride, int tx_type) {
31287997d490ae52aa962a985c95b3cddf7f8832641johannkoenig@chromium.org  vp9_high_iht16x16_256_add_c(in, out, stride, tx_type, 12);
31387997d490ae52aa962a985c95b3cddf7f8832641johannkoenig@chromium.org}
31487997d490ae52aa962a985c95b3cddf7f8832641johannkoenig@chromium.org#endif
31587997d490ae52aa962a985c95b3cddf7f8832641johannkoenig@chromium.org
316f9586bb54d74c97d07b09eb2512f8569c9c1c025fgalligan@chromium.orgclass Trans16x16TestBase {
31747265f8fe3a36a426773454ad90d20c9aa616c24johannkoenig@chromium.org public:
318f9586bb54d74c97d07b09eb2512f8569c9c1c025fgalligan@chromium.org  virtual ~Trans16x16TestBase() {}
31947265f8fe3a36a426773454ad90d20c9aa616c24johannkoenig@chromium.org
320f9586bb54d74c97d07b09eb2512f8569c9c1c025fgalligan@chromium.org protected:
32187997d490ae52aa962a985c95b3cddf7f8832641johannkoenig@chromium.org  virtual void RunFwdTxfm(int16_t *in, tran_low_t *out, int stride) = 0;
322f9586bb54d74c97d07b09eb2512f8569c9c1c025fgalligan@chromium.org
32387997d490ae52aa962a985c95b3cddf7f8832641johannkoenig@chromium.org  virtual void RunInvTxfm(tran_low_t *out, uint8_t *dst, int stride) = 0;
324f9586bb54d74c97d07b09eb2512f8569c9c1c025fgalligan@chromium.org
325f9586bb54d74c97d07b09eb2512f8569c9c1c025fgalligan@chromium.org  void RunAccuracyCheck() {
326f9586bb54d74c97d07b09eb2512f8569c9c1c025fgalligan@chromium.org    ACMRandom rnd(ACMRandom::DeterministicSeed());
327f9586bb54d74c97d07b09eb2512f8569c9c1c025fgalligan@chromium.org    uint32_t max_error = 0;
328f9586bb54d74c97d07b09eb2512f8569c9c1c025fgalligan@chromium.org    int64_t total_error = 0;
329f9586bb54d74c97d07b09eb2512f8569c9c1c025fgalligan@chromium.org    const int count_test_block = 10000;
330f9586bb54d74c97d07b09eb2512f8569c9c1c025fgalligan@chromium.org    for (int i = 0; i < count_test_block; ++i) {
331f9586bb54d74c97d07b09eb2512f8569c9c1c025fgalligan@chromium.org      DECLARE_ALIGNED_ARRAY(16, int16_t, test_input_block, kNumCoeffs);
33287997d490ae52aa962a985c95b3cddf7f8832641johannkoenig@chromium.org      DECLARE_ALIGNED_ARRAY(16, tran_low_t, test_temp_block, kNumCoeffs);
333f9586bb54d74c97d07b09eb2512f8569c9c1c025fgalligan@chromium.org      DECLARE_ALIGNED_ARRAY(16, uint8_t, dst, kNumCoeffs);
334f9586bb54d74c97d07b09eb2512f8569c9c1c025fgalligan@chromium.org      DECLARE_ALIGNED_ARRAY(16, uint8_t, src, kNumCoeffs);
33587997d490ae52aa962a985c95b3cddf7f8832641johannkoenig@chromium.org#if CONFIG_VP9_HIGHBITDEPTH
33687997d490ae52aa962a985c95b3cddf7f8832641johannkoenig@chromium.org      DECLARE_ALIGNED_ARRAY(16, uint16_t, dst16, kNumCoeffs);
33787997d490ae52aa962a985c95b3cddf7f8832641johannkoenig@chromium.org      DECLARE_ALIGNED_ARRAY(16, uint16_t, src16, kNumCoeffs);
33887997d490ae52aa962a985c95b3cddf7f8832641johannkoenig@chromium.org#endif
339f9586bb54d74c97d07b09eb2512f8569c9c1c025fgalligan@chromium.org
34087997d490ae52aa962a985c95b3cddf7f8832641johannkoenig@chromium.org      // Initialize a test block with input range [-mask_, mask_].
341f9586bb54d74c97d07b09eb2512f8569c9c1c025fgalligan@chromium.org      for (int j = 0; j < kNumCoeffs; ++j) {
34287997d490ae52aa962a985c95b3cddf7f8832641johannkoenig@chromium.org        if (bit_depth_ == VPX_BITS_8) {
34387997d490ae52aa962a985c95b3cddf7f8832641johannkoenig@chromium.org          src[j] = rnd.Rand8();
34487997d490ae52aa962a985c95b3cddf7f8832641johannkoenig@chromium.org          dst[j] = rnd.Rand8();
34587997d490ae52aa962a985c95b3cddf7f8832641johannkoenig@chromium.org          test_input_block[j] = src[j] - dst[j];
34687997d490ae52aa962a985c95b3cddf7f8832641johannkoenig@chromium.org#if CONFIG_VP9_HIGHBITDEPTH
34787997d490ae52aa962a985c95b3cddf7f8832641johannkoenig@chromium.org        } else {
34887997d490ae52aa962a985c95b3cddf7f8832641johannkoenig@chromium.org          src16[j] = rnd.Rand16() & mask_;
34987997d490ae52aa962a985c95b3cddf7f8832641johannkoenig@chromium.org          dst16[j] = rnd.Rand16() & mask_;
35087997d490ae52aa962a985c95b3cddf7f8832641johannkoenig@chromium.org          test_input_block[j] = src16[j] - dst16[j];
35187997d490ae52aa962a985c95b3cddf7f8832641johannkoenig@chromium.org#endif
35287997d490ae52aa962a985c95b3cddf7f8832641johannkoenig@chromium.org        }
353f9586bb54d74c97d07b09eb2512f8569c9c1c025fgalligan@chromium.org      }
354f9586bb54d74c97d07b09eb2512f8569c9c1c025fgalligan@chromium.org
35595aa45d73048f952dcaad0037429cc6751b34f2fjohannkoenig@google.com      ASM_REGISTER_STATE_CHECK(RunFwdTxfm(test_input_block,
35695aa45d73048f952dcaad0037429cc6751b34f2fjohannkoenig@google.com                                          test_temp_block, pitch_));
35787997d490ae52aa962a985c95b3cddf7f8832641johannkoenig@chromium.org      if (bit_depth_ == VPX_BITS_8) {
35887997d490ae52aa962a985c95b3cddf7f8832641johannkoenig@chromium.org        ASM_REGISTER_STATE_CHECK(
35987997d490ae52aa962a985c95b3cddf7f8832641johannkoenig@chromium.org            RunInvTxfm(test_temp_block, dst, pitch_));
36087997d490ae52aa962a985c95b3cddf7f8832641johannkoenig@chromium.org#if CONFIG_VP9_HIGHBITDEPTH
36187997d490ae52aa962a985c95b3cddf7f8832641johannkoenig@chromium.org      } else {
36287997d490ae52aa962a985c95b3cddf7f8832641johannkoenig@chromium.org        ASM_REGISTER_STATE_CHECK(
36387997d490ae52aa962a985c95b3cddf7f8832641johannkoenig@chromium.org            RunInvTxfm(test_temp_block, CONVERT_TO_BYTEPTR(dst16), pitch_));
36487997d490ae52aa962a985c95b3cddf7f8832641johannkoenig@chromium.org#endif
36587997d490ae52aa962a985c95b3cddf7f8832641johannkoenig@chromium.org      }
366f9586bb54d74c97d07b09eb2512f8569c9c1c025fgalligan@chromium.org
367f9586bb54d74c97d07b09eb2512f8569c9c1c025fgalligan@chromium.org      for (int j = 0; j < kNumCoeffs; ++j) {
36887997d490ae52aa962a985c95b3cddf7f8832641johannkoenig@chromium.org#if CONFIG_VP9_HIGHBITDEPTH
36987997d490ae52aa962a985c95b3cddf7f8832641johannkoenig@chromium.org        const uint32_t diff =
37087997d490ae52aa962a985c95b3cddf7f8832641johannkoenig@chromium.org            bit_depth_ == VPX_BITS_8 ?  dst[j] - src[j] : dst16[j] - src16[j];
37187997d490ae52aa962a985c95b3cddf7f8832641johannkoenig@chromium.org#else
372f9586bb54d74c97d07b09eb2512f8569c9c1c025fgalligan@chromium.org        const uint32_t diff = dst[j] - src[j];
37387997d490ae52aa962a985c95b3cddf7f8832641johannkoenig@chromium.org#endif
374f9586bb54d74c97d07b09eb2512f8569c9c1c025fgalligan@chromium.org        const uint32_t error = diff * diff;
375f9586bb54d74c97d07b09eb2512f8569c9c1c025fgalligan@chromium.org        if (max_error < error)
376f9586bb54d74c97d07b09eb2512f8569c9c1c025fgalligan@chromium.org          max_error = error;
377f9586bb54d74c97d07b09eb2512f8569c9c1c025fgalligan@chromium.org        total_error += error;
378f9586bb54d74c97d07b09eb2512f8569c9c1c025fgalligan@chromium.org      }
37910a9a0d835561a7f2300c561c514efcf374554d6fgalligan@chromium.org    }
3806fefe538d859300e7febe78271828198c10f1b52fgalligan@chromium.org
38187997d490ae52aa962a985c95b3cddf7f8832641johannkoenig@chromium.org    EXPECT_GE(1u  << 2 * (bit_depth_ - 8), max_error)
382f9586bb54d74c97d07b09eb2512f8569c9c1c025fgalligan@chromium.org        << "Error: 16x16 FHT/IHT has an individual round trip error > 1";
383f9586bb54d74c97d07b09eb2512f8569c9c1c025fgalligan@chromium.org
38487997d490ae52aa962a985c95b3cddf7f8832641johannkoenig@chromium.org    EXPECT_GE(count_test_block << 2 * (bit_depth_ - 8), total_error)
385f9586bb54d74c97d07b09eb2512f8569c9c1c025fgalligan@chromium.org        << "Error: 16x16 FHT/IHT has average round trip error > 1 per block";
38647265f8fe3a36a426773454ad90d20c9aa616c24johannkoenig@chromium.org  }
38747265f8fe3a36a426773454ad90d20c9aa616c24johannkoenig@chromium.org
388f9586bb54d74c97d07b09eb2512f8569c9c1c025fgalligan@chromium.org  void RunCoeffCheck() {
389f9586bb54d74c97d07b09eb2512f8569c9c1c025fgalligan@chromium.org    ACMRandom rnd(ACMRandom::DeterministicSeed());
390f9586bb54d74c97d07b09eb2512f8569c9c1c025fgalligan@chromium.org    const int count_test_block = 1000;
391f9586bb54d74c97d07b09eb2512f8569c9c1c025fgalligan@chromium.org    DECLARE_ALIGNED_ARRAY(16, int16_t, input_block, kNumCoeffs);
39287997d490ae52aa962a985c95b3cddf7f8832641johannkoenig@chromium.org    DECLARE_ALIGNED_ARRAY(16, tran_low_t, output_ref_block, kNumCoeffs);
39387997d490ae52aa962a985c95b3cddf7f8832641johannkoenig@chromium.org    DECLARE_ALIGNED_ARRAY(16, tran_low_t, output_block, kNumCoeffs);
39410a9a0d835561a7f2300c561c514efcf374554d6fgalligan@chromium.org
395f9586bb54d74c97d07b09eb2512f8569c9c1c025fgalligan@chromium.org    for (int i = 0; i < count_test_block; ++i) {
39687997d490ae52aa962a985c95b3cddf7f8832641johannkoenig@chromium.org      // Initialize a test block with input range [-mask_, mask_].
397f9586bb54d74c97d07b09eb2512f8569c9c1c025fgalligan@chromium.org      for (int j = 0; j < kNumCoeffs; ++j)
39887997d490ae52aa962a985c95b3cddf7f8832641johannkoenig@chromium.org        input_block[j] = (rnd.Rand16() & mask_) - (rnd.Rand16() & mask_);
399f9586bb54d74c97d07b09eb2512f8569c9c1c025fgalligan@chromium.org
400f9586bb54d74c97d07b09eb2512f8569c9c1c025fgalligan@chromium.org      fwd_txfm_ref(input_block, output_ref_block, pitch_, tx_type_);
40195aa45d73048f952dcaad0037429cc6751b34f2fjohannkoenig@google.com      ASM_REGISTER_STATE_CHECK(RunFwdTxfm(input_block, output_block, pitch_));
402f9586bb54d74c97d07b09eb2512f8569c9c1c025fgalligan@chromium.org
403f9586bb54d74c97d07b09eb2512f8569c9c1c025fgalligan@chromium.org      // The minimum quant value is 4.
404f9586bb54d74c97d07b09eb2512f8569c9c1c025fgalligan@chromium.org      for (int j = 0; j < kNumCoeffs; ++j)
405f9586bb54d74c97d07b09eb2512f8569c9c1c025fgalligan@chromium.org        EXPECT_EQ(output_block[j], output_ref_block[j]);
40647265f8fe3a36a426773454ad90d20c9aa616c24johannkoenig@chromium.org    }
407f9586bb54d74c97d07b09eb2512f8569c9c1c025fgalligan@chromium.org  }
4086fefe538d859300e7febe78271828198c10f1b52fgalligan@chromium.org
409f9586bb54d74c97d07b09eb2512f8569c9c1c025fgalligan@chromium.org  void RunMemCheck() {
410f9586bb54d74c97d07b09eb2512f8569c9c1c025fgalligan@chromium.org    ACMRandom rnd(ACMRandom::DeterministicSeed());
411f9586bb54d74c97d07b09eb2512f8569c9c1c025fgalligan@chromium.org    const int count_test_block = 1000;
412f9586bb54d74c97d07b09eb2512f8569c9c1c025fgalligan@chromium.org    DECLARE_ALIGNED_ARRAY(16, int16_t, input_block, kNumCoeffs);
413f9586bb54d74c97d07b09eb2512f8569c9c1c025fgalligan@chromium.org    DECLARE_ALIGNED_ARRAY(16, int16_t, input_extreme_block, kNumCoeffs);
41487997d490ae52aa962a985c95b3cddf7f8832641johannkoenig@chromium.org    DECLARE_ALIGNED_ARRAY(16, tran_low_t, output_ref_block, kNumCoeffs);
41587997d490ae52aa962a985c95b3cddf7f8832641johannkoenig@chromium.org    DECLARE_ALIGNED_ARRAY(16, tran_low_t, output_block, kNumCoeffs);
4166fefe538d859300e7febe78271828198c10f1b52fgalligan@chromium.org
417f9586bb54d74c97d07b09eb2512f8569c9c1c025fgalligan@chromium.org    for (int i = 0; i < count_test_block; ++i) {
41887997d490ae52aa962a985c95b3cddf7f8832641johannkoenig@chromium.org      // Initialize a test block with input range [-mask_, mask_].
419f9586bb54d74c97d07b09eb2512f8569c9c1c025fgalligan@chromium.org      for (int j = 0; j < kNumCoeffs; ++j) {
42087997d490ae52aa962a985c95b3cddf7f8832641johannkoenig@chromium.org        input_block[j] = (rnd.Rand16() & mask_) - (rnd.Rand16() & mask_);
42187997d490ae52aa962a985c95b3cddf7f8832641johannkoenig@chromium.org        input_extreme_block[j] = rnd.Rand8() % 2 ? mask_ : -mask_;
422f9586bb54d74c97d07b09eb2512f8569c9c1c025fgalligan@chromium.org      }
42388b47b29cc274dd19cddc37c1ce1834d97df282efgalligan@chromium.org      if (i == 0) {
424f9586bb54d74c97d07b09eb2512f8569c9c1c025fgalligan@chromium.org        for (int j = 0; j < kNumCoeffs; ++j)
42587997d490ae52aa962a985c95b3cddf7f8832641johannkoenig@chromium.org          input_extreme_block[j] = mask_;
42688b47b29cc274dd19cddc37c1ce1834d97df282efgalligan@chromium.org      } else if (i == 1) {
427f9586bb54d74c97d07b09eb2512f8569c9c1c025fgalligan@chromium.org        for (int j = 0; j < kNumCoeffs; ++j)
42887997d490ae52aa962a985c95b3cddf7f8832641johannkoenig@chromium.org          input_extreme_block[j] = -mask_;
42988b47b29cc274dd19cddc37c1ce1834d97df282efgalligan@chromium.org      }
430f9586bb54d74c97d07b09eb2512f8569c9c1c025fgalligan@chromium.org
431f9586bb54d74c97d07b09eb2512f8569c9c1c025fgalligan@chromium.org      fwd_txfm_ref(input_extreme_block, output_ref_block, pitch_, tx_type_);
43295aa45d73048f952dcaad0037429cc6751b34f2fjohannkoenig@google.com      ASM_REGISTER_STATE_CHECK(RunFwdTxfm(input_extreme_block,
43395aa45d73048f952dcaad0037429cc6751b34f2fjohannkoenig@google.com                                          output_block, pitch_));
434f9586bb54d74c97d07b09eb2512f8569c9c1c025fgalligan@chromium.org
435f9586bb54d74c97d07b09eb2512f8569c9c1c025fgalligan@chromium.org      // The minimum quant value is 4.
436f9586bb54d74c97d07b09eb2512f8569c9c1c025fgalligan@chromium.org      for (int j = 0; j < kNumCoeffs; ++j) {
437f9586bb54d74c97d07b09eb2512f8569c9c1c025fgalligan@chromium.org        EXPECT_EQ(output_block[j], output_ref_block[j]);
43887997d490ae52aa962a985c95b3cddf7f8832641johannkoenig@chromium.org        EXPECT_GE(4 * DCT_MAX_VALUE << (bit_depth_ - 8), abs(output_block[j]))
439f9586bb54d74c97d07b09eb2512f8569c9c1c025fgalligan@chromium.org            << "Error: 16x16 FDCT has coefficient larger than 4*DCT_MAX_VALUE";
440f9586bb54d74c97d07b09eb2512f8569c9c1c025fgalligan@chromium.org      }
4416fefe538d859300e7febe78271828198c10f1b52fgalligan@chromium.org    }
4426fefe538d859300e7febe78271828198c10f1b52fgalligan@chromium.org  }
4436fefe538d859300e7febe78271828198c10f1b52fgalligan@chromium.org
44488b47b29cc274dd19cddc37c1ce1834d97df282efgalligan@chromium.org  void RunQuantCheck(int dc_thred, int ac_thred) {
44588b47b29cc274dd19cddc37c1ce1834d97df282efgalligan@chromium.org    ACMRandom rnd(ACMRandom::DeterministicSeed());
44688b47b29cc274dd19cddc37c1ce1834d97df282efgalligan@chromium.org    const int count_test_block = 1000;
44788b47b29cc274dd19cddc37c1ce1834d97df282efgalligan@chromium.org    DECLARE_ALIGNED_ARRAY(16, int16_t, input_block, kNumCoeffs);
44888b47b29cc274dd19cddc37c1ce1834d97df282efgalligan@chromium.org    DECLARE_ALIGNED_ARRAY(16, int16_t, input_extreme_block, kNumCoeffs);
44987997d490ae52aa962a985c95b3cddf7f8832641johannkoenig@chromium.org    DECLARE_ALIGNED_ARRAY(16, tran_low_t, output_ref_block, kNumCoeffs);
45088b47b29cc274dd19cddc37c1ce1834d97df282efgalligan@chromium.org
45188b47b29cc274dd19cddc37c1ce1834d97df282efgalligan@chromium.org    DECLARE_ALIGNED_ARRAY(16, uint8_t, dst, kNumCoeffs);
45288b47b29cc274dd19cddc37c1ce1834d97df282efgalligan@chromium.org    DECLARE_ALIGNED_ARRAY(16, uint8_t, ref, kNumCoeffs);
45387997d490ae52aa962a985c95b3cddf7f8832641johannkoenig@chromium.org#if CONFIG_VP9_HIGHBITDEPTH
45487997d490ae52aa962a985c95b3cddf7f8832641johannkoenig@chromium.org    DECLARE_ALIGNED_ARRAY(16, uint16_t, dst16, kNumCoeffs);
45587997d490ae52aa962a985c95b3cddf7f8832641johannkoenig@chromium.org    DECLARE_ALIGNED_ARRAY(16, uint16_t, ref16, kNumCoeffs);
45687997d490ae52aa962a985c95b3cddf7f8832641johannkoenig@chromium.org#endif
45788b47b29cc274dd19cddc37c1ce1834d97df282efgalligan@chromium.org
45888b47b29cc274dd19cddc37c1ce1834d97df282efgalligan@chromium.org    for (int i = 0; i < count_test_block; ++i) {
45987997d490ae52aa962a985c95b3cddf7f8832641johannkoenig@chromium.org      // Initialize a test block with input range [-mask_, mask_].
46088b47b29cc274dd19cddc37c1ce1834d97df282efgalligan@chromium.org      for (int j = 0; j < kNumCoeffs; ++j) {
46187997d490ae52aa962a985c95b3cddf7f8832641johannkoenig@chromium.org        if (bit_depth_ == VPX_BITS_8)
46287997d490ae52aa962a985c95b3cddf7f8832641johannkoenig@chromium.org          input_block[j] = rnd.Rand8() - rnd.Rand8();
46387997d490ae52aa962a985c95b3cddf7f8832641johannkoenig@chromium.org        else
46487997d490ae52aa962a985c95b3cddf7f8832641johannkoenig@chromium.org          input_block[j] = (rnd.Rand16() & mask_) - (rnd.Rand16() & mask_);
46587997d490ae52aa962a985c95b3cddf7f8832641johannkoenig@chromium.org        input_extreme_block[j] = rnd.Rand8() % 2 ? mask_ : -mask_;
46688b47b29cc274dd19cddc37c1ce1834d97df282efgalligan@chromium.org      }
46788b47b29cc274dd19cddc37c1ce1834d97df282efgalligan@chromium.org      if (i == 0)
46888b47b29cc274dd19cddc37c1ce1834d97df282efgalligan@chromium.org        for (int j = 0; j < kNumCoeffs; ++j)
46987997d490ae52aa962a985c95b3cddf7f8832641johannkoenig@chromium.org          input_extreme_block[j] = mask_;
47088b47b29cc274dd19cddc37c1ce1834d97df282efgalligan@chromium.org      if (i == 1)
47188b47b29cc274dd19cddc37c1ce1834d97df282efgalligan@chromium.org        for (int j = 0; j < kNumCoeffs; ++j)
47287997d490ae52aa962a985c95b3cddf7f8832641johannkoenig@chromium.org          input_extreme_block[j] = -mask_;
47388b47b29cc274dd19cddc37c1ce1834d97df282efgalligan@chromium.org
47488b47b29cc274dd19cddc37c1ce1834d97df282efgalligan@chromium.org      fwd_txfm_ref(input_extreme_block, output_ref_block, pitch_, tx_type_);
47588b47b29cc274dd19cddc37c1ce1834d97df282efgalligan@chromium.org
47688b47b29cc274dd19cddc37c1ce1834d97df282efgalligan@chromium.org      // clear reconstructed pixel buffers
47788b47b29cc274dd19cddc37c1ce1834d97df282efgalligan@chromium.org      vpx_memset(dst, 0, kNumCoeffs * sizeof(uint8_t));
47888b47b29cc274dd19cddc37c1ce1834d97df282efgalligan@chromium.org      vpx_memset(ref, 0, kNumCoeffs * sizeof(uint8_t));
47987997d490ae52aa962a985c95b3cddf7f8832641johannkoenig@chromium.org#if CONFIG_VP9_HIGHBITDEPTH
48087997d490ae52aa962a985c95b3cddf7f8832641johannkoenig@chromium.org      vpx_memset(dst16, 0, kNumCoeffs * sizeof(uint16_t));
48187997d490ae52aa962a985c95b3cddf7f8832641johannkoenig@chromium.org      vpx_memset(ref16, 0, kNumCoeffs * sizeof(uint16_t));
48287997d490ae52aa962a985c95b3cddf7f8832641johannkoenig@chromium.org#endif
48388b47b29cc274dd19cddc37c1ce1834d97df282efgalligan@chromium.org
48488b47b29cc274dd19cddc37c1ce1834d97df282efgalligan@chromium.org      // quantization with maximum allowed step sizes
48588b47b29cc274dd19cddc37c1ce1834d97df282efgalligan@chromium.org      output_ref_block[0] = (output_ref_block[0] / dc_thred) * dc_thred;
48688b47b29cc274dd19cddc37c1ce1834d97df282efgalligan@chromium.org      for (int j = 1; j < kNumCoeffs; ++j)
48788b47b29cc274dd19cddc37c1ce1834d97df282efgalligan@chromium.org        output_ref_block[j] = (output_ref_block[j] / ac_thred) * ac_thred;
48887997d490ae52aa962a985c95b3cddf7f8832641johannkoenig@chromium.org      if (bit_depth_ == VPX_BITS_8) {
48987997d490ae52aa962a985c95b3cddf7f8832641johannkoenig@chromium.org        inv_txfm_ref(output_ref_block, ref, pitch_, tx_type_);
49087997d490ae52aa962a985c95b3cddf7f8832641johannkoenig@chromium.org        ASM_REGISTER_STATE_CHECK(RunInvTxfm(output_ref_block, dst, pitch_));
49187997d490ae52aa962a985c95b3cddf7f8832641johannkoenig@chromium.org#if CONFIG_VP9_HIGHBITDEPTH
49287997d490ae52aa962a985c95b3cddf7f8832641johannkoenig@chromium.org      } else {
49387997d490ae52aa962a985c95b3cddf7f8832641johannkoenig@chromium.org        inv_txfm_ref(output_ref_block, CONVERT_TO_BYTEPTR(ref16), pitch_,
49487997d490ae52aa962a985c95b3cddf7f8832641johannkoenig@chromium.org                     tx_type_);
49587997d490ae52aa962a985c95b3cddf7f8832641johannkoenig@chromium.org        ASM_REGISTER_STATE_CHECK(RunInvTxfm(output_ref_block,
49687997d490ae52aa962a985c95b3cddf7f8832641johannkoenig@chromium.org                                            CONVERT_TO_BYTEPTR(dst16), pitch_));
49787997d490ae52aa962a985c95b3cddf7f8832641johannkoenig@chromium.org#endif
49887997d490ae52aa962a985c95b3cddf7f8832641johannkoenig@chromium.org      }
49987997d490ae52aa962a985c95b3cddf7f8832641johannkoenig@chromium.org      if (bit_depth_ == VPX_BITS_8) {
50087997d490ae52aa962a985c95b3cddf7f8832641johannkoenig@chromium.org        for (int j = 0; j < kNumCoeffs; ++j)
50187997d490ae52aa962a985c95b3cddf7f8832641johannkoenig@chromium.org          EXPECT_EQ(ref[j], dst[j]);
50287997d490ae52aa962a985c95b3cddf7f8832641johannkoenig@chromium.org#if CONFIG_VP9_HIGHBITDEPTH
50387997d490ae52aa962a985c95b3cddf7f8832641johannkoenig@chromium.org      } else {
50487997d490ae52aa962a985c95b3cddf7f8832641johannkoenig@chromium.org        for (int j = 0; j < kNumCoeffs; ++j)
50587997d490ae52aa962a985c95b3cddf7f8832641johannkoenig@chromium.org          EXPECT_EQ(ref16[j], dst16[j]);
50687997d490ae52aa962a985c95b3cddf7f8832641johannkoenig@chromium.org#endif
50787997d490ae52aa962a985c95b3cddf7f8832641johannkoenig@chromium.org      }
50888b47b29cc274dd19cddc37c1ce1834d97df282efgalligan@chromium.org    }
50988b47b29cc274dd19cddc37c1ce1834d97df282efgalligan@chromium.org  }
51088b47b29cc274dd19cddc37c1ce1834d97df282efgalligan@chromium.org
511f9586bb54d74c97d07b09eb2512f8569c9c1c025fgalligan@chromium.org  void RunInvAccuracyCheck() {
512f9586bb54d74c97d07b09eb2512f8569c9c1c025fgalligan@chromium.org    ACMRandom rnd(ACMRandom::DeterministicSeed());
513f9586bb54d74c97d07b09eb2512f8569c9c1c025fgalligan@chromium.org    const int count_test_block = 1000;
514f9586bb54d74c97d07b09eb2512f8569c9c1c025fgalligan@chromium.org    DECLARE_ALIGNED_ARRAY(16, int16_t, in, kNumCoeffs);
51587997d490ae52aa962a985c95b3cddf7f8832641johannkoenig@chromium.org    DECLARE_ALIGNED_ARRAY(16, tran_low_t, coeff, kNumCoeffs);
516f9586bb54d74c97d07b09eb2512f8569c9c1c025fgalligan@chromium.org    DECLARE_ALIGNED_ARRAY(16, uint8_t, dst, kNumCoeffs);
517f9586bb54d74c97d07b09eb2512f8569c9c1c025fgalligan@chromium.org    DECLARE_ALIGNED_ARRAY(16, uint8_t, src, kNumCoeffs);
51887997d490ae52aa962a985c95b3cddf7f8832641johannkoenig@chromium.org#if CONFIG_VP9_HIGHBITDEPTH
51987997d490ae52aa962a985c95b3cddf7f8832641johannkoenig@chromium.org    DECLARE_ALIGNED_ARRAY(16, uint16_t, dst16, kNumCoeffs);
52087997d490ae52aa962a985c95b3cddf7f8832641johannkoenig@chromium.org    DECLARE_ALIGNED_ARRAY(16, uint16_t, src16, kNumCoeffs);
52187997d490ae52aa962a985c95b3cddf7f8832641johannkoenig@chromium.org#endif
5226fefe538d859300e7febe78271828198c10f1b52fgalligan@chromium.org
523f9586bb54d74c97d07b09eb2512f8569c9c1c025fgalligan@chromium.org    for (int i = 0; i < count_test_block; ++i) {
524f9586bb54d74c97d07b09eb2512f8569c9c1c025fgalligan@chromium.org      double out_r[kNumCoeffs];
5256fefe538d859300e7febe78271828198c10f1b52fgalligan@chromium.org
526f9586bb54d74c97d07b09eb2512f8569c9c1c025fgalligan@chromium.org      // Initialize a test block with input range [-255, 255].
527f9586bb54d74c97d07b09eb2512f8569c9c1c025fgalligan@chromium.org      for (int j = 0; j < kNumCoeffs; ++j) {
52887997d490ae52aa962a985c95b3cddf7f8832641johannkoenig@chromium.org        if (bit_depth_ == VPX_BITS_8) {
52987997d490ae52aa962a985c95b3cddf7f8832641johannkoenig@chromium.org          src[j] = rnd.Rand8();
53087997d490ae52aa962a985c95b3cddf7f8832641johannkoenig@chromium.org          dst[j] = rnd.Rand8();
53187997d490ae52aa962a985c95b3cddf7f8832641johannkoenig@chromium.org          in[j] = src[j] - dst[j];
53287997d490ae52aa962a985c95b3cddf7f8832641johannkoenig@chromium.org#if CONFIG_VP9_HIGHBITDEPTH
53387997d490ae52aa962a985c95b3cddf7f8832641johannkoenig@chromium.org        } else {
53487997d490ae52aa962a985c95b3cddf7f8832641johannkoenig@chromium.org          src16[j] = rnd.Rand16() & mask_;
53587997d490ae52aa962a985c95b3cddf7f8832641johannkoenig@chromium.org          dst16[j] = rnd.Rand16() & mask_;
53687997d490ae52aa962a985c95b3cddf7f8832641johannkoenig@chromium.org          in[j] = src16[j] - dst16[j];
53787997d490ae52aa962a985c95b3cddf7f8832641johannkoenig@chromium.org#endif
53887997d490ae52aa962a985c95b3cddf7f8832641johannkoenig@chromium.org        }
539f9586bb54d74c97d07b09eb2512f8569c9c1c025fgalligan@chromium.org      }
540f9586bb54d74c97d07b09eb2512f8569c9c1c025fgalligan@chromium.org
541f9586bb54d74c97d07b09eb2512f8569c9c1c025fgalligan@chromium.org      reference_16x16_dct_2d(in, out_r);
542f9586bb54d74c97d07b09eb2512f8569c9c1c025fgalligan@chromium.org      for (int j = 0; j < kNumCoeffs; ++j)
543f9586bb54d74c97d07b09eb2512f8569c9c1c025fgalligan@chromium.org        coeff[j] = round(out_r[j]);
544f9586bb54d74c97d07b09eb2512f8569c9c1c025fgalligan@chromium.org
54587997d490ae52aa962a985c95b3cddf7f8832641johannkoenig@chromium.org      if (bit_depth_ == VPX_BITS_8) {
54687997d490ae52aa962a985c95b3cddf7f8832641johannkoenig@chromium.org        ASM_REGISTER_STATE_CHECK(RunInvTxfm(coeff, dst, 16));
54787997d490ae52aa962a985c95b3cddf7f8832641johannkoenig@chromium.org#if CONFIG_VP9_HIGHBITDEPTH
54887997d490ae52aa962a985c95b3cddf7f8832641johannkoenig@chromium.org      } else {
54987997d490ae52aa962a985c95b3cddf7f8832641johannkoenig@chromium.org        ASM_REGISTER_STATE_CHECK(RunInvTxfm(coeff, CONVERT_TO_BYTEPTR(dst16),
55087997d490ae52aa962a985c95b3cddf7f8832641johannkoenig@chromium.org                                            16));
55187997d490ae52aa962a985c95b3cddf7f8832641johannkoenig@chromium.org#endif
55287997d490ae52aa962a985c95b3cddf7f8832641johannkoenig@chromium.org      }
553f9586bb54d74c97d07b09eb2512f8569c9c1c025fgalligan@chromium.org
554f9586bb54d74c97d07b09eb2512f8569c9c1c025fgalligan@chromium.org      for (int j = 0; j < kNumCoeffs; ++j) {
55587997d490ae52aa962a985c95b3cddf7f8832641johannkoenig@chromium.org#if CONFIG_VP9_HIGHBITDEPTH
55687997d490ae52aa962a985c95b3cddf7f8832641johannkoenig@chromium.org        const uint32_t diff =
55787997d490ae52aa962a985c95b3cddf7f8832641johannkoenig@chromium.org            bit_depth_ == VPX_BITS_8 ? dst[j] - src[j] : dst16[j] - src16[j];
55887997d490ae52aa962a985c95b3cddf7f8832641johannkoenig@chromium.org#else
559f9586bb54d74c97d07b09eb2512f8569c9c1c025fgalligan@chromium.org        const uint32_t diff = dst[j] - src[j];
56087997d490ae52aa962a985c95b3cddf7f8832641johannkoenig@chromium.org#endif
561f9586bb54d74c97d07b09eb2512f8569c9c1c025fgalligan@chromium.org        const uint32_t error = diff * diff;
562f9586bb54d74c97d07b09eb2512f8569c9c1c025fgalligan@chromium.org        EXPECT_GE(1u, error)
563f9586bb54d74c97d07b09eb2512f8569c9c1c025fgalligan@chromium.org            << "Error: 16x16 IDCT has error " << error
564f9586bb54d74c97d07b09eb2512f8569c9c1c025fgalligan@chromium.org            << " at index " << j;
565f9586bb54d74c97d07b09eb2512f8569c9c1c025fgalligan@chromium.org      }
56647265f8fe3a36a426773454ad90d20c9aa616c24johannkoenig@chromium.org    }
56747265f8fe3a36a426773454ad90d20c9aa616c24johannkoenig@chromium.org  }
568f9586bb54d74c97d07b09eb2512f8569c9c1c025fgalligan@chromium.org  int pitch_;
569f9586bb54d74c97d07b09eb2512f8569c9c1c025fgalligan@chromium.org  int tx_type_;
57087997d490ae52aa962a985c95b3cddf7f8832641johannkoenig@chromium.org  vpx_bit_depth_t bit_depth_;
57187997d490ae52aa962a985c95b3cddf7f8832641johannkoenig@chromium.org  int mask_;
572ac4e313c19203132648a2a271703b6ee76fe4284johannkoenig@chromium.org  FhtFunc fwd_txfm_ref;
573ac4e313c19203132648a2a271703b6ee76fe4284johannkoenig@chromium.org  IhtFunc inv_txfm_ref;
574f9586bb54d74c97d07b09eb2512f8569c9c1c025fgalligan@chromium.org};
575f9586bb54d74c97d07b09eb2512f8569c9c1c025fgalligan@chromium.org
576d851b91d14ef0bd71acdce7b90c9a8f1af1181adjohannkoenig@chromium.orgclass Trans16x16DCT
577d851b91d14ef0bd71acdce7b90c9a8f1af1181adjohannkoenig@chromium.org    : public Trans16x16TestBase,
578ac4e313c19203132648a2a271703b6ee76fe4284johannkoenig@chromium.org      public ::testing::TestWithParam<Dct16x16Param> {
579f9586bb54d74c97d07b09eb2512f8569c9c1c025fgalligan@chromium.org public:
580f9586bb54d74c97d07b09eb2512f8569c9c1c025fgalligan@chromium.org  virtual ~Trans16x16DCT() {}
581f9586bb54d74c97d07b09eb2512f8569c9c1c025fgalligan@chromium.org
582f9586bb54d74c97d07b09eb2512f8569c9c1c025fgalligan@chromium.org  virtual void SetUp() {
583f9586bb54d74c97d07b09eb2512f8569c9c1c025fgalligan@chromium.org    fwd_txfm_ = GET_PARAM(0);
584f9586bb54d74c97d07b09eb2512f8569c9c1c025fgalligan@chromium.org    inv_txfm_ = GET_PARAM(1);
585f9586bb54d74c97d07b09eb2512f8569c9c1c025fgalligan@chromium.org    tx_type_  = GET_PARAM(2);
58687997d490ae52aa962a985c95b3cddf7f8832641johannkoenig@chromium.org    bit_depth_ = GET_PARAM(3);
5870d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org    pitch_    = 16;
588f9586bb54d74c97d07b09eb2512f8569c9c1c025fgalligan@chromium.org    fwd_txfm_ref = fdct16x16_ref;
58988b47b29cc274dd19cddc37c1ce1834d97df282efgalligan@chromium.org    inv_txfm_ref = idct16x16_ref;
59087997d490ae52aa962a985c95b3cddf7f8832641johannkoenig@chromium.org    mask_ = (1 << bit_depth_) - 1;
59187997d490ae52aa962a985c95b3cddf7f8832641johannkoenig@chromium.org#if CONFIG_VP9_HIGHBITDEPTH
59287997d490ae52aa962a985c95b3cddf7f8832641johannkoenig@chromium.org    switch (bit_depth_) {
59387997d490ae52aa962a985c95b3cddf7f8832641johannkoenig@chromium.org      case 10:
59487997d490ae52aa962a985c95b3cddf7f8832641johannkoenig@chromium.org        inv_txfm_ref = idct16x16_10_ref;
59587997d490ae52aa962a985c95b3cddf7f8832641johannkoenig@chromium.org        break;
59687997d490ae52aa962a985c95b3cddf7f8832641johannkoenig@chromium.org      case 12:
59787997d490ae52aa962a985c95b3cddf7f8832641johannkoenig@chromium.org        inv_txfm_ref = idct16x16_12_ref;
59887997d490ae52aa962a985c95b3cddf7f8832641johannkoenig@chromium.org        break;
59987997d490ae52aa962a985c95b3cddf7f8832641johannkoenig@chromium.org      default:
60087997d490ae52aa962a985c95b3cddf7f8832641johannkoenig@chromium.org        inv_txfm_ref = idct16x16_ref;
60187997d490ae52aa962a985c95b3cddf7f8832641johannkoenig@chromium.org        break;
60287997d490ae52aa962a985c95b3cddf7f8832641johannkoenig@chromium.org    }
60387997d490ae52aa962a985c95b3cddf7f8832641johannkoenig@chromium.org#else
60487997d490ae52aa962a985c95b3cddf7f8832641johannkoenig@chromium.org    inv_txfm_ref = idct16x16_ref;
60587997d490ae52aa962a985c95b3cddf7f8832641johannkoenig@chromium.org#endif
606f9586bb54d74c97d07b09eb2512f8569c9c1c025fgalligan@chromium.org  }
607f9586bb54d74c97d07b09eb2512f8569c9c1c025fgalligan@chromium.org  virtual void TearDown() { libvpx_test::ClearSystemState(); }
608f9586bb54d74c97d07b09eb2512f8569c9c1c025fgalligan@chromium.org
609f9586bb54d74c97d07b09eb2512f8569c9c1c025fgalligan@chromium.org protected:
61087997d490ae52aa962a985c95b3cddf7f8832641johannkoenig@chromium.org  void RunFwdTxfm(int16_t *in, tran_low_t *out, int stride) {
611f9586bb54d74c97d07b09eb2512f8569c9c1c025fgalligan@chromium.org    fwd_txfm_(in, out, stride);
612f9586bb54d74c97d07b09eb2512f8569c9c1c025fgalligan@chromium.org  }
61387997d490ae52aa962a985c95b3cddf7f8832641johannkoenig@chromium.org  void RunInvTxfm(tran_low_t *out, uint8_t *dst, int stride) {
6140d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org    inv_txfm_(out, dst, stride);
615f9586bb54d74c97d07b09eb2512f8569c9c1c025fgalligan@chromium.org  }
616f9586bb54d74c97d07b09eb2512f8569c9c1c025fgalligan@chromium.org
617ac4e313c19203132648a2a271703b6ee76fe4284johannkoenig@chromium.org  FdctFunc fwd_txfm_;
618ac4e313c19203132648a2a271703b6ee76fe4284johannkoenig@chromium.org  IdctFunc inv_txfm_;
619f9586bb54d74c97d07b09eb2512f8569c9c1c025fgalligan@chromium.org};
620f9586bb54d74c97d07b09eb2512f8569c9c1c025fgalligan@chromium.org
621f9586bb54d74c97d07b09eb2512f8569c9c1c025fgalligan@chromium.orgTEST_P(Trans16x16DCT, AccuracyCheck) {
622f9586bb54d74c97d07b09eb2512f8569c9c1c025fgalligan@chromium.org  RunAccuracyCheck();
62347265f8fe3a36a426773454ad90d20c9aa616c24johannkoenig@chromium.org}
62447265f8fe3a36a426773454ad90d20c9aa616c24johannkoenig@chromium.org
625f9586bb54d74c97d07b09eb2512f8569c9c1c025fgalligan@chromium.orgTEST_P(Trans16x16DCT, CoeffCheck) {
626f9586bb54d74c97d07b09eb2512f8569c9c1c025fgalligan@chromium.org  RunCoeffCheck();
627f9586bb54d74c97d07b09eb2512f8569c9c1c025fgalligan@chromium.org}
62847265f8fe3a36a426773454ad90d20c9aa616c24johannkoenig@chromium.org
629f9586bb54d74c97d07b09eb2512f8569c9c1c025fgalligan@chromium.orgTEST_P(Trans16x16DCT, MemCheck) {
630f9586bb54d74c97d07b09eb2512f8569c9c1c025fgalligan@chromium.org  RunMemCheck();
631f9586bb54d74c97d07b09eb2512f8569c9c1c025fgalligan@chromium.org}
63247265f8fe3a36a426773454ad90d20c9aa616c24johannkoenig@chromium.org
63388b47b29cc274dd19cddc37c1ce1834d97df282efgalligan@chromium.orgTEST_P(Trans16x16DCT, QuantCheck) {
63488b47b29cc274dd19cddc37c1ce1834d97df282efgalligan@chromium.org  // Use maximally allowed quantization step sizes for DC and AC
63588b47b29cc274dd19cddc37c1ce1834d97df282efgalligan@chromium.org  // coefficients respectively.
63688b47b29cc274dd19cddc37c1ce1834d97df282efgalligan@chromium.org  RunQuantCheck(1336, 1828);
63788b47b29cc274dd19cddc37c1ce1834d97df282efgalligan@chromium.org}
63888b47b29cc274dd19cddc37c1ce1834d97df282efgalligan@chromium.org
639f9586bb54d74c97d07b09eb2512f8569c9c1c025fgalligan@chromium.orgTEST_P(Trans16x16DCT, InvAccuracyCheck) {
640f9586bb54d74c97d07b09eb2512f8569c9c1c025fgalligan@chromium.org  RunInvAccuracyCheck();
641f9586bb54d74c97d07b09eb2512f8569c9c1c025fgalligan@chromium.org}
642f9586bb54d74c97d07b09eb2512f8569c9c1c025fgalligan@chromium.org
643d851b91d14ef0bd71acdce7b90c9a8f1af1181adjohannkoenig@chromium.orgclass Trans16x16HT
644d851b91d14ef0bd71acdce7b90c9a8f1af1181adjohannkoenig@chromium.org    : public Trans16x16TestBase,
645ac4e313c19203132648a2a271703b6ee76fe4284johannkoenig@chromium.org      public ::testing::TestWithParam<Ht16x16Param> {
646f9586bb54d74c97d07b09eb2512f8569c9c1c025fgalligan@chromium.org public:
647f9586bb54d74c97d07b09eb2512f8569c9c1c025fgalligan@chromium.org  virtual ~Trans16x16HT() {}
648f9586bb54d74c97d07b09eb2512f8569c9c1c025fgalligan@chromium.org
649f9586bb54d74c97d07b09eb2512f8569c9c1c025fgalligan@chromium.org  virtual void SetUp() {
650f9586bb54d74c97d07b09eb2512f8569c9c1c025fgalligan@chromium.org    fwd_txfm_ = GET_PARAM(0);
651f9586bb54d74c97d07b09eb2512f8569c9c1c025fgalligan@chromium.org    inv_txfm_ = GET_PARAM(1);
652f9586bb54d74c97d07b09eb2512f8569c9c1c025fgalligan@chromium.org    tx_type_  = GET_PARAM(2);
65387997d490ae52aa962a985c95b3cddf7f8832641johannkoenig@chromium.org    bit_depth_ = GET_PARAM(3);
654f9586bb54d74c97d07b09eb2512f8569c9c1c025fgalligan@chromium.org    pitch_    = 16;
655f9586bb54d74c97d07b09eb2512f8569c9c1c025fgalligan@chromium.org    fwd_txfm_ref = fht16x16_ref;
65688b47b29cc274dd19cddc37c1ce1834d97df282efgalligan@chromium.org    inv_txfm_ref = iht16x16_ref;
65787997d490ae52aa962a985c95b3cddf7f8832641johannkoenig@chromium.org    mask_ = (1 << bit_depth_) - 1;
65887997d490ae52aa962a985c95b3cddf7f8832641johannkoenig@chromium.org#if CONFIG_VP9_HIGHBITDEPTH
65987997d490ae52aa962a985c95b3cddf7f8832641johannkoenig@chromium.org    switch (bit_depth_) {
66087997d490ae52aa962a985c95b3cddf7f8832641johannkoenig@chromium.org      case VPX_BITS_10:
66187997d490ae52aa962a985c95b3cddf7f8832641johannkoenig@chromium.org        inv_txfm_ref = iht16x16_10;
66287997d490ae52aa962a985c95b3cddf7f8832641johannkoenig@chromium.org        break;
66387997d490ae52aa962a985c95b3cddf7f8832641johannkoenig@chromium.org      case VPX_BITS_12:
66487997d490ae52aa962a985c95b3cddf7f8832641johannkoenig@chromium.org        inv_txfm_ref = iht16x16_12;
66587997d490ae52aa962a985c95b3cddf7f8832641johannkoenig@chromium.org        break;
66687997d490ae52aa962a985c95b3cddf7f8832641johannkoenig@chromium.org      default:
66787997d490ae52aa962a985c95b3cddf7f8832641johannkoenig@chromium.org        inv_txfm_ref = iht16x16_ref;
66887997d490ae52aa962a985c95b3cddf7f8832641johannkoenig@chromium.org        break;
66987997d490ae52aa962a985c95b3cddf7f8832641johannkoenig@chromium.org    }
67087997d490ae52aa962a985c95b3cddf7f8832641johannkoenig@chromium.org#else
67187997d490ae52aa962a985c95b3cddf7f8832641johannkoenig@chromium.org    inv_txfm_ref = iht16x16_ref;
67287997d490ae52aa962a985c95b3cddf7f8832641johannkoenig@chromium.org#endif
673f9586bb54d74c97d07b09eb2512f8569c9c1c025fgalligan@chromium.org  }
674f9586bb54d74c97d07b09eb2512f8569c9c1c025fgalligan@chromium.org  virtual void TearDown() { libvpx_test::ClearSystemState(); }
675f9586bb54d74c97d07b09eb2512f8569c9c1c025fgalligan@chromium.org
676f9586bb54d74c97d07b09eb2512f8569c9c1c025fgalligan@chromium.org protected:
67787997d490ae52aa962a985c95b3cddf7f8832641johannkoenig@chromium.org  void RunFwdTxfm(int16_t *in, tran_low_t *out, int stride) {
678f9586bb54d74c97d07b09eb2512f8569c9c1c025fgalligan@chromium.org    fwd_txfm_(in, out, stride, tx_type_);
679f9586bb54d74c97d07b09eb2512f8569c9c1c025fgalligan@chromium.org  }
68087997d490ae52aa962a985c95b3cddf7f8832641johannkoenig@chromium.org  void RunInvTxfm(tran_low_t *out, uint8_t *dst, int stride) {
681f9586bb54d74c97d07b09eb2512f8569c9c1c025fgalligan@chromium.org    inv_txfm_(out, dst, stride, tx_type_);
6826fefe538d859300e7febe78271828198c10f1b52fgalligan@chromium.org  }
683f9586bb54d74c97d07b09eb2512f8569c9c1c025fgalligan@chromium.org
684ac4e313c19203132648a2a271703b6ee76fe4284johannkoenig@chromium.org  FhtFunc fwd_txfm_;
685ac4e313c19203132648a2a271703b6ee76fe4284johannkoenig@chromium.org  IhtFunc inv_txfm_;
686f9586bb54d74c97d07b09eb2512f8569c9c1c025fgalligan@chromium.org};
687f9586bb54d74c97d07b09eb2512f8569c9c1c025fgalligan@chromium.org
688f9586bb54d74c97d07b09eb2512f8569c9c1c025fgalligan@chromium.orgTEST_P(Trans16x16HT, AccuracyCheck) {
689f9586bb54d74c97d07b09eb2512f8569c9c1c025fgalligan@chromium.org  RunAccuracyCheck();
690f9586bb54d74c97d07b09eb2512f8569c9c1c025fgalligan@chromium.org}
691f9586bb54d74c97d07b09eb2512f8569c9c1c025fgalligan@chromium.org
692f9586bb54d74c97d07b09eb2512f8569c9c1c025fgalligan@chromium.orgTEST_P(Trans16x16HT, CoeffCheck) {
693f9586bb54d74c97d07b09eb2512f8569c9c1c025fgalligan@chromium.org  RunCoeffCheck();
694f9586bb54d74c97d07b09eb2512f8569c9c1c025fgalligan@chromium.org}
695f9586bb54d74c97d07b09eb2512f8569c9c1c025fgalligan@chromium.org
696f9586bb54d74c97d07b09eb2512f8569c9c1c025fgalligan@chromium.orgTEST_P(Trans16x16HT, MemCheck) {
697f9586bb54d74c97d07b09eb2512f8569c9c1c025fgalligan@chromium.org  RunMemCheck();
6986fefe538d859300e7febe78271828198c10f1b52fgalligan@chromium.org}
69947265f8fe3a36a426773454ad90d20c9aa616c24johannkoenig@chromium.org
70088b47b29cc274dd19cddc37c1ce1834d97df282efgalligan@chromium.orgTEST_P(Trans16x16HT, QuantCheck) {
70188b47b29cc274dd19cddc37c1ce1834d97df282efgalligan@chromium.org  // The encoder skips any non-DC intra prediction modes,
70288b47b29cc274dd19cddc37c1ce1834d97df282efgalligan@chromium.org  // when the quantization step size goes beyond 988.
70388b47b29cc274dd19cddc37c1ce1834d97df282efgalligan@chromium.org  RunQuantCheck(549, 988);
70488b47b29cc274dd19cddc37c1ce1834d97df282efgalligan@chromium.org}
70588b47b29cc274dd19cddc37c1ce1834d97df282efgalligan@chromium.org
706f9586bb54d74c97d07b09eb2512f8569c9c1c025fgalligan@chromium.orgusing std::tr1::make_tuple;
707f9586bb54d74c97d07b09eb2512f8569c9c1c025fgalligan@chromium.org
70887997d490ae52aa962a985c95b3cddf7f8832641johannkoenig@chromium.org#if CONFIG_VP9_HIGHBITDEPTH
70987997d490ae52aa962a985c95b3cddf7f8832641johannkoenig@chromium.orgINSTANTIATE_TEST_CASE_P(
71087997d490ae52aa962a985c95b3cddf7f8832641johannkoenig@chromium.org    C, Trans16x16DCT,
71187997d490ae52aa962a985c95b3cddf7f8832641johannkoenig@chromium.org    ::testing::Values(
71287997d490ae52aa962a985c95b3cddf7f8832641johannkoenig@chromium.org        make_tuple(&vp9_high_fdct16x16_c, &idct16x16_10, 0, VPX_BITS_10),
71387997d490ae52aa962a985c95b3cddf7f8832641johannkoenig@chromium.org        make_tuple(&vp9_high_fdct16x16_c, &idct16x16_12, 0, VPX_BITS_12),
71487997d490ae52aa962a985c95b3cddf7f8832641johannkoenig@chromium.org        make_tuple(&vp9_fdct16x16_c, &vp9_idct16x16_256_add_c, 0, VPX_BITS_8)));
71587997d490ae52aa962a985c95b3cddf7f8832641johannkoenig@chromium.org#else
716f9586bb54d74c97d07b09eb2512f8569c9c1c025fgalligan@chromium.orgINSTANTIATE_TEST_CASE_P(
717f9586bb54d74c97d07b09eb2512f8569c9c1c025fgalligan@chromium.org    C, Trans16x16DCT,
718f9586bb54d74c97d07b09eb2512f8569c9c1c025fgalligan@chromium.org    ::testing::Values(
71987997d490ae52aa962a985c95b3cddf7f8832641johannkoenig@chromium.org        make_tuple(&vp9_fdct16x16_c, &vp9_idct16x16_256_add_c, 0, VPX_BITS_8)));
72087997d490ae52aa962a985c95b3cddf7f8832641johannkoenig@chromium.org#endif
72187997d490ae52aa962a985c95b3cddf7f8832641johannkoenig@chromium.org
72287997d490ae52aa962a985c95b3cddf7f8832641johannkoenig@chromium.org#if CONFIG_VP9_HIGHBITDEPTH
723f9586bb54d74c97d07b09eb2512f8569c9c1c025fgalligan@chromium.orgINSTANTIATE_TEST_CASE_P(
724f9586bb54d74c97d07b09eb2512f8569c9c1c025fgalligan@chromium.org    C, Trans16x16HT,
725f9586bb54d74c97d07b09eb2512f8569c9c1c025fgalligan@chromium.org    ::testing::Values(
72687997d490ae52aa962a985c95b3cddf7f8832641johannkoenig@chromium.org        make_tuple(&vp9_high_fht16x16_c, &iht16x16_10, 0, VPX_BITS_10),
72787997d490ae52aa962a985c95b3cddf7f8832641johannkoenig@chromium.org        make_tuple(&vp9_high_fht16x16_c, &iht16x16_10, 1, VPX_BITS_10),
72887997d490ae52aa962a985c95b3cddf7f8832641johannkoenig@chromium.org        make_tuple(&vp9_high_fht16x16_c, &iht16x16_10, 2, VPX_BITS_10),
72987997d490ae52aa962a985c95b3cddf7f8832641johannkoenig@chromium.org        make_tuple(&vp9_high_fht16x16_c, &iht16x16_10, 3, VPX_BITS_10),
73087997d490ae52aa962a985c95b3cddf7f8832641johannkoenig@chromium.org        make_tuple(&vp9_high_fht16x16_c, &iht16x16_12, 0, VPX_BITS_12),
73187997d490ae52aa962a985c95b3cddf7f8832641johannkoenig@chromium.org        make_tuple(&vp9_high_fht16x16_c, &iht16x16_12, 1, VPX_BITS_12),
73287997d490ae52aa962a985c95b3cddf7f8832641johannkoenig@chromium.org        make_tuple(&vp9_high_fht16x16_c, &iht16x16_12, 2, VPX_BITS_12),
73387997d490ae52aa962a985c95b3cddf7f8832641johannkoenig@chromium.org        make_tuple(&vp9_high_fht16x16_c, &iht16x16_12, 3, VPX_BITS_12),
73487997d490ae52aa962a985c95b3cddf7f8832641johannkoenig@chromium.org        make_tuple(&vp9_fht16x16_c, &vp9_iht16x16_256_add_c, 0, VPX_BITS_8),
73587997d490ae52aa962a985c95b3cddf7f8832641johannkoenig@chromium.org        make_tuple(&vp9_fht16x16_c, &vp9_iht16x16_256_add_c, 1, VPX_BITS_8),
73687997d490ae52aa962a985c95b3cddf7f8832641johannkoenig@chromium.org        make_tuple(&vp9_fht16x16_c, &vp9_iht16x16_256_add_c, 2, VPX_BITS_8),
73787997d490ae52aa962a985c95b3cddf7f8832641johannkoenig@chromium.org        make_tuple(&vp9_fht16x16_c, &vp9_iht16x16_256_add_c, 3, VPX_BITS_8)));
73887997d490ae52aa962a985c95b3cddf7f8832641johannkoenig@chromium.org#else
73987997d490ae52aa962a985c95b3cddf7f8832641johannkoenig@chromium.orgINSTANTIATE_TEST_CASE_P(
74087997d490ae52aa962a985c95b3cddf7f8832641johannkoenig@chromium.org    C, Trans16x16HT,
74187997d490ae52aa962a985c95b3cddf7f8832641johannkoenig@chromium.org    ::testing::Values(
74287997d490ae52aa962a985c95b3cddf7f8832641johannkoenig@chromium.org        make_tuple(&vp9_fht16x16_c, &vp9_iht16x16_256_add_c, 0, VPX_BITS_8),
74387997d490ae52aa962a985c95b3cddf7f8832641johannkoenig@chromium.org        make_tuple(&vp9_fht16x16_c, &vp9_iht16x16_256_add_c, 1, VPX_BITS_8),
74487997d490ae52aa962a985c95b3cddf7f8832641johannkoenig@chromium.org        make_tuple(&vp9_fht16x16_c, &vp9_iht16x16_256_add_c, 2, VPX_BITS_8),
74587997d490ae52aa962a985c95b3cddf7f8832641johannkoenig@chromium.org        make_tuple(&vp9_fht16x16_c, &vp9_iht16x16_256_add_c, 3, VPX_BITS_8)));
74687997d490ae52aa962a985c95b3cddf7f8832641johannkoenig@chromium.org#endif
747f9586bb54d74c97d07b09eb2512f8569c9c1c025fgalligan@chromium.org
74887997d490ae52aa962a985c95b3cddf7f8832641johannkoenig@chromium.org#if HAVE_NEON_ASM && !CONFIG_VP9_HIGHBITDEPTH
749411971f94253c85e1866c281860d6344f6aa0c78fgalligan@chromium.orgINSTANTIATE_TEST_CASE_P(
750411971f94253c85e1866c281860d6344f6aa0c78fgalligan@chromium.org    NEON, Trans16x16DCT,
751411971f94253c85e1866c281860d6344f6aa0c78fgalligan@chromium.org    ::testing::Values(
752411971f94253c85e1866c281860d6344f6aa0c78fgalligan@chromium.org        make_tuple(&vp9_fdct16x16_c,
75387997d490ae52aa962a985c95b3cddf7f8832641johannkoenig@chromium.org                   &vp9_idct16x16_256_add_neon, 0, VPX_BITS_8)));
754411971f94253c85e1866c281860d6344f6aa0c78fgalligan@chromium.org#endif
755411971f94253c85e1866c281860d6344f6aa0c78fgalligan@chromium.org
75687997d490ae52aa962a985c95b3cddf7f8832641johannkoenig@chromium.org#if HAVE_SSE2 && !CONFIG_VP9_HIGHBITDEPTH
757f9586bb54d74c97d07b09eb2512f8569c9c1c025fgalligan@chromium.orgINSTANTIATE_TEST_CASE_P(
758f9586bb54d74c97d07b09eb2512f8569c9c1c025fgalligan@chromium.org    SSE2, Trans16x16DCT,
759f9586bb54d74c97d07b09eb2512f8569c9c1c025fgalligan@chromium.org    ::testing::Values(
7600d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org        make_tuple(&vp9_fdct16x16_sse2,
76187997d490ae52aa962a985c95b3cddf7f8832641johannkoenig@chromium.org                   &vp9_idct16x16_256_add_sse2, 0, VPX_BITS_8)));
762f9586bb54d74c97d07b09eb2512f8569c9c1c025fgalligan@chromium.orgINSTANTIATE_TEST_CASE_P(
763f9586bb54d74c97d07b09eb2512f8569c9c1c025fgalligan@chromium.org    SSE2, Trans16x16HT,
764f9586bb54d74c97d07b09eb2512f8569c9c1c025fgalligan@chromium.org    ::testing::Values(
76587997d490ae52aa962a985c95b3cddf7f8832641johannkoenig@chromium.org        make_tuple(&vp9_fht16x16_sse2, &vp9_iht16x16_256_add_sse2, 0,
76687997d490ae52aa962a985c95b3cddf7f8832641johannkoenig@chromium.org                   VPX_BITS_8),
76787997d490ae52aa962a985c95b3cddf7f8832641johannkoenig@chromium.org        make_tuple(&vp9_fht16x16_sse2, &vp9_iht16x16_256_add_sse2, 1,
76887997d490ae52aa962a985c95b3cddf7f8832641johannkoenig@chromium.org                   VPX_BITS_8),
76987997d490ae52aa962a985c95b3cddf7f8832641johannkoenig@chromium.org        make_tuple(&vp9_fht16x16_sse2, &vp9_iht16x16_256_add_sse2, 2,
77087997d490ae52aa962a985c95b3cddf7f8832641johannkoenig@chromium.org                   VPX_BITS_8),
77187997d490ae52aa962a985c95b3cddf7f8832641johannkoenig@chromium.org        make_tuple(&vp9_fht16x16_sse2, &vp9_iht16x16_256_add_sse2, 3,
77287997d490ae52aa962a985c95b3cddf7f8832641johannkoenig@chromium.org                   VPX_BITS_8)));
773f9586bb54d74c97d07b09eb2512f8569c9c1c025fgalligan@chromium.org#endif
77488b47b29cc274dd19cddc37c1ce1834d97df282efgalligan@chromium.org
77587997d490ae52aa962a985c95b3cddf7f8832641johannkoenig@chromium.org#if HAVE_SSSE3 && !CONFIG_VP9_HIGHBITDEPTH
77688b47b29cc274dd19cddc37c1ce1834d97df282efgalligan@chromium.orgINSTANTIATE_TEST_CASE_P(
77788b47b29cc274dd19cddc37c1ce1834d97df282efgalligan@chromium.org    SSSE3, Trans16x16DCT,
77888b47b29cc274dd19cddc37c1ce1834d97df282efgalligan@chromium.org    ::testing::Values(
77987997d490ae52aa962a985c95b3cddf7f8832641johannkoenig@chromium.org        make_tuple(&vp9_fdct16x16_c, &vp9_idct16x16_256_add_ssse3, 0,
78087997d490ae52aa962a985c95b3cddf7f8832641johannkoenig@chromium.org                   VPX_BITS_8)));
78188b47b29cc274dd19cddc37c1ce1834d97df282efgalligan@chromium.org#endif
7826fefe538d859300e7febe78271828198c10f1b52fgalligan@chromium.org}  // namespace
783