Add aq mode 0 and 3 to active map test
[platform/upstream/libvpx.git] / test / vp9_quantize_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 <math.h>
12 #include <stdlib.h>
13 #include <string.h>
14 #include <tuple>
15
16 #include "third_party/googletest/src/include/gtest/gtest.h"
17
18 #include "./vp9_rtcd.h"
19 #include "./vpx_config.h"
20 #include "./vpx_dsp_rtcd.h"
21 #include "test/acm_random.h"
22 #include "test/bench.h"
23 #include "test/buffer.h"
24 #include "test/clear_system_state.h"
25 #include "test/register_state_check.h"
26 #include "test/util.h"
27 #include "vp9/common/vp9_entropy.h"
28 #include "vp9/common/vp9_scan.h"
29 #include "vpx/vpx_codec.h"
30 #include "vpx/vpx_integer.h"
31 #include "vpx_ports/msvc.h"
32 #include "vpx_ports/vpx_timer.h"
33
34 using libvpx_test::ACMRandom;
35 using libvpx_test::Buffer;
36
37 namespace {
38 const int number_of_iterations = 100;
39
40 typedef void (*QuantizeFunc)(const tran_low_t *coeff, intptr_t count,
41                              const int16_t *zbin, const int16_t *round,
42                              const int16_t *quant, const int16_t *quant_shift,
43                              tran_low_t *qcoeff, tran_low_t *dqcoeff,
44                              const int16_t *dequant, uint16_t *eob,
45                              const int16_t *scan, const int16_t *iscan);
46 typedef std::tuple<QuantizeFunc, QuantizeFunc, vpx_bit_depth_t,
47                    int /*max_size*/, bool /*is_fp*/>
48     QuantizeParam;
49
50 // Wrapper for FP version which does not use zbin or quant_shift.
51 typedef void (*QuantizeFPFunc)(const tran_low_t *coeff, intptr_t count,
52                                const int16_t *round, const int16_t *quant,
53                                tran_low_t *qcoeff, tran_low_t *dqcoeff,
54                                const int16_t *dequant, uint16_t *eob,
55                                const int16_t *scan, const int16_t *iscan);
56
57 template <QuantizeFPFunc fn>
58 void QuantFPWrapper(const tran_low_t *coeff, intptr_t count,
59                     const int16_t *zbin, const int16_t *round,
60                     const int16_t *quant, const int16_t *quant_shift,
61                     tran_low_t *qcoeff, tran_low_t *dqcoeff,
62                     const int16_t *dequant, uint16_t *eob, const int16_t *scan,
63                     const int16_t *iscan) {
64   (void)zbin;
65   (void)quant_shift;
66
67   fn(coeff, count, round, quant, qcoeff, dqcoeff, dequant, eob, scan, iscan);
68 }
69
70 class VP9QuantizeBase : public AbstractBench {
71  public:
72   VP9QuantizeBase(vpx_bit_depth_t bit_depth, int max_size, bool is_fp)
73       : bit_depth_(bit_depth), max_size_(max_size), is_fp_(is_fp),
74         coeff_(Buffer<tran_low_t>(max_size_, max_size_, 0, 16)),
75         qcoeff_(Buffer<tran_low_t>(max_size_, max_size_, 0, 32)),
76         dqcoeff_(Buffer<tran_low_t>(max_size_, max_size_, 0, 32)) {
77     // TODO(jianj): SSSE3 and AVX2 tests fail on extreme values.
78 #if HAVE_NEON
79     max_value_ = (1 << (7 + bit_depth_)) - 1;
80 #else
81     max_value_ = (1 << bit_depth_) - 1;
82 #endif
83     zbin_ptr_ =
84         reinterpret_cast<int16_t *>(vpx_memalign(16, 8 * sizeof(*zbin_ptr_)));
85     round_fp_ptr_ = reinterpret_cast<int16_t *>(
86         vpx_memalign(16, 8 * sizeof(*round_fp_ptr_)));
87     quant_fp_ptr_ = reinterpret_cast<int16_t *>(
88         vpx_memalign(16, 8 * sizeof(*quant_fp_ptr_)));
89     round_ptr_ =
90         reinterpret_cast<int16_t *>(vpx_memalign(16, 8 * sizeof(*round_ptr_)));
91     quant_ptr_ =
92         reinterpret_cast<int16_t *>(vpx_memalign(16, 8 * sizeof(*quant_ptr_)));
93     quant_shift_ptr_ = reinterpret_cast<int16_t *>(
94         vpx_memalign(16, 8 * sizeof(*quant_shift_ptr_)));
95     dequant_ptr_ = reinterpret_cast<int16_t *>(
96         vpx_memalign(16, 8 * sizeof(*dequant_ptr_)));
97
98     r_ptr_ = (is_fp_) ? round_fp_ptr_ : round_ptr_;
99     q_ptr_ = (is_fp_) ? quant_fp_ptr_ : quant_ptr_;
100   }
101
102   ~VP9QuantizeBase() {
103     vpx_free(zbin_ptr_);
104     vpx_free(round_fp_ptr_);
105     vpx_free(quant_fp_ptr_);
106     vpx_free(round_ptr_);
107     vpx_free(quant_ptr_);
108     vpx_free(quant_shift_ptr_);
109     vpx_free(dequant_ptr_);
110     zbin_ptr_ = nullptr;
111     round_fp_ptr_ = nullptr;
112     quant_fp_ptr_ = nullptr;
113     round_ptr_ = nullptr;
114     quant_ptr_ = nullptr;
115     quant_shift_ptr_ = nullptr;
116     dequant_ptr_ = nullptr;
117     libvpx_test::ClearSystemState();
118   }
119
120  protected:
121   int16_t *zbin_ptr_;
122   int16_t *round_fp_ptr_;
123   int16_t *quant_fp_ptr_;
124   int16_t *round_ptr_;
125   int16_t *quant_ptr_;
126   int16_t *quant_shift_ptr_;
127   int16_t *dequant_ptr_;
128   const vpx_bit_depth_t bit_depth_;
129   int max_value_;
130   const int max_size_;
131   const bool is_fp_;
132   Buffer<tran_low_t> coeff_;
133   Buffer<tran_low_t> qcoeff_;
134   Buffer<tran_low_t> dqcoeff_;
135   int16_t *r_ptr_;
136   int16_t *q_ptr_;
137   int count_;
138   const scan_order *scan_;
139   uint16_t eob_;
140 };
141
142 class VP9QuantizeTest : public VP9QuantizeBase,
143                         public ::testing::TestWithParam<QuantizeParam> {
144  public:
145   VP9QuantizeTest()
146       : VP9QuantizeBase(GET_PARAM(2), GET_PARAM(3), GET_PARAM(4)),
147         quantize_op_(GET_PARAM(0)), ref_quantize_op_(GET_PARAM(1)) {}
148
149  protected:
150   virtual void Run();
151   const QuantizeFunc quantize_op_;
152   const QuantizeFunc ref_quantize_op_;
153 };
154
155 void VP9QuantizeTest::Run() {
156   quantize_op_(coeff_.TopLeftPixel(), count_, zbin_ptr_, r_ptr_, q_ptr_,
157                quant_shift_ptr_, qcoeff_.TopLeftPixel(),
158                dqcoeff_.TopLeftPixel(), dequant_ptr_, &eob_, scan_->scan,
159                scan_->iscan);
160 }
161
162 // This quantizer compares the AC coefficients to the quantization step size to
163 // determine if further multiplication operations are needed.
164 // Based on vp9_quantize_fp_sse2().
165 inline void quant_fp_nz(const tran_low_t *coeff_ptr, intptr_t n_coeffs,
166                         const int16_t *round_ptr, const int16_t *quant_ptr,
167                         tran_low_t *qcoeff_ptr, tran_low_t *dqcoeff_ptr,
168                         const int16_t *dequant_ptr, uint16_t *eob_ptr,
169                         const int16_t *scan, const int16_t *iscan,
170                         int is_32x32) {
171   int i, eob = -1;
172   const int thr = dequant_ptr[1] >> (1 + is_32x32);
173   (void)iscan;
174
175   // Quantization pass: All coefficients with index >= zero_flag are
176   // skippable. Note: zero_flag can be zero.
177   for (i = 0; i < n_coeffs; i += 16) {
178     int y;
179     int nzflag_cnt = 0;
180     int abs_coeff[16];
181     int coeff_sign[16];
182
183     // count nzflag for each row (16 tran_low_t)
184     for (y = 0; y < 16; ++y) {
185       const int rc = i + y;
186       const int coeff = coeff_ptr[rc];
187       coeff_sign[y] = (coeff >> 31);
188       abs_coeff[y] = (coeff ^ coeff_sign[y]) - coeff_sign[y];
189       // The first 16 are skipped in the sse2 code.  Do the same here to match.
190       if (i >= 16 && (abs_coeff[y] <= thr)) {
191         nzflag_cnt++;
192       }
193     }
194
195     for (y = 0; y < 16; ++y) {
196       const int rc = i + y;
197       // If all of the AC coeffs in a row has magnitude less than the
198       // quantization step_size/2, quantize to zero.
199       if (nzflag_cnt < 16) {
200         int tmp;
201         int _round;
202
203         if (is_32x32) {
204           _round = ROUND_POWER_OF_TWO(round_ptr[rc != 0], 1);
205         } else {
206           _round = round_ptr[rc != 0];
207         }
208         tmp = clamp(abs_coeff[y] + _round, INT16_MIN, INT16_MAX);
209         tmp = (tmp * quant_ptr[rc != 0]) >> (16 - is_32x32);
210         qcoeff_ptr[rc] = (tmp ^ coeff_sign[y]) - coeff_sign[y];
211         dqcoeff_ptr[rc] =
212             static_cast<tran_low_t>(qcoeff_ptr[rc] * dequant_ptr[rc != 0]);
213
214         if (is_32x32) {
215           dqcoeff_ptr[rc] = static_cast<tran_low_t>(qcoeff_ptr[rc] *
216                                                     dequant_ptr[rc != 0] / 2);
217         } else {
218           dqcoeff_ptr[rc] =
219               static_cast<tran_low_t>(qcoeff_ptr[rc] * dequant_ptr[rc != 0]);
220         }
221       } else {
222         qcoeff_ptr[rc] = 0;
223         dqcoeff_ptr[rc] = 0;
224       }
225     }
226   }
227
228   // Scan for eob.
229   for (i = 0; i < n_coeffs; i++) {
230     // Use the scan order to find the correct eob.
231     const int rc = scan[i];
232     if (qcoeff_ptr[rc]) {
233       eob = i;
234     }
235   }
236   *eob_ptr = eob + 1;
237 }
238
239 void quantize_fp_nz_c(const tran_low_t *coeff_ptr, intptr_t n_coeffs,
240                       const int16_t *round_ptr, const int16_t *quant_ptr,
241                       tran_low_t *qcoeff_ptr, tran_low_t *dqcoeff_ptr,
242                       const int16_t *dequant_ptr, uint16_t *eob_ptr,
243                       const int16_t *scan, const int16_t *iscan) {
244   quant_fp_nz(coeff_ptr, n_coeffs, round_ptr, quant_ptr, qcoeff_ptr,
245               dqcoeff_ptr, dequant_ptr, eob_ptr, scan, iscan, 0);
246 }
247
248 void quantize_fp_32x32_nz_c(const tran_low_t *coeff_ptr, intptr_t n_coeffs,
249                             const int16_t *round_ptr, const int16_t *quant_ptr,
250                             tran_low_t *qcoeff_ptr, tran_low_t *dqcoeff_ptr,
251                             const int16_t *dequant_ptr, uint16_t *eob_ptr,
252                             const int16_t *scan, const int16_t *iscan) {
253   quant_fp_nz(coeff_ptr, n_coeffs, round_ptr, quant_ptr, qcoeff_ptr,
254               dqcoeff_ptr, dequant_ptr, eob_ptr, scan, iscan, 1);
255 }
256
257 void GenerateHelperArrays(ACMRandom *rnd, int16_t *zbin, int16_t *round,
258                           int16_t *quant, int16_t *quant_shift,
259                           int16_t *dequant, int16_t *round_fp,
260                           int16_t *quant_fp) {
261   // Max when q == 0.  Otherwise, it is 48 for Y and 42 for U/V.
262   const int max_qrounding_factor_fp = 64;
263
264   for (int j = 0; j < 2; j++) {
265     // The range is 4 to 1828 in the VP9 tables.
266     const int qlookup = rnd->RandRange(1825) + 4;
267     round_fp[j] = (max_qrounding_factor_fp * qlookup) >> 7;
268     quant_fp[j] = (1 << 16) / qlookup;
269
270     // Values determined by deconstructing vp9_init_quantizer().
271     // zbin may be up to 1143 for 8 and 10 bit Y values, or 1200 for 12 bit Y
272     // values or U/V values of any bit depth. This is because y_delta is not
273     // factored into the vp9_ac_quant() call.
274     zbin[j] = rnd->RandRange(1200);
275
276     // round may be up to 685 for Y values or 914 for U/V.
277     round[j] = rnd->RandRange(914);
278     // quant ranges from 1 to -32703
279     quant[j] = static_cast<int>(rnd->RandRange(32704)) - 32703;
280     // quant_shift goes up to 1 << 16.
281     quant_shift[j] = rnd->RandRange(16384);
282     // dequant maxes out at 1828 for all cases.
283     dequant[j] = rnd->RandRange(1828);
284   }
285   for (int j = 2; j < 8; j++) {
286     zbin[j] = zbin[1];
287     round_fp[j] = round_fp[1];
288     quant_fp[j] = quant_fp[1];
289     round[j] = round[1];
290     quant[j] = quant[1];
291     quant_shift[j] = quant_shift[1];
292     dequant[j] = dequant[1];
293   }
294 }
295
296 TEST_P(VP9QuantizeTest, OperationCheck) {
297   ACMRandom rnd(ACMRandom::DeterministicSeed());
298   ASSERT_TRUE(coeff_.Init());
299   ASSERT_TRUE(qcoeff_.Init());
300   ASSERT_TRUE(dqcoeff_.Init());
301   Buffer<tran_low_t> ref_qcoeff =
302       Buffer<tran_low_t>(max_size_, max_size_, 0, 32);
303   ASSERT_TRUE(ref_qcoeff.Init());
304   Buffer<tran_low_t> ref_dqcoeff =
305       Buffer<tran_low_t>(max_size_, max_size_, 0, 32);
306   ASSERT_TRUE(ref_dqcoeff.Init());
307   uint16_t ref_eob = 0;
308   eob_ = 0;
309
310   for (int i = 0; i < number_of_iterations; ++i) {
311     TX_SIZE sz;
312     if (max_size_ == 16) {
313       sz = static_cast<TX_SIZE>(i % 3);  // TX_4X4, TX_8X8 TX_16X16
314     } else {
315       sz = TX_32X32;
316     }
317     const TX_TYPE tx_type = static_cast<TX_TYPE>((i >> 2) % 3);
318     scan_ = &vp9_scan_orders[sz][tx_type];
319     count_ = (4 << sz) * (4 << sz);
320     coeff_.Set(&rnd, -max_value_, max_value_);
321     GenerateHelperArrays(&rnd, zbin_ptr_, round_ptr_, quant_ptr_,
322                          quant_shift_ptr_, dequant_ptr_, round_fp_ptr_,
323                          quant_fp_ptr_);
324     ref_quantize_op_(coeff_.TopLeftPixel(), count_, zbin_ptr_, r_ptr_, q_ptr_,
325                      quant_shift_ptr_, ref_qcoeff.TopLeftPixel(),
326                      ref_dqcoeff.TopLeftPixel(), dequant_ptr_, &ref_eob,
327                      scan_->scan, scan_->iscan);
328
329     ASM_REGISTER_STATE_CHECK(quantize_op_(
330         coeff_.TopLeftPixel(), count_, zbin_ptr_, r_ptr_, q_ptr_,
331         quant_shift_ptr_, qcoeff_.TopLeftPixel(), dqcoeff_.TopLeftPixel(),
332         dequant_ptr_, &eob_, scan_->scan, scan_->iscan));
333
334     EXPECT_TRUE(qcoeff_.CheckValues(ref_qcoeff));
335     EXPECT_TRUE(dqcoeff_.CheckValues(ref_dqcoeff));
336
337     EXPECT_EQ(eob_, ref_eob);
338
339     if (HasFailure()) {
340       printf("Failure on iteration %d.\n", i);
341       qcoeff_.PrintDifference(ref_qcoeff);
342       dqcoeff_.PrintDifference(ref_dqcoeff);
343       return;
344     }
345   }
346 }
347
348 TEST_P(VP9QuantizeTest, EOBCheck) {
349   ACMRandom rnd(ACMRandom::DeterministicSeed());
350   ASSERT_TRUE(coeff_.Init());
351   ASSERT_TRUE(qcoeff_.Init());
352   ASSERT_TRUE(dqcoeff_.Init());
353   Buffer<tran_low_t> ref_qcoeff =
354       Buffer<tran_low_t>(max_size_, max_size_, 0, 32);
355   ASSERT_TRUE(ref_qcoeff.Init());
356   Buffer<tran_low_t> ref_dqcoeff =
357       Buffer<tran_low_t>(max_size_, max_size_, 0, 32);
358   ASSERT_TRUE(ref_dqcoeff.Init());
359   uint16_t ref_eob = 0;
360   eob_ = 0;
361   const uint32_t max_index = max_size_ * max_size_ - 1;
362
363   for (int i = 0; i < number_of_iterations; ++i) {
364     TX_SIZE sz;
365     if (max_size_ == 16) {
366       sz = static_cast<TX_SIZE>(i % 3);  // TX_4X4, TX_8X8 TX_16X16
367     } else {
368       sz = TX_32X32;
369     }
370     const TX_TYPE tx_type = static_cast<TX_TYPE>((i >> 2) % 3);
371     scan_ = &vp9_scan_orders[sz][tx_type];
372     count_ = (4 << sz) * (4 << sz);
373     // Two random entries
374     coeff_.Set(0);
375     coeff_.TopLeftPixel()[rnd.RandRange(count_) & max_index] =
376         static_cast<int>(rnd.RandRange(max_value_ * 2)) - max_value_;
377     coeff_.TopLeftPixel()[rnd.RandRange(count_) & max_index] =
378         static_cast<int>(rnd.RandRange(max_value_ * 2)) - max_value_;
379     GenerateHelperArrays(&rnd, zbin_ptr_, round_ptr_, quant_ptr_,
380                          quant_shift_ptr_, dequant_ptr_, round_fp_ptr_,
381                          quant_fp_ptr_);
382     ref_quantize_op_(coeff_.TopLeftPixel(), count_, zbin_ptr_, r_ptr_, q_ptr_,
383                      quant_shift_ptr_, ref_qcoeff.TopLeftPixel(),
384                      ref_dqcoeff.TopLeftPixel(), dequant_ptr_, &ref_eob,
385                      scan_->scan, scan_->iscan);
386
387     ASM_REGISTER_STATE_CHECK(quantize_op_(
388         coeff_.TopLeftPixel(), count_, zbin_ptr_, r_ptr_, q_ptr_,
389         quant_shift_ptr_, qcoeff_.TopLeftPixel(), dqcoeff_.TopLeftPixel(),
390         dequant_ptr_, &eob_, scan_->scan, scan_->iscan));
391
392     EXPECT_TRUE(qcoeff_.CheckValues(ref_qcoeff));
393     EXPECT_TRUE(dqcoeff_.CheckValues(ref_dqcoeff));
394
395     EXPECT_EQ(eob_, ref_eob);
396
397     if (HasFailure()) {
398       printf("Failure on iteration %d.\n", i);
399       qcoeff_.PrintDifference(ref_qcoeff);
400       dqcoeff_.PrintDifference(ref_dqcoeff);
401       return;
402     }
403   }
404 }
405
406 TEST_P(VP9QuantizeTest, DISABLED_Speed) {
407   ACMRandom rnd(ACMRandom::DeterministicSeed());
408   ASSERT_TRUE(coeff_.Init());
409   ASSERT_TRUE(qcoeff_.Init());
410   ASSERT_TRUE(dqcoeff_.Init());
411   TX_SIZE starting_sz, ending_sz;
412
413   if (max_size_ == 16) {
414     starting_sz = TX_4X4;
415     ending_sz = TX_16X16;
416   } else {
417     starting_sz = TX_32X32;
418     ending_sz = TX_32X32;
419   }
420
421   for (TX_SIZE sz = starting_sz; sz <= ending_sz; ++sz) {
422     // zbin > coeff, zbin < coeff.
423     for (int i = 0; i < 2; ++i) {
424       // TX_TYPE defines the scan order. That is not relevant to the speed test.
425       // Pick the first one.
426       const TX_TYPE tx_type = DCT_DCT;
427       count_ = (4 << sz) * (4 << sz);
428       scan_ = &vp9_scan_orders[sz][tx_type];
429
430       GenerateHelperArrays(&rnd, zbin_ptr_, round_ptr_, quant_ptr_,
431                            quant_shift_ptr_, dequant_ptr_, round_fp_ptr_,
432                            quant_fp_ptr_);
433
434       if (i == 0) {
435         // When |coeff values| are less than zbin the results are 0.
436         int threshold = 100;
437         if (max_size_ == 32) {
438           // For 32x32, the threshold is halved. Double it to keep the values
439           // from clearing it.
440           threshold = 200;
441         }
442         for (int j = 0; j < 8; ++j) zbin_ptr_[j] = threshold;
443         coeff_.Set(&rnd, -99, 99);
444       } else if (i == 1) {
445         for (int j = 0; j < 8; ++j) zbin_ptr_[j] = 50;
446         coeff_.Set(&rnd, -500, 500);
447       }
448
449       RunNTimes(10000000 / count_);
450       const char *type =
451           (i == 0) ? "Bypass calculations " : "Full calculations ";
452       char block_size[16];
453       snprintf(block_size, sizeof(block_size), "%dx%d", 4 << sz, 4 << sz);
454       char title[100];
455       snprintf(title, sizeof(title), "%25s %8s ", type, block_size);
456       PrintMedian(title);
457     }
458   }
459 }
460
461 using std::make_tuple;
462
463 #if HAVE_SSE2
464 #if CONFIG_VP9_HIGHBITDEPTH
465 INSTANTIATE_TEST_SUITE_P(
466     SSE2, VP9QuantizeTest,
467     ::testing::Values(
468         make_tuple(&vpx_quantize_b_sse2, &vpx_quantize_b_c, VPX_BITS_8, 16,
469                    false),
470         make_tuple(&vpx_highbd_quantize_b_sse2, &vpx_highbd_quantize_b_c,
471                    VPX_BITS_8, 16, false),
472         make_tuple(&vpx_highbd_quantize_b_sse2, &vpx_highbd_quantize_b_c,
473                    VPX_BITS_10, 16, false),
474         make_tuple(&vpx_highbd_quantize_b_sse2, &vpx_highbd_quantize_b_c,
475                    VPX_BITS_12, 16, false),
476         make_tuple(&vpx_highbd_quantize_b_32x32_sse2,
477                    &vpx_highbd_quantize_b_32x32_c, VPX_BITS_8, 32, false),
478         make_tuple(&vpx_highbd_quantize_b_32x32_sse2,
479                    &vpx_highbd_quantize_b_32x32_c, VPX_BITS_10, 32, false),
480         make_tuple(&vpx_highbd_quantize_b_32x32_sse2,
481                    &vpx_highbd_quantize_b_32x32_c, VPX_BITS_12, 32, false)));
482
483 #else
484 INSTANTIATE_TEST_SUITE_P(
485     SSE2, VP9QuantizeTest,
486     ::testing::Values(make_tuple(&vpx_quantize_b_sse2, &vpx_quantize_b_c,
487                                  VPX_BITS_8, 16, false),
488                       make_tuple(&QuantFPWrapper<vp9_quantize_fp_sse2>,
489                                  &QuantFPWrapper<quantize_fp_nz_c>, VPX_BITS_8,
490                                  16, true)));
491 #endif  // CONFIG_VP9_HIGHBITDEPTH
492 #endif  // HAVE_SSE2
493
494 #if HAVE_SSSE3
495 #if VPX_ARCH_X86_64
496 INSTANTIATE_TEST_SUITE_P(
497     SSSE3, VP9QuantizeTest,
498     ::testing::Values(make_tuple(&vpx_quantize_b_ssse3, &vpx_quantize_b_c,
499                                  VPX_BITS_8, 16, false),
500                       make_tuple(&vpx_quantize_b_32x32_ssse3,
501                                  &vpx_quantize_b_32x32_c, VPX_BITS_8, 32,
502                                  false),
503                       make_tuple(&QuantFPWrapper<vp9_quantize_fp_ssse3>,
504                                  &QuantFPWrapper<quantize_fp_nz_c>, VPX_BITS_8,
505                                  16, true),
506                       make_tuple(&QuantFPWrapper<vp9_quantize_fp_32x32_ssse3>,
507                                  &QuantFPWrapper<quantize_fp_32x32_nz_c>,
508                                  VPX_BITS_8, 32, true)));
509 #else
510 INSTANTIATE_TEST_SUITE_P(
511     SSSE3, VP9QuantizeTest,
512     ::testing::Values(make_tuple(&vpx_quantize_b_ssse3, &vpx_quantize_b_c,
513                                  VPX_BITS_8, 16, false),
514                       make_tuple(&vpx_quantize_b_32x32_ssse3,
515                                  &vpx_quantize_b_32x32_c, VPX_BITS_8, 32,
516                                  false)));
517
518 #endif  // VPX_ARCH_X86_64
519 #endif  // HAVE_SSSE3
520
521 #if HAVE_AVX
522 INSTANTIATE_TEST_SUITE_P(AVX, VP9QuantizeTest,
523                          ::testing::Values(make_tuple(&vpx_quantize_b_avx,
524                                                       &vpx_quantize_b_c,
525                                                       VPX_BITS_8, 16, false),
526                                            make_tuple(&vpx_quantize_b_32x32_avx,
527                                                       &vpx_quantize_b_32x32_c,
528                                                       VPX_BITS_8, 32, false)));
529 #endif  // HAVE_AVX
530
531 #if VPX_ARCH_X86_64 && HAVE_AVX2
532 INSTANTIATE_TEST_SUITE_P(
533     AVX2, VP9QuantizeTest,
534     ::testing::Values(make_tuple(&QuantFPWrapper<vp9_quantize_fp_avx2>,
535                                  &QuantFPWrapper<quantize_fp_nz_c>, VPX_BITS_8,
536                                  16, true)));
537 #endif  // HAVE_AVX2
538
539 #if HAVE_NEON
540 INSTANTIATE_TEST_SUITE_P(
541     NEON, VP9QuantizeTest,
542     ::testing::Values(make_tuple(&vpx_quantize_b_neon, &vpx_quantize_b_c,
543                                  VPX_BITS_8, 16, false),
544                       make_tuple(&vpx_quantize_b_32x32_neon,
545                                  &vpx_quantize_b_32x32_c, VPX_BITS_8, 32,
546                                  false),
547                       make_tuple(&QuantFPWrapper<vp9_quantize_fp_neon>,
548                                  &QuantFPWrapper<vp9_quantize_fp_c>, VPX_BITS_8,
549                                  16, true),
550                       make_tuple(&QuantFPWrapper<vp9_quantize_fp_32x32_neon>,
551                                  &QuantFPWrapper<vp9_quantize_fp_32x32_c>,
552                                  VPX_BITS_8, 32, true)));
553 #endif  // HAVE_NEON
554
555 #if HAVE_VSX && !CONFIG_VP9_HIGHBITDEPTH
556 INSTANTIATE_TEST_SUITE_P(
557     VSX, VP9QuantizeTest,
558     ::testing::Values(make_tuple(&vpx_quantize_b_vsx, &vpx_quantize_b_c,
559                                  VPX_BITS_8, 16, false),
560                       make_tuple(&vpx_quantize_b_32x32_vsx,
561                                  &vpx_quantize_b_32x32_c, VPX_BITS_8, 32,
562                                  false),
563                       make_tuple(&QuantFPWrapper<vp9_quantize_fp_vsx>,
564                                  &QuantFPWrapper<vp9_quantize_fp_c>, VPX_BITS_8,
565                                  16, true),
566                       make_tuple(&QuantFPWrapper<vp9_quantize_fp_32x32_vsx>,
567                                  &QuantFPWrapper<vp9_quantize_fp_32x32_c>,
568                                  VPX_BITS_8, 32, true)));
569 #endif  // HAVE_VSX && !CONFIG_VP9_HIGHBITDEPTH
570
571 // Only useful to compare "Speed" test results.
572 INSTANTIATE_TEST_SUITE_P(
573     DISABLED_C, VP9QuantizeTest,
574     ::testing::Values(
575         make_tuple(&vpx_quantize_b_c, &vpx_quantize_b_c, VPX_BITS_8, 16, false),
576         make_tuple(&vpx_quantize_b_32x32_c, &vpx_quantize_b_32x32_c, VPX_BITS_8,
577                    32, false),
578         make_tuple(&QuantFPWrapper<vp9_quantize_fp_c>,
579                    &QuantFPWrapper<vp9_quantize_fp_c>, VPX_BITS_8, 16, true),
580         make_tuple(&QuantFPWrapper<quantize_fp_nz_c>,
581                    &QuantFPWrapper<quantize_fp_nz_c>, VPX_BITS_8, 16, true),
582         make_tuple(&QuantFPWrapper<quantize_fp_32x32_nz_c>,
583                    &QuantFPWrapper<quantize_fp_32x32_nz_c>, VPX_BITS_8, 32,
584                    true),
585         make_tuple(&QuantFPWrapper<vp9_quantize_fp_32x32_c>,
586                    &QuantFPWrapper<vp9_quantize_fp_32x32_c>, VPX_BITS_8, 32,
587                    true)));
588 }  // namespace