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