Silience warnings about uninitiated test cases
[platform/upstream/libvpx.git] / test / lpf_test.cc
1 /*
2  *  Copyright (c) 2014 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 <cmath>
12 #include <cstdlib>
13 #include <string>
14 #include <tuple>
15
16 #include "third_party/googletest/src/include/gtest/gtest.h"
17
18 #include "./vpx_config.h"
19 #include "./vpx_dsp_rtcd.h"
20 #include "test/acm_random.h"
21 #include "test/clear_system_state.h"
22 #include "test/register_state_check.h"
23 #include "test/util.h"
24 #include "vp9/common/vp9_entropy.h"
25 #include "vp9/common/vp9_loopfilter.h"
26 #include "vpx/vpx_integer.h"
27
28 using libvpx_test::ACMRandom;
29
30 namespace {
31 // Horizontally and Vertically need 32x32: 8  Coeffs preceeding filtered section
32 //                                         16 Coefs within filtered section
33 //                                         8  Coeffs following filtered section
34 const int kNumCoeffs = 1024;
35
36 const int number_of_iterations = 10000;
37
38 #if CONFIG_VP9_HIGHBITDEPTH
39 typedef uint16_t Pixel;
40 #define PIXEL_WIDTH 16
41
42 typedef void (*loop_op_t)(Pixel *s, int p, const uint8_t *blimit,
43                           const uint8_t *limit, const uint8_t *thresh, int bd);
44 typedef void (*dual_loop_op_t)(Pixel *s, int p, const uint8_t *blimit0,
45                                const uint8_t *limit0, const uint8_t *thresh0,
46                                const uint8_t *blimit1, const uint8_t *limit1,
47                                const uint8_t *thresh1, int bd);
48 #else
49 typedef uint8_t Pixel;
50 #define PIXEL_WIDTH 8
51
52 typedef void (*loop_op_t)(Pixel *s, int p, const uint8_t *blimit,
53                           const uint8_t *limit, const uint8_t *thresh);
54 typedef void (*dual_loop_op_t)(Pixel *s, int p, const uint8_t *blimit0,
55                                const uint8_t *limit0, const uint8_t *thresh0,
56                                const uint8_t *blimit1, const uint8_t *limit1,
57                                const uint8_t *thresh1);
58 #endif  // CONFIG_VP9_HIGHBITDEPTH
59
60 typedef std::tuple<loop_op_t, loop_op_t, int> loop8_param_t;
61 typedef std::tuple<dual_loop_op_t, dual_loop_op_t, int> dualloop8_param_t;
62
63 void InitInput(Pixel *s, Pixel *ref_s, ACMRandom *rnd, const uint8_t limit,
64                const int mask, const int32_t p, const int i) {
65   uint16_t tmp_s[kNumCoeffs];
66
67   for (int j = 0; j < kNumCoeffs;) {
68     const uint8_t val = rnd->Rand8();
69     if (val & 0x80) {  // 50% chance to choose a new value.
70       tmp_s[j] = rnd->Rand16();
71       j++;
72     } else {  // 50% chance to repeat previous value in row X times.
73       int k = 0;
74       while (k++ < ((val & 0x1f) + 1) && j < kNumCoeffs) {
75         if (j < 1) {
76           tmp_s[j] = rnd->Rand16();
77         } else if (val & 0x20) {  // Increment by a value within the limit.
78           tmp_s[j] = static_cast<uint16_t>(tmp_s[j - 1] + (limit - 1));
79         } else {  // Decrement by a value within the limit.
80           tmp_s[j] = static_cast<uint16_t>(tmp_s[j - 1] - (limit - 1));
81         }
82         j++;
83       }
84     }
85   }
86
87   for (int j = 0; j < kNumCoeffs;) {
88     const uint8_t val = rnd->Rand8();
89     if (val & 0x80) {
90       j++;
91     } else {  // 50% chance to repeat previous value in column X times.
92       int k = 0;
93       while (k++ < ((val & 0x1f) + 1) && j < kNumCoeffs) {
94         if (j < 1) {
95           tmp_s[j] = rnd->Rand16();
96         } else if (val & 0x20) {  // Increment by a value within the limit.
97           tmp_s[(j % 32) * 32 + j / 32] = static_cast<uint16_t>(
98               tmp_s[((j - 1) % 32) * 32 + (j - 1) / 32] + (limit - 1));
99         } else {  // Decrement by a value within the limit.
100           tmp_s[(j % 32) * 32 + j / 32] = static_cast<uint16_t>(
101               tmp_s[((j - 1) % 32) * 32 + (j - 1) / 32] - (limit - 1));
102         }
103         j++;
104       }
105     }
106   }
107
108   for (int j = 0; j < kNumCoeffs; j++) {
109     if (i % 2) {
110       s[j] = tmp_s[j] & mask;
111     } else {
112       s[j] = tmp_s[p * (j % p) + j / p] & mask;
113     }
114     ref_s[j] = s[j];
115   }
116 }
117
118 uint8_t GetOuterThresh(ACMRandom *rnd) {
119   return static_cast<uint8_t>(rnd->RandRange(3 * MAX_LOOP_FILTER + 5));
120 }
121
122 uint8_t GetInnerThresh(ACMRandom *rnd) {
123   return static_cast<uint8_t>(rnd->RandRange(MAX_LOOP_FILTER + 1));
124 }
125
126 uint8_t GetHevThresh(ACMRandom *rnd) {
127   return static_cast<uint8_t>(rnd->RandRange(MAX_LOOP_FILTER + 1) >> 4);
128 }
129
130 class Loop8Test6Param : public ::testing::TestWithParam<loop8_param_t> {
131  public:
132   virtual ~Loop8Test6Param() {}
133   virtual void SetUp() {
134     loopfilter_op_ = GET_PARAM(0);
135     ref_loopfilter_op_ = GET_PARAM(1);
136     bit_depth_ = GET_PARAM(2);
137     mask_ = (1 << bit_depth_) - 1;
138   }
139
140   virtual void TearDown() { libvpx_test::ClearSystemState(); }
141
142  protected:
143   int bit_depth_;
144   int mask_;
145   loop_op_t loopfilter_op_;
146   loop_op_t ref_loopfilter_op_;
147 };
148
149 #if HAVE_NEON || HAVE_SSE2 || \
150     (HAVE_DSPR2 || HAVE_MSA && !CONFIG_VP9_HIGHBITDEPTH)
151 class Loop8Test9Param : public ::testing::TestWithParam<dualloop8_param_t> {
152  public:
153   virtual ~Loop8Test9Param() {}
154   virtual void SetUp() {
155     loopfilter_op_ = GET_PARAM(0);
156     ref_loopfilter_op_ = GET_PARAM(1);
157     bit_depth_ = GET_PARAM(2);
158     mask_ = (1 << bit_depth_) - 1;
159   }
160
161   virtual void TearDown() { libvpx_test::ClearSystemState(); }
162
163  protected:
164   int bit_depth_;
165   int mask_;
166   dual_loop_op_t loopfilter_op_;
167   dual_loop_op_t ref_loopfilter_op_;
168 };
169 #endif  // HAVE_NEON || HAVE_SSE2 || (HAVE_DSPR2 || HAVE_MSA &&
170         // (!CONFIG_VP9_HIGHBITDEPTH))
171
172 TEST_P(Loop8Test6Param, OperationCheck) {
173   ACMRandom rnd(ACMRandom::DeterministicSeed());
174   const int count_test_block = number_of_iterations;
175   const int32_t p = kNumCoeffs / 32;
176   DECLARE_ALIGNED(PIXEL_WIDTH, Pixel, s[kNumCoeffs]);
177   DECLARE_ALIGNED(PIXEL_WIDTH, Pixel, ref_s[kNumCoeffs]);
178   int err_count_total = 0;
179   int first_failure = -1;
180   for (int i = 0; i < count_test_block; ++i) {
181     int err_count = 0;
182     uint8_t tmp = GetOuterThresh(&rnd);
183     DECLARE_ALIGNED(16, const uint8_t,
184                     blimit[16]) = { tmp, tmp, tmp, tmp, tmp, tmp, tmp, tmp,
185                                     tmp, tmp, tmp, tmp, tmp, tmp, tmp, tmp };
186     tmp = GetInnerThresh(&rnd);
187     DECLARE_ALIGNED(16, const uint8_t,
188                     limit[16]) = { tmp, tmp, tmp, tmp, tmp, tmp, tmp, tmp,
189                                    tmp, tmp, tmp, tmp, tmp, tmp, tmp, tmp };
190     tmp = GetHevThresh(&rnd);
191     DECLARE_ALIGNED(16, const uint8_t,
192                     thresh[16]) = { tmp, tmp, tmp, tmp, tmp, tmp, tmp, tmp,
193                                     tmp, tmp, tmp, tmp, tmp, tmp, tmp, tmp };
194     InitInput(s, ref_s, &rnd, *limit, mask_, p, i);
195 #if CONFIG_VP9_HIGHBITDEPTH
196     ref_loopfilter_op_(ref_s + 8 + p * 8, p, blimit, limit, thresh, bit_depth_);
197     ASM_REGISTER_STATE_CHECK(
198         loopfilter_op_(s + 8 + p * 8, p, blimit, limit, thresh, bit_depth_));
199 #else
200     ref_loopfilter_op_(ref_s + 8 + p * 8, p, blimit, limit, thresh);
201     ASM_REGISTER_STATE_CHECK(
202         loopfilter_op_(s + 8 + p * 8, p, blimit, limit, thresh));
203 #endif  // CONFIG_VP9_HIGHBITDEPTH
204
205     for (int j = 0; j < kNumCoeffs; ++j) {
206       err_count += ref_s[j] != s[j];
207     }
208     if (err_count && !err_count_total) {
209       first_failure = i;
210     }
211     err_count_total += err_count;
212   }
213   EXPECT_EQ(0, err_count_total)
214       << "Error: Loop8Test6Param, C output doesn't match SSE2 "
215          "loopfilter output. "
216       << "First failed at test case " << first_failure;
217 }
218
219 TEST_P(Loop8Test6Param, ValueCheck) {
220   ACMRandom rnd(ACMRandom::DeterministicSeed());
221   const int count_test_block = number_of_iterations;
222   DECLARE_ALIGNED(PIXEL_WIDTH, Pixel, s[kNumCoeffs]);
223   DECLARE_ALIGNED(PIXEL_WIDTH, Pixel, ref_s[kNumCoeffs]);
224   int err_count_total = 0;
225   int first_failure = -1;
226
227   // NOTE: The code in vp9_loopfilter.c:update_sharpness computes mblim as a
228   // function of sharpness_lvl and the loopfilter lvl as:
229   // block_inside_limit = lvl >> ((sharpness_lvl > 0) + (sharpness_lvl > 4));
230   // ...
231   // memset(lfi->lfthr[lvl].mblim, (2 * (lvl + 2) + block_inside_limit),
232   //        SIMD_WIDTH);
233   // This means that the largest value for mblim will occur when sharpness_lvl
234   // is equal to 0, and lvl is equal to its greatest value (MAX_LOOP_FILTER).
235   // In this case block_inside_limit will be equal to MAX_LOOP_FILTER and
236   // therefore mblim will be equal to (2 * (lvl + 2) + block_inside_limit) =
237   // 2 * (MAX_LOOP_FILTER + 2) + MAX_LOOP_FILTER = 3 * MAX_LOOP_FILTER + 4
238
239   for (int i = 0; i < count_test_block; ++i) {
240     int err_count = 0;
241     uint8_t tmp = GetOuterThresh(&rnd);
242     DECLARE_ALIGNED(16, const uint8_t,
243                     blimit[16]) = { tmp, tmp, tmp, tmp, tmp, tmp, tmp, tmp,
244                                     tmp, tmp, tmp, tmp, tmp, tmp, tmp, tmp };
245     tmp = GetInnerThresh(&rnd);
246     DECLARE_ALIGNED(16, const uint8_t,
247                     limit[16]) = { tmp, tmp, tmp, tmp, tmp, tmp, tmp, tmp,
248                                    tmp, tmp, tmp, tmp, tmp, tmp, tmp, tmp };
249     tmp = GetHevThresh(&rnd);
250     DECLARE_ALIGNED(16, const uint8_t,
251                     thresh[16]) = { tmp, tmp, tmp, tmp, tmp, tmp, tmp, tmp,
252                                     tmp, tmp, tmp, tmp, tmp, tmp, tmp, tmp };
253     int32_t p = kNumCoeffs / 32;
254     for (int j = 0; j < kNumCoeffs; ++j) {
255       s[j] = rnd.Rand16() & mask_;
256       ref_s[j] = s[j];
257     }
258 #if CONFIG_VP9_HIGHBITDEPTH
259     ref_loopfilter_op_(ref_s + 8 + p * 8, p, blimit, limit, thresh, bit_depth_);
260     ASM_REGISTER_STATE_CHECK(
261         loopfilter_op_(s + 8 + p * 8, p, blimit, limit, thresh, bit_depth_));
262 #else
263     ref_loopfilter_op_(ref_s + 8 + p * 8, p, blimit, limit, thresh);
264     ASM_REGISTER_STATE_CHECK(
265         loopfilter_op_(s + 8 + p * 8, p, blimit, limit, thresh));
266 #endif  // CONFIG_VP9_HIGHBITDEPTH
267
268     for (int j = 0; j < kNumCoeffs; ++j) {
269       err_count += ref_s[j] != s[j];
270     }
271     if (err_count && !err_count_total) {
272       first_failure = i;
273     }
274     err_count_total += err_count;
275   }
276   EXPECT_EQ(0, err_count_total)
277       << "Error: Loop8Test6Param, C output doesn't match SSE2 "
278          "loopfilter output. "
279       << "First failed at test case " << first_failure;
280 }
281
282 #if HAVE_NEON || HAVE_SSE2 || \
283     (HAVE_DSPR2 || HAVE_MSA && (!CONFIG_VP9_HIGHBITDEPTH))
284 TEST_P(Loop8Test9Param, OperationCheck) {
285   ACMRandom rnd(ACMRandom::DeterministicSeed());
286   const int count_test_block = number_of_iterations;
287   DECLARE_ALIGNED(PIXEL_WIDTH, Pixel, s[kNumCoeffs]);
288   DECLARE_ALIGNED(PIXEL_WIDTH, Pixel, ref_s[kNumCoeffs]);
289   int err_count_total = 0;
290   int first_failure = -1;
291   for (int i = 0; i < count_test_block; ++i) {
292     int err_count = 0;
293     uint8_t tmp = GetOuterThresh(&rnd);
294     DECLARE_ALIGNED(16, const uint8_t,
295                     blimit0[16]) = { tmp, tmp, tmp, tmp, tmp, tmp, tmp, tmp,
296                                      tmp, tmp, tmp, tmp, tmp, tmp, tmp, tmp };
297     tmp = GetInnerThresh(&rnd);
298     DECLARE_ALIGNED(16, const uint8_t,
299                     limit0[16]) = { tmp, tmp, tmp, tmp, tmp, tmp, tmp, tmp,
300                                     tmp, tmp, tmp, tmp, tmp, tmp, tmp, tmp };
301     tmp = GetHevThresh(&rnd);
302     DECLARE_ALIGNED(16, const uint8_t,
303                     thresh0[16]) = { tmp, tmp, tmp, tmp, tmp, tmp, tmp, tmp,
304                                      tmp, tmp, tmp, tmp, tmp, tmp, tmp, tmp };
305     tmp = GetOuterThresh(&rnd);
306     DECLARE_ALIGNED(16, const uint8_t,
307                     blimit1[16]) = { tmp, tmp, tmp, tmp, tmp, tmp, tmp, tmp,
308                                      tmp, tmp, tmp, tmp, tmp, tmp, tmp, tmp };
309     tmp = GetInnerThresh(&rnd);
310     DECLARE_ALIGNED(16, const uint8_t,
311                     limit1[16]) = { tmp, tmp, tmp, tmp, tmp, tmp, tmp, tmp,
312                                     tmp, tmp, tmp, tmp, tmp, tmp, tmp, tmp };
313     tmp = GetHevThresh(&rnd);
314     DECLARE_ALIGNED(16, const uint8_t,
315                     thresh1[16]) = { tmp, tmp, tmp, tmp, tmp, tmp, tmp, tmp,
316                                      tmp, tmp, tmp, tmp, tmp, tmp, tmp, tmp };
317     int32_t p = kNumCoeffs / 32;
318     const uint8_t limit = *limit0 < *limit1 ? *limit0 : *limit1;
319     InitInput(s, ref_s, &rnd, limit, mask_, p, i);
320 #if CONFIG_VP9_HIGHBITDEPTH
321     ref_loopfilter_op_(ref_s + 8 + p * 8, p, blimit0, limit0, thresh0, blimit1,
322                        limit1, thresh1, bit_depth_);
323     ASM_REGISTER_STATE_CHECK(loopfilter_op_(s + 8 + p * 8, p, blimit0, limit0,
324                                             thresh0, blimit1, limit1, thresh1,
325                                             bit_depth_));
326 #else
327     ref_loopfilter_op_(ref_s + 8 + p * 8, p, blimit0, limit0, thresh0, blimit1,
328                        limit1, thresh1);
329     ASM_REGISTER_STATE_CHECK(loopfilter_op_(s + 8 + p * 8, p, blimit0, limit0,
330                                             thresh0, blimit1, limit1, thresh1));
331 #endif  // CONFIG_VP9_HIGHBITDEPTH
332
333     for (int j = 0; j < kNumCoeffs; ++j) {
334       err_count += ref_s[j] != s[j];
335     }
336     if (err_count && !err_count_total) {
337       first_failure = i;
338     }
339     err_count_total += err_count;
340   }
341   EXPECT_EQ(0, err_count_total)
342       << "Error: Loop8Test9Param, C output doesn't match SSE2 "
343          "loopfilter output. "
344       << "First failed at test case " << first_failure;
345 }
346
347 TEST_P(Loop8Test9Param, ValueCheck) {
348   ACMRandom rnd(ACMRandom::DeterministicSeed());
349   const int count_test_block = number_of_iterations;
350   DECLARE_ALIGNED(PIXEL_WIDTH, Pixel, s[kNumCoeffs]);
351   DECLARE_ALIGNED(PIXEL_WIDTH, Pixel, ref_s[kNumCoeffs]);
352   int err_count_total = 0;
353   int first_failure = -1;
354   for (int i = 0; i < count_test_block; ++i) {
355     int err_count = 0;
356     uint8_t tmp = GetOuterThresh(&rnd);
357     DECLARE_ALIGNED(16, const uint8_t,
358                     blimit0[16]) = { tmp, tmp, tmp, tmp, tmp, tmp, tmp, tmp,
359                                      tmp, tmp, tmp, tmp, tmp, tmp, tmp, tmp };
360     tmp = GetInnerThresh(&rnd);
361     DECLARE_ALIGNED(16, const uint8_t,
362                     limit0[16]) = { tmp, tmp, tmp, tmp, tmp, tmp, tmp, tmp,
363                                     tmp, tmp, tmp, tmp, tmp, tmp, tmp, tmp };
364     tmp = GetHevThresh(&rnd);
365     DECLARE_ALIGNED(16, const uint8_t,
366                     thresh0[16]) = { tmp, tmp, tmp, tmp, tmp, tmp, tmp, tmp,
367                                      tmp, tmp, tmp, tmp, tmp, tmp, tmp, tmp };
368     tmp = GetOuterThresh(&rnd);
369     DECLARE_ALIGNED(16, const uint8_t,
370                     blimit1[16]) = { tmp, tmp, tmp, tmp, tmp, tmp, tmp, tmp,
371                                      tmp, tmp, tmp, tmp, tmp, tmp, tmp, tmp };
372     tmp = GetInnerThresh(&rnd);
373     DECLARE_ALIGNED(16, const uint8_t,
374                     limit1[16]) = { tmp, tmp, tmp, tmp, tmp, tmp, tmp, tmp,
375                                     tmp, tmp, tmp, tmp, tmp, tmp, tmp, tmp };
376     tmp = GetHevThresh(&rnd);
377     DECLARE_ALIGNED(16, const uint8_t,
378                     thresh1[16]) = { tmp, tmp, tmp, tmp, tmp, tmp, tmp, tmp,
379                                      tmp, tmp, tmp, tmp, tmp, tmp, tmp, tmp };
380     int32_t p = kNumCoeffs / 32;  // TODO(pdlf) can we have non-square here?
381     for (int j = 0; j < kNumCoeffs; ++j) {
382       s[j] = rnd.Rand16() & mask_;
383       ref_s[j] = s[j];
384     }
385 #if CONFIG_VP9_HIGHBITDEPTH
386     ref_loopfilter_op_(ref_s + 8 + p * 8, p, blimit0, limit0, thresh0, blimit1,
387                        limit1, thresh1, bit_depth_);
388     ASM_REGISTER_STATE_CHECK(loopfilter_op_(s + 8 + p * 8, p, blimit0, limit0,
389                                             thresh0, blimit1, limit1, thresh1,
390                                             bit_depth_));
391 #else
392     ref_loopfilter_op_(ref_s + 8 + p * 8, p, blimit0, limit0, thresh0, blimit1,
393                        limit1, thresh1);
394     ASM_REGISTER_STATE_CHECK(loopfilter_op_(s + 8 + p * 8, p, blimit0, limit0,
395                                             thresh0, blimit1, limit1, thresh1));
396 #endif  // CONFIG_VP9_HIGHBITDEPTH
397
398     for (int j = 0; j < kNumCoeffs; ++j) {
399       err_count += ref_s[j] != s[j];
400     }
401     if (err_count && !err_count_total) {
402       first_failure = i;
403     }
404     err_count_total += err_count;
405   }
406   EXPECT_EQ(0, err_count_total)
407       << "Error: Loop8Test9Param, C output doesn't match SSE2"
408          "loopfilter output. "
409       << "First failed at test case " << first_failure;
410 }
411 #endif  // HAVE_NEON || HAVE_SSE2 || (HAVE_DSPR2 || HAVE_MSA &&
412         // (!CONFIG_VP9_HIGHBITDEPTH))
413
414 using std::make_tuple;
415
416 #if HAVE_SSE2
417 #if CONFIG_VP9_HIGHBITDEPTH
418 INSTANTIATE_TEST_SUITE_P(
419     SSE2, Loop8Test6Param,
420     ::testing::Values(make_tuple(&vpx_highbd_lpf_horizontal_4_sse2,
421                                  &vpx_highbd_lpf_horizontal_4_c, 8),
422                       make_tuple(&vpx_highbd_lpf_vertical_4_sse2,
423                                  &vpx_highbd_lpf_vertical_4_c, 8),
424                       make_tuple(&vpx_highbd_lpf_horizontal_8_sse2,
425                                  &vpx_highbd_lpf_horizontal_8_c, 8),
426                       make_tuple(&vpx_highbd_lpf_horizontal_16_sse2,
427                                  &vpx_highbd_lpf_horizontal_16_c, 8),
428                       make_tuple(&vpx_highbd_lpf_horizontal_16_dual_sse2,
429                                  &vpx_highbd_lpf_horizontal_16_dual_c, 8),
430                       make_tuple(&vpx_highbd_lpf_vertical_8_sse2,
431                                  &vpx_highbd_lpf_vertical_8_c, 8),
432                       make_tuple(&vpx_highbd_lpf_vertical_16_sse2,
433                                  &vpx_highbd_lpf_vertical_16_c, 8),
434                       make_tuple(&vpx_highbd_lpf_horizontal_4_sse2,
435                                  &vpx_highbd_lpf_horizontal_4_c, 10),
436                       make_tuple(&vpx_highbd_lpf_vertical_4_sse2,
437                                  &vpx_highbd_lpf_vertical_4_c, 10),
438                       make_tuple(&vpx_highbd_lpf_horizontal_8_sse2,
439                                  &vpx_highbd_lpf_horizontal_8_c, 10),
440                       make_tuple(&vpx_highbd_lpf_horizontal_16_sse2,
441                                  &vpx_highbd_lpf_horizontal_16_c, 10),
442                       make_tuple(&vpx_highbd_lpf_horizontal_16_dual_sse2,
443                                  &vpx_highbd_lpf_horizontal_16_dual_c, 10),
444                       make_tuple(&vpx_highbd_lpf_vertical_8_sse2,
445                                  &vpx_highbd_lpf_vertical_8_c, 10),
446                       make_tuple(&vpx_highbd_lpf_vertical_16_sse2,
447                                  &vpx_highbd_lpf_vertical_16_c, 10),
448                       make_tuple(&vpx_highbd_lpf_horizontal_4_sse2,
449                                  &vpx_highbd_lpf_horizontal_4_c, 12),
450                       make_tuple(&vpx_highbd_lpf_vertical_4_sse2,
451                                  &vpx_highbd_lpf_vertical_4_c, 12),
452                       make_tuple(&vpx_highbd_lpf_horizontal_8_sse2,
453                                  &vpx_highbd_lpf_horizontal_8_c, 12),
454                       make_tuple(&vpx_highbd_lpf_horizontal_16_sse2,
455                                  &vpx_highbd_lpf_horizontal_16_c, 12),
456                       make_tuple(&vpx_highbd_lpf_horizontal_16_dual_sse2,
457                                  &vpx_highbd_lpf_horizontal_16_dual_c, 12),
458                       make_tuple(&vpx_highbd_lpf_vertical_8_sse2,
459                                  &vpx_highbd_lpf_vertical_8_c, 12),
460                       make_tuple(&vpx_highbd_lpf_vertical_16_sse2,
461                                  &vpx_highbd_lpf_vertical_16_c, 12),
462                       make_tuple(&vpx_highbd_lpf_vertical_16_dual_sse2,
463                                  &vpx_highbd_lpf_vertical_16_dual_c, 8),
464                       make_tuple(&vpx_highbd_lpf_vertical_16_dual_sse2,
465                                  &vpx_highbd_lpf_vertical_16_dual_c, 10),
466                       make_tuple(&vpx_highbd_lpf_vertical_16_dual_sse2,
467                                  &vpx_highbd_lpf_vertical_16_dual_c, 12)));
468 #else
469 INSTANTIATE_TEST_SUITE_P(
470     SSE2, Loop8Test6Param,
471     ::testing::Values(
472         make_tuple(&vpx_lpf_horizontal_4_sse2, &vpx_lpf_horizontal_4_c, 8),
473         make_tuple(&vpx_lpf_horizontal_8_sse2, &vpx_lpf_horizontal_8_c, 8),
474         make_tuple(&vpx_lpf_horizontal_16_sse2, &vpx_lpf_horizontal_16_c, 8),
475         make_tuple(&vpx_lpf_horizontal_16_dual_sse2,
476                    &vpx_lpf_horizontal_16_dual_c, 8),
477         make_tuple(&vpx_lpf_vertical_4_sse2, &vpx_lpf_vertical_4_c, 8),
478         make_tuple(&vpx_lpf_vertical_8_sse2, &vpx_lpf_vertical_8_c, 8),
479         make_tuple(&vpx_lpf_vertical_16_sse2, &vpx_lpf_vertical_16_c, 8),
480         make_tuple(&vpx_lpf_vertical_16_dual_sse2, &vpx_lpf_vertical_16_dual_c,
481                    8)));
482 #endif  // CONFIG_VP9_HIGHBITDEPTH
483 #endif
484
485 #if HAVE_AVX2 && (!CONFIG_VP9_HIGHBITDEPTH)
486 INSTANTIATE_TEST_SUITE_P(
487     AVX2, Loop8Test6Param,
488     ::testing::Values(make_tuple(&vpx_lpf_horizontal_16_avx2,
489                                  &vpx_lpf_horizontal_16_c, 8),
490                       make_tuple(&vpx_lpf_horizontal_16_dual_avx2,
491                                  &vpx_lpf_horizontal_16_dual_c, 8)));
492 #endif
493
494 #if HAVE_SSE2
495 #if CONFIG_VP9_HIGHBITDEPTH
496 INSTANTIATE_TEST_SUITE_P(
497     SSE2, Loop8Test9Param,
498     ::testing::Values(make_tuple(&vpx_highbd_lpf_horizontal_4_dual_sse2,
499                                  &vpx_highbd_lpf_horizontal_4_dual_c, 8),
500                       make_tuple(&vpx_highbd_lpf_horizontal_8_dual_sse2,
501                                  &vpx_highbd_lpf_horizontal_8_dual_c, 8),
502                       make_tuple(&vpx_highbd_lpf_vertical_4_dual_sse2,
503                                  &vpx_highbd_lpf_vertical_4_dual_c, 8),
504                       make_tuple(&vpx_highbd_lpf_vertical_8_dual_sse2,
505                                  &vpx_highbd_lpf_vertical_8_dual_c, 8),
506                       make_tuple(&vpx_highbd_lpf_horizontal_4_dual_sse2,
507                                  &vpx_highbd_lpf_horizontal_4_dual_c, 10),
508                       make_tuple(&vpx_highbd_lpf_horizontal_8_dual_sse2,
509                                  &vpx_highbd_lpf_horizontal_8_dual_c, 10),
510                       make_tuple(&vpx_highbd_lpf_vertical_4_dual_sse2,
511                                  &vpx_highbd_lpf_vertical_4_dual_c, 10),
512                       make_tuple(&vpx_highbd_lpf_vertical_8_dual_sse2,
513                                  &vpx_highbd_lpf_vertical_8_dual_c, 10),
514                       make_tuple(&vpx_highbd_lpf_horizontal_4_dual_sse2,
515                                  &vpx_highbd_lpf_horizontal_4_dual_c, 12),
516                       make_tuple(&vpx_highbd_lpf_horizontal_8_dual_sse2,
517                                  &vpx_highbd_lpf_horizontal_8_dual_c, 12),
518                       make_tuple(&vpx_highbd_lpf_vertical_4_dual_sse2,
519                                  &vpx_highbd_lpf_vertical_4_dual_c, 12),
520                       make_tuple(&vpx_highbd_lpf_vertical_8_dual_sse2,
521                                  &vpx_highbd_lpf_vertical_8_dual_c, 12)));
522 #else
523 INSTANTIATE_TEST_SUITE_P(
524     SSE2, Loop8Test9Param,
525     ::testing::Values(make_tuple(&vpx_lpf_horizontal_4_dual_sse2,
526                                  &vpx_lpf_horizontal_4_dual_c, 8),
527                       make_tuple(&vpx_lpf_horizontal_8_dual_sse2,
528                                  &vpx_lpf_horizontal_8_dual_c, 8),
529                       make_tuple(&vpx_lpf_vertical_4_dual_sse2,
530                                  &vpx_lpf_vertical_4_dual_c, 8),
531                       make_tuple(&vpx_lpf_vertical_8_dual_sse2,
532                                  &vpx_lpf_vertical_8_dual_c, 8)));
533 #endif  // CONFIG_VP9_HIGHBITDEPTH
534 #endif
535
536 #if HAVE_NEON
537 #if CONFIG_VP9_HIGHBITDEPTH
538 INSTANTIATE_TEST_SUITE_P(
539     NEON, Loop8Test6Param,
540     ::testing::Values(make_tuple(&vpx_highbd_lpf_horizontal_4_neon,
541                                  &vpx_highbd_lpf_horizontal_4_c, 8),
542                       make_tuple(&vpx_highbd_lpf_horizontal_4_neon,
543                                  &vpx_highbd_lpf_horizontal_4_c, 10),
544                       make_tuple(&vpx_highbd_lpf_horizontal_4_neon,
545                                  &vpx_highbd_lpf_horizontal_4_c, 12),
546                       make_tuple(&vpx_highbd_lpf_horizontal_8_neon,
547                                  &vpx_highbd_lpf_horizontal_8_c, 8),
548                       make_tuple(&vpx_highbd_lpf_horizontal_8_neon,
549                                  &vpx_highbd_lpf_horizontal_8_c, 10),
550                       make_tuple(&vpx_highbd_lpf_horizontal_8_neon,
551                                  &vpx_highbd_lpf_horizontal_8_c, 12),
552                       make_tuple(&vpx_highbd_lpf_horizontal_16_neon,
553                                  &vpx_highbd_lpf_horizontal_16_c, 8),
554                       make_tuple(&vpx_highbd_lpf_horizontal_16_neon,
555                                  &vpx_highbd_lpf_horizontal_16_c, 10),
556                       make_tuple(&vpx_highbd_lpf_horizontal_16_neon,
557                                  &vpx_highbd_lpf_horizontal_16_c, 12),
558                       make_tuple(&vpx_highbd_lpf_horizontal_16_dual_neon,
559                                  &vpx_highbd_lpf_horizontal_16_dual_c, 8),
560                       make_tuple(&vpx_highbd_lpf_horizontal_16_dual_neon,
561                                  &vpx_highbd_lpf_horizontal_16_dual_c, 10),
562                       make_tuple(&vpx_highbd_lpf_horizontal_16_dual_neon,
563                                  &vpx_highbd_lpf_horizontal_16_dual_c, 12),
564                       make_tuple(&vpx_highbd_lpf_vertical_4_neon,
565                                  &vpx_highbd_lpf_vertical_4_c, 8),
566                       make_tuple(&vpx_highbd_lpf_vertical_4_neon,
567                                  &vpx_highbd_lpf_vertical_4_c, 10),
568                       make_tuple(&vpx_highbd_lpf_vertical_4_neon,
569                                  &vpx_highbd_lpf_vertical_4_c, 12),
570                       make_tuple(&vpx_highbd_lpf_vertical_8_neon,
571                                  &vpx_highbd_lpf_vertical_8_c, 8),
572                       make_tuple(&vpx_highbd_lpf_vertical_8_neon,
573                                  &vpx_highbd_lpf_vertical_8_c, 10),
574                       make_tuple(&vpx_highbd_lpf_vertical_8_neon,
575                                  &vpx_highbd_lpf_vertical_8_c, 12),
576                       make_tuple(&vpx_highbd_lpf_vertical_16_neon,
577                                  &vpx_highbd_lpf_vertical_16_c, 8),
578                       make_tuple(&vpx_highbd_lpf_vertical_16_neon,
579                                  &vpx_highbd_lpf_vertical_16_c, 10),
580                       make_tuple(&vpx_highbd_lpf_vertical_16_neon,
581                                  &vpx_highbd_lpf_vertical_16_c, 12),
582                       make_tuple(&vpx_highbd_lpf_vertical_16_dual_neon,
583                                  &vpx_highbd_lpf_vertical_16_dual_c, 8),
584                       make_tuple(&vpx_highbd_lpf_vertical_16_dual_neon,
585                                  &vpx_highbd_lpf_vertical_16_dual_c, 10),
586                       make_tuple(&vpx_highbd_lpf_vertical_16_dual_neon,
587                                  &vpx_highbd_lpf_vertical_16_dual_c, 12)));
588 INSTANTIATE_TEST_SUITE_P(
589     NEON, Loop8Test9Param,
590     ::testing::Values(make_tuple(&vpx_highbd_lpf_horizontal_4_dual_neon,
591                                  &vpx_highbd_lpf_horizontal_4_dual_c, 8),
592                       make_tuple(&vpx_highbd_lpf_horizontal_4_dual_neon,
593                                  &vpx_highbd_lpf_horizontal_4_dual_c, 10),
594                       make_tuple(&vpx_highbd_lpf_horizontal_4_dual_neon,
595                                  &vpx_highbd_lpf_horizontal_4_dual_c, 12),
596                       make_tuple(&vpx_highbd_lpf_horizontal_8_dual_neon,
597                                  &vpx_highbd_lpf_horizontal_8_dual_c, 8),
598                       make_tuple(&vpx_highbd_lpf_horizontal_8_dual_neon,
599                                  &vpx_highbd_lpf_horizontal_8_dual_c, 10),
600                       make_tuple(&vpx_highbd_lpf_horizontal_8_dual_neon,
601                                  &vpx_highbd_lpf_horizontal_8_dual_c, 12),
602                       make_tuple(&vpx_highbd_lpf_vertical_4_dual_neon,
603                                  &vpx_highbd_lpf_vertical_4_dual_c, 8),
604                       make_tuple(&vpx_highbd_lpf_vertical_4_dual_neon,
605                                  &vpx_highbd_lpf_vertical_4_dual_c, 10),
606                       make_tuple(&vpx_highbd_lpf_vertical_4_dual_neon,
607                                  &vpx_highbd_lpf_vertical_4_dual_c, 12),
608                       make_tuple(&vpx_highbd_lpf_vertical_8_dual_neon,
609                                  &vpx_highbd_lpf_vertical_8_dual_c, 8),
610                       make_tuple(&vpx_highbd_lpf_vertical_8_dual_neon,
611                                  &vpx_highbd_lpf_vertical_8_dual_c, 10),
612                       make_tuple(&vpx_highbd_lpf_vertical_8_dual_neon,
613                                  &vpx_highbd_lpf_vertical_8_dual_c, 12)));
614 #else
615 INSTANTIATE_TEST_SUITE_P(
616     NEON, Loop8Test6Param,
617     ::testing::Values(
618         make_tuple(&vpx_lpf_horizontal_16_neon, &vpx_lpf_horizontal_16_c, 8),
619         make_tuple(&vpx_lpf_horizontal_16_dual_neon,
620                    &vpx_lpf_horizontal_16_dual_c, 8),
621         make_tuple(&vpx_lpf_vertical_16_neon, &vpx_lpf_vertical_16_c, 8),
622         make_tuple(&vpx_lpf_vertical_16_dual_neon, &vpx_lpf_vertical_16_dual_c,
623                    8),
624         make_tuple(&vpx_lpf_horizontal_8_neon, &vpx_lpf_horizontal_8_c, 8),
625         make_tuple(&vpx_lpf_vertical_8_neon, &vpx_lpf_vertical_8_c, 8),
626         make_tuple(&vpx_lpf_horizontal_4_neon, &vpx_lpf_horizontal_4_c, 8),
627         make_tuple(&vpx_lpf_vertical_4_neon, &vpx_lpf_vertical_4_c, 8)));
628 INSTANTIATE_TEST_SUITE_P(
629     NEON, Loop8Test9Param,
630     ::testing::Values(make_tuple(&vpx_lpf_horizontal_8_dual_neon,
631                                  &vpx_lpf_horizontal_8_dual_c, 8),
632                       make_tuple(&vpx_lpf_vertical_8_dual_neon,
633                                  &vpx_lpf_vertical_8_dual_c, 8),
634                       make_tuple(&vpx_lpf_horizontal_4_dual_neon,
635                                  &vpx_lpf_horizontal_4_dual_c, 8),
636                       make_tuple(&vpx_lpf_vertical_4_dual_neon,
637                                  &vpx_lpf_vertical_4_dual_c, 8)));
638 #endif  // CONFIG_VP9_HIGHBITDEPTH
639 #endif  // HAVE_NEON
640
641 #if HAVE_DSPR2 && !CONFIG_VP9_HIGHBITDEPTH
642 INSTANTIATE_TEST_SUITE_P(
643     DSPR2, Loop8Test6Param,
644     ::testing::Values(
645         make_tuple(&vpx_lpf_horizontal_4_dspr2, &vpx_lpf_horizontal_4_c, 8),
646         make_tuple(&vpx_lpf_horizontal_8_dspr2, &vpx_lpf_horizontal_8_c, 8),
647         make_tuple(&vpx_lpf_horizontal_16_dspr2, &vpx_lpf_horizontal_16_c, 8),
648         make_tuple(&vpx_lpf_horizontal_16_dual_dspr2,
649                    &vpx_lpf_horizontal_16_dual_c, 8),
650         make_tuple(&vpx_lpf_vertical_4_dspr2, &vpx_lpf_vertical_4_c, 8),
651         make_tuple(&vpx_lpf_vertical_8_dspr2, &vpx_lpf_vertical_8_c, 8),
652         make_tuple(&vpx_lpf_vertical_16_dspr2, &vpx_lpf_vertical_16_c, 8),
653         make_tuple(&vpx_lpf_vertical_16_dual_dspr2, &vpx_lpf_vertical_16_dual_c,
654                    8)));
655
656 INSTANTIATE_TEST_SUITE_P(
657     DSPR2, Loop8Test9Param,
658     ::testing::Values(make_tuple(&vpx_lpf_horizontal_4_dual_dspr2,
659                                  &vpx_lpf_horizontal_4_dual_c, 8),
660                       make_tuple(&vpx_lpf_horizontal_8_dual_dspr2,
661                                  &vpx_lpf_horizontal_8_dual_c, 8),
662                       make_tuple(&vpx_lpf_vertical_4_dual_dspr2,
663                                  &vpx_lpf_vertical_4_dual_c, 8),
664                       make_tuple(&vpx_lpf_vertical_8_dual_dspr2,
665                                  &vpx_lpf_vertical_8_dual_c, 8)));
666 #endif  // HAVE_DSPR2 && !CONFIG_VP9_HIGHBITDEPTH
667
668 #if HAVE_MSA && (!CONFIG_VP9_HIGHBITDEPTH)
669 INSTANTIATE_TEST_SUITE_P(
670     MSA, Loop8Test6Param,
671     ::testing::Values(
672         make_tuple(&vpx_lpf_horizontal_4_msa, &vpx_lpf_horizontal_4_c, 8),
673         make_tuple(&vpx_lpf_horizontal_8_msa, &vpx_lpf_horizontal_8_c, 8),
674         make_tuple(&vpx_lpf_horizontal_16_msa, &vpx_lpf_horizontal_16_c, 8),
675         make_tuple(&vpx_lpf_horizontal_16_dual_msa,
676                    &vpx_lpf_horizontal_16_dual_c, 8),
677         make_tuple(&vpx_lpf_vertical_4_msa, &vpx_lpf_vertical_4_c, 8),
678         make_tuple(&vpx_lpf_vertical_8_msa, &vpx_lpf_vertical_8_c, 8),
679         make_tuple(&vpx_lpf_vertical_16_msa, &vpx_lpf_vertical_16_c, 8)));
680
681 INSTANTIATE_TEST_SUITE_P(
682     MSA, Loop8Test9Param,
683     ::testing::Values(make_tuple(&vpx_lpf_horizontal_4_dual_msa,
684                                  &vpx_lpf_horizontal_4_dual_c, 8),
685                       make_tuple(&vpx_lpf_horizontal_8_dual_msa,
686                                  &vpx_lpf_horizontal_8_dual_c, 8),
687                       make_tuple(&vpx_lpf_vertical_4_dual_msa,
688                                  &vpx_lpf_vertical_4_dual_c, 8),
689                       make_tuple(&vpx_lpf_vertical_8_dual_msa,
690                                  &vpx_lpf_vertical_8_dual_c, 8)));
691 #endif  // HAVE_MSA && (!CONFIG_VP9_HIGHBITDEPTH)
692
693 }  // namespace