Yi Luo | ef39c84 | 2017-05-19 11:51:53 -0700 | [diff] [blame] | 1 | /* |
James Zern | b7c05bd | 2024-06-11 19:15:10 -0700 | [diff] [blame^] | 2 | * Copyright (c) 2017, Alliance for Open Media. All rights reserved. |
Yi Luo | ef39c84 | 2017-05-19 11:51:53 -0700 | [diff] [blame] | 3 | * |
| 4 | * This source code is subject to the terms of the BSD 2 Clause License and |
| 5 | * the Alliance for Open Media Patent License 1.0. If the BSD 2 Clause License |
| 6 | * was not distributed with this source code in the LICENSE file, you can |
| 7 | * obtain it at www.aomedia.org/license/software. If the Alliance for Open |
| 8 | * Media Patent License 1.0 was not distributed with this source code in the |
| 9 | * PATENTS file, you can obtain it at www.aomedia.org/license/patent. |
| 10 | */ |
| 11 | |
Scott LaVarnway | 61f1e35 | 2022-05-06 05:19:00 -0700 | [diff] [blame] | 12 | #include <algorithm> |
sarahparker | a543df5 | 2018-11-02 16:02:05 -0700 | [diff] [blame] | 13 | #include <tuple> |
| 14 | |
Yi Luo | ef39c84 | 2017-05-19 11:51:53 -0700 | [diff] [blame] | 15 | #include "third_party/googletest/src/googletest/include/gtest/gtest.h" |
| 16 | |
Tom Finegan | 60e653d | 2018-05-22 11:34:58 -0700 | [diff] [blame] | 17 | #include "config/aom_config.h" |
Tom Finegan | 44702c8 | 2018-05-22 13:00:39 -0700 | [diff] [blame] | 18 | #include "config/aom_dsp_rtcd.h" |
| 19 | #include "config/av1_rtcd.h" |
Tom Finegan | 60e653d | 2018-05-22 11:34:58 -0700 | [diff] [blame] | 20 | |
Yi Luo | ef39c84 | 2017-05-19 11:51:53 -0700 | [diff] [blame] | 21 | #include "aom/aom_codec.h" |
Wan-Teh Chang | 87a1e9e | 2024-03-26 21:44:29 -0700 | [diff] [blame] | 22 | #include "aom_dsp/txfm_common.h" |
Yi Luo | 2d44b69 | 2017-06-07 16:41:51 -0700 | [diff] [blame] | 23 | #include "aom_ports/aom_timer.h" |
Yi Luo | ef39c84 | 2017-05-19 11:51:53 -0700 | [diff] [blame] | 24 | #include "av1/encoder/encoder.h" |
Peng Bin | 03ea522 | 2018-04-12 15:59:54 +0800 | [diff] [blame] | 25 | #include "av1/common/scan.h" |
Yi Luo | ef39c84 | 2017-05-19 11:51:53 -0700 | [diff] [blame] | 26 | #include "test/acm_random.h" |
Yi Luo | ef39c84 | 2017-05-19 11:51:53 -0700 | [diff] [blame] | 27 | #include "test/register_state_check.h" |
| 28 | #include "test/util.h" |
| 29 | |
| 30 | namespace { |
| 31 | using libaom_test::ACMRandom; |
| 32 | |
Peng Bin | 6b97198 | 2018-09-07 15:21:40 +0800 | [diff] [blame] | 33 | #define QUAN_PARAM_LIST \ |
Peng Bin | 437cbae | 2018-04-19 20:39:22 +0800 | [diff] [blame] | 34 | const tran_low_t *coeff_ptr, intptr_t n_coeffs, const int16_t *zbin_ptr, \ |
| 35 | const int16_t *round_ptr, const int16_t *quant_ptr, \ |
| 36 | const int16_t *quant_shift_ptr, tran_low_t *qcoeff_ptr, \ |
| 37 | tran_low_t *dqcoeff_ptr, const int16_t *dequant_ptr, uint16_t *eob_ptr, \ |
| 38 | const int16_t *scan, const int16_t *iscan |
| 39 | |
Jerome Jiang | 3838b5c | 2020-09-01 18:28:52 -0700 | [diff] [blame] | 40 | #define LP_QUANTIZE_PARAM_LIST \ |
| 41 | const int16_t *coeff_ptr, intptr_t n_coeffs, const int16_t *round_ptr, \ |
| 42 | const int16_t *quant_ptr, int16_t *qcoeff_ptr, int16_t *dqcoeff_ptr, \ |
| 43 | const int16_t *dequant_ptr, uint16_t *eob_ptr, const int16_t *scan, \ |
| 44 | const int16_t *iscan |
| 45 | |
| 46 | typedef void (*LPQuantizeFunc)(LP_QUANTIZE_PARAM_LIST); |
Yi Luo | 6faf349 | 2017-06-15 16:56:08 -0700 | [diff] [blame] | 47 | typedef void (*QuantizeFunc)(QUAN_PARAM_LIST); |
Peng Bin | 6b97198 | 2018-09-07 15:21:40 +0800 | [diff] [blame] | 48 | typedef void (*QuantizeFuncHbd)(QUAN_PARAM_LIST, int log_scale); |
Yi Luo | 6faf349 | 2017-06-15 16:56:08 -0700 | [diff] [blame] | 49 | |
Jerome Jiang | 3838b5c | 2020-09-01 18:28:52 -0700 | [diff] [blame] | 50 | #undef LP_QUANTIZE_PARAM_LIST |
| 51 | |
Yi Luo | 6faf349 | 2017-06-15 16:56:08 -0700 | [diff] [blame] | 52 | #define HBD_QUAN_FUNC \ |
Peng Bin | 0dcd23c | 2018-04-19 21:42:30 +0800 | [diff] [blame] | 53 | fn(coeff_ptr, n_coeffs, zbin_ptr, round_ptr, quant_ptr, quant_shift_ptr, \ |
| 54 | qcoeff_ptr, dqcoeff_ptr, dequant_ptr, eob_ptr, scan, iscan, log_scale) |
Yi Luo | 6faf349 | 2017-06-15 16:56:08 -0700 | [diff] [blame] | 55 | |
Peng Bin | 6b97198 | 2018-09-07 15:21:40 +0800 | [diff] [blame] | 56 | #define LBD_QUAN_FUNC \ |
Peng Bin | 437cbae | 2018-04-19 20:39:22 +0800 | [diff] [blame] | 57 | fn(coeff_ptr, n_coeffs, zbin_ptr, round_ptr, quant_ptr, quant_shift_ptr, \ |
| 58 | qcoeff_ptr, dqcoeff_ptr, dequant_ptr, eob_ptr, scan, iscan) |
| 59 | |
Yi Luo | 6faf349 | 2017-06-15 16:56:08 -0700 | [diff] [blame] | 60 | template <QuantizeFuncHbd fn> |
| 61 | void highbd_quan16x16_wrapper(QUAN_PARAM_LIST) { |
| 62 | const int log_scale = 0; |
| 63 | HBD_QUAN_FUNC; |
| 64 | } |
| 65 | |
| 66 | template <QuantizeFuncHbd fn> |
| 67 | void highbd_quan32x32_wrapper(QUAN_PARAM_LIST) { |
| 68 | const int log_scale = 1; |
| 69 | HBD_QUAN_FUNC; |
| 70 | } |
| 71 | |
| 72 | template <QuantizeFuncHbd fn> |
| 73 | void highbd_quan64x64_wrapper(QUAN_PARAM_LIST) { |
| 74 | const int log_scale = 2; |
| 75 | HBD_QUAN_FUNC; |
| 76 | } |
Yi Luo | ef39c84 | 2017-05-19 11:51:53 -0700 | [diff] [blame] | 77 | |
Pascal Massimino | a6fe432 | 2019-04-09 09:49:24 +0200 | [diff] [blame] | 78 | enum QuantType { TYPE_B, TYPE_DC, TYPE_FP }; |
Yi Luo | 193422e | 2017-06-19 15:54:06 -0700 | [diff] [blame] | 79 | |
sarahparker | a543df5 | 2018-11-02 16:02:05 -0700 | [diff] [blame] | 80 | using std::tuple; |
Jerome Jiang | 3838b5c | 2020-09-01 18:28:52 -0700 | [diff] [blame] | 81 | |
| 82 | template <typename FuncType> |
| 83 | using QuantizeParam = |
| 84 | tuple<FuncType, FuncType, TX_SIZE, QuantType, aom_bit_depth_t>; |
Yi Luo | ef39c84 | 2017-05-19 11:51:53 -0700 | [diff] [blame] | 85 | |
| 86 | typedef struct { |
| 87 | QUANTS quant; |
| 88 | Dequants dequant; |
| 89 | } QuanTable; |
| 90 | |
| 91 | const int kTestNum = 1000; |
| 92 | |
Jerome Jiang | 3838b5c | 2020-09-01 18:28:52 -0700 | [diff] [blame] | 93 | #define GET_TEMPLATE_PARAM(k) std::get<k>(this->GetParam()) |
| 94 | |
| 95 | template <typename CoeffType, typename FuncType> |
| 96 | class QuantizeTestBase |
| 97 | : public ::testing::TestWithParam<QuantizeParam<FuncType>> { |
Yi Luo | ef39c84 | 2017-05-19 11:51:53 -0700 | [diff] [blame] | 98 | protected: |
Jerome Jiang | e58af08 | 2020-08-28 14:53:14 -0700 | [diff] [blame] | 99 | QuantizeTestBase() |
Jerome Jiang | 3838b5c | 2020-09-01 18:28:52 -0700 | [diff] [blame] | 100 | : quant_ref_(GET_TEMPLATE_PARAM(0)), quant_(GET_TEMPLATE_PARAM(1)), |
| 101 | tx_size_(GET_TEMPLATE_PARAM(2)), type_(GET_TEMPLATE_PARAM(3)), |
| 102 | bd_(GET_TEMPLATE_PARAM(4)) {} |
Yi Luo | ef39c84 | 2017-05-19 11:51:53 -0700 | [diff] [blame] | 103 | |
James Zern | f1fa1eb | 2023-07-25 15:34:13 -0700 | [diff] [blame] | 104 | ~QuantizeTestBase() override = default; |
Yi Luo | ef39c84 | 2017-05-19 11:51:53 -0700 | [diff] [blame] | 105 | |
James Zern | faa2dcf | 2023-07-24 18:29:51 -0700 | [diff] [blame] | 106 | void SetUp() override { |
Yi Luo | 2d44b69 | 2017-06-07 16:41:51 -0700 | [diff] [blame] | 107 | qtab_ = reinterpret_cast<QuanTable *>(aom_memalign(32, sizeof(*qtab_))); |
James Zern | 1633b59 | 2021-11-22 15:48:34 -0800 | [diff] [blame] | 108 | ASSERT_NE(qtab_, nullptr); |
Yi Luo | 7e2dce0 | 2017-06-06 10:15:22 -0700 | [diff] [blame] | 109 | const int n_coeffs = coeff_num(); |
Jerome Jiang | e58af08 | 2020-08-28 14:53:14 -0700 | [diff] [blame] | 110 | coeff_ = reinterpret_cast<CoeffType *>( |
| 111 | aom_memalign(32, 6 * n_coeffs * sizeof(CoeffType))); |
James Zern | 1633b59 | 2021-11-22 15:48:34 -0800 | [diff] [blame] | 112 | ASSERT_NE(coeff_, nullptr); |
Yi Luo | ef39c84 | 2017-05-19 11:51:53 -0700 | [diff] [blame] | 113 | InitQuantizer(); |
| 114 | } |
| 115 | |
James Zern | faa2dcf | 2023-07-24 18:29:51 -0700 | [diff] [blame] | 116 | void TearDown() override { |
Yi Luo | ef39c84 | 2017-05-19 11:51:53 -0700 | [diff] [blame] | 117 | aom_free(qtab_); |
James Zern | 664f04d | 2022-05-24 17:30:58 -0700 | [diff] [blame] | 118 | qtab_ = nullptr; |
Yi Luo | ef39c84 | 2017-05-19 11:51:53 -0700 | [diff] [blame] | 119 | aom_free(coeff_); |
James Zern | 664f04d | 2022-05-24 17:30:58 -0700 | [diff] [blame] | 120 | coeff_ = nullptr; |
Yi Luo | ef39c84 | 2017-05-19 11:51:53 -0700 | [diff] [blame] | 121 | } |
| 122 | |
| 123 | void InitQuantizer() { |
Yaowu Xu | be42dc7 | 2017-11-08 17:38:24 -0800 | [diff] [blame] | 124 | av1_build_quantizer(bd_, 0, 0, 0, 0, 0, &qtab_->quant, &qtab_->dequant); |
Yi Luo | ef39c84 | 2017-05-19 11:51:53 -0700 | [diff] [blame] | 125 | } |
| 126 | |
Jerome Jiang | e58af08 | 2020-08-28 14:53:14 -0700 | [diff] [blame] | 127 | virtual void RunQuantizeFunc( |
| 128 | const CoeffType *coeff_ptr, intptr_t n_coeffs, const int16_t *zbin_ptr, |
| 129 | const int16_t *round_ptr, const int16_t *quant_ptr, |
| 130 | const int16_t *quant_shift_ptr, CoeffType *qcoeff_ptr, |
| 131 | CoeffType *qcoeff_ref_ptr, CoeffType *dqcoeff_ptr, |
| 132 | CoeffType *dqcoeff_ref_ptr, const int16_t *dequant_ptr, |
| 133 | uint16_t *eob_ref_ptr, uint16_t *eob_ptr, const int16_t *scan, |
| 134 | const int16_t *iscan) = 0; |
| 135 | |
Yi Luo | 7e2dce0 | 2017-06-06 10:15:22 -0700 | [diff] [blame] | 136 | void QuantizeRun(bool is_loop, int q = 0, int test_num = 1) { |
Jerome Jiang | e58af08 | 2020-08-28 14:53:14 -0700 | [diff] [blame] | 137 | CoeffType *coeff_ptr = coeff_; |
Yi Luo | 7e2dce0 | 2017-06-06 10:15:22 -0700 | [diff] [blame] | 138 | const intptr_t n_coeffs = coeff_num(); |
Yi Luo | ef39c84 | 2017-05-19 11:51:53 -0700 | [diff] [blame] | 139 | |
Jerome Jiang | e58af08 | 2020-08-28 14:53:14 -0700 | [diff] [blame] | 140 | CoeffType *qcoeff_ref = coeff_ptr + n_coeffs; |
| 141 | CoeffType *dqcoeff_ref = qcoeff_ref + n_coeffs; |
Yi Luo | ef39c84 | 2017-05-19 11:51:53 -0700 | [diff] [blame] | 142 | |
Jerome Jiang | e58af08 | 2020-08-28 14:53:14 -0700 | [diff] [blame] | 143 | CoeffType *qcoeff = dqcoeff_ref + n_coeffs; |
| 144 | CoeffType *dqcoeff = qcoeff + n_coeffs; |
Yi Luo | ef39c84 | 2017-05-19 11:51:53 -0700 | [diff] [blame] | 145 | uint16_t *eob = (uint16_t *)(dqcoeff + n_coeffs); |
| 146 | |
| 147 | // Testing uses 2-D DCT scan order table |
Peng Bin | 03ea522 | 2018-04-12 15:59:54 +0800 | [diff] [blame] | 148 | const SCAN_ORDER *const sc = get_default_scan(tx_size_, DCT_DCT); |
Yi Luo | ef39c84 | 2017-05-19 11:51:53 -0700 | [diff] [blame] | 149 | |
| 150 | // Testing uses luminance quantization table |
| 151 | const int16_t *zbin = qtab_->quant.y_zbin[q]; |
Yi Luo | 193422e | 2017-06-19 15:54:06 -0700 | [diff] [blame] | 152 | |
James Zern | 65fca7c | 2023-07-25 15:39:01 -0700 | [diff] [blame] | 153 | const int16_t *round = nullptr; |
| 154 | const int16_t *quant = nullptr; |
Yi Luo | 193422e | 2017-06-19 15:54:06 -0700 | [diff] [blame] | 155 | if (type_ == TYPE_B) { |
| 156 | round = qtab_->quant.y_round[q]; |
| 157 | quant = qtab_->quant.y_quant[q]; |
| 158 | } else if (type_ == TYPE_FP) { |
| 159 | round = qtab_->quant.y_round_fp[q]; |
| 160 | quant = qtab_->quant.y_quant_fp[q]; |
| 161 | } |
| 162 | |
Yi Luo | ef39c84 | 2017-05-19 11:51:53 -0700 | [diff] [blame] | 163 | const int16_t *quant_shift = qtab_->quant.y_quant_shift[q]; |
Monty Montgomery | 125c0fc | 2017-10-26 00:44:35 -0400 | [diff] [blame] | 164 | const int16_t *dequant = qtab_->dequant.y_dequant_QTX[q]; |
Yi Luo | ef39c84 | 2017-05-19 11:51:53 -0700 | [diff] [blame] | 165 | |
Yi Luo | 7e2dce0 | 2017-06-06 10:15:22 -0700 | [diff] [blame] | 166 | for (int i = 0; i < test_num; ++i) { |
| 167 | if (is_loop) FillCoeffRandom(); |
Yi Luo | ef39c84 | 2017-05-19 11:51:53 -0700 | [diff] [blame] | 168 | |
| 169 | memset(qcoeff_ref, 0, 5 * n_coeffs * sizeof(*qcoeff_ref)); |
| 170 | |
Jerome Jiang | e58af08 | 2020-08-28 14:53:14 -0700 | [diff] [blame] | 171 | RunQuantizeFunc(coeff_ptr, n_coeffs, zbin, round, quant, quant_shift, |
| 172 | qcoeff, qcoeff_ref, dqcoeff, dqcoeff_ref, dequant, |
| 173 | &eob[0], &eob[1], sc->scan, sc->iscan); |
| 174 | |
Yi Luo | 2d44b69 | 2017-06-07 16:41:51 -0700 | [diff] [blame] | 175 | for (int j = 0; j < n_coeffs; ++j) { |
| 176 | ASSERT_EQ(qcoeff_ref[j], qcoeff[j]) |
| 177 | << "Q mismatch on test: " << i << " at position: " << j |
| 178 | << " Q: " << q << " coeff: " << coeff_ptr[j]; |
| 179 | } |
| 180 | |
| 181 | for (int j = 0; j < n_coeffs; ++j) { |
| 182 | ASSERT_EQ(dqcoeff_ref[j], dqcoeff[j]) |
| 183 | << "Dq mismatch on test: " << i << " at position: " << j |
| 184 | << " Q: " << q << " coeff: " << coeff_ptr[j]; |
| 185 | } |
| 186 | |
clang-format | 4eafefe | 2017-09-04 12:51:20 -0700 | [diff] [blame] | 187 | ASSERT_EQ(eob[0], eob[1]) |
| 188 | << "eobs mismatch on test: " << i << " Q: " << q; |
Yi Luo | ef39c84 | 2017-05-19 11:51:53 -0700 | [diff] [blame] | 189 | } |
| 190 | } |
| 191 | |
Jerome Jiang | e58af08 | 2020-08-28 14:53:14 -0700 | [diff] [blame] | 192 | void CompareResults(const CoeffType *buf_ref, const CoeffType *buf, int size, |
| 193 | const char *text, int q, int number) { |
Yi Luo | ef39c84 | 2017-05-19 11:51:53 -0700 | [diff] [blame] | 194 | int i; |
| 195 | for (i = 0; i < size; ++i) { |
| 196 | ASSERT_EQ(buf_ref[i], buf[i]) << text << " mismatch on test: " << number |
| 197 | << " at position: " << i << " Q: " << q; |
| 198 | } |
| 199 | } |
| 200 | |
Urvang Joshi | 8089315 | 2017-10-27 11:51:14 -0700 | [diff] [blame] | 201 | int coeff_num() const { return av1_get_max_eob(tx_size_); } |
Yi Luo | ef39c84 | 2017-05-19 11:51:53 -0700 | [diff] [blame] | 202 | |
Jerome Jiang | e58af08 | 2020-08-28 14:53:14 -0700 | [diff] [blame] | 203 | void FillCoeff(CoeffType c) { |
Yi Luo | 7e2dce0 | 2017-06-06 10:15:22 -0700 | [diff] [blame] | 204 | const int n_coeffs = coeff_num(); |
| 205 | for (int i = 0; i < n_coeffs; ++i) { |
| 206 | coeff_[i] = c; |
Yi Luo | ef39c84 | 2017-05-19 11:51:53 -0700 | [diff] [blame] | 207 | } |
| 208 | } |
| 209 | |
Yi Luo | 7e2dce0 | 2017-06-06 10:15:22 -0700 | [diff] [blame] | 210 | void FillCoeffRandom() { |
| 211 | const int n_coeffs = coeff_num(); |
| 212 | FillCoeffZero(); |
Scott LaVarnway | 61f1e35 | 2022-05-06 05:19:00 -0700 | [diff] [blame] | 213 | const int num = rnd_.Rand16() % n_coeffs; |
| 214 | // Randomize the first non zero coeff position. |
| 215 | const int start = rnd_.Rand16() % n_coeffs; |
| 216 | const int end = std::min(start + num, n_coeffs); |
| 217 | for (int i = start; i < end; ++i) { |
Yi Luo | 7e2dce0 | 2017-06-06 10:15:22 -0700 | [diff] [blame] | 218 | coeff_[i] = GetRandomCoeff(); |
| 219 | } |
| 220 | } |
| 221 | |
Aniket Dhok | 64a5e40 | 2019-03-19 20:15:29 +0530 | [diff] [blame] | 222 | void FillCoeffRandomRows(int num) { |
| 223 | FillCoeffZero(); |
| 224 | for (int i = 0; i < num; ++i) { |
| 225 | coeff_[i] = GetRandomCoeff(); |
| 226 | } |
| 227 | } |
| 228 | |
Yi Luo | 7e2dce0 | 2017-06-06 10:15:22 -0700 | [diff] [blame] | 229 | void FillCoeffZero() { FillCoeff(0); } |
Yi Luo | ef39c84 | 2017-05-19 11:51:53 -0700 | [diff] [blame] | 230 | |
| 231 | void FillCoeffConstant() { |
Jerome Jiang | e58af08 | 2020-08-28 14:53:14 -0700 | [diff] [blame] | 232 | CoeffType c = GetRandomCoeff(); |
Yi Luo | 7e2dce0 | 2017-06-06 10:15:22 -0700 | [diff] [blame] | 233 | FillCoeff(c); |
Yi Luo | ef39c84 | 2017-05-19 11:51:53 -0700 | [diff] [blame] | 234 | } |
| 235 | |
| 236 | void FillDcOnly() { |
| 237 | FillCoeffZero(); |
| 238 | coeff_[0] = GetRandomCoeff(); |
| 239 | } |
| 240 | |
| 241 | void FillDcLargeNegative() { |
| 242 | FillCoeffZero(); |
| 243 | // Generate a qcoeff which contains 512/-512 (0x0100/0xFE00) to catch issues |
| 244 | // like BUG=883 where the constant being compared was incorrectly |
| 245 | // initialized. |
| 246 | coeff_[0] = -8191; |
| 247 | } |
| 248 | |
Jerome Jiang | e58af08 | 2020-08-28 14:53:14 -0700 | [diff] [blame] | 249 | CoeffType GetRandomCoeff() { |
| 250 | CoeffType coeff; |
Yi Luo | 6faf349 | 2017-06-15 16:56:08 -0700 | [diff] [blame] | 251 | if (bd_ == AOM_BITS_8) { |
| 252 | coeff = |
| 253 | clamp(static_cast<int16_t>(rnd_.Rand16()), INT16_MIN + 1, INT16_MAX); |
| 254 | } else { |
Jerome Jiang | e58af08 | 2020-08-28 14:53:14 -0700 | [diff] [blame] | 255 | CoeffType min = -(1 << (7 + bd_)); |
| 256 | CoeffType max = -min - 1; |
| 257 | coeff = clamp(static_cast<CoeffType>(rnd_.Rand31()), min, max); |
Yi Luo | 6faf349 | 2017-06-15 16:56:08 -0700 | [diff] [blame] | 258 | } |
| 259 | return coeff; |
Yi Luo | ef39c84 | 2017-05-19 11:51:53 -0700 | [diff] [blame] | 260 | } |
| 261 | |
| 262 | ACMRandom rnd_; |
| 263 | QuanTable *qtab_; |
Jerome Jiang | e58af08 | 2020-08-28 14:53:14 -0700 | [diff] [blame] | 264 | CoeffType *coeff_; |
Jerome Jiang | 3838b5c | 2020-09-01 18:28:52 -0700 | [diff] [blame] | 265 | FuncType quant_ref_; |
| 266 | FuncType quant_; |
Yi Luo | ef39c84 | 2017-05-19 11:51:53 -0700 | [diff] [blame] | 267 | TX_SIZE tx_size_; |
Yi Luo | 193422e | 2017-06-19 15:54:06 -0700 | [diff] [blame] | 268 | QuantType type_; |
Yi Luo | ef39c84 | 2017-05-19 11:51:53 -0700 | [diff] [blame] | 269 | aom_bit_depth_t bd_; |
| 270 | }; |
| 271 | |
Jerome Jiang | 3838b5c | 2020-09-01 18:28:52 -0700 | [diff] [blame] | 272 | class FullPrecisionQuantizeTest |
| 273 | : public QuantizeTestBase<tran_low_t, QuantizeFunc> { |
Jerome Jiang | e58af08 | 2020-08-28 14:53:14 -0700 | [diff] [blame] | 274 | void RunQuantizeFunc(const tran_low_t *coeff_ptr, intptr_t n_coeffs, |
| 275 | const int16_t *zbin_ptr, const int16_t *round_ptr, |
| 276 | const int16_t *quant_ptr, const int16_t *quant_shift_ptr, |
| 277 | tran_low_t *qcoeff_ptr, tran_low_t *qcoeff_ref_ptr, |
| 278 | tran_low_t *dqcoeff_ptr, tran_low_t *dqcoeff_ref_ptr, |
| 279 | const int16_t *dequant_ptr, uint16_t *eob_ref_ptr, |
| 280 | uint16_t *eob_ptr, const int16_t *scan, |
| 281 | const int16_t *iscan) override { |
| 282 | quant_ref_(coeff_ptr, n_coeffs, zbin_ptr, round_ptr, quant_ptr, |
| 283 | quant_shift_ptr, qcoeff_ref_ptr, dqcoeff_ref_ptr, dequant_ptr, |
| 284 | eob_ref_ptr, scan, iscan); |
| 285 | |
chiyotsai | ef26106 | 2021-07-01 14:01:45 -0700 | [diff] [blame] | 286 | API_REGISTER_STATE_CHECK(quant_( |
Jerome Jiang | e58af08 | 2020-08-28 14:53:14 -0700 | [diff] [blame] | 287 | coeff_ptr, n_coeffs, zbin_ptr, round_ptr, quant_ptr, quant_shift_ptr, |
| 288 | qcoeff_ptr, dqcoeff_ptr, dequant_ptr, eob_ptr, scan, iscan)); |
| 289 | } |
| 290 | }; |
| 291 | |
Jerome Jiang | 3838b5c | 2020-09-01 18:28:52 -0700 | [diff] [blame] | 292 | class LowPrecisionQuantizeTest |
| 293 | : public QuantizeTestBase<int16_t, LPQuantizeFunc> { |
| 294 | void RunQuantizeFunc(const int16_t *coeff_ptr, intptr_t n_coeffs, |
| 295 | const int16_t * /*zbin_ptr*/, const int16_t *round_ptr, |
| 296 | const int16_t *quant_ptr, |
| 297 | const int16_t * /*quant_shift_ptr*/, int16_t *qcoeff_ptr, |
| 298 | int16_t *qcoeff_ref_ptr, int16_t *dqcoeff_ptr, |
| 299 | int16_t *dqcoeff_ref_ptr, const int16_t *dequant_ptr, |
| 300 | uint16_t *eob_ref_ptr, uint16_t *eob_ptr, |
| 301 | const int16_t *scan, const int16_t *iscan) override { |
| 302 | quant_ref_(coeff_ptr, n_coeffs, round_ptr, quant_ptr, qcoeff_ref_ptr, |
| 303 | dqcoeff_ref_ptr, dequant_ptr, eob_ref_ptr, scan, iscan); |
| 304 | |
| 305 | API_REGISTER_STATE_CHECK(quant_(coeff_ptr, n_coeffs, round_ptr, quant_ptr, |
| 306 | qcoeff_ptr, dqcoeff_ptr, dequant_ptr, |
| 307 | eob_ptr, scan, iscan)); |
| 308 | } |
| 309 | }; |
| 310 | |
Jerome Jiang | e58af08 | 2020-08-28 14:53:14 -0700 | [diff] [blame] | 311 | TEST_P(FullPrecisionQuantizeTest, ZeroInput) { |
Yi Luo | ef39c84 | 2017-05-19 11:51:53 -0700 | [diff] [blame] | 312 | FillCoeffZero(); |
| 313 | QuantizeRun(false); |
| 314 | } |
| 315 | |
Jerome Jiang | e58af08 | 2020-08-28 14:53:14 -0700 | [diff] [blame] | 316 | TEST_P(FullPrecisionQuantizeTest, LargeNegativeInput) { |
Yi Luo | ef39c84 | 2017-05-19 11:51:53 -0700 | [diff] [blame] | 317 | FillDcLargeNegative(); |
Yi Luo | 2d44b69 | 2017-06-07 16:41:51 -0700 | [diff] [blame] | 318 | QuantizeRun(false, 0, 1); |
Yi Luo | ef39c84 | 2017-05-19 11:51:53 -0700 | [diff] [blame] | 319 | } |
| 320 | |
Jerome Jiang | e58af08 | 2020-08-28 14:53:14 -0700 | [diff] [blame] | 321 | TEST_P(FullPrecisionQuantizeTest, DcOnlyInput) { |
Yi Luo | ef39c84 | 2017-05-19 11:51:53 -0700 | [diff] [blame] | 322 | FillDcOnly(); |
Yi Luo | 2d44b69 | 2017-06-07 16:41:51 -0700 | [diff] [blame] | 323 | QuantizeRun(false, 0, 1); |
Yi Luo | ef39c84 | 2017-05-19 11:51:53 -0700 | [diff] [blame] | 324 | } |
| 325 | |
Jerome Jiang | e58af08 | 2020-08-28 14:53:14 -0700 | [diff] [blame] | 326 | TEST_P(FullPrecisionQuantizeTest, RandomInput) { |
| 327 | QuantizeRun(true, 0, kTestNum); |
| 328 | } |
Yi Luo | ef39c84 | 2017-05-19 11:51:53 -0700 | [diff] [blame] | 329 | |
Jerome Jiang | e58af08 | 2020-08-28 14:53:14 -0700 | [diff] [blame] | 330 | TEST_P(FullPrecisionQuantizeTest, MultipleQ) { |
Yi Luo | ef39c84 | 2017-05-19 11:51:53 -0700 | [diff] [blame] | 331 | for (int q = 0; q < QINDEX_RANGE; ++q) { |
| 332 | QuantizeRun(true, q, kTestNum); |
| 333 | } |
| 334 | } |
| 335 | |
Scott LaVarnway | 3e9e26f | 2018-05-02 12:51:16 -0700 | [diff] [blame] | 336 | // Force the coeff to be half the value of the dequant. This exposes a |
| 337 | // mismatch found in av1_quantize_fp_sse2(). |
Jerome Jiang | e58af08 | 2020-08-28 14:53:14 -0700 | [diff] [blame] | 338 | TEST_P(FullPrecisionQuantizeTest, CoeffHalfDequant) { |
Scott LaVarnway | 3e9e26f | 2018-05-02 12:51:16 -0700 | [diff] [blame] | 339 | FillCoeff(16); |
| 340 | QuantizeRun(false, 25, 1); |
| 341 | } |
| 342 | |
Jerome Jiang | e58af08 | 2020-08-28 14:53:14 -0700 | [diff] [blame] | 343 | TEST_P(FullPrecisionQuantizeTest, DISABLED_Speed) { |
Yi Luo | 2d44b69 | 2017-06-07 16:41:51 -0700 | [diff] [blame] | 344 | tran_low_t *coeff_ptr = coeff_; |
| 345 | const intptr_t n_coeffs = coeff_num(); |
Yi Luo | 2d44b69 | 2017-06-07 16:41:51 -0700 | [diff] [blame] | 346 | |
| 347 | tran_low_t *qcoeff_ref = coeff_ptr + n_coeffs; |
| 348 | tran_low_t *dqcoeff_ref = qcoeff_ref + n_coeffs; |
| 349 | |
| 350 | tran_low_t *qcoeff = dqcoeff_ref + n_coeffs; |
| 351 | tran_low_t *dqcoeff = qcoeff + n_coeffs; |
| 352 | uint16_t *eob = (uint16_t *)(dqcoeff + n_coeffs); |
| 353 | |
| 354 | // Testing uses 2-D DCT scan order table |
Peng Bin | 03ea522 | 2018-04-12 15:59:54 +0800 | [diff] [blame] | 355 | const SCAN_ORDER *const sc = get_default_scan(tx_size_, DCT_DCT); |
Yi Luo | 2d44b69 | 2017-06-07 16:41:51 -0700 | [diff] [blame] | 356 | |
| 357 | // Testing uses luminance quantization table |
| 358 | const int q = 22; |
| 359 | const int16_t *zbin = qtab_->quant.y_zbin[q]; |
| 360 | const int16_t *round_fp = qtab_->quant.y_round_fp[q]; |
| 361 | const int16_t *quant_fp = qtab_->quant.y_quant_fp[q]; |
| 362 | const int16_t *quant_shift = qtab_->quant.y_quant_shift[q]; |
Monty Montgomery | 125c0fc | 2017-10-26 00:44:35 -0400 | [diff] [blame] | 363 | const int16_t *dequant = qtab_->dequant.y_dequant_QTX[q]; |
Yi Luo | 2d44b69 | 2017-06-07 16:41:51 -0700 | [diff] [blame] | 364 | const int kNumTests = 5000000; |
Aniket Dhok | 90fc8d0 | 2018-11-21 18:28:32 +0530 | [diff] [blame] | 365 | aom_usec_timer timer, simd_timer; |
Aniket Dhok | 64a5e40 | 2019-03-19 20:15:29 +0530 | [diff] [blame] | 366 | int rows = tx_size_high[tx_size_]; |
| 367 | int cols = tx_size_wide[tx_size_]; |
Aniket Dhok | 29d8ce4 | 2019-03-29 19:44:02 +0530 | [diff] [blame] | 368 | rows = AOMMIN(32, rows); |
| 369 | cols = AOMMIN(32, cols); |
Aniket Dhok | 64a5e40 | 2019-03-19 20:15:29 +0530 | [diff] [blame] | 370 | for (int cnt = 0; cnt <= rows; cnt++) { |
| 371 | FillCoeffRandomRows(cnt * cols); |
Yi Luo | 2d44b69 | 2017-06-07 16:41:51 -0700 | [diff] [blame] | 372 | |
Aniket Dhok | 64a5e40 | 2019-03-19 20:15:29 +0530 | [diff] [blame] | 373 | aom_usec_timer_start(&timer); |
| 374 | for (int n = 0; n < kNumTests; ++n) { |
| 375 | quant_ref_(coeff_ptr, n_coeffs, zbin, round_fp, quant_fp, quant_shift, |
| 376 | qcoeff, dqcoeff, dequant, eob, sc->scan, sc->iscan); |
| 377 | } |
| 378 | aom_usec_timer_mark(&timer); |
Yi Luo | 2d44b69 | 2017-06-07 16:41:51 -0700 | [diff] [blame] | 379 | |
Aniket Dhok | 64a5e40 | 2019-03-19 20:15:29 +0530 | [diff] [blame] | 380 | aom_usec_timer_start(&simd_timer); |
| 381 | for (int n = 0; n < kNumTests; ++n) { |
| 382 | quant_(coeff_ptr, n_coeffs, zbin, round_fp, quant_fp, quant_shift, qcoeff, |
| 383 | dqcoeff, dequant, eob, sc->scan, sc->iscan); |
| 384 | } |
| 385 | aom_usec_timer_mark(&simd_timer); |
| 386 | |
| 387 | const int elapsed_time = static_cast<int>(aom_usec_timer_elapsed(&timer)); |
| 388 | const int simd_elapsed_time = |
| 389 | static_cast<int>(aom_usec_timer_elapsed(&simd_timer)); |
Scott LaVarnway | 85b7ce7 | 2022-04-26 05:56:34 -0700 | [diff] [blame] | 390 | printf("c_time = %d \t simd_time = %d \t Gain = %f \n", elapsed_time, |
| 391 | simd_elapsed_time, ((float)elapsed_time / simd_elapsed_time)); |
Yi Luo | 2d44b69 | 2017-06-07 16:41:51 -0700 | [diff] [blame] | 392 | } |
Yi Luo | 2d44b69 | 2017-06-07 16:41:51 -0700 | [diff] [blame] | 393 | } |
| 394 | |
Jerome Jiang | 3838b5c | 2020-09-01 18:28:52 -0700 | [diff] [blame] | 395 | // TODO(crbug.com/aomedia/2796) |
| 396 | TEST_P(LowPrecisionQuantizeTest, ZeroInput) { |
| 397 | FillCoeffZero(); |
| 398 | QuantizeRun(false); |
| 399 | } |
| 400 | |
| 401 | TEST_P(LowPrecisionQuantizeTest, LargeNegativeInput) { |
| 402 | FillDcLargeNegative(); |
| 403 | QuantizeRun(false, 0, 1); |
| 404 | } |
| 405 | |
| 406 | TEST_P(LowPrecisionQuantizeTest, DcOnlyInput) { |
| 407 | FillDcOnly(); |
| 408 | QuantizeRun(false, 0, 1); |
| 409 | } |
| 410 | |
| 411 | TEST_P(LowPrecisionQuantizeTest, RandomInput) { |
| 412 | QuantizeRun(true, 0, kTestNum); |
| 413 | } |
| 414 | |
| 415 | TEST_P(LowPrecisionQuantizeTest, MultipleQ) { |
| 416 | for (int q = 0; q < QINDEX_RANGE; ++q) { |
| 417 | QuantizeRun(true, q, kTestNum); |
| 418 | } |
| 419 | } |
| 420 | |
| 421 | // Force the coeff to be half the value of the dequant. This exposes a |
| 422 | // mismatch found in av1_quantize_fp_sse2(). |
| 423 | TEST_P(LowPrecisionQuantizeTest, CoeffHalfDequant) { |
| 424 | FillCoeff(16); |
| 425 | QuantizeRun(false, 25, 1); |
| 426 | } |
| 427 | |
| 428 | TEST_P(LowPrecisionQuantizeTest, DISABLED_Speed) { |
| 429 | int16_t *coeff_ptr = coeff_; |
| 430 | const intptr_t n_coeffs = coeff_num(); |
| 431 | |
| 432 | int16_t *qcoeff_ref = coeff_ptr + n_coeffs; |
| 433 | int16_t *dqcoeff_ref = qcoeff_ref + n_coeffs; |
| 434 | |
| 435 | int16_t *qcoeff = dqcoeff_ref + n_coeffs; |
| 436 | int16_t *dqcoeff = qcoeff + n_coeffs; |
| 437 | uint16_t *eob = (uint16_t *)(dqcoeff + n_coeffs); |
| 438 | |
| 439 | // Testing uses 2-D DCT scan order table |
| 440 | const SCAN_ORDER *const sc = get_default_scan(tx_size_, DCT_DCT); |
| 441 | |
| 442 | // Testing uses luminance quantization table |
| 443 | const int q = 22; |
| 444 | const int16_t *round_fp = qtab_->quant.y_round_fp[q]; |
| 445 | const int16_t *quant_fp = qtab_->quant.y_quant_fp[q]; |
| 446 | const int16_t *dequant = qtab_->dequant.y_dequant_QTX[q]; |
| 447 | const int kNumTests = 5000000; |
| 448 | aom_usec_timer timer, simd_timer; |
| 449 | int rows = tx_size_high[tx_size_]; |
| 450 | int cols = tx_size_wide[tx_size_]; |
| 451 | rows = AOMMIN(32, rows); |
| 452 | cols = AOMMIN(32, cols); |
| 453 | for (int cnt = 0; cnt <= rows; cnt++) { |
| 454 | FillCoeffRandomRows(cnt * cols); |
| 455 | |
| 456 | aom_usec_timer_start(&timer); |
| 457 | for (int n = 0; n < kNumTests; ++n) { |
| 458 | quant_ref_(coeff_ptr, n_coeffs, round_fp, quant_fp, qcoeff, dqcoeff, |
| 459 | dequant, eob, sc->scan, sc->iscan); |
| 460 | } |
| 461 | aom_usec_timer_mark(&timer); |
| 462 | |
| 463 | aom_usec_timer_start(&simd_timer); |
| 464 | for (int n = 0; n < kNumTests; ++n) { |
| 465 | quant_(coeff_ptr, n_coeffs, round_fp, quant_fp, qcoeff, dqcoeff, dequant, |
| 466 | eob, sc->scan, sc->iscan); |
| 467 | } |
| 468 | aom_usec_timer_mark(&simd_timer); |
| 469 | |
| 470 | const int elapsed_time = static_cast<int>(aom_usec_timer_elapsed(&timer)); |
| 471 | const int simd_elapsed_time = |
| 472 | static_cast<int>(aom_usec_timer_elapsed(&simd_timer)); |
| 473 | printf("c_time = %d \t simd_time = %d \t Gain = %f \n", elapsed_time, |
| 474 | simd_elapsed_time, ((float)elapsed_time / simd_elapsed_time)); |
| 475 | } |
| 476 | } |
| 477 | |
sarahparker | a543df5 | 2018-11-02 16:02:05 -0700 | [diff] [blame] | 478 | using std::make_tuple; |
Yi Luo | ef39c84 | 2017-05-19 11:51:53 -0700 | [diff] [blame] | 479 | |
Yi Luo | 2d44b69 | 2017-06-07 16:41:51 -0700 | [diff] [blame] | 480 | #if HAVE_AVX2 |
Jerome Jiang | 3838b5c | 2020-09-01 18:28:52 -0700 | [diff] [blame] | 481 | |
| 482 | const QuantizeParam<LPQuantizeFunc> kLPQParamArrayAvx2[] = { |
| 483 | make_tuple(&av1_quantize_lp_c, &av1_quantize_lp_avx2, |
| 484 | static_cast<TX_SIZE>(TX_16X16), TYPE_FP, AOM_BITS_8), |
| 485 | make_tuple(&av1_quantize_lp_c, &av1_quantize_lp_avx2, |
Salome Thirot | 69975b1 | 2024-03-15 15:37:39 +0000 | [diff] [blame] | 486 | static_cast<TX_SIZE>(TX_8X8), TYPE_FP, AOM_BITS_8), |
Jerome Jiang | 3838b5c | 2020-09-01 18:28:52 -0700 | [diff] [blame] | 487 | make_tuple(&av1_quantize_lp_c, &av1_quantize_lp_avx2, |
Salome Thirot | 69975b1 | 2024-03-15 15:37:39 +0000 | [diff] [blame] | 488 | static_cast<TX_SIZE>(TX_4X4), TYPE_FP, AOM_BITS_8) |
Jerome Jiang | 3838b5c | 2020-09-01 18:28:52 -0700 | [diff] [blame] | 489 | }; |
| 490 | |
| 491 | INSTANTIATE_TEST_SUITE_P(AVX2, LowPrecisionQuantizeTest, |
| 492 | ::testing::ValuesIn(kLPQParamArrayAvx2)); |
| 493 | |
| 494 | const QuantizeParam<QuantizeFunc> kQParamArrayAvx2[] = { |
Pascal Massimino | a6fe432 | 2019-04-09 09:49:24 +0200 | [diff] [blame] | 495 | make_tuple(&av1_quantize_fp_c, &av1_quantize_fp_avx2, |
| 496 | static_cast<TX_SIZE>(TX_16X16), TYPE_FP, AOM_BITS_8), |
| 497 | make_tuple(&av1_quantize_fp_c, &av1_quantize_fp_avx2, |
| 498 | static_cast<TX_SIZE>(TX_4X16), TYPE_FP, AOM_BITS_8), |
| 499 | make_tuple(&av1_quantize_fp_c, &av1_quantize_fp_avx2, |
| 500 | static_cast<TX_SIZE>(TX_16X4), TYPE_FP, AOM_BITS_8), |
| 501 | make_tuple(&av1_quantize_fp_c, &av1_quantize_fp_avx2, |
| 502 | static_cast<TX_SIZE>(TX_32X8), TYPE_FP, AOM_BITS_8), |
| 503 | make_tuple(&av1_quantize_fp_c, &av1_quantize_fp_avx2, |
| 504 | static_cast<TX_SIZE>(TX_8X32), TYPE_FP, AOM_BITS_8), |
| 505 | make_tuple(&av1_quantize_fp_32x32_c, &av1_quantize_fp_32x32_avx2, |
| 506 | static_cast<TX_SIZE>(TX_32X32), TYPE_FP, AOM_BITS_8), |
| 507 | make_tuple(&av1_quantize_fp_32x32_c, &av1_quantize_fp_32x32_avx2, |
| 508 | static_cast<TX_SIZE>(TX_16X64), TYPE_FP, AOM_BITS_8), |
| 509 | make_tuple(&av1_quantize_fp_32x32_c, &av1_quantize_fp_32x32_avx2, |
| 510 | static_cast<TX_SIZE>(TX_64X16), TYPE_FP, AOM_BITS_8), |
| 511 | make_tuple(&av1_quantize_fp_64x64_c, &av1_quantize_fp_64x64_avx2, |
| 512 | static_cast<TX_SIZE>(TX_64X64), TYPE_FP, AOM_BITS_8), |
Jerome Jiang | f8cc1c4 | 2019-08-02 16:34:32 -0700 | [diff] [blame] | 513 | #if CONFIG_AV1_HIGHBITDEPTH |
Yi Luo | 6faf349 | 2017-06-15 16:56:08 -0700 | [diff] [blame] | 514 | make_tuple(&highbd_quan16x16_wrapper<av1_highbd_quantize_fp_c>, |
Pascal Massimino | a6fe432 | 2019-04-09 09:49:24 +0200 | [diff] [blame] | 515 | &highbd_quan16x16_wrapper<av1_highbd_quantize_fp_avx2>, |
| 516 | static_cast<TX_SIZE>(TX_16X16), TYPE_FP, AOM_BITS_8), |
Yi Luo | 6faf349 | 2017-06-15 16:56:08 -0700 | [diff] [blame] | 517 | make_tuple(&highbd_quan16x16_wrapper<av1_highbd_quantize_fp_c>, |
Pascal Massimino | a6fe432 | 2019-04-09 09:49:24 +0200 | [diff] [blame] | 518 | &highbd_quan16x16_wrapper<av1_highbd_quantize_fp_avx2>, |
| 519 | static_cast<TX_SIZE>(TX_16X16), TYPE_FP, AOM_BITS_10), |
Yi Luo | 6faf349 | 2017-06-15 16:56:08 -0700 | [diff] [blame] | 520 | make_tuple(&highbd_quan16x16_wrapper<av1_highbd_quantize_fp_c>, |
Pascal Massimino | a6fe432 | 2019-04-09 09:49:24 +0200 | [diff] [blame] | 521 | &highbd_quan16x16_wrapper<av1_highbd_quantize_fp_avx2>, |
| 522 | static_cast<TX_SIZE>(TX_16X16), TYPE_FP, AOM_BITS_12), |
Yi Luo | 6faf349 | 2017-06-15 16:56:08 -0700 | [diff] [blame] | 523 | make_tuple(&highbd_quan32x32_wrapper<av1_highbd_quantize_fp_c>, |
Pascal Massimino | a6fe432 | 2019-04-09 09:49:24 +0200 | [diff] [blame] | 524 | &highbd_quan32x32_wrapper<av1_highbd_quantize_fp_avx2>, |
| 525 | static_cast<TX_SIZE>(TX_32X32), TYPE_FP, AOM_BITS_8), |
Yi Luo | 6faf349 | 2017-06-15 16:56:08 -0700 | [diff] [blame] | 526 | make_tuple(&highbd_quan32x32_wrapper<av1_highbd_quantize_fp_c>, |
Pascal Massimino | a6fe432 | 2019-04-09 09:49:24 +0200 | [diff] [blame] | 527 | &highbd_quan32x32_wrapper<av1_highbd_quantize_fp_avx2>, |
| 528 | static_cast<TX_SIZE>(TX_32X32), TYPE_FP, AOM_BITS_10), |
Yi Luo | 6faf349 | 2017-06-15 16:56:08 -0700 | [diff] [blame] | 529 | make_tuple(&highbd_quan32x32_wrapper<av1_highbd_quantize_fp_c>, |
Pascal Massimino | a6fe432 | 2019-04-09 09:49:24 +0200 | [diff] [blame] | 530 | &highbd_quan32x32_wrapper<av1_highbd_quantize_fp_avx2>, |
| 531 | static_cast<TX_SIZE>(TX_32X32), TYPE_FP, AOM_BITS_12), |
Yi Luo | 6faf349 | 2017-06-15 16:56:08 -0700 | [diff] [blame] | 532 | make_tuple(&highbd_quan64x64_wrapper<av1_highbd_quantize_fp_c>, |
Pascal Massimino | a6fe432 | 2019-04-09 09:49:24 +0200 | [diff] [blame] | 533 | &highbd_quan64x64_wrapper<av1_highbd_quantize_fp_avx2>, |
| 534 | static_cast<TX_SIZE>(TX_64X64), TYPE_FP, AOM_BITS_8), |
Yi Luo | 6faf349 | 2017-06-15 16:56:08 -0700 | [diff] [blame] | 535 | make_tuple(&highbd_quan64x64_wrapper<av1_highbd_quantize_fp_c>, |
Pascal Massimino | a6fe432 | 2019-04-09 09:49:24 +0200 | [diff] [blame] | 536 | &highbd_quan64x64_wrapper<av1_highbd_quantize_fp_avx2>, |
| 537 | static_cast<TX_SIZE>(TX_64X64), TYPE_FP, AOM_BITS_10), |
Yi Luo | 6faf349 | 2017-06-15 16:56:08 -0700 | [diff] [blame] | 538 | make_tuple(&highbd_quan64x64_wrapper<av1_highbd_quantize_fp_c>, |
Pascal Massimino | a6fe432 | 2019-04-09 09:49:24 +0200 | [diff] [blame] | 539 | &highbd_quan64x64_wrapper<av1_highbd_quantize_fp_avx2>, |
| 540 | static_cast<TX_SIZE>(TX_64X64), TYPE_FP, AOM_BITS_12), |
| 541 | make_tuple(&aom_highbd_quantize_b_c, &aom_highbd_quantize_b_avx2, |
| 542 | static_cast<TX_SIZE>(TX_16X16), TYPE_B, AOM_BITS_8), |
| 543 | make_tuple(&aom_highbd_quantize_b_c, &aom_highbd_quantize_b_avx2, |
| 544 | static_cast<TX_SIZE>(TX_16X16), TYPE_B, AOM_BITS_10), |
| 545 | make_tuple(&aom_highbd_quantize_b_c, &aom_highbd_quantize_b_avx2, |
| 546 | static_cast<TX_SIZE>(TX_16X16), TYPE_B, AOM_BITS_12), |
Scott LaVarnway | cfce500 | 2022-06-13 10:18:00 -0700 | [diff] [blame] | 547 | make_tuple(&aom_highbd_quantize_b_32x32_c, &aom_highbd_quantize_b_32x32_avx2, |
| 548 | static_cast<TX_SIZE>(TX_32X32), TYPE_B, AOM_BITS_12), |
Scott LaVarnway | a62d5d7 | 2022-06-14 18:20:37 -0700 | [diff] [blame] | 549 | make_tuple(&aom_highbd_quantize_b_64x64_c, &aom_highbd_quantize_b_64x64_avx2, |
| 550 | static_cast<TX_SIZE>(TX_64X64), TYPE_B, AOM_BITS_12), |
James Zern | 7c6fd21 | 2022-06-09 13:41:52 -0700 | [diff] [blame] | 551 | #if !CONFIG_REALTIME_ONLY |
Remya | 8a99f6b | 2019-05-27 18:36:12 +0530 | [diff] [blame] | 552 | make_tuple(&aom_highbd_quantize_b_adaptive_c, |
| 553 | &aom_highbd_quantize_b_adaptive_avx2, |
| 554 | static_cast<TX_SIZE>(TX_16X16), TYPE_B, AOM_BITS_8), |
| 555 | make_tuple(&aom_highbd_quantize_b_adaptive_c, |
| 556 | &aom_highbd_quantize_b_adaptive_avx2, |
| 557 | static_cast<TX_SIZE>(TX_16X16), TYPE_B, AOM_BITS_10), |
| 558 | make_tuple(&aom_highbd_quantize_b_adaptive_c, |
| 559 | &aom_highbd_quantize_b_adaptive_avx2, |
Remya | a7d48a6 | 2019-06-03 14:22:34 +0530 | [diff] [blame] | 560 | static_cast<TX_SIZE>(TX_16X16), TYPE_B, AOM_BITS_12), |
| 561 | make_tuple(&aom_highbd_quantize_b_32x32_adaptive_c, |
| 562 | &aom_highbd_quantize_b_32x32_adaptive_avx2, |
| 563 | static_cast<TX_SIZE>(TX_32X32), TYPE_B, AOM_BITS_8), |
| 564 | make_tuple(&aom_highbd_quantize_b_32x32_adaptive_c, |
| 565 | &aom_highbd_quantize_b_32x32_adaptive_avx2, |
| 566 | static_cast<TX_SIZE>(TX_32X32), TYPE_B, AOM_BITS_10), |
| 567 | make_tuple(&aom_highbd_quantize_b_32x32_adaptive_c, |
| 568 | &aom_highbd_quantize_b_32x32_adaptive_avx2, |
Jerome Jiang | f8cc1c4 | 2019-08-02 16:34:32 -0700 | [diff] [blame] | 569 | static_cast<TX_SIZE>(TX_32X32), TYPE_B, AOM_BITS_12), |
James Zern | 7c6fd21 | 2022-06-09 13:41:52 -0700 | [diff] [blame] | 570 | #endif // !CONFIG_REALTIME_ONLY |
| 571 | #endif // CONFIG_AV1_HIGHBITDEPTH |
| 572 | #if !CONFIG_REALTIME_ONLY |
Jerome Jiang | f8cc1c4 | 2019-08-02 16:34:32 -0700 | [diff] [blame] | 573 | make_tuple(&aom_quantize_b_adaptive_c, &aom_quantize_b_adaptive_avx2, |
| 574 | static_cast<TX_SIZE>(TX_16X16), TYPE_B, AOM_BITS_8), |
| 575 | make_tuple(&aom_quantize_b_adaptive_c, &aom_quantize_b_adaptive_avx2, |
| 576 | static_cast<TX_SIZE>(TX_8X8), TYPE_B, AOM_BITS_8), |
| 577 | make_tuple(&aom_quantize_b_adaptive_c, &aom_quantize_b_adaptive_avx2, |
Scott LaVarnway | 93ae615 | 2022-06-01 11:33:19 -0700 | [diff] [blame] | 578 | static_cast<TX_SIZE>(TX_4X4), TYPE_B, AOM_BITS_8), |
James Zern | 7c6fd21 | 2022-06-09 13:41:52 -0700 | [diff] [blame] | 579 | #endif // !CONFIG_REALTIME_ONLY |
Scott LaVarnway | 93ae615 | 2022-06-01 11:33:19 -0700 | [diff] [blame] | 580 | make_tuple(&aom_quantize_b_c, &aom_quantize_b_avx2, |
| 581 | static_cast<TX_SIZE>(TX_16X16), TYPE_B, AOM_BITS_8), |
Scott LaVarnway | dbd2867 | 2022-06-09 16:47:13 -0700 | [diff] [blame] | 582 | make_tuple(&aom_quantize_b_32x32_c, &aom_quantize_b_32x32_avx2, |
| 583 | static_cast<TX_SIZE>(TX_32X32), TYPE_B, AOM_BITS_8), |
Scott LaVarnway | 339fef7 | 2022-06-09 18:10:02 -0700 | [diff] [blame] | 584 | make_tuple(&aom_quantize_b_64x64_c, &aom_quantize_b_64x64_avx2, |
| 585 | static_cast<TX_SIZE>(TX_64X64), TYPE_B, AOM_BITS_8), |
Yi Luo | 2d44b69 | 2017-06-07 16:41:51 -0700 | [diff] [blame] | 586 | }; |
| 587 | |
Jerome Jiang | e58af08 | 2020-08-28 14:53:14 -0700 | [diff] [blame] | 588 | INSTANTIATE_TEST_SUITE_P(AVX2, FullPrecisionQuantizeTest, |
Cheng Chen | 96786fe | 2020-02-14 17:28:25 -0800 | [diff] [blame] | 589 | ::testing::ValuesIn(kQParamArrayAvx2)); |
Yi Luo | 6faf349 | 2017-06-15 16:56:08 -0700 | [diff] [blame] | 590 | #endif // HAVE_AVX2 |
Yi Luo | 2d44b69 | 2017-06-07 16:41:51 -0700 | [diff] [blame] | 591 | |
Yi Luo | ef39c84 | 2017-05-19 11:51:53 -0700 | [diff] [blame] | 592 | #if HAVE_SSE2 |
Jerome Jiang | 3838b5c | 2020-09-01 18:28:52 -0700 | [diff] [blame] | 593 | |
| 594 | const QuantizeParam<LPQuantizeFunc> kLPQParamArraySSE2[] = { |
| 595 | make_tuple(&av1_quantize_lp_c, &av1_quantize_lp_sse2, |
| 596 | static_cast<TX_SIZE>(TX_16X16), TYPE_FP, AOM_BITS_8), |
| 597 | make_tuple(&av1_quantize_lp_c, &av1_quantize_lp_sse2, |
| 598 | static_cast<TX_SIZE>(TX_8X8), TYPE_FP, AOM_BITS_8), |
| 599 | make_tuple(&av1_quantize_lp_c, &av1_quantize_lp_sse2, |
| 600 | static_cast<TX_SIZE>(TX_4X4), TYPE_FP, AOM_BITS_8) |
| 601 | }; |
| 602 | |
| 603 | INSTANTIATE_TEST_SUITE_P(SSE2, LowPrecisionQuantizeTest, |
| 604 | ::testing::ValuesIn(kLPQParamArraySSE2)); |
| 605 | |
| 606 | const QuantizeParam<QuantizeFunc> kQParamArraySSE2[] = { |
Pascal Massimino | a6fe432 | 2019-04-09 09:49:24 +0200 | [diff] [blame] | 607 | make_tuple(&av1_quantize_fp_c, &av1_quantize_fp_sse2, |
| 608 | static_cast<TX_SIZE>(TX_16X16), TYPE_FP, AOM_BITS_8), |
| 609 | make_tuple(&av1_quantize_fp_c, &av1_quantize_fp_sse2, |
| 610 | static_cast<TX_SIZE>(TX_4X16), TYPE_FP, AOM_BITS_8), |
| 611 | make_tuple(&av1_quantize_fp_c, &av1_quantize_fp_sse2, |
| 612 | static_cast<TX_SIZE>(TX_16X4), TYPE_FP, AOM_BITS_8), |
| 613 | make_tuple(&av1_quantize_fp_c, &av1_quantize_fp_sse2, |
| 614 | static_cast<TX_SIZE>(TX_8X32), TYPE_FP, AOM_BITS_8), |
| 615 | make_tuple(&av1_quantize_fp_c, &av1_quantize_fp_sse2, |
| 616 | static_cast<TX_SIZE>(TX_32X8), TYPE_FP, AOM_BITS_8), |
| 617 | make_tuple(&aom_quantize_b_c, &aom_quantize_b_sse2, |
| 618 | static_cast<TX_SIZE>(TX_16X16), TYPE_B, AOM_BITS_8), |
Jerome Jiang | f8cc1c4 | 2019-08-02 16:34:32 -0700 | [diff] [blame] | 619 | #if CONFIG_AV1_HIGHBITDEPTH |
Pascal Massimino | a6fe432 | 2019-04-09 09:49:24 +0200 | [diff] [blame] | 620 | make_tuple(&aom_highbd_quantize_b_c, &aom_highbd_quantize_b_sse2, |
| 621 | static_cast<TX_SIZE>(TX_16X16), TYPE_B, AOM_BITS_8), |
| 622 | make_tuple(&aom_highbd_quantize_b_c, &aom_highbd_quantize_b_sse2, |
| 623 | static_cast<TX_SIZE>(TX_16X16), TYPE_B, AOM_BITS_10), |
| 624 | make_tuple(&aom_highbd_quantize_b_c, &aom_highbd_quantize_b_sse2, |
| 625 | static_cast<TX_SIZE>(TX_16X16), TYPE_B, AOM_BITS_12), |
James Zern | 7c6fd21 | 2022-06-09 13:41:52 -0700 | [diff] [blame] | 626 | #if !CONFIG_REALTIME_ONLY |
Remya | 7a3af0c | 2019-06-04 11:51:32 +0530 | [diff] [blame] | 627 | make_tuple(&aom_highbd_quantize_b_adaptive_c, |
| 628 | &aom_highbd_quantize_b_adaptive_sse2, |
| 629 | static_cast<TX_SIZE>(TX_16X16), TYPE_B, AOM_BITS_8), |
| 630 | make_tuple(&aom_highbd_quantize_b_adaptive_c, |
| 631 | &aom_highbd_quantize_b_adaptive_sse2, |
| 632 | static_cast<TX_SIZE>(TX_16X16), TYPE_B, AOM_BITS_10), |
| 633 | make_tuple(&aom_highbd_quantize_b_adaptive_c, |
| 634 | &aom_highbd_quantize_b_adaptive_sse2, |
| 635 | static_cast<TX_SIZE>(TX_16X16), TYPE_B, AOM_BITS_12), |
Yi Luo | 193422e | 2017-06-19 15:54:06 -0700 | [diff] [blame] | 636 | make_tuple(&aom_highbd_quantize_b_32x32_c, &aom_highbd_quantize_b_32x32_sse2, |
Pascal Massimino | a6fe432 | 2019-04-09 09:49:24 +0200 | [diff] [blame] | 637 | static_cast<TX_SIZE>(TX_32X32), TYPE_B, AOM_BITS_8), |
Yi Luo | 193422e | 2017-06-19 15:54:06 -0700 | [diff] [blame] | 638 | make_tuple(&aom_highbd_quantize_b_32x32_c, &aom_highbd_quantize_b_32x32_sse2, |
Pascal Massimino | a6fe432 | 2019-04-09 09:49:24 +0200 | [diff] [blame] | 639 | static_cast<TX_SIZE>(TX_32X32), TYPE_B, AOM_BITS_10), |
Yi Luo | 193422e | 2017-06-19 15:54:06 -0700 | [diff] [blame] | 640 | make_tuple(&aom_highbd_quantize_b_32x32_c, &aom_highbd_quantize_b_32x32_sse2, |
Pascal Massimino | a6fe432 | 2019-04-09 09:49:24 +0200 | [diff] [blame] | 641 | static_cast<TX_SIZE>(TX_32X32), TYPE_B, AOM_BITS_12), |
Remya | 014f91a | 2019-06-04 11:10:10 +0530 | [diff] [blame] | 642 | make_tuple(&aom_highbd_quantize_b_32x32_adaptive_c, |
| 643 | &aom_highbd_quantize_b_32x32_adaptive_sse2, |
| 644 | static_cast<TX_SIZE>(TX_32X32), TYPE_B, AOM_BITS_8), |
| 645 | make_tuple(&aom_highbd_quantize_b_32x32_adaptive_c, |
| 646 | &aom_highbd_quantize_b_32x32_adaptive_sse2, |
| 647 | static_cast<TX_SIZE>(TX_32X32), TYPE_B, AOM_BITS_10), |
| 648 | make_tuple(&aom_highbd_quantize_b_32x32_adaptive_c, |
| 649 | &aom_highbd_quantize_b_32x32_adaptive_sse2, |
| 650 | static_cast<TX_SIZE>(TX_32X32), TYPE_B, AOM_BITS_12), |
James Zern | 7c6fd21 | 2022-06-09 13:41:52 -0700 | [diff] [blame] | 651 | #endif // !CONFIG_REALTIME_ONLY |
Aniket Dhok | 3ff6ff3 | 2019-02-06 22:03:22 +0530 | [diff] [blame] | 652 | make_tuple(&aom_highbd_quantize_b_64x64_c, &aom_highbd_quantize_b_64x64_sse2, |
Pascal Massimino | a6fe432 | 2019-04-09 09:49:24 +0200 | [diff] [blame] | 653 | static_cast<TX_SIZE>(TX_64X64), TYPE_B, AOM_BITS_8), |
Aniket Dhok | 3ff6ff3 | 2019-02-06 22:03:22 +0530 | [diff] [blame] | 654 | make_tuple(&aom_highbd_quantize_b_64x64_c, &aom_highbd_quantize_b_64x64_sse2, |
Pascal Massimino | a6fe432 | 2019-04-09 09:49:24 +0200 | [diff] [blame] | 655 | static_cast<TX_SIZE>(TX_64X64), TYPE_B, AOM_BITS_10), |
Aniket Dhok | 3ff6ff3 | 2019-02-06 22:03:22 +0530 | [diff] [blame] | 656 | make_tuple(&aom_highbd_quantize_b_64x64_c, &aom_highbd_quantize_b_64x64_sse2, |
Pascal Massimino | a6fe432 | 2019-04-09 09:49:24 +0200 | [diff] [blame] | 657 | static_cast<TX_SIZE>(TX_64X64), TYPE_B, AOM_BITS_12), |
James Zern | 7c6fd21 | 2022-06-09 13:41:52 -0700 | [diff] [blame] | 658 | #if !CONFIG_REALTIME_ONLY |
Remya | d9f3528 | 2019-06-03 10:52:34 +0530 | [diff] [blame] | 659 | make_tuple(&aom_highbd_quantize_b_64x64_adaptive_c, |
| 660 | &aom_highbd_quantize_b_64x64_adaptive_sse2, |
| 661 | static_cast<TX_SIZE>(TX_64X64), TYPE_B, AOM_BITS_8), |
| 662 | make_tuple(&aom_highbd_quantize_b_64x64_adaptive_c, |
| 663 | &aom_highbd_quantize_b_64x64_adaptive_sse2, |
| 664 | static_cast<TX_SIZE>(TX_64X64), TYPE_B, AOM_BITS_10), |
| 665 | make_tuple(&aom_highbd_quantize_b_64x64_adaptive_c, |
| 666 | &aom_highbd_quantize_b_64x64_adaptive_sse2, |
| 667 | static_cast<TX_SIZE>(TX_64X64), TYPE_B, AOM_BITS_12), |
James Zern | 7c6fd21 | 2022-06-09 13:41:52 -0700 | [diff] [blame] | 668 | #endif // !CONFIG_REALTIME_ONLY |
| 669 | #endif // CONFIG_AV1_HIGHBITDEPTH |
| 670 | #if !CONFIG_REALTIME_ONLY |
Aniket Dhok | 64a5e40 | 2019-03-19 20:15:29 +0530 | [diff] [blame] | 671 | make_tuple(&aom_quantize_b_adaptive_c, &aom_quantize_b_adaptive_sse2, |
Pascal Massimino | a6fe432 | 2019-04-09 09:49:24 +0200 | [diff] [blame] | 672 | static_cast<TX_SIZE>(TX_16X16), TYPE_B, AOM_BITS_8), |
| 673 | make_tuple(&aom_quantize_b_adaptive_c, &aom_quantize_b_adaptive_sse2, |
| 674 | static_cast<TX_SIZE>(TX_8X8), TYPE_B, AOM_BITS_8), |
| 675 | make_tuple(&aom_quantize_b_adaptive_c, &aom_quantize_b_adaptive_sse2, |
| 676 | static_cast<TX_SIZE>(TX_4X4), TYPE_B, AOM_BITS_8), |
Aniket Dhok | c615fd3 | 2019-03-22 19:42:05 +0530 | [diff] [blame] | 677 | make_tuple(&aom_quantize_b_32x32_adaptive_c, |
Pascal Massimino | a6fe432 | 2019-04-09 09:49:24 +0200 | [diff] [blame] | 678 | &aom_quantize_b_32x32_adaptive_sse2, |
| 679 | static_cast<TX_SIZE>(TX_32X16), TYPE_B, AOM_BITS_8), |
Aniket Dhok | c615fd3 | 2019-03-22 19:42:05 +0530 | [diff] [blame] | 680 | make_tuple(&aom_quantize_b_32x32_adaptive_c, |
Pascal Massimino | a6fe432 | 2019-04-09 09:49:24 +0200 | [diff] [blame] | 681 | &aom_quantize_b_32x32_adaptive_sse2, |
| 682 | static_cast<TX_SIZE>(TX_16X32), TYPE_B, AOM_BITS_8), |
Aniket Dhok | c615fd3 | 2019-03-22 19:42:05 +0530 | [diff] [blame] | 683 | make_tuple(&aom_quantize_b_32x32_adaptive_c, |
Pascal Massimino | a6fe432 | 2019-04-09 09:49:24 +0200 | [diff] [blame] | 684 | &aom_quantize_b_32x32_adaptive_sse2, |
| 685 | static_cast<TX_SIZE>(TX_32X32), TYPE_B, AOM_BITS_8), |
Aniket Dhok | 29d8ce4 | 2019-03-29 19:44:02 +0530 | [diff] [blame] | 686 | make_tuple(&aom_quantize_b_64x64_adaptive_c, |
Pascal Massimino | a6fe432 | 2019-04-09 09:49:24 +0200 | [diff] [blame] | 687 | &aom_quantize_b_64x64_adaptive_sse2, |
| 688 | static_cast<TX_SIZE>(TX_32X64), TYPE_B, AOM_BITS_8), |
Aniket Dhok | 29d8ce4 | 2019-03-29 19:44:02 +0530 | [diff] [blame] | 689 | make_tuple(&aom_quantize_b_64x64_adaptive_c, |
Pascal Massimino | a6fe432 | 2019-04-09 09:49:24 +0200 | [diff] [blame] | 690 | &aom_quantize_b_64x64_adaptive_sse2, |
| 691 | static_cast<TX_SIZE>(TX_64X32), TYPE_B, AOM_BITS_8), |
Aniket Dhok | 29d8ce4 | 2019-03-29 19:44:02 +0530 | [diff] [blame] | 692 | make_tuple(&aom_quantize_b_64x64_adaptive_c, |
Pascal Massimino | a6fe432 | 2019-04-09 09:49:24 +0200 | [diff] [blame] | 693 | &aom_quantize_b_64x64_adaptive_sse2, |
| 694 | static_cast<TX_SIZE>(TX_64X64), TYPE_B, AOM_BITS_8) |
James Zern | 7c6fd21 | 2022-06-09 13:41:52 -0700 | [diff] [blame] | 695 | #endif // !CONFIG_REALTIME_ONLY |
Yi Luo | 193422e | 2017-06-19 15:54:06 -0700 | [diff] [blame] | 696 | }; |
Yi Luo | ef39c84 | 2017-05-19 11:51:53 -0700 | [diff] [blame] | 697 | |
Jerome Jiang | e58af08 | 2020-08-28 14:53:14 -0700 | [diff] [blame] | 698 | INSTANTIATE_TEST_SUITE_P(SSE2, FullPrecisionQuantizeTest, |
Cheng Chen | 96786fe | 2020-02-14 17:28:25 -0800 | [diff] [blame] | 699 | ::testing::ValuesIn(kQParamArraySSE2)); |
Yi Luo | ef39c84 | 2017-05-19 11:51:53 -0700 | [diff] [blame] | 700 | #endif |
| 701 | |
Jerome Jiang | e604b4e | 2019-07-01 16:19:48 -0700 | [diff] [blame] | 702 | #if HAVE_NEON |
Jerome Jiang | 3838b5c | 2020-09-01 18:28:52 -0700 | [diff] [blame] | 703 | |
| 704 | const QuantizeParam<LPQuantizeFunc> kLPQParamArrayNEON[] = { |
| 705 | make_tuple(av1_quantize_lp_c, av1_quantize_lp_neon, |
| 706 | static_cast<TX_SIZE>(TX_16X16), TYPE_FP, AOM_BITS_8), |
| 707 | make_tuple(av1_quantize_lp_c, av1_quantize_lp_neon, |
Salome Thirot | 69975b1 | 2024-03-15 15:37:39 +0000 | [diff] [blame] | 708 | static_cast<TX_SIZE>(TX_8X8), TYPE_FP, AOM_BITS_8), |
Jerome Jiang | 3838b5c | 2020-09-01 18:28:52 -0700 | [diff] [blame] | 709 | make_tuple(av1_quantize_lp_c, av1_quantize_lp_neon, |
Salome Thirot | 69975b1 | 2024-03-15 15:37:39 +0000 | [diff] [blame] | 710 | static_cast<TX_SIZE>(TX_4X4), TYPE_FP, AOM_BITS_8) |
Jerome Jiang | 3838b5c | 2020-09-01 18:28:52 -0700 | [diff] [blame] | 711 | }; |
| 712 | |
| 713 | INSTANTIATE_TEST_SUITE_P(NEON, LowPrecisionQuantizeTest, |
| 714 | ::testing::ValuesIn(kLPQParamArrayNEON)); |
| 715 | |
| 716 | const QuantizeParam<QuantizeFunc> kQParamArrayNEON[] = { |
Jerome Jiang | e604b4e | 2019-07-01 16:19:48 -0700 | [diff] [blame] | 717 | make_tuple(&av1_quantize_fp_c, &av1_quantize_fp_neon, |
| 718 | static_cast<TX_SIZE>(TX_16X16), TYPE_FP, AOM_BITS_8), |
| 719 | make_tuple(&av1_quantize_fp_c, &av1_quantize_fp_neon, |
| 720 | static_cast<TX_SIZE>(TX_4X16), TYPE_FP, AOM_BITS_8), |
| 721 | make_tuple(&av1_quantize_fp_c, &av1_quantize_fp_neon, |
| 722 | static_cast<TX_SIZE>(TX_16X4), TYPE_FP, AOM_BITS_8), |
| 723 | make_tuple(&av1_quantize_fp_c, &av1_quantize_fp_neon, |
| 724 | static_cast<TX_SIZE>(TX_8X32), TYPE_FP, AOM_BITS_8), |
| 725 | make_tuple(&av1_quantize_fp_c, &av1_quantize_fp_neon, |
Vitalii Dziumenko | 5951ee3 | 2020-03-30 19:56:54 +0300 | [diff] [blame] | 726 | static_cast<TX_SIZE>(TX_32X8), TYPE_FP, AOM_BITS_8), |
| 727 | make_tuple(&av1_quantize_fp_32x32_c, &av1_quantize_fp_32x32_neon, |
| 728 | static_cast<TX_SIZE>(TX_32X32), TYPE_FP, AOM_BITS_8), |
| 729 | make_tuple(&av1_quantize_fp_64x64_c, &av1_quantize_fp_64x64_neon, |
| 730 | static_cast<TX_SIZE>(TX_64X64), TYPE_FP, AOM_BITS_8), |
| 731 | make_tuple(&aom_quantize_b_c, &aom_quantize_b_neon, |
| 732 | static_cast<TX_SIZE>(TX_16X16), TYPE_B, AOM_BITS_8), |
| 733 | make_tuple(&aom_quantize_b_32x32_c, &aom_quantize_b_32x32_neon, |
| 734 | static_cast<TX_SIZE>(TX_32X32), TYPE_B, AOM_BITS_8), |
| 735 | make_tuple(&aom_quantize_b_64x64_c, &aom_quantize_b_64x64_neon, |
Scott LaVarnway | 85b7ce7 | 2022-04-26 05:56:34 -0700 | [diff] [blame] | 736 | static_cast<TX_SIZE>(TX_64X64), TYPE_B, AOM_BITS_8), |
Scott LaVarnway | cdbfa94 | 2022-04-22 07:19:25 -0700 | [diff] [blame] | 737 | |
Scott LaVarnway | 85b7ce7 | 2022-04-26 05:56:34 -0700 | [diff] [blame] | 738 | #if CONFIG_AV1_HIGHBITDEPTH |
| 739 | make_tuple(&highbd_quan16x16_wrapper<av1_highbd_quantize_fp_c>, |
| 740 | &highbd_quan16x16_wrapper<av1_highbd_quantize_fp_neon>, |
| 741 | static_cast<TX_SIZE>(TX_16X16), TYPE_FP, AOM_BITS_12), |
| 742 | make_tuple(&highbd_quan32x32_wrapper<av1_highbd_quantize_fp_c>, |
| 743 | &highbd_quan32x32_wrapper<av1_highbd_quantize_fp_neon>, |
| 744 | static_cast<TX_SIZE>(TX_32X32), TYPE_FP, AOM_BITS_12), |
| 745 | make_tuple(&highbd_quan64x64_wrapper<av1_highbd_quantize_fp_c>, |
| 746 | &highbd_quan64x64_wrapper<av1_highbd_quantize_fp_neon>, |
| 747 | static_cast<TX_SIZE>(TX_64X64), TYPE_FP, AOM_BITS_12), |
Scott LaVarnway | cdbfa94 | 2022-04-22 07:19:25 -0700 | [diff] [blame] | 748 | make_tuple(&aom_highbd_quantize_b_c, &aom_highbd_quantize_b_neon, |
| 749 | static_cast<TX_SIZE>(TX_16X16), TYPE_B, AOM_BITS_12), |
| 750 | make_tuple(&aom_highbd_quantize_b_32x32_c, &aom_highbd_quantize_b_32x32_neon, |
| 751 | static_cast<TX_SIZE>(TX_32X32), TYPE_B, AOM_BITS_12), |
| 752 | make_tuple(&aom_highbd_quantize_b_64x64_c, &aom_highbd_quantize_b_64x64_neon, |
| 753 | static_cast<TX_SIZE>(TX_64X64), TYPE_B, AOM_BITS_12), |
James Zern | 7c6fd21 | 2022-06-09 13:41:52 -0700 | [diff] [blame] | 754 | #if !CONFIG_REALTIME_ONLY |
Scott LaVarnway | 2727d2d | 2022-05-03 07:20:51 -0700 | [diff] [blame] | 755 | make_tuple(&aom_highbd_quantize_b_adaptive_c, |
| 756 | &aom_highbd_quantize_b_adaptive_neon, |
| 757 | static_cast<TX_SIZE>(TX_16X16), TYPE_B, AOM_BITS_12), |
| 758 | make_tuple(&aom_highbd_quantize_b_32x32_adaptive_c, |
| 759 | &aom_highbd_quantize_b_32x32_adaptive_neon, |
| 760 | static_cast<TX_SIZE>(TX_32X32), TYPE_B, AOM_BITS_12), |
| 761 | make_tuple(&aom_highbd_quantize_b_64x64_adaptive_c, |
| 762 | &aom_highbd_quantize_b_64x64_adaptive_neon, |
| 763 | static_cast<TX_SIZE>(TX_64X64), TYPE_B, AOM_BITS_12), |
James Zern | 7c6fd21 | 2022-06-09 13:41:52 -0700 | [diff] [blame] | 764 | #endif // !CONFIG_REALTIME_ONLY |
| 765 | #endif // CONFIG_AV1_HIGHBITDEPTH |
Jerome Jiang | e604b4e | 2019-07-01 16:19:48 -0700 | [diff] [blame] | 766 | }; |
| 767 | |
Jerome Jiang | e58af08 | 2020-08-28 14:53:14 -0700 | [diff] [blame] | 768 | INSTANTIATE_TEST_SUITE_P(NEON, FullPrecisionQuantizeTest, |
Cheng Chen | 96786fe | 2020-02-14 17:28:25 -0800 | [diff] [blame] | 769 | ::testing::ValuesIn(kQParamArrayNEON)); |
Jerome Jiang | e604b4e | 2019-07-01 16:19:48 -0700 | [diff] [blame] | 770 | #endif |
| 771 | |
James Zern | 1fbb25c | 2023-05-22 10:45:24 -0700 | [diff] [blame] | 772 | #if HAVE_SSSE3 && AOM_ARCH_X86_64 |
Cheng Chen | 96786fe | 2020-02-14 17:28:25 -0800 | [diff] [blame] | 773 | INSTANTIATE_TEST_SUITE_P( |
Jerome Jiang | e58af08 | 2020-08-28 14:53:14 -0700 | [diff] [blame] | 774 | SSSE3, FullPrecisionQuantizeTest, |
Pascal Massimino | a6fe432 | 2019-04-09 09:49:24 +0200 | [diff] [blame] | 775 | ::testing::Values( |
| 776 | make_tuple(&aom_quantize_b_c, &aom_quantize_b_ssse3, |
| 777 | static_cast<TX_SIZE>(TX_16X16), TYPE_B, AOM_BITS_8), |
| 778 | make_tuple(&aom_quantize_b_32x32_c, &aom_quantize_b_32x32_ssse3, |
| 779 | static_cast<TX_SIZE>(TX_32X32), TYPE_B, AOM_BITS_8), |
| 780 | make_tuple(&aom_quantize_b_64x64_c, &aom_quantize_b_64x64_ssse3, |
| 781 | static_cast<TX_SIZE>(TX_64X64), TYPE_B, AOM_BITS_8))); |
Johann | 89b4c61 | 2018-09-13 15:43:29 -0700 | [diff] [blame] | 782 | |
James Zern | 1fbb25c | 2023-05-22 10:45:24 -0700 | [diff] [blame] | 783 | #endif // HAVE_SSSE3 && AOM_ARCH_X86_64 |
Johann | 89b4c61 | 2018-09-13 15:43:29 -0700 | [diff] [blame] | 784 | |
Jerome Jiang | a281721 | 2020-04-29 10:37:51 -0700 | [diff] [blame] | 785 | #if HAVE_AVX |
Cheng Chen | 96786fe | 2020-02-14 17:28:25 -0800 | [diff] [blame] | 786 | INSTANTIATE_TEST_SUITE_P( |
Jerome Jiang | e58af08 | 2020-08-28 14:53:14 -0700 | [diff] [blame] | 787 | AVX, FullPrecisionQuantizeTest, |
Pascal Massimino | a6fe432 | 2019-04-09 09:49:24 +0200 | [diff] [blame] | 788 | ::testing::Values( |
| 789 | make_tuple(&aom_quantize_b_c, &aom_quantize_b_avx, |
| 790 | static_cast<TX_SIZE>(TX_16X16), TYPE_B, AOM_BITS_8), |
| 791 | make_tuple(&aom_quantize_b_32x32_c, &aom_quantize_b_32x32_avx, |
| 792 | static_cast<TX_SIZE>(TX_32X32), TYPE_B, AOM_BITS_8))); |
Johann | 89b4c61 | 2018-09-13 15:43:29 -0700 | [diff] [blame] | 793 | |
Jerome Jiang | a281721 | 2020-04-29 10:37:51 -0700 | [diff] [blame] | 794 | #endif // HAVE_AVX |
Angie Chiang | 4dd53d0 | 2021-04-27 17:04:44 -0700 | [diff] [blame] | 795 | |
Yi Luo | ef39c84 | 2017-05-19 11:51:53 -0700 | [diff] [blame] | 796 | } // namespace |