blob: 75ed1d8c90a0b15f5cce59b7b926f82940342acc [file] [log] [blame]
Daniel Kangfed8a182012-08-02 17:03:14 -07001/*
2 * Copyright (c) 2012 The WebM project authors. All Rights Reserved.
3 *
4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree.
9 */
10
11#include <math.h>
12#include <stdlib.h>
13#include <string.h>
14
15#include "third_party/googletest/src/include/gtest/gtest.h"
Jingning Han8f92a7e2013-09-05 12:44:03 -070016#include "test/acm_random.h"
17#include "test/clear_system_state.h"
18#include "test/register_state_check.h"
19#include "test/util.h"
Daniel Kangfed8a182012-08-02 17:03:14 -070020
Yaowu Xuafffa3d2013-09-05 08:45:56 -070021#include "./vp9_rtcd.h"
James Zern002ad402014-01-18 13:03:31 -080022#include "vp9/common/vp9_entropy.h"
Deb Mukherjee10783d42014-09-02 16:34:09 -070023#include "vpx/vpx_codec.h"
James Zern002ad402014-01-18 13:03:31 -080024#include "vpx/vpx_integer.h"
25
Daniel Kangfed8a182012-08-02 17:03:14 -070026using libvpx_test::ACMRandom;
27
28namespace {
29
Yaowu Xu77f889b2013-02-04 15:22:55 -080030#ifdef _MSC_VER
31static int round(double x) {
32 if (x < 0)
Yaowu Xuafffa3d2013-09-05 08:45:56 -070033 return static_cast<int>(ceil(x - 0.5));
Yaowu Xu77f889b2013-02-04 15:22:55 -080034 else
Yaowu Xuafffa3d2013-09-05 08:45:56 -070035 return static_cast<int>(floor(x + 0.5));
Yaowu Xu77f889b2013-02-04 15:22:55 -080036}
37#endif
38
Jingning Han8f92a7e2013-09-05 12:44:03 -070039const int kNumCoeffs = 256;
Daniel Kangfed8a182012-08-02 17:03:14 -070040const double PI = 3.1415926535898;
41void reference2_16x16_idct_2d(double *input, double *output) {
42 double x;
43 for (int l = 0; l < 16; ++l) {
44 for (int k = 0; k < 16; ++k) {
45 double s = 0;
46 for (int i = 0; i < 16; ++i) {
47 for (int j = 0; j < 16; ++j) {
Yaowu Xuafffa3d2013-09-05 08:45:56 -070048 x = cos(PI * j * (l + 0.5) / 16.0) *
49 cos(PI * i * (k + 0.5) / 16.0) *
50 input[i * 16 + j] / 256;
Daniel Kangfed8a182012-08-02 17:03:14 -070051 if (i != 0)
52 x *= sqrt(2.0);
53 if (j != 0)
54 x *= sqrt(2.0);
55 s += x;
56 }
57 }
58 output[k*16+l] = s;
59 }
60 }
61}
62
Yaowu Xu0b17ea62012-08-07 13:55:49 -070063
Jingning Han8f92a7e2013-09-05 12:44:03 -070064const double C1 = 0.995184726672197;
65const double C2 = 0.98078528040323;
66const double C3 = 0.956940335732209;
67const double C4 = 0.923879532511287;
68const double C5 = 0.881921264348355;
69const double C6 = 0.831469612302545;
70const double C7 = 0.773010453362737;
71const double C8 = 0.707106781186548;
72const double C9 = 0.634393284163646;
73const double C10 = 0.555570233019602;
74const double C11 = 0.471396736825998;
75const double C12 = 0.38268343236509;
76const double C13 = 0.290284677254462;
77const double C14 = 0.195090322016128;
78const double C15 = 0.098017140329561;
Yaowu Xu0b17ea62012-08-07 13:55:49 -070079
Jingning Hanec4b2742013-08-27 17:03:46 -070080void butterfly_16x16_dct_1d(double input[16], double output[16]) {
Daniel Kangfed8a182012-08-02 17:03:14 -070081 double step[16];
82 double intermediate[16];
83 double temp1, temp2;
84
Daniel Kangfed8a182012-08-02 17:03:14 -070085 // step 1
86 step[ 0] = input[0] + input[15];
87 step[ 1] = input[1] + input[14];
88 step[ 2] = input[2] + input[13];
89 step[ 3] = input[3] + input[12];
90 step[ 4] = input[4] + input[11];
91 step[ 5] = input[5] + input[10];
92 step[ 6] = input[6] + input[ 9];
93 step[ 7] = input[7] + input[ 8];
94 step[ 8] = input[7] - input[ 8];
95 step[ 9] = input[6] - input[ 9];
96 step[10] = input[5] - input[10];
97 step[11] = input[4] - input[11];
98 step[12] = input[3] - input[12];
99 step[13] = input[2] - input[13];
100 step[14] = input[1] - input[14];
101 step[15] = input[0] - input[15];
102
103 // step 2
104 output[0] = step[0] + step[7];
105 output[1] = step[1] + step[6];
106 output[2] = step[2] + step[5];
107 output[3] = step[3] + step[4];
108 output[4] = step[3] - step[4];
109 output[5] = step[2] - step[5];
110 output[6] = step[1] - step[6];
111 output[7] = step[0] - step[7];
112
Jingning Han8f92a7e2013-09-05 12:44:03 -0700113 temp1 = step[ 8] * C7;
114 temp2 = step[15] * C9;
Daniel Kangfed8a182012-08-02 17:03:14 -0700115 output[ 8] = temp1 + temp2;
116
Jingning Han8f92a7e2013-09-05 12:44:03 -0700117 temp1 = step[ 9] * C11;
118 temp2 = step[14] * C5;
Daniel Kangfed8a182012-08-02 17:03:14 -0700119 output[ 9] = temp1 - temp2;
120
Jingning Han8f92a7e2013-09-05 12:44:03 -0700121 temp1 = step[10] * C3;
122 temp2 = step[13] * C13;
Daniel Kangfed8a182012-08-02 17:03:14 -0700123 output[10] = temp1 + temp2;
124
Jingning Han8f92a7e2013-09-05 12:44:03 -0700125 temp1 = step[11] * C15;
126 temp2 = step[12] * C1;
Daniel Kangfed8a182012-08-02 17:03:14 -0700127 output[11] = temp1 - temp2;
128
Jingning Han8f92a7e2013-09-05 12:44:03 -0700129 temp1 = step[11] * C1;
130 temp2 = step[12] * C15;
Daniel Kangfed8a182012-08-02 17:03:14 -0700131 output[12] = temp2 + temp1;
132
Jingning Han8f92a7e2013-09-05 12:44:03 -0700133 temp1 = step[10] * C13;
134 temp2 = step[13] * C3;
Daniel Kangfed8a182012-08-02 17:03:14 -0700135 output[13] = temp2 - temp1;
136
Jingning Han8f92a7e2013-09-05 12:44:03 -0700137 temp1 = step[ 9] * C5;
138 temp2 = step[14] * C11;
Daniel Kangfed8a182012-08-02 17:03:14 -0700139 output[14] = temp2 + temp1;
140
Jingning Han8f92a7e2013-09-05 12:44:03 -0700141 temp1 = step[ 8] * C9;
142 temp2 = step[15] * C7;
Daniel Kangfed8a182012-08-02 17:03:14 -0700143 output[15] = temp2 - temp1;
144
145 // step 3
146 step[ 0] = output[0] + output[3];
147 step[ 1] = output[1] + output[2];
148 step[ 2] = output[1] - output[2];
149 step[ 3] = output[0] - output[3];
150
Jingning Han8f92a7e2013-09-05 12:44:03 -0700151 temp1 = output[4] * C14;
152 temp2 = output[7] * C2;
Daniel Kangfed8a182012-08-02 17:03:14 -0700153 step[ 4] = temp1 + temp2;
154
Jingning Han8f92a7e2013-09-05 12:44:03 -0700155 temp1 = output[5] * C10;
156 temp2 = output[6] * C6;
Daniel Kangfed8a182012-08-02 17:03:14 -0700157 step[ 5] = temp1 + temp2;
158
Jingning Han8f92a7e2013-09-05 12:44:03 -0700159 temp1 = output[5] * C6;
160 temp2 = output[6] * C10;
Daniel Kangfed8a182012-08-02 17:03:14 -0700161 step[ 6] = temp2 - temp1;
162
Jingning Han8f92a7e2013-09-05 12:44:03 -0700163 temp1 = output[4] * C2;
164 temp2 = output[7] * C14;
Daniel Kangfed8a182012-08-02 17:03:14 -0700165 step[ 7] = temp2 - temp1;
166
167 step[ 8] = output[ 8] + output[11];
168 step[ 9] = output[ 9] + output[10];
169 step[10] = output[ 9] - output[10];
170 step[11] = output[ 8] - output[11];
171
172 step[12] = output[12] + output[15];
173 step[13] = output[13] + output[14];
174 step[14] = output[13] - output[14];
175 step[15] = output[12] - output[15];
176
177 // step 4
178 output[ 0] = (step[ 0] + step[ 1]);
179 output[ 8] = (step[ 0] - step[ 1]);
180
Jingning Han8f92a7e2013-09-05 12:44:03 -0700181 temp1 = step[2] * C12;
182 temp2 = step[3] * C4;
Daniel Kangfed8a182012-08-02 17:03:14 -0700183 temp1 = temp1 + temp2;
Jingning Han8f92a7e2013-09-05 12:44:03 -0700184 output[ 4] = 2*(temp1 * C8);
Daniel Kangfed8a182012-08-02 17:03:14 -0700185
Jingning Han8f92a7e2013-09-05 12:44:03 -0700186 temp1 = step[2] * C4;
187 temp2 = step[3] * C12;
Daniel Kangfed8a182012-08-02 17:03:14 -0700188 temp1 = temp2 - temp1;
Jingning Han8f92a7e2013-09-05 12:44:03 -0700189 output[12] = 2 * (temp1 * C8);
Daniel Kangfed8a182012-08-02 17:03:14 -0700190
Jingning Han8f92a7e2013-09-05 12:44:03 -0700191 output[ 2] = 2 * ((step[4] + step[ 5]) * C8);
192 output[14] = 2 * ((step[7] - step[ 6]) * C8);
Daniel Kangfed8a182012-08-02 17:03:14 -0700193
194 temp1 = step[4] - step[5];
195 temp2 = step[6] + step[7];
196 output[ 6] = (temp1 + temp2);
197 output[10] = (temp1 - temp2);
198
199 intermediate[8] = step[8] + step[14];
200 intermediate[9] = step[9] + step[15];
201
Jingning Han8f92a7e2013-09-05 12:44:03 -0700202 temp1 = intermediate[8] * C12;
203 temp2 = intermediate[9] * C4;
Daniel Kangfed8a182012-08-02 17:03:14 -0700204 temp1 = temp1 - temp2;
Jingning Han8f92a7e2013-09-05 12:44:03 -0700205 output[3] = 2 * (temp1 * C8);
Daniel Kangfed8a182012-08-02 17:03:14 -0700206
Jingning Han8f92a7e2013-09-05 12:44:03 -0700207 temp1 = intermediate[8] * C4;
208 temp2 = intermediate[9] * C12;
Daniel Kangfed8a182012-08-02 17:03:14 -0700209 temp1 = temp2 + temp1;
Jingning Han8f92a7e2013-09-05 12:44:03 -0700210 output[13] = 2 * (temp1 * C8);
Daniel Kangfed8a182012-08-02 17:03:14 -0700211
Jingning Han8f92a7e2013-09-05 12:44:03 -0700212 output[ 9] = 2 * ((step[10] + step[11]) * C8);
Daniel Kangfed8a182012-08-02 17:03:14 -0700213
214 intermediate[11] = step[10] - step[11];
215 intermediate[12] = step[12] + step[13];
216 intermediate[13] = step[12] - step[13];
217 intermediate[14] = step[ 8] - step[14];
218 intermediate[15] = step[ 9] - step[15];
219
220 output[15] = (intermediate[11] + intermediate[12]);
221 output[ 1] = -(intermediate[11] - intermediate[12]);
222
Jingning Han8f92a7e2013-09-05 12:44:03 -0700223 output[ 7] = 2 * (intermediate[13] * C8);
Daniel Kangfed8a182012-08-02 17:03:14 -0700224
Jingning Han8f92a7e2013-09-05 12:44:03 -0700225 temp1 = intermediate[14] * C12;
226 temp2 = intermediate[15] * C4;
Daniel Kangfed8a182012-08-02 17:03:14 -0700227 temp1 = temp1 - temp2;
Jingning Han8f92a7e2013-09-05 12:44:03 -0700228 output[11] = -2 * (temp1 * C8);
Daniel Kangfed8a182012-08-02 17:03:14 -0700229
Jingning Han8f92a7e2013-09-05 12:44:03 -0700230 temp1 = intermediate[14] * C4;
231 temp2 = intermediate[15] * C12;
Daniel Kangfed8a182012-08-02 17:03:14 -0700232 temp1 = temp2 + temp1;
Jingning Han8f92a7e2013-09-05 12:44:03 -0700233 output[ 5] = 2 * (temp1 * C8);
Daniel Kangfed8a182012-08-02 17:03:14 -0700234}
235
Jingning Han8f92a7e2013-09-05 12:44:03 -0700236void reference_16x16_dct_2d(int16_t input[256], double output[256]) {
Daniel Kangfed8a182012-08-02 17:03:14 -0700237 // First transform columns
238 for (int i = 0; i < 16; ++i) {
239 double temp_in[16], temp_out[16];
240 for (int j = 0; j < 16; ++j)
Jingning Han8f92a7e2013-09-05 12:44:03 -0700241 temp_in[j] = input[j * 16 + i];
Daniel Kangfed8a182012-08-02 17:03:14 -0700242 butterfly_16x16_dct_1d(temp_in, temp_out);
243 for (int j = 0; j < 16; ++j)
Jingning Han8f92a7e2013-09-05 12:44:03 -0700244 output[j * 16 + i] = temp_out[j];
Daniel Kangfed8a182012-08-02 17:03:14 -0700245 }
246 // Then transform rows
247 for (int i = 0; i < 16; ++i) {
248 double temp_in[16], temp_out[16];
249 for (int j = 0; j < 16; ++j)
Jingning Han8f92a7e2013-09-05 12:44:03 -0700250 temp_in[j] = output[j + i * 16];
Daniel Kangfed8a182012-08-02 17:03:14 -0700251 butterfly_16x16_dct_1d(temp_in, temp_out);
252 // Scale by some magic number
253 for (int j = 0; j < 16; ++j)
Jingning Han8f92a7e2013-09-05 12:44:03 -0700254 output[j + i * 16] = temp_out[j]/2;
Daniel Kangfed8a182012-08-02 17:03:14 -0700255 }
256}
257
Deb Mukherjee10783d42014-09-02 16:34:09 -0700258typedef void (*FdctFunc)(const int16_t *in, tran_low_t *out, int stride);
259typedef void (*IdctFunc)(const tran_low_t *in, uint8_t *out, int stride);
260typedef void (*FhtFunc)(const int16_t *in, tran_low_t *out, int stride,
James Zern44f84842014-07-16 18:53:33 -0700261 int tx_type);
Deb Mukherjee10783d42014-09-02 16:34:09 -0700262typedef void (*IhtFunc)(const tran_low_t *in, uint8_t *out, int stride,
James Zern44f84842014-07-16 18:53:33 -0700263 int tx_type);
Jingning Hancf768b22013-07-09 16:16:49 -0700264
Deb Mukherjee10783d42014-09-02 16:34:09 -0700265typedef std::tr1::tuple<FdctFunc, IdctFunc, int, vpx_bit_depth_t> Dct16x16Param;
266typedef std::tr1::tuple<FhtFunc, IhtFunc, int, vpx_bit_depth_t> Ht16x16Param;
Joshua Litt51490e52013-11-18 17:07:55 -0800267
Deb Mukherjee10783d42014-09-02 16:34:09 -0700268void fdct16x16_ref(const int16_t *in, tran_low_t *out, int stride,
James Zern632e4192014-08-22 12:11:42 -0700269 int /*tx_type*/) {
Dmitry Kovalev02feb632013-10-23 10:57:12 -0700270 vp9_fdct16x16_c(in, out, stride);
Jingning Han37705a32013-09-09 17:07:55 -0700271}
272
Deb Mukherjee10783d42014-09-02 16:34:09 -0700273void idct16x16_ref(const tran_low_t *in, uint8_t *dest, int stride,
James Zern632e4192014-08-22 12:11:42 -0700274 int /*tx_type*/) {
Jingning Han49b4a272014-05-29 12:50:54 -0700275 vp9_idct16x16_256_add_c(in, dest, stride);
276}
277
Deb Mukherjee10783d42014-09-02 16:34:09 -0700278void fht16x16_ref(const int16_t *in, tran_low_t *out, int stride,
279 int tx_type) {
Dmitry Kovalev005fc692014-02-06 11:54:15 -0800280 vp9_fht16x16_c(in, out, stride, tx_type);
Jingning Han37705a32013-09-09 17:07:55 -0700281}
282
Deb Mukherjee10783d42014-09-02 16:34:09 -0700283void iht16x16_ref(const tran_low_t *in, uint8_t *dest, int stride,
284 int tx_type) {
Jingning Han49b4a272014-05-29 12:50:54 -0700285 vp9_iht16x16_256_add_c(in, dest, stride, tx_type);
286}
287
Deb Mukherjee10783d42014-09-02 16:34:09 -0700288#if CONFIG_VP9_HIGHBITDEPTH
289void idct16x16_10(const tran_low_t *in, uint8_t *out, int stride) {
290 vp9_high_idct16x16_256_add_c(in, out, stride, 10);
291}
292
293void idct16x16_12(const tran_low_t *in, uint8_t *out, int stride) {
294 vp9_high_idct16x16_256_add_c(in, out, stride, 12);
295}
296
297void idct16x16_10_ref(const tran_low_t *in, uint8_t *out, int stride,
298 int tx_type) {
299 idct16x16_10(in, out, stride);
300}
301
302void idct16x16_12_ref(const tran_low_t *in, uint8_t *out, int stride,
303 int tx_type) {
304 idct16x16_12(in, out, stride);
305}
306
307void iht16x16_10(const tran_low_t *in, uint8_t *out, int stride, int tx_type) {
308 vp9_high_iht16x16_256_add_c(in, out, stride, tx_type, 10);
309}
310
311void iht16x16_12(const tran_low_t *in, uint8_t *out, int stride, int tx_type) {
312 vp9_high_iht16x16_256_add_c(in, out, stride, tx_type, 12);
313}
314#endif
315
Jingning Han8f92a7e2013-09-05 12:44:03 -0700316class Trans16x16TestBase {
Jingning Hancf768b22013-07-09 16:16:49 -0700317 public:
Jingning Han8f92a7e2013-09-05 12:44:03 -0700318 virtual ~Trans16x16TestBase() {}
Jingning Hancf768b22013-07-09 16:16:49 -0700319
Jingning Han8f92a7e2013-09-05 12:44:03 -0700320 protected:
Deb Mukherjee10783d42014-09-02 16:34:09 -0700321 virtual void RunFwdTxfm(int16_t *in, tran_low_t *out, int stride) = 0;
Jingning Han8f92a7e2013-09-05 12:44:03 -0700322
Deb Mukherjee10783d42014-09-02 16:34:09 -0700323 virtual void RunInvTxfm(tran_low_t *out, uint8_t *dst, int stride) = 0;
Jingning Han8f92a7e2013-09-05 12:44:03 -0700324
325 void RunAccuracyCheck() {
326 ACMRandom rnd(ACMRandom::DeterministicSeed());
Jingning Han37705a32013-09-09 17:07:55 -0700327 uint32_t max_error = 0;
328 int64_t total_error = 0;
Jingning Han8f92a7e2013-09-05 12:44:03 -0700329 const int count_test_block = 10000;
330 for (int i = 0; i < count_test_block; ++i) {
331 DECLARE_ALIGNED_ARRAY(16, int16_t, test_input_block, kNumCoeffs);
Deb Mukherjee10783d42014-09-02 16:34:09 -0700332 DECLARE_ALIGNED_ARRAY(16, tran_low_t, test_temp_block, kNumCoeffs);
Jingning Han8f92a7e2013-09-05 12:44:03 -0700333 DECLARE_ALIGNED_ARRAY(16, uint8_t, dst, kNumCoeffs);
334 DECLARE_ALIGNED_ARRAY(16, uint8_t, src, kNumCoeffs);
Deb Mukherjee10783d42014-09-02 16:34:09 -0700335#if CONFIG_VP9_HIGHBITDEPTH
336 DECLARE_ALIGNED_ARRAY(16, uint16_t, dst16, kNumCoeffs);
337 DECLARE_ALIGNED_ARRAY(16, uint16_t, src16, kNumCoeffs);
338#endif
Jingning Han8f92a7e2013-09-05 12:44:03 -0700339
Deb Mukherjee10783d42014-09-02 16:34:09 -0700340 // Initialize a test block with input range [-mask_, mask_].
Jingning Han8f92a7e2013-09-05 12:44:03 -0700341 for (int j = 0; j < kNumCoeffs; ++j) {
Deb Mukherjee10783d42014-09-02 16:34:09 -0700342 if (bit_depth_ == VPX_BITS_8) {
343 src[j] = rnd.Rand8();
344 dst[j] = rnd.Rand8();
345 test_input_block[j] = src[j] - dst[j];
346#if CONFIG_VP9_HIGHBITDEPTH
347 } else {
348 src16[j] = rnd.Rand16() & mask_;
349 dst16[j] = rnd.Rand16() & mask_;
350 test_input_block[j] = src16[j] - dst16[j];
351#endif
352 }
Jingning Han8f92a7e2013-09-05 12:44:03 -0700353 }
354
James Zern29e1b1a2014-07-09 21:02:02 -0700355 ASM_REGISTER_STATE_CHECK(RunFwdTxfm(test_input_block,
356 test_temp_block, pitch_));
Deb Mukherjee10783d42014-09-02 16:34:09 -0700357 if (bit_depth_ == VPX_BITS_8) {
358 ASM_REGISTER_STATE_CHECK(
359 RunInvTxfm(test_temp_block, dst, pitch_));
360#if CONFIG_VP9_HIGHBITDEPTH
361 } else {
362 ASM_REGISTER_STATE_CHECK(
363 RunInvTxfm(test_temp_block, CONVERT_TO_BYTEPTR(dst16), pitch_));
364#endif
365 }
Jingning Han8f92a7e2013-09-05 12:44:03 -0700366
367 for (int j = 0; j < kNumCoeffs; ++j) {
Deb Mukherjee10783d42014-09-02 16:34:09 -0700368#if CONFIG_VP9_HIGHBITDEPTH
369 const uint32_t diff =
370 bit_depth_ == VPX_BITS_8 ? dst[j] - src[j] : dst16[j] - src16[j];
371#else
Jingning Han37705a32013-09-09 17:07:55 -0700372 const uint32_t diff = dst[j] - src[j];
Deb Mukherjee10783d42014-09-02 16:34:09 -0700373#endif
Jingning Han37705a32013-09-09 17:07:55 -0700374 const uint32_t error = diff * diff;
Jingning Han8f92a7e2013-09-05 12:44:03 -0700375 if (max_error < error)
376 max_error = error;
377 total_error += error;
378 }
379 }
380
Deb Mukherjee10783d42014-09-02 16:34:09 -0700381 EXPECT_GE(1u << 2 * (bit_depth_ - 8), max_error)
Jingning Han8f92a7e2013-09-05 12:44:03 -0700382 << "Error: 16x16 FHT/IHT has an individual round trip error > 1";
383
Deb Mukherjee10783d42014-09-02 16:34:09 -0700384 EXPECT_GE(count_test_block << 2 * (bit_depth_ - 8), total_error)
Jingning Han8f92a7e2013-09-05 12:44:03 -0700385 << "Error: 16x16 FHT/IHT has average round trip error > 1 per block";
386 }
387
Jingning Han37705a32013-09-09 17:07:55 -0700388 void RunCoeffCheck() {
Jingning Han8f92a7e2013-09-05 12:44:03 -0700389 ACMRandom rnd(ACMRandom::DeterministicSeed());
390 const int count_test_block = 1000;
Jingning Han37705a32013-09-09 17:07:55 -0700391 DECLARE_ALIGNED_ARRAY(16, int16_t, input_block, kNumCoeffs);
Deb Mukherjee10783d42014-09-02 16:34:09 -0700392 DECLARE_ALIGNED_ARRAY(16, tran_low_t, output_ref_block, kNumCoeffs);
393 DECLARE_ALIGNED_ARRAY(16, tran_low_t, output_block, kNumCoeffs);
Jingning Han8f92a7e2013-09-05 12:44:03 -0700394
Jingning Han37705a32013-09-09 17:07:55 -0700395 for (int i = 0; i < count_test_block; ++i) {
Deb Mukherjee10783d42014-09-02 16:34:09 -0700396 // Initialize a test block with input range [-mask_, mask_].
Jingning Han37705a32013-09-09 17:07:55 -0700397 for (int j = 0; j < kNumCoeffs; ++j)
Deb Mukherjee10783d42014-09-02 16:34:09 -0700398 input_block[j] = (rnd.Rand16() & mask_) - (rnd.Rand16() & mask_);
Jingning Han37705a32013-09-09 17:07:55 -0700399
400 fwd_txfm_ref(input_block, output_ref_block, pitch_, tx_type_);
James Zern29e1b1a2014-07-09 21:02:02 -0700401 ASM_REGISTER_STATE_CHECK(RunFwdTxfm(input_block, output_block, pitch_));
Jingning Han37705a32013-09-09 17:07:55 -0700402
403 // The minimum quant value is 4.
404 for (int j = 0; j < kNumCoeffs; ++j)
405 EXPECT_EQ(output_block[j], output_ref_block[j]);
406 }
407 }
408
409 void RunMemCheck() {
410 ACMRandom rnd(ACMRandom::DeterministicSeed());
411 const int count_test_block = 1000;
412 DECLARE_ALIGNED_ARRAY(16, int16_t, input_block, kNumCoeffs);
413 DECLARE_ALIGNED_ARRAY(16, int16_t, input_extreme_block, kNumCoeffs);
Deb Mukherjee10783d42014-09-02 16:34:09 -0700414 DECLARE_ALIGNED_ARRAY(16, tran_low_t, output_ref_block, kNumCoeffs);
415 DECLARE_ALIGNED_ARRAY(16, tran_low_t, output_block, kNumCoeffs);
Jingning Han37705a32013-09-09 17:07:55 -0700416
417 for (int i = 0; i < count_test_block; ++i) {
Deb Mukherjee10783d42014-09-02 16:34:09 -0700418 // Initialize a test block with input range [-mask_, mask_].
Jingning Han8f92a7e2013-09-05 12:44:03 -0700419 for (int j = 0; j < kNumCoeffs; ++j) {
Deb Mukherjee10783d42014-09-02 16:34:09 -0700420 input_block[j] = (rnd.Rand16() & mask_) - (rnd.Rand16() & mask_);
421 input_extreme_block[j] = rnd.Rand8() % 2 ? mask_ : -mask_;
Jingning Han8f92a7e2013-09-05 12:44:03 -0700422 }
Jingning Han5c2696c2014-06-02 16:40:01 -0700423 if (i == 0) {
Jingning Han8f92a7e2013-09-05 12:44:03 -0700424 for (int j = 0; j < kNumCoeffs; ++j)
Deb Mukherjee10783d42014-09-02 16:34:09 -0700425 input_extreme_block[j] = mask_;
Jingning Han5c2696c2014-06-02 16:40:01 -0700426 } else if (i == 1) {
Jingning Han37705a32013-09-09 17:07:55 -0700427 for (int j = 0; j < kNumCoeffs; ++j)
Deb Mukherjee10783d42014-09-02 16:34:09 -0700428 input_extreme_block[j] = -mask_;
Jingning Han5c2696c2014-06-02 16:40:01 -0700429 }
Jingning Han8f92a7e2013-09-05 12:44:03 -0700430
Jingning Han37705a32013-09-09 17:07:55 -0700431 fwd_txfm_ref(input_extreme_block, output_ref_block, pitch_, tx_type_);
James Zern29e1b1a2014-07-09 21:02:02 -0700432 ASM_REGISTER_STATE_CHECK(RunFwdTxfm(input_extreme_block,
433 output_block, pitch_));
Jingning Han8f92a7e2013-09-05 12:44:03 -0700434
435 // The minimum quant value is 4.
436 for (int j = 0; j < kNumCoeffs; ++j) {
Jingning Han37705a32013-09-09 17:07:55 -0700437 EXPECT_EQ(output_block[j], output_ref_block[j]);
Deb Mukherjee10783d42014-09-02 16:34:09 -0700438 EXPECT_GE(4 * DCT_MAX_VALUE << (bit_depth_ - 8), abs(output_block[j]))
Jingning Han8f92a7e2013-09-05 12:44:03 -0700439 << "Error: 16x16 FDCT has coefficient larger than 4*DCT_MAX_VALUE";
Jingning Han8f92a7e2013-09-05 12:44:03 -0700440 }
Jingning Hancf768b22013-07-09 16:16:49 -0700441 }
442 }
443
Jingning Han49b4a272014-05-29 12:50:54 -0700444 void RunQuantCheck(int dc_thred, int ac_thred) {
445 ACMRandom rnd(ACMRandom::DeterministicSeed());
Jingning Han12344f22014-10-06 10:18:17 -0700446 const int count_test_block = 100000;
Jingning Han49b4a272014-05-29 12:50:54 -0700447 DECLARE_ALIGNED_ARRAY(16, int16_t, input_block, kNumCoeffs);
448 DECLARE_ALIGNED_ARRAY(16, int16_t, input_extreme_block, kNumCoeffs);
Deb Mukherjee10783d42014-09-02 16:34:09 -0700449 DECLARE_ALIGNED_ARRAY(16, tran_low_t, output_ref_block, kNumCoeffs);
Jingning Han49b4a272014-05-29 12:50:54 -0700450
451 DECLARE_ALIGNED_ARRAY(16, uint8_t, dst, kNumCoeffs);
452 DECLARE_ALIGNED_ARRAY(16, uint8_t, ref, kNumCoeffs);
Deb Mukherjee10783d42014-09-02 16:34:09 -0700453#if CONFIG_VP9_HIGHBITDEPTH
454 DECLARE_ALIGNED_ARRAY(16, uint16_t, dst16, kNumCoeffs);
455 DECLARE_ALIGNED_ARRAY(16, uint16_t, ref16, kNumCoeffs);
456#endif
Jingning Han49b4a272014-05-29 12:50:54 -0700457
458 for (int i = 0; i < count_test_block; ++i) {
Deb Mukherjee10783d42014-09-02 16:34:09 -0700459 // Initialize a test block with input range [-mask_, mask_].
Jingning Han49b4a272014-05-29 12:50:54 -0700460 for (int j = 0; j < kNumCoeffs; ++j) {
Deb Mukherjee10783d42014-09-02 16:34:09 -0700461 if (bit_depth_ == VPX_BITS_8)
462 input_block[j] = rnd.Rand8() - rnd.Rand8();
463 else
464 input_block[j] = (rnd.Rand16() & mask_) - (rnd.Rand16() & mask_);
465 input_extreme_block[j] = rnd.Rand8() % 2 ? mask_ : -mask_;
Jingning Han49b4a272014-05-29 12:50:54 -0700466 }
467 if (i == 0)
468 for (int j = 0; j < kNumCoeffs; ++j)
Deb Mukherjee10783d42014-09-02 16:34:09 -0700469 input_extreme_block[j] = mask_;
Jingning Han49b4a272014-05-29 12:50:54 -0700470 if (i == 1)
471 for (int j = 0; j < kNumCoeffs; ++j)
Deb Mukherjee10783d42014-09-02 16:34:09 -0700472 input_extreme_block[j] = -mask_;
Jingning Han49b4a272014-05-29 12:50:54 -0700473
474 fwd_txfm_ref(input_extreme_block, output_ref_block, pitch_, tx_type_);
475
476 // clear reconstructed pixel buffers
477 vpx_memset(dst, 0, kNumCoeffs * sizeof(uint8_t));
478 vpx_memset(ref, 0, kNumCoeffs * sizeof(uint8_t));
Deb Mukherjee10783d42014-09-02 16:34:09 -0700479#if CONFIG_VP9_HIGHBITDEPTH
480 vpx_memset(dst16, 0, kNumCoeffs * sizeof(uint16_t));
481 vpx_memset(ref16, 0, kNumCoeffs * sizeof(uint16_t));
482#endif
Jingning Han49b4a272014-05-29 12:50:54 -0700483
484 // quantization with maximum allowed step sizes
485 output_ref_block[0] = (output_ref_block[0] / dc_thred) * dc_thred;
486 for (int j = 1; j < kNumCoeffs; ++j)
487 output_ref_block[j] = (output_ref_block[j] / ac_thred) * ac_thred;
Deb Mukherjee10783d42014-09-02 16:34:09 -0700488 if (bit_depth_ == VPX_BITS_8) {
489 inv_txfm_ref(output_ref_block, ref, pitch_, tx_type_);
490 ASM_REGISTER_STATE_CHECK(RunInvTxfm(output_ref_block, dst, pitch_));
491#if CONFIG_VP9_HIGHBITDEPTH
492 } else {
493 inv_txfm_ref(output_ref_block, CONVERT_TO_BYTEPTR(ref16), pitch_,
494 tx_type_);
495 ASM_REGISTER_STATE_CHECK(RunInvTxfm(output_ref_block,
496 CONVERT_TO_BYTEPTR(dst16), pitch_));
497#endif
498 }
499 if (bit_depth_ == VPX_BITS_8) {
500 for (int j = 0; j < kNumCoeffs; ++j)
501 EXPECT_EQ(ref[j], dst[j]);
502#if CONFIG_VP9_HIGHBITDEPTH
503 } else {
504 for (int j = 0; j < kNumCoeffs; ++j)
505 EXPECT_EQ(ref16[j], dst16[j]);
506#endif
507 }
Jingning Han49b4a272014-05-29 12:50:54 -0700508 }
509 }
510
Jingning Han8f92a7e2013-09-05 12:44:03 -0700511 void RunInvAccuracyCheck() {
512 ACMRandom rnd(ACMRandom::DeterministicSeed());
513 const int count_test_block = 1000;
Jingning Han37705a32013-09-09 17:07:55 -0700514 DECLARE_ALIGNED_ARRAY(16, int16_t, in, kNumCoeffs);
Deb Mukherjee10783d42014-09-02 16:34:09 -0700515 DECLARE_ALIGNED_ARRAY(16, tran_low_t, coeff, kNumCoeffs);
Jingning Han37705a32013-09-09 17:07:55 -0700516 DECLARE_ALIGNED_ARRAY(16, uint8_t, dst, kNumCoeffs);
517 DECLARE_ALIGNED_ARRAY(16, uint8_t, src, kNumCoeffs);
Deb Mukherjee10783d42014-09-02 16:34:09 -0700518#if CONFIG_VP9_HIGHBITDEPTH
519 DECLARE_ALIGNED_ARRAY(16, uint16_t, dst16, kNumCoeffs);
520 DECLARE_ALIGNED_ARRAY(16, uint16_t, src16, kNumCoeffs);
521#endif
Jingning Han8f92a7e2013-09-05 12:44:03 -0700522
523 for (int i = 0; i < count_test_block; ++i) {
Jingning Han8f92a7e2013-09-05 12:44:03 -0700524 double out_r[kNumCoeffs];
525
526 // Initialize a test block with input range [-255, 255].
527 for (int j = 0; j < kNumCoeffs; ++j) {
Deb Mukherjee10783d42014-09-02 16:34:09 -0700528 if (bit_depth_ == VPX_BITS_8) {
529 src[j] = rnd.Rand8();
530 dst[j] = rnd.Rand8();
531 in[j] = src[j] - dst[j];
532#if CONFIG_VP9_HIGHBITDEPTH
533 } else {
534 src16[j] = rnd.Rand16() & mask_;
535 dst16[j] = rnd.Rand16() & mask_;
536 in[j] = src16[j] - dst16[j];
537#endif
538 }
Jingning Han8f92a7e2013-09-05 12:44:03 -0700539 }
540
541 reference_16x16_dct_2d(in, out_r);
542 for (int j = 0; j < kNumCoeffs; ++j)
543 coeff[j] = round(out_r[j]);
544
Deb Mukherjee10783d42014-09-02 16:34:09 -0700545 if (bit_depth_ == VPX_BITS_8) {
546 ASM_REGISTER_STATE_CHECK(RunInvTxfm(coeff, dst, 16));
547#if CONFIG_VP9_HIGHBITDEPTH
548 } else {
549 ASM_REGISTER_STATE_CHECK(RunInvTxfm(coeff, CONVERT_TO_BYTEPTR(dst16),
550 16));
551#endif
552 }
Jingning Han8f92a7e2013-09-05 12:44:03 -0700553
554 for (int j = 0; j < kNumCoeffs; ++j) {
Deb Mukherjee10783d42014-09-02 16:34:09 -0700555#if CONFIG_VP9_HIGHBITDEPTH
556 const uint32_t diff =
557 bit_depth_ == VPX_BITS_8 ? dst[j] - src[j] : dst16[j] - src16[j];
558#else
Jingning Han37705a32013-09-09 17:07:55 -0700559 const uint32_t diff = dst[j] - src[j];
Deb Mukherjee10783d42014-09-02 16:34:09 -0700560#endif
Jingning Han37705a32013-09-09 17:07:55 -0700561 const uint32_t error = diff * diff;
562 EXPECT_GE(1u, error)
Jingning Han8f92a7e2013-09-05 12:44:03 -0700563 << "Error: 16x16 IDCT has error " << error
564 << " at index " << j;
565 }
566 }
Jingning Hancf768b22013-07-09 16:16:49 -0700567 }
Jingning Han37705a32013-09-09 17:07:55 -0700568 int pitch_;
569 int tx_type_;
Deb Mukherjee10783d42014-09-02 16:34:09 -0700570 vpx_bit_depth_t bit_depth_;
571 int mask_;
James Zern44f84842014-07-16 18:53:33 -0700572 FhtFunc fwd_txfm_ref;
573 IhtFunc inv_txfm_ref;
Jingning Han8f92a7e2013-09-05 12:44:03 -0700574};
575
Joshua Litt51490e52013-11-18 17:07:55 -0800576class Trans16x16DCT
577 : public Trans16x16TestBase,
James Zern44f84842014-07-16 18:53:33 -0700578 public ::testing::TestWithParam<Dct16x16Param> {
Jingning Han8f92a7e2013-09-05 12:44:03 -0700579 public:
580 virtual ~Trans16x16DCT() {}
581
582 virtual void SetUp() {
583 fwd_txfm_ = GET_PARAM(0);
584 inv_txfm_ = GET_PARAM(1);
585 tx_type_ = GET_PARAM(2);
Deb Mukherjee10783d42014-09-02 16:34:09 -0700586 bit_depth_ = GET_PARAM(3);
Dmitry Kovalev1aa7fd52013-10-18 11:49:33 -0700587 pitch_ = 16;
Jingning Han37705a32013-09-09 17:07:55 -0700588 fwd_txfm_ref = fdct16x16_ref;
Jingning Han49b4a272014-05-29 12:50:54 -0700589 inv_txfm_ref = idct16x16_ref;
Deb Mukherjee10783d42014-09-02 16:34:09 -0700590 mask_ = (1 << bit_depth_) - 1;
591#if CONFIG_VP9_HIGHBITDEPTH
592 switch (bit_depth_) {
593 case 10:
594 inv_txfm_ref = idct16x16_10_ref;
595 break;
596 case 12:
597 inv_txfm_ref = idct16x16_12_ref;
598 break;
599 default:
600 inv_txfm_ref = idct16x16_ref;
601 break;
602 }
603#else
604 inv_txfm_ref = idct16x16_ref;
605#endif
Jingning Han8f92a7e2013-09-05 12:44:03 -0700606 }
607 virtual void TearDown() { libvpx_test::ClearSystemState(); }
608
609 protected:
Deb Mukherjee10783d42014-09-02 16:34:09 -0700610 void RunFwdTxfm(int16_t *in, tran_low_t *out, int stride) {
Jingning Han8f92a7e2013-09-05 12:44:03 -0700611 fwd_txfm_(in, out, stride);
612 }
Deb Mukherjee10783d42014-09-02 16:34:09 -0700613 void RunInvTxfm(tran_low_t *out, uint8_t *dst, int stride) {
Dmitry Kovalev1aa7fd52013-10-18 11:49:33 -0700614 inv_txfm_(out, dst, stride);
Jingning Hancf768b22013-07-09 16:16:49 -0700615 }
616
James Zern44f84842014-07-16 18:53:33 -0700617 FdctFunc fwd_txfm_;
618 IdctFunc inv_txfm_;
Jingning Hancf768b22013-07-09 16:16:49 -0700619};
620
Jingning Han8f92a7e2013-09-05 12:44:03 -0700621TEST_P(Trans16x16DCT, AccuracyCheck) {
622 RunAccuracyCheck();
Jingning Hancf768b22013-07-09 16:16:49 -0700623}
624
Jingning Han37705a32013-09-09 17:07:55 -0700625TEST_P(Trans16x16DCT, CoeffCheck) {
626 RunCoeffCheck();
627}
628
629TEST_P(Trans16x16DCT, MemCheck) {
630 RunMemCheck();
Jingning Hancf768b22013-07-09 16:16:49 -0700631}
632
Jingning Han49b4a272014-05-29 12:50:54 -0700633TEST_P(Trans16x16DCT, QuantCheck) {
634 // Use maximally allowed quantization step sizes for DC and AC
635 // coefficients respectively.
636 RunQuantCheck(1336, 1828);
637}
638
Jingning Han8f92a7e2013-09-05 12:44:03 -0700639TEST_P(Trans16x16DCT, InvAccuracyCheck) {
640 RunInvAccuracyCheck();
Daniel Kangfed8a182012-08-02 17:03:14 -0700641}
Scott LaVarnwaya272ff22013-05-15 13:16:02 -0400642
Joshua Litt51490e52013-11-18 17:07:55 -0800643class Trans16x16HT
644 : public Trans16x16TestBase,
James Zern44f84842014-07-16 18:53:33 -0700645 public ::testing::TestWithParam<Ht16x16Param> {
Jingning Han8f92a7e2013-09-05 12:44:03 -0700646 public:
647 virtual ~Trans16x16HT() {}
648
649 virtual void SetUp() {
650 fwd_txfm_ = GET_PARAM(0);
651 inv_txfm_ = GET_PARAM(1);
652 tx_type_ = GET_PARAM(2);
Deb Mukherjee10783d42014-09-02 16:34:09 -0700653 bit_depth_ = GET_PARAM(3);
Jingning Han37705a32013-09-09 17:07:55 -0700654 pitch_ = 16;
655 fwd_txfm_ref = fht16x16_ref;
Jingning Han49b4a272014-05-29 12:50:54 -0700656 inv_txfm_ref = iht16x16_ref;
Deb Mukherjee10783d42014-09-02 16:34:09 -0700657 mask_ = (1 << bit_depth_) - 1;
658#if CONFIG_VP9_HIGHBITDEPTH
659 switch (bit_depth_) {
660 case VPX_BITS_10:
661 inv_txfm_ref = iht16x16_10;
662 break;
663 case VPX_BITS_12:
664 inv_txfm_ref = iht16x16_12;
665 break;
666 default:
667 inv_txfm_ref = iht16x16_ref;
668 break;
669 }
670#else
671 inv_txfm_ref = iht16x16_ref;
672#endif
Jingning Han8f92a7e2013-09-05 12:44:03 -0700673 }
674 virtual void TearDown() { libvpx_test::ClearSystemState(); }
675
676 protected:
Deb Mukherjee10783d42014-09-02 16:34:09 -0700677 void RunFwdTxfm(int16_t *in, tran_low_t *out, int stride) {
Jingning Han37705a32013-09-09 17:07:55 -0700678 fwd_txfm_(in, out, stride, tx_type_);
Jingning Han8f92a7e2013-09-05 12:44:03 -0700679 }
Deb Mukherjee10783d42014-09-02 16:34:09 -0700680 void RunInvTxfm(tran_low_t *out, uint8_t *dst, int stride) {
Jingning Han37705a32013-09-09 17:07:55 -0700681 inv_txfm_(out, dst, stride, tx_type_);
Jingning Han8f92a7e2013-09-05 12:44:03 -0700682 }
683
James Zern44f84842014-07-16 18:53:33 -0700684 FhtFunc fwd_txfm_;
685 IhtFunc inv_txfm_;
Jingning Han8f92a7e2013-09-05 12:44:03 -0700686};
687
688TEST_P(Trans16x16HT, AccuracyCheck) {
689 RunAccuracyCheck();
690}
691
Jingning Han37705a32013-09-09 17:07:55 -0700692TEST_P(Trans16x16HT, CoeffCheck) {
693 RunCoeffCheck();
694}
695
696TEST_P(Trans16x16HT, MemCheck) {
697 RunMemCheck();
Jingning Han8f92a7e2013-09-05 12:44:03 -0700698}
699
Jingning Han49b4a272014-05-29 12:50:54 -0700700TEST_P(Trans16x16HT, QuantCheck) {
701 // The encoder skips any non-DC intra prediction modes,
702 // when the quantization step size goes beyond 988.
Jingning Han12344f22014-10-06 10:18:17 -0700703 RunQuantCheck(429, 729);
Jingning Han49b4a272014-05-29 12:50:54 -0700704}
705
Jingning Han8f92a7e2013-09-05 12:44:03 -0700706using std::tr1::make_tuple;
707
Deb Mukherjee10783d42014-09-02 16:34:09 -0700708#if CONFIG_VP9_HIGHBITDEPTH
Jingning Han8f92a7e2013-09-05 12:44:03 -0700709INSTANTIATE_TEST_CASE_P(
710 C, Trans16x16DCT,
711 ::testing::Values(
Deb Mukherjee10783d42014-09-02 16:34:09 -0700712 make_tuple(&vp9_high_fdct16x16_c, &idct16x16_10, 0, VPX_BITS_10),
713 make_tuple(&vp9_high_fdct16x16_c, &idct16x16_12, 0, VPX_BITS_12),
714 make_tuple(&vp9_fdct16x16_c, &vp9_idct16x16_256_add_c, 0, VPX_BITS_8)));
715#else
716INSTANTIATE_TEST_CASE_P(
717 C, Trans16x16DCT,
718 ::testing::Values(
719 make_tuple(&vp9_fdct16x16_c, &vp9_idct16x16_256_add_c, 0, VPX_BITS_8)));
720#endif
721
722#if CONFIG_VP9_HIGHBITDEPTH
Jingning Han8f92a7e2013-09-05 12:44:03 -0700723INSTANTIATE_TEST_CASE_P(
724 C, Trans16x16HT,
725 ::testing::Values(
Deb Mukherjee10783d42014-09-02 16:34:09 -0700726 make_tuple(&vp9_high_fht16x16_c, &iht16x16_10, 0, VPX_BITS_10),
727 make_tuple(&vp9_high_fht16x16_c, &iht16x16_10, 1, VPX_BITS_10),
728 make_tuple(&vp9_high_fht16x16_c, &iht16x16_10, 2, VPX_BITS_10),
729 make_tuple(&vp9_high_fht16x16_c, &iht16x16_10, 3, VPX_BITS_10),
730 make_tuple(&vp9_high_fht16x16_c, &iht16x16_12, 0, VPX_BITS_12),
731 make_tuple(&vp9_high_fht16x16_c, &iht16x16_12, 1, VPX_BITS_12),
732 make_tuple(&vp9_high_fht16x16_c, &iht16x16_12, 2, VPX_BITS_12),
733 make_tuple(&vp9_high_fht16x16_c, &iht16x16_12, 3, VPX_BITS_12),
734 make_tuple(&vp9_fht16x16_c, &vp9_iht16x16_256_add_c, 0, VPX_BITS_8),
735 make_tuple(&vp9_fht16x16_c, &vp9_iht16x16_256_add_c, 1, VPX_BITS_8),
736 make_tuple(&vp9_fht16x16_c, &vp9_iht16x16_256_add_c, 2, VPX_BITS_8),
737 make_tuple(&vp9_fht16x16_c, &vp9_iht16x16_256_add_c, 3, VPX_BITS_8)));
738#else
739INSTANTIATE_TEST_CASE_P(
740 C, Trans16x16HT,
741 ::testing::Values(
742 make_tuple(&vp9_fht16x16_c, &vp9_iht16x16_256_add_c, 0, VPX_BITS_8),
743 make_tuple(&vp9_fht16x16_c, &vp9_iht16x16_256_add_c, 1, VPX_BITS_8),
744 make_tuple(&vp9_fht16x16_c, &vp9_iht16x16_256_add_c, 2, VPX_BITS_8),
745 make_tuple(&vp9_fht16x16_c, &vp9_iht16x16_256_add_c, 3, VPX_BITS_8)));
746#endif
Jingning Han8f92a7e2013-09-05 12:44:03 -0700747
Deb Mukherjeed50716f2014-10-02 15:43:27 -0700748#if HAVE_NEON_ASM && !CONFIG_VP9_HIGHBITDEPTH && !CONFIG_EMULATE_HARDWARE
James Zernadbb8812014-02-25 23:11:49 -0800749INSTANTIATE_TEST_CASE_P(
750 NEON, Trans16x16DCT,
751 ::testing::Values(
752 make_tuple(&vp9_fdct16x16_c,
Deb Mukherjee10783d42014-09-02 16:34:09 -0700753 &vp9_idct16x16_256_add_neon, 0, VPX_BITS_8)));
James Zernadbb8812014-02-25 23:11:49 -0800754#endif
755
Deb Mukherjeed50716f2014-10-02 15:43:27 -0700756#if HAVE_SSE2 && !CONFIG_VP9_HIGHBITDEPTH && !CONFIG_EMULATE_HARDWARE
Jingning Han8f92a7e2013-09-05 12:44:03 -0700757INSTANTIATE_TEST_CASE_P(
758 SSE2, Trans16x16DCT,
759 ::testing::Values(
Dmitry Kovalev02feb632013-10-23 10:57:12 -0700760 make_tuple(&vp9_fdct16x16_sse2,
Deb Mukherjee10783d42014-09-02 16:34:09 -0700761 &vp9_idct16x16_256_add_sse2, 0, VPX_BITS_8)));
Jingning Han8f92a7e2013-09-05 12:44:03 -0700762INSTANTIATE_TEST_CASE_P(
763 SSE2, Trans16x16HT,
764 ::testing::Values(
Deb Mukherjee10783d42014-09-02 16:34:09 -0700765 make_tuple(&vp9_fht16x16_sse2, &vp9_iht16x16_256_add_sse2, 0,
766 VPX_BITS_8),
767 make_tuple(&vp9_fht16x16_sse2, &vp9_iht16x16_256_add_sse2, 1,
768 VPX_BITS_8),
769 make_tuple(&vp9_fht16x16_sse2, &vp9_iht16x16_256_add_sse2, 2,
770 VPX_BITS_8),
771 make_tuple(&vp9_fht16x16_sse2, &vp9_iht16x16_256_add_sse2, 3,
772 VPX_BITS_8)));
Jingning Han8f92a7e2013-09-05 12:44:03 -0700773#endif
Jingning Hane4a758b2014-05-22 11:31:43 -0700774
Deb Mukherjeed50716f2014-10-02 15:43:27 -0700775#if HAVE_SSSE3 && !CONFIG_VP9_HIGHBITDEPTH && !CONFIG_EMULATE_HARDWARE
Jingning Hane4a758b2014-05-22 11:31:43 -0700776INSTANTIATE_TEST_CASE_P(
777 SSSE3, Trans16x16DCT,
778 ::testing::Values(
Deb Mukherjee10783d42014-09-02 16:34:09 -0700779 make_tuple(&vp9_fdct16x16_c, &vp9_idct16x16_256_add_ssse3, 0,
780 VPX_BITS_8)));
Jingning Hane4a758b2014-05-22 11:31:43 -0700781#endif
Daniel Kangfed8a182012-08-02 17:03:14 -0700782} // namespace