1 /*
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"
16 #include "test/acm_random.h"
17 #include "test/clear_system_state.h"
18 #include "test/register_state_check.h"
19 #include "test/util.h"
20 
21 #include "./vp9_rtcd.h"
22 #include "vp9/common/vp9_entropy.h"
23 #include "vpx/vpx_integer.h"
24 
25 extern "C" {
26 void vp9_idct16x16_256_add_c(const int16_t *input, uint8_t *output, int pitch);
27 }
28 
29 using libvpx_test::ACMRandom;
30 
31 namespace {
32 
33 #ifdef _MSC_VER
round(double x)34 static int round(double x) {
35   if (x < 0)
36     return static_cast<int>(ceil(x - 0.5));
37   else
38     return static_cast<int>(floor(x + 0.5));
39 }
40 #endif
41 
42 const int kNumCoeffs = 256;
43 const double PI = 3.1415926535898;
reference2_16x16_idct_2d(double * input,double * output)44 void reference2_16x16_idct_2d(double *input, double *output) {
45   double x;
46   for (int l = 0; l < 16; ++l) {
47     for (int k = 0; k < 16; ++k) {
48       double s = 0;
49       for (int i = 0; i < 16; ++i) {
50         for (int j = 0; j < 16; ++j) {
51           x = cos(PI * j * (l + 0.5) / 16.0) *
52               cos(PI * i * (k + 0.5) / 16.0) *
53               input[i * 16 + j] / 256;
54           if (i != 0)
55             x *= sqrt(2.0);
56           if (j != 0)
57             x *= sqrt(2.0);
58           s += x;
59         }
60       }
61       output[k*16+l] = s;
62     }
63   }
64 }
65 
66 
67 const double C1 = 0.995184726672197;
68 const double C2 = 0.98078528040323;
69 const double C3 = 0.956940335732209;
70 const double C4 = 0.923879532511287;
71 const double C5 = 0.881921264348355;
72 const double C6 = 0.831469612302545;
73 const double C7 = 0.773010453362737;
74 const double C8 = 0.707106781186548;
75 const double C9 = 0.634393284163646;
76 const double C10 = 0.555570233019602;
77 const double C11 = 0.471396736825998;
78 const double C12 = 0.38268343236509;
79 const double C13 = 0.290284677254462;
80 const double C14 = 0.195090322016128;
81 const double C15 = 0.098017140329561;
82 
butterfly_16x16_dct_1d(double input[16],double output[16])83 void butterfly_16x16_dct_1d(double input[16], double output[16]) {
84   double step[16];
85   double intermediate[16];
86   double temp1, temp2;
87 
88   // step 1
89   step[ 0] = input[0] + input[15];
90   step[ 1] = input[1] + input[14];
91   step[ 2] = input[2] + input[13];
92   step[ 3] = input[3] + input[12];
93   step[ 4] = input[4] + input[11];
94   step[ 5] = input[5] + input[10];
95   step[ 6] = input[6] + input[ 9];
96   step[ 7] = input[7] + input[ 8];
97   step[ 8] = input[7] - input[ 8];
98   step[ 9] = input[6] - input[ 9];
99   step[10] = input[5] - input[10];
100   step[11] = input[4] - input[11];
101   step[12] = input[3] - input[12];
102   step[13] = input[2] - input[13];
103   step[14] = input[1] - input[14];
104   step[15] = input[0] - input[15];
105 
106   // step 2
107   output[0] = step[0] + step[7];
108   output[1] = step[1] + step[6];
109   output[2] = step[2] + step[5];
110   output[3] = step[3] + step[4];
111   output[4] = step[3] - step[4];
112   output[5] = step[2] - step[5];
113   output[6] = step[1] - step[6];
114   output[7] = step[0] - step[7];
115 
116   temp1 = step[ 8] * C7;
117   temp2 = step[15] * C9;
118   output[ 8] = temp1 + temp2;
119 
120   temp1 = step[ 9] * C11;
121   temp2 = step[14] * C5;
122   output[ 9] = temp1 - temp2;
123 
124   temp1 = step[10] * C3;
125   temp2 = step[13] * C13;
126   output[10] = temp1 + temp2;
127 
128   temp1 = step[11] * C15;
129   temp2 = step[12] * C1;
130   output[11] = temp1 - temp2;
131 
132   temp1 = step[11] * C1;
133   temp2 = step[12] * C15;
134   output[12] = temp2 + temp1;
135 
136   temp1 = step[10] * C13;
137   temp2 = step[13] * C3;
138   output[13] = temp2 - temp1;
139 
140   temp1 = step[ 9] * C5;
141   temp2 = step[14] * C11;
142   output[14] = temp2 + temp1;
143 
144   temp1 = step[ 8] * C9;
145   temp2 = step[15] * C7;
146   output[15] = temp2 - temp1;
147 
148   // step 3
149   step[ 0] = output[0] + output[3];
150   step[ 1] = output[1] + output[2];
151   step[ 2] = output[1] - output[2];
152   step[ 3] = output[0] - output[3];
153 
154   temp1 = output[4] * C14;
155   temp2 = output[7] * C2;
156   step[ 4] = temp1 + temp2;
157 
158   temp1 = output[5] * C10;
159   temp2 = output[6] * C6;
160   step[ 5] = temp1 + temp2;
161 
162   temp1 = output[5] * C6;
163   temp2 = output[6] * C10;
164   step[ 6] = temp2 - temp1;
165 
166   temp1 = output[4] * C2;
167   temp2 = output[7] * C14;
168   step[ 7] = temp2 - temp1;
169 
170   step[ 8] = output[ 8] + output[11];
171   step[ 9] = output[ 9] + output[10];
172   step[10] = output[ 9] - output[10];
173   step[11] = output[ 8] - output[11];
174 
175   step[12] = output[12] + output[15];
176   step[13] = output[13] + output[14];
177   step[14] = output[13] - output[14];
178   step[15] = output[12] - output[15];
179 
180   // step 4
181   output[ 0] = (step[ 0] + step[ 1]);
182   output[ 8] = (step[ 0] - step[ 1]);
183 
184   temp1 = step[2] * C12;
185   temp2 = step[3] * C4;
186   temp1 = temp1 + temp2;
187   output[ 4] = 2*(temp1 * C8);
188 
189   temp1 = step[2] * C4;
190   temp2 = step[3] * C12;
191   temp1 = temp2 - temp1;
192   output[12] = 2 * (temp1 * C8);
193 
194   output[ 2] = 2 * ((step[4] + step[ 5]) * C8);
195   output[14] = 2 * ((step[7] - step[ 6]) * C8);
196 
197   temp1 = step[4] - step[5];
198   temp2 = step[6] + step[7];
199   output[ 6] = (temp1 + temp2);
200   output[10] = (temp1 - temp2);
201 
202   intermediate[8] = step[8] + step[14];
203   intermediate[9] = step[9] + step[15];
204 
205   temp1 = intermediate[8] * C12;
206   temp2 = intermediate[9] * C4;
207   temp1 = temp1 - temp2;
208   output[3] = 2 * (temp1 * C8);
209 
210   temp1 = intermediate[8] * C4;
211   temp2 = intermediate[9] * C12;
212   temp1 = temp2 + temp1;
213   output[13] = 2 * (temp1 * C8);
214 
215   output[ 9] = 2 * ((step[10] + step[11]) * C8);
216 
217   intermediate[11] = step[10] - step[11];
218   intermediate[12] = step[12] + step[13];
219   intermediate[13] = step[12] - step[13];
220   intermediate[14] = step[ 8] - step[14];
221   intermediate[15] = step[ 9] - step[15];
222 
223   output[15] = (intermediate[11] + intermediate[12]);
224   output[ 1] = -(intermediate[11] - intermediate[12]);
225 
226   output[ 7] = 2 * (intermediate[13] * C8);
227 
228   temp1 = intermediate[14] * C12;
229   temp2 = intermediate[15] * C4;
230   temp1 = temp1 - temp2;
231   output[11] = -2 * (temp1 * C8);
232 
233   temp1 = intermediate[14] * C4;
234   temp2 = intermediate[15] * C12;
235   temp1 = temp2 + temp1;
236   output[ 5] = 2 * (temp1 * C8);
237 }
238 
reference_16x16_dct_2d(int16_t input[256],double output[256])239 void reference_16x16_dct_2d(int16_t input[256], double output[256]) {
240   // First transform columns
241   for (int i = 0; i < 16; ++i) {
242     double temp_in[16], temp_out[16];
243     for (int j = 0; j < 16; ++j)
244       temp_in[j] = input[j * 16 + i];
245     butterfly_16x16_dct_1d(temp_in, temp_out);
246     for (int j = 0; j < 16; ++j)
247       output[j * 16 + i] = temp_out[j];
248   }
249   // Then transform rows
250   for (int i = 0; i < 16; ++i) {
251     double temp_in[16], temp_out[16];
252     for (int j = 0; j < 16; ++j)
253       temp_in[j] = output[j + i * 16];
254     butterfly_16x16_dct_1d(temp_in, temp_out);
255     // Scale by some magic number
256     for (int j = 0; j < 16; ++j)
257       output[j + i * 16] = temp_out[j]/2;
258   }
259 }
260 
261 typedef void (*FdctFunc)(const int16_t *in, int16_t *out, int stride);
262 typedef void (*IdctFunc)(const int16_t *in, uint8_t *out, int stride);
263 typedef void (*FhtFunc)(const int16_t *in, int16_t *out, int stride,
264                         int tx_type);
265 typedef void (*IhtFunc)(const int16_t *in, uint8_t *out, int stride,
266                         int tx_type);
267 
268 typedef std::tr1::tuple<FdctFunc, IdctFunc, int> Dct16x16Param;
269 typedef std::tr1::tuple<FhtFunc, IhtFunc, int> Ht16x16Param;
270 
fdct16x16_ref(const int16_t * in,int16_t * out,int stride,int tx_type)271 void fdct16x16_ref(const int16_t *in, int16_t *out, int stride, int tx_type) {
272   vp9_fdct16x16_c(in, out, stride);
273 }
274 
idct16x16_ref(const int16_t * in,uint8_t * dest,int stride,int tx_type)275 void idct16x16_ref(const int16_t *in, uint8_t *dest, int stride, int tx_type) {
276   vp9_idct16x16_256_add_c(in, dest, stride);
277 }
278 
fht16x16_ref(const int16_t * in,int16_t * out,int stride,int tx_type)279 void fht16x16_ref(const int16_t *in, int16_t *out, int stride, int tx_type) {
280   vp9_fht16x16_c(in, out, stride, tx_type);
281 }
282 
iht16x16_ref(const int16_t * in,uint8_t * dest,int stride,int tx_type)283 void iht16x16_ref(const int16_t *in, uint8_t *dest, int stride, int tx_type) {
284   vp9_iht16x16_256_add_c(in, dest, stride, tx_type);
285 }
286 
287 class Trans16x16TestBase {
288  public:
~Trans16x16TestBase()289   virtual ~Trans16x16TestBase() {}
290 
291  protected:
292   virtual void RunFwdTxfm(int16_t *in, int16_t *out, int stride) = 0;
293 
294   virtual void RunInvTxfm(int16_t *out, uint8_t *dst, int stride) = 0;
295 
RunAccuracyCheck()296   void RunAccuracyCheck() {
297     ACMRandom rnd(ACMRandom::DeterministicSeed());
298     uint32_t max_error = 0;
299     int64_t total_error = 0;
300     const int count_test_block = 10000;
301     for (int i = 0; i < count_test_block; ++i) {
302       DECLARE_ALIGNED_ARRAY(16, int16_t, test_input_block, kNumCoeffs);
303       DECLARE_ALIGNED_ARRAY(16, int16_t, test_temp_block, kNumCoeffs);
304       DECLARE_ALIGNED_ARRAY(16, uint8_t, dst, kNumCoeffs);
305       DECLARE_ALIGNED_ARRAY(16, uint8_t, src, kNumCoeffs);
306 
307       // Initialize a test block with input range [-255, 255].
308       for (int j = 0; j < kNumCoeffs; ++j) {
309         src[j] = rnd.Rand8();
310         dst[j] = rnd.Rand8();
311         test_input_block[j] = src[j] - dst[j];
312       }
313 
314       ASM_REGISTER_STATE_CHECK(RunFwdTxfm(test_input_block,
315                                           test_temp_block, pitch_));
316       ASM_REGISTER_STATE_CHECK(RunInvTxfm(test_temp_block, dst, pitch_));
317 
318       for (int j = 0; j < kNumCoeffs; ++j) {
319         const uint32_t diff = dst[j] - src[j];
320         const uint32_t error = diff * diff;
321         if (max_error < error)
322           max_error = error;
323         total_error += error;
324       }
325     }
326 
327     EXPECT_GE(1u, max_error)
328         << "Error: 16x16 FHT/IHT has an individual round trip error > 1";
329 
330     EXPECT_GE(count_test_block , total_error)
331         << "Error: 16x16 FHT/IHT has average round trip error > 1 per block";
332   }
333 
RunCoeffCheck()334   void RunCoeffCheck() {
335     ACMRandom rnd(ACMRandom::DeterministicSeed());
336     const int count_test_block = 1000;
337     DECLARE_ALIGNED_ARRAY(16, int16_t, input_block, kNumCoeffs);
338     DECLARE_ALIGNED_ARRAY(16, int16_t, output_ref_block, kNumCoeffs);
339     DECLARE_ALIGNED_ARRAY(16, int16_t, output_block, kNumCoeffs);
340 
341     for (int i = 0; i < count_test_block; ++i) {
342       // Initialize a test block with input range [-255, 255].
343       for (int j = 0; j < kNumCoeffs; ++j)
344         input_block[j] = rnd.Rand8() - rnd.Rand8();
345 
346       fwd_txfm_ref(input_block, output_ref_block, pitch_, tx_type_);
347       ASM_REGISTER_STATE_CHECK(RunFwdTxfm(input_block, output_block, pitch_));
348 
349       // The minimum quant value is 4.
350       for (int j = 0; j < kNumCoeffs; ++j)
351         EXPECT_EQ(output_block[j], output_ref_block[j]);
352     }
353   }
354 
RunMemCheck()355   void RunMemCheck() {
356     ACMRandom rnd(ACMRandom::DeterministicSeed());
357     const int count_test_block = 1000;
358     DECLARE_ALIGNED_ARRAY(16, int16_t, input_block, kNumCoeffs);
359     DECLARE_ALIGNED_ARRAY(16, int16_t, input_extreme_block, kNumCoeffs);
360     DECLARE_ALIGNED_ARRAY(16, int16_t, output_ref_block, kNumCoeffs);
361     DECLARE_ALIGNED_ARRAY(16, int16_t, output_block, kNumCoeffs);
362 
363     for (int i = 0; i < count_test_block; ++i) {
364       // Initialize a test block with input range [-255, 255].
365       for (int j = 0; j < kNumCoeffs; ++j) {
366         input_block[j] = rnd.Rand8() - rnd.Rand8();
367         input_extreme_block[j] = rnd.Rand8() % 2 ? 255 : -255;
368       }
369       if (i == 0) {
370         for (int j = 0; j < kNumCoeffs; ++j)
371           input_extreme_block[j] = 255;
372       } else if (i == 1) {
373         for (int j = 0; j < kNumCoeffs; ++j)
374           input_extreme_block[j] = -255;
375       }
376 
377       fwd_txfm_ref(input_extreme_block, output_ref_block, pitch_, tx_type_);
378       ASM_REGISTER_STATE_CHECK(RunFwdTxfm(input_extreme_block,
379                                           output_block, pitch_));
380 
381       // The minimum quant value is 4.
382       for (int j = 0; j < kNumCoeffs; ++j) {
383         EXPECT_EQ(output_block[j], output_ref_block[j]);
384         EXPECT_GE(4 * DCT_MAX_VALUE, abs(output_block[j]))
385             << "Error: 16x16 FDCT has coefficient larger than 4*DCT_MAX_VALUE";
386       }
387     }
388   }
389 
RunQuantCheck(int dc_thred,int ac_thred)390   void RunQuantCheck(int dc_thred, int ac_thred) {
391     ACMRandom rnd(ACMRandom::DeterministicSeed());
392     const int count_test_block = 1000;
393     DECLARE_ALIGNED_ARRAY(16, int16_t, input_block, kNumCoeffs);
394     DECLARE_ALIGNED_ARRAY(16, int16_t, input_extreme_block, kNumCoeffs);
395     DECLARE_ALIGNED_ARRAY(16, int16_t, output_ref_block, kNumCoeffs);
396 
397     DECLARE_ALIGNED_ARRAY(16, uint8_t, dst, kNumCoeffs);
398     DECLARE_ALIGNED_ARRAY(16, uint8_t, ref, kNumCoeffs);
399 
400     for (int i = 0; i < count_test_block; ++i) {
401       // Initialize a test block with input range [-255, 255].
402       for (int j = 0; j < kNumCoeffs; ++j) {
403         input_block[j] = rnd.Rand8() - rnd.Rand8();
404         input_extreme_block[j] = rnd.Rand8() % 2 ? 255 : -255;
405       }
406       if (i == 0)
407         for (int j = 0; j < kNumCoeffs; ++j)
408           input_extreme_block[j] = 255;
409       if (i == 1)
410         for (int j = 0; j < kNumCoeffs; ++j)
411           input_extreme_block[j] = -255;
412 
413       fwd_txfm_ref(input_extreme_block, output_ref_block, pitch_, tx_type_);
414 
415       // clear reconstructed pixel buffers
416       vpx_memset(dst, 0, kNumCoeffs * sizeof(uint8_t));
417       vpx_memset(ref, 0, kNumCoeffs * sizeof(uint8_t));
418 
419       // quantization with maximum allowed step sizes
420       output_ref_block[0] = (output_ref_block[0] / dc_thred) * dc_thred;
421       for (int j = 1; j < kNumCoeffs; ++j)
422         output_ref_block[j] = (output_ref_block[j] / ac_thred) * ac_thred;
423       inv_txfm_ref(output_ref_block, ref, pitch_, tx_type_);
424       ASM_REGISTER_STATE_CHECK(RunInvTxfm(output_ref_block, dst, pitch_));
425 
426       for (int j = 0; j < kNumCoeffs; ++j)
427         EXPECT_EQ(ref[j], dst[j]);
428     }
429   }
430 
RunInvAccuracyCheck()431   void RunInvAccuracyCheck() {
432     ACMRandom rnd(ACMRandom::DeterministicSeed());
433     const int count_test_block = 1000;
434     DECLARE_ALIGNED_ARRAY(16, int16_t, in, kNumCoeffs);
435     DECLARE_ALIGNED_ARRAY(16, int16_t, coeff, kNumCoeffs);
436     DECLARE_ALIGNED_ARRAY(16, uint8_t, dst, kNumCoeffs);
437     DECLARE_ALIGNED_ARRAY(16, uint8_t, src, kNumCoeffs);
438 
439     for (int i = 0; i < count_test_block; ++i) {
440       double out_r[kNumCoeffs];
441 
442       // Initialize a test block with input range [-255, 255].
443       for (int j = 0; j < kNumCoeffs; ++j) {
444         src[j] = rnd.Rand8();
445         dst[j] = rnd.Rand8();
446         in[j] = src[j] - dst[j];
447       }
448 
449       reference_16x16_dct_2d(in, out_r);
450       for (int j = 0; j < kNumCoeffs; ++j)
451         coeff[j] = round(out_r[j]);
452 
453       ASM_REGISTER_STATE_CHECK(RunInvTxfm(coeff, dst, 16));
454 
455       for (int j = 0; j < kNumCoeffs; ++j) {
456         const uint32_t diff = dst[j] - src[j];
457         const uint32_t error = diff * diff;
458         EXPECT_GE(1u, error)
459             << "Error: 16x16 IDCT has error " << error
460             << " at index " << j;
461       }
462     }
463   }
464   int pitch_;
465   int tx_type_;
466   FhtFunc fwd_txfm_ref;
467   IhtFunc inv_txfm_ref;
468 };
469 
470 class Trans16x16DCT
471     : public Trans16x16TestBase,
472       public ::testing::TestWithParam<Dct16x16Param> {
473  public:
~Trans16x16DCT()474   virtual ~Trans16x16DCT() {}
475 
SetUp()476   virtual void SetUp() {
477     fwd_txfm_ = GET_PARAM(0);
478     inv_txfm_ = GET_PARAM(1);
479     tx_type_  = GET_PARAM(2);
480     pitch_    = 16;
481     fwd_txfm_ref = fdct16x16_ref;
482     inv_txfm_ref = idct16x16_ref;
483   }
TearDown()484   virtual void TearDown() { libvpx_test::ClearSystemState(); }
485 
486  protected:
RunFwdTxfm(int16_t * in,int16_t * out,int stride)487   void RunFwdTxfm(int16_t *in, int16_t *out, int stride) {
488     fwd_txfm_(in, out, stride);
489   }
RunInvTxfm(int16_t * out,uint8_t * dst,int stride)490   void RunInvTxfm(int16_t *out, uint8_t *dst, int stride) {
491     inv_txfm_(out, dst, stride);
492   }
493 
494   FdctFunc fwd_txfm_;
495   IdctFunc inv_txfm_;
496 };
497 
TEST_P(Trans16x16DCT,AccuracyCheck)498 TEST_P(Trans16x16DCT, AccuracyCheck) {
499   RunAccuracyCheck();
500 }
501 
TEST_P(Trans16x16DCT,CoeffCheck)502 TEST_P(Trans16x16DCT, CoeffCheck) {
503   RunCoeffCheck();
504 }
505 
TEST_P(Trans16x16DCT,MemCheck)506 TEST_P(Trans16x16DCT, MemCheck) {
507   RunMemCheck();
508 }
509 
TEST_P(Trans16x16DCT,QuantCheck)510 TEST_P(Trans16x16DCT, QuantCheck) {
511   // Use maximally allowed quantization step sizes for DC and AC
512   // coefficients respectively.
513   RunQuantCheck(1336, 1828);
514 }
515 
TEST_P(Trans16x16DCT,InvAccuracyCheck)516 TEST_P(Trans16x16DCT, InvAccuracyCheck) {
517   RunInvAccuracyCheck();
518 }
519 
520 class Trans16x16HT
521     : public Trans16x16TestBase,
522       public ::testing::TestWithParam<Ht16x16Param> {
523  public:
~Trans16x16HT()524   virtual ~Trans16x16HT() {}
525 
SetUp()526   virtual void SetUp() {
527     fwd_txfm_ = GET_PARAM(0);
528     inv_txfm_ = GET_PARAM(1);
529     tx_type_  = GET_PARAM(2);
530     pitch_    = 16;
531     fwd_txfm_ref = fht16x16_ref;
532     inv_txfm_ref = iht16x16_ref;
533   }
TearDown()534   virtual void TearDown() { libvpx_test::ClearSystemState(); }
535 
536  protected:
RunFwdTxfm(int16_t * in,int16_t * out,int stride)537   void RunFwdTxfm(int16_t *in, int16_t *out, int stride) {
538     fwd_txfm_(in, out, stride, tx_type_);
539   }
RunInvTxfm(int16_t * out,uint8_t * dst,int stride)540   void RunInvTxfm(int16_t *out, uint8_t *dst, int stride) {
541     inv_txfm_(out, dst, stride, tx_type_);
542   }
543 
544   FhtFunc fwd_txfm_;
545   IhtFunc inv_txfm_;
546 };
547 
TEST_P(Trans16x16HT,AccuracyCheck)548 TEST_P(Trans16x16HT, AccuracyCheck) {
549   RunAccuracyCheck();
550 }
551 
TEST_P(Trans16x16HT,CoeffCheck)552 TEST_P(Trans16x16HT, CoeffCheck) {
553   RunCoeffCheck();
554 }
555 
TEST_P(Trans16x16HT,MemCheck)556 TEST_P(Trans16x16HT, MemCheck) {
557   RunMemCheck();
558 }
559 
TEST_P(Trans16x16HT,QuantCheck)560 TEST_P(Trans16x16HT, QuantCheck) {
561   // The encoder skips any non-DC intra prediction modes,
562   // when the quantization step size goes beyond 988.
563   RunQuantCheck(549, 988);
564 }
565 
566 using std::tr1::make_tuple;
567 
568 INSTANTIATE_TEST_CASE_P(
569     C, Trans16x16DCT,
570     ::testing::Values(
571         make_tuple(&vp9_fdct16x16_c, &vp9_idct16x16_256_add_c, 0)));
572 INSTANTIATE_TEST_CASE_P(
573     C, Trans16x16HT,
574     ::testing::Values(
575         make_tuple(&vp9_fht16x16_c, &vp9_iht16x16_256_add_c, 0),
576         make_tuple(&vp9_fht16x16_c, &vp9_iht16x16_256_add_c, 1),
577         make_tuple(&vp9_fht16x16_c, &vp9_iht16x16_256_add_c, 2),
578         make_tuple(&vp9_fht16x16_c, &vp9_iht16x16_256_add_c, 3)));
579 
580 #if HAVE_NEON_ASM
581 INSTANTIATE_TEST_CASE_P(
582     NEON, Trans16x16DCT,
583     ::testing::Values(
584         make_tuple(&vp9_fdct16x16_c,
585                    &vp9_idct16x16_256_add_neon, 0)));
586 #endif
587 
588 #if HAVE_SSE2
589 INSTANTIATE_TEST_CASE_P(
590     SSE2, Trans16x16DCT,
591     ::testing::Values(
592         make_tuple(&vp9_fdct16x16_sse2,
593                    &vp9_idct16x16_256_add_sse2, 0)));
594 INSTANTIATE_TEST_CASE_P(
595     SSE2, Trans16x16HT,
596     ::testing::Values(
597         make_tuple(&vp9_fht16x16_sse2, &vp9_iht16x16_256_add_sse2, 0),
598         make_tuple(&vp9_fht16x16_sse2, &vp9_iht16x16_256_add_sse2, 1),
599         make_tuple(&vp9_fht16x16_sse2, &vp9_iht16x16_256_add_sse2, 2),
600         make_tuple(&vp9_fht16x16_sse2, &vp9_iht16x16_256_add_sse2, 3)));
601 #endif
602 
603 #if HAVE_SSSE3
604 INSTANTIATE_TEST_CASE_P(
605     SSSE3, Trans16x16DCT,
606     ::testing::Values(
607         make_tuple(&vp9_fdct16x16_c, &vp9_idct16x16_256_add_ssse3, 0)));
608 #endif
609 }  // namespace
610