This c version uses the shortcuts found in the x86 vp9_quantize_fp functions. The test was updated to use the correct quant/round range.
Unified · Split
| @@ -14,9 +14,9 @@ · 13 unmodified lines | |||
| 14 | 14 | ||
| 15 | #include "third_party/googletest/src/include/gtest/gtest.h" | 15 | #include "third_party/googletest/src/include/gtest/gtest.h" |
| 16 | 16 | ||
| 17 | #include "./vp9_rtcd.h" | ||
| 17 | #include "./vpx_config.h" | 18 | #include "./vpx_config.h" |
| 18 | #include "./vpx_dsp_rtcd.h" | 19 | #include "./vpx_dsp_rtcd.h" |
| 19 | #include "./vp9_rtcd.h" | ||
| 20 | #include "test/acm_random.h" | 20 | #include "test/acm_random.h" |
| 21 | #include "test/buffer.h" | 21 | #include "test/buffer.h" |
| 22 | #include "test/clear_system_state.h" | 22 | #include "test/clear_system_state.h" |
| @@ -42,7 +42,7 @@ typedef void (*QuantizeFunc)(const tran_low_t *coeff, intptr_t count, · 19 unmodified lines | |||
| 42 | uint16_t *eob, const int16_t *scan, | 42 | uint16_t *eob, const int16_t *scan, |
| 43 | const int16_t *iscan); | 43 | const int16_t *iscan); |
| 44 | typedef std::tr1::tuple<QuantizeFunc, QuantizeFunc, vpx_bit_depth_t, | 44 | typedef std::tr1::tuple<QuantizeFunc, QuantizeFunc, vpx_bit_depth_t, |
| 45 | int /*max_size*/> | 45 | int /*max_size*/, bool /*is_fp*/> |
| 46 | QuantizeParam; | 46 | QuantizeParam; |
| 47 | 47 | ||
| 48 | // Wrapper for FP version which does not use zbin or quant_shift. | 48 | // Wrapper for FP version which does not use zbin or quant_shift. |
| @@ -69,11 +69,15 @@ void QuantFPWrapper(const tran_low_t *coeff, intptr_t count, int skip_block, · 20 unmodified lines | |||
| 69 | 69 | ||
| 70 | class VP9QuantizeBase { | 70 | class VP9QuantizeBase { |
| 71 | public: | 71 | public: |
| 72 | VP9QuantizeBase(vpx_bit_depth_t bit_depth, int max_size) | 72 | VP9QuantizeBase(vpx_bit_depth_t bit_depth, int max_size, bool is_fp) |
| 73 | : bit_depth_(bit_depth), max_size_(max_size) { | 73 | : bit_depth_(bit_depth), max_size_(max_size), is_fp_(is_fp) { |
| 74 | max_value_ = (1 << bit_depth_) - 1; | 74 | max_value_ = (1 << bit_depth_) - 1; |
| 75 | zbin_ptr_ = | 75 | zbin_ptr_ = |
| 76 | reinterpret_cast<int16_t *>(vpx_memalign(16, 8 * sizeof(*zbin_ptr_))); | 76 | reinterpret_cast<int16_t *>(vpx_memalign(16, 8 * sizeof(*zbin_ptr_))); |
| 77 | round_fp_ptr_ = reinterpret_cast<int16_t *>( | ||
| 78 | vpx_memalign(16, 8 * sizeof(*round_fp_ptr_))); | ||
| 79 | quant_fp_ptr_ = reinterpret_cast<int16_t *>( | ||
| 80 | vpx_memalign(16, 8 * sizeof(*quant_fp_ptr_))); | ||
| 77 | round_ptr_ = | 81 | round_ptr_ = |
| 78 | reinterpret_cast<int16_t *>(vpx_memalign(16, 8 * sizeof(*round_ptr_))); | 82 | reinterpret_cast<int16_t *>(vpx_memalign(16, 8 * sizeof(*round_ptr_))); |
| 79 | quant_ptr_ = | 83 | quant_ptr_ = |
| @@ -86,11 +90,15 @@ class VP9QuantizeBase { · 6 unmodified lines | |||
| 86 | 90 | ||
| 87 | ~VP9QuantizeBase() { | 91 | ~VP9QuantizeBase() { |
| 88 | vpx_free(zbin_ptr_); | 92 | vpx_free(zbin_ptr_); |
| 93 | vpx_free(round_fp_ptr_); | ||
| 94 | vpx_free(quant_fp_ptr_); | ||
| 89 | vpx_free(round_ptr_); | 95 | vpx_free(round_ptr_); |
| 90 | vpx_free(quant_ptr_); | 96 | vpx_free(quant_ptr_); |
| 91 | vpx_free(quant_shift_ptr_); | 97 | vpx_free(quant_shift_ptr_); |
| 92 | vpx_free(dequant_ptr_); | 98 | vpx_free(dequant_ptr_); |
| 93 | zbin_ptr_ = NULL; | 99 | zbin_ptr_ = NULL; |
| 100 | round_fp_ptr_ = NULL; | ||
| 101 | quant_fp_ptr_ = NULL; | ||
| 94 | round_ptr_ = NULL; | 102 | round_ptr_ = NULL; |
| 95 | quant_ptr_ = NULL; | 103 | quant_ptr_ = NULL; |
| 96 | quant_shift_ptr_ = NULL; | 104 | quant_shift_ptr_ = NULL; |
| @@ -100,6 +108,8 @@ class VP9QuantizeBase { · 3 unmodified lines | |||
| 100 | 108 | ||
| 101 | protected: | 109 | protected: |
| 102 | int16_t *zbin_ptr_; | 110 | int16_t *zbin_ptr_; |
| 111 | int16_t *round_fp_ptr_; | ||
| 112 | int16_t *quant_fp_ptr_; | ||
| 103 | int16_t *round_ptr_; | 113 | int16_t *round_ptr_; |
| 104 | int16_t *quant_ptr_; | 114 | int16_t *quant_ptr_; |
| 105 | int16_t *quant_shift_ptr_; | 115 | int16_t *quant_shift_ptr_; |
| @@ -107,29 +117,103 @@ class VP9QuantizeBase { · 1 unmodified line | |||
| 107 | const vpx_bit_depth_t bit_depth_; | 117 | const vpx_bit_depth_t bit_depth_; |
| 108 | int max_value_; | 118 | int max_value_; |
| 109 | const int max_size_; | 119 | const int max_size_; |
| 120 | const bool is_fp_; | ||
| 110 | }; | 121 | }; |
| 111 | 122 | ||
| 112 | class VP9QuantizeTest : public VP9QuantizeBase, | 123 | class VP9QuantizeTest : public VP9QuantizeBase, |
| 113 | public ::testing::TestWithParam<QuantizeParam> { | 124 | public ::testing::TestWithParam<QuantizeParam> { |
| 114 | public: | 125 | public: |
| 115 | VP9QuantizeTest() | 126 | VP9QuantizeTest() |
| 116 | : VP9QuantizeBase(GET_PARAM(2), GET_PARAM(3)), quantize_op_(GET_PARAM(0)), | 127 | : VP9QuantizeBase(GET_PARAM(2), GET_PARAM(3), GET_PARAM(4)), |
| 117 | ref_quantize_op_(GET_PARAM(1)) {} | 128 | quantize_op_(GET_PARAM(0)), ref_quantize_op_(GET_PARAM(1)) {} |
| 118 | 129 | ||
| 119 | protected: | 130 | protected: |
| 120 | const QuantizeFunc quantize_op_; | 131 | const QuantizeFunc quantize_op_; |
| 121 | const QuantizeFunc ref_quantize_op_; | 132 | const QuantizeFunc ref_quantize_op_; |
| 122 | }; | 133 | }; |
| 123 | 134 | ||
| 135 | // This quantizer compares the AC coefficients to the quantization step size to | ||
| 136 | // determine if further multiplication operations are needed. | ||
| 137 | // Based on vp9_quantize_fp_sse2(). | ||
| 138 | void quantize_fp_nz_c(const tran_low_t *coeff_ptr, intptr_t n_coeffs, | ||
| 139 | int skip_block, const int16_t *round_ptr, | ||
| 140 | const int16_t *quant_ptr, tran_low_t *qcoeff_ptr, | ||
| 141 | tran_low_t *dqcoeff_ptr, const int16_t *dequant_ptr, | ||
| 142 | uint16_t *eob_ptr, const int16_t *scan, | ||
| 143 | const int16_t *iscan) { | ||
| 144 | int i, eob = -1; | ||
| 145 | const int thr = dequant_ptr[1] >> 1; | ||
| 146 | (void)iscan; | ||
| 147 | (void)skip_block; | ||
| 148 | assert(!skip_block); | ||
| 149 | |||
| 150 | // Quantization pass: All coefficients with index >= zero_flag are | ||
| 151 | // skippable. Note: zero_flag can be zero. | ||
| 152 | for (i = 0; i < n_coeffs; i += 16) { | ||
| 153 | int y; | ||
| 154 | int nzflag_cnt = 0; | ||
| 155 | int abs_coeff[16]; | ||
| 156 | int coeff_sign[16]; | ||
| 157 | |||
| 158 | // count nzflag for each row (16 tran_low_t) | ||
| 159 | for (y = 0; y < 16; ++y) { | ||
| 160 | const int rc = i + y; | ||
| 161 | const int coeff = coeff_ptr[rc]; | ||
| 162 | coeff_sign[y] = (coeff >> 31); | ||
| 163 | abs_coeff[y] = (coeff ^ coeff_sign[y]) - coeff_sign[y]; | ||
| 164 | // The first 16 are skipped in the sse2 code. Do the same here to match. | ||
| 165 | if (i >= 16 && (abs_coeff[y] <= thr)) { | ||
| 166 | nzflag_cnt++; | ||
| 167 | } | ||
| 168 | } | ||
| 169 | |||
| 170 | for (y = 0; y < 16; ++y) { | ||
| 171 | const int rc = i + y; | ||
| 172 | // If all of the AC coeffs in a row has magnitude less than the | ||
| 173 | // quantization step_size/2, quantize to zero. | ||
| 174 | if (nzflag_cnt < 16) { | ||
| 175 | int tmp = | ||
| 176 | clamp(abs_coeff[y] + round_ptr[rc != 0], INT16_MIN, INT16_MAX); | ||
| 177 | tmp = (tmp * quant_ptr[rc != 0]) >> 16; | ||
| 178 | qcoeff_ptr[rc] = (tmp ^ coeff_sign[y]) - coeff_sign[y]; | ||
| 179 | dqcoeff_ptr[rc] = qcoeff_ptr[rc] * dequant_ptr[rc != 0]; | ||
| 180 | } else { | ||
| 181 | qcoeff_ptr[rc] = 0; | ||
| 182 | dqcoeff_ptr[rc] = 0; | ||
| 183 | } | ||
| 184 | } | ||
| 185 | } | ||
| 186 | |||
| 187 | // Scan for eob. | ||
| 188 | for (i = 0; i < n_coeffs; i++) { | ||
| 189 | // Use the scan order to find the correct eob. | ||
| 190 | const int rc = scan[i]; | ||
| 191 | if (qcoeff_ptr[rc]) { | ||
| 192 | eob = i; | ||
| 193 | } | ||
| 194 | } | ||
| 195 | *eob_ptr = eob + 1; | ||
| 196 | } | ||
| 197 | |||
| 124 | void GenerateHelperArrays(ACMRandom *rnd, int16_t *zbin, int16_t *round, | 198 | void GenerateHelperArrays(ACMRandom *rnd, int16_t *zbin, int16_t *round, |
| 125 | int16_t *quant, int16_t *quant_shift, | 199 | int16_t *quant, int16_t *quant_shift, |
| 126 | int16_t *dequant) { | 200 | int16_t *dequant, int16_t *round_fp, |
| 201 | int16_t *quant_fp) { | ||
| 202 | // Max when q == 0. Otherwise, it is 48 for Y and 42 for U/V. | ||
| 203 | const int max_qrounding_factor_fp = 64; | ||
| 204 | |||
| 127 | for (int j = 0; j < 2; j++) { | 205 | for (int j = 0; j < 2; j++) { |
| 206 | // The range is 4 to 1828 in the VP9 tables. | ||
| 207 | const int qlookup = rnd->RandRange(1825) + 4; | ||
| 208 | round_fp[j] = (max_qrounding_factor_fp * qlookup) >> 7; | ||
| 209 | quant_fp[j] = (1 << 16) / qlookup; | ||
| 210 | |||
| 128 | // Values determined by deconstructing vp9_init_quantizer(). | 211 | // Values determined by deconstructing vp9_init_quantizer(). |
| 129 | // zbin may be up to 1143 for 8 and 10 bit Y values, or 1200 for 12 bit Y | 212 | // zbin may be up to 1143 for 8 and 10 bit Y values, or 1200 for 12 bit Y |
| 130 | // values or U/V values of any bit depth. This is because y_delta is not | 213 | // values or U/V values of any bit depth. This is because y_delta is not |
| 131 | // factored into the vp9_ac_quant() call. | 214 | // factored into the vp9_ac_quant() call. |
| 132 | zbin[j] = rnd->RandRange(1200); | 215 | zbin[j] = rnd->RandRange(1200); |
| 216 | |||
| 133 | // round may be up to 685 for Y values or 914 for U/V. | 217 | // round may be up to 685 for Y values or 914 for U/V. |
| 134 | round[j] = rnd->RandRange(914); | 218 | round[j] = rnd->RandRange(914); |
| 135 | // quant ranges from 1 to -32703 | 219 | // quant ranges from 1 to -32703 |
| @@ -141,6 +225,8 @@ void GenerateHelperArrays(ACMRandom *rnd, int16_t *zbin, int16_t *round, · 5 unmodified lines | |||
| 141 | } | 225 | } |
| 142 | for (int j = 2; j < 8; j++) { | 226 | for (int j = 2; j < 8; j++) { |
| 143 | zbin[j] = zbin[1]; | 227 | zbin[j] = zbin[1]; |
| 228 | round_fp[j] = round_fp[1]; | ||
| 229 | quant_fp[j] = quant_fp[1]; | ||
| 144 | round[j] = round[1]; | 230 | round[j] = round[1]; |
| 145 | quant[j] = quant[1]; | 231 | quant[j] = quant[1]; |
| 146 | quant_shift[j] = quant_shift[1]; | 232 | quant_shift[j] = quant_shift[1]; |
| @@ -179,19 +265,19 @@ TEST_P(VP9QuantizeTest, OperationCheck) { · 32 unmodified lines | |||
| 179 | const int count = (4 << sz) * (4 << sz); | 265 | const int count = (4 << sz) * (4 << sz); |
| 180 | coeff.Set(&rnd, -max_value_, max_value_); | 266 | coeff.Set(&rnd, -max_value_, max_value_); |
| 181 | GenerateHelperArrays(&rnd, zbin_ptr_, round_ptr_, quant_ptr_, | 267 | GenerateHelperArrays(&rnd, zbin_ptr_, round_ptr_, quant_ptr_, |
| 182 | quant_shift_ptr_, dequant_ptr_); | 268 | quant_shift_ptr_, dequant_ptr_, round_fp_ptr_, |
| 183 | 269 | quant_fp_ptr_); | |
| 184 | ref_quantize_op_(coeff.TopLeftPixel(), count, skip_block, zbin_ptr_, | 270 | int16_t *r_ptr = (is_fp_) ? round_fp_ptr_ : round_ptr_; |
| 185 | round_ptr_, quant_ptr_, quant_shift_ptr_, | 271 | int16_t *q_ptr = (is_fp_) ? quant_fp_ptr_ : quant_ptr_; |
| 186 | ref_qcoeff.TopLeftPixel(), ref_dqcoeff.TopLeftPixel(), | 272 | ref_quantize_op_(coeff.TopLeftPixel(), count, skip_block, zbin_ptr_, r_ptr, |
| 187 | dequant_ptr_, &ref_eob, scan_order->scan, | 273 | q_ptr, quant_shift_ptr_, ref_qcoeff.TopLeftPixel(), |
| 188 | scan_order->iscan); | 274 | ref_dqcoeff.TopLeftPixel(), dequant_ptr_, &ref_eob, |
| 189 | 275 | scan_order->scan, scan_order->iscan); | |
| 190 | ASM_REGISTER_STATE_CHECK( | 276 | |
| 191 | quantize_op_(coeff.TopLeftPixel(), count, skip_block, zbin_ptr_, | 277 | ASM_REGISTER_STATE_CHECK(quantize_op_( |
| 192 | round_ptr_, quant_ptr_, quant_shift_ptr_, | 278 | coeff.TopLeftPixel(), count, skip_block, zbin_ptr_, r_ptr, q_ptr, |
| 193 | qcoeff.TopLeftPixel(), dqcoeff.TopLeftPixel(), | 279 | quant_shift_ptr_, qcoeff.TopLeftPixel(), dqcoeff.TopLeftPixel(), |
| 194 | dequant_ptr_, &eob, scan_order->scan, scan_order->iscan)); | 280 | dequant_ptr_, &eob, scan_order->scan, scan_order->iscan)); |
| 195 | 281 | ||
| 196 | EXPECT_TRUE(qcoeff.CheckValues(ref_qcoeff)); | 282 | EXPECT_TRUE(qcoeff.CheckValues(ref_qcoeff)); |
| 197 | EXPECT_TRUE(dqcoeff.CheckValues(ref_dqcoeff)); | 283 | EXPECT_TRUE(dqcoeff.CheckValues(ref_dqcoeff)); |
| @@ -241,19 +327,19 @@ TEST_P(VP9QuantizeTest, EOBCheck) { · 43 unmodified lines | |||
| 241 | coeff.TopLeftPixel()[rnd(count)] = | 327 | coeff.TopLeftPixel()[rnd(count)] = |
| 242 | static_cast<int>(rnd.RandRange(max_value_ * 2)) - max_value_; | 328 | static_cast<int>(rnd.RandRange(max_value_ * 2)) - max_value_; |
| 243 | GenerateHelperArrays(&rnd, zbin_ptr_, round_ptr_, quant_ptr_, | 329 | GenerateHelperArrays(&rnd, zbin_ptr_, round_ptr_, quant_ptr_, |
| 244 | quant_shift_ptr_, dequant_ptr_); | 330 | quant_shift_ptr_, dequant_ptr_, round_fp_ptr_, |
| 245 | 331 | quant_fp_ptr_); | |
| 246 | ref_quantize_op_(coeff.TopLeftPixel(), count, skip_block, zbin_ptr_, | 332 | int16_t *r_ptr = (is_fp_) ? round_fp_ptr_ : round_ptr_; |
| 247 | round_ptr_, quant_ptr_, quant_shift_ptr_, | 333 | int16_t *q_ptr = (is_fp_) ? quant_fp_ptr_ : quant_ptr_; |
| 248 | ref_qcoeff.TopLeftPixel(), ref_dqcoeff.TopLeftPixel(), | 334 | ref_quantize_op_(coeff.TopLeftPixel(), count, skip_block, zbin_ptr_, r_ptr, |
| 249 | dequant_ptr_, &ref_eob, scan_order->scan, | 335 | q_ptr, quant_shift_ptr_, ref_qcoeff.TopLeftPixel(), |
| 250 | scan_order->iscan); | 336 | ref_dqcoeff.TopLeftPixel(), dequant_ptr_, &ref_eob, |
| 251 | 337 | scan_order->scan, scan_order->iscan); | |
| 252 | ASM_REGISTER_STATE_CHECK( | 338 | |
| 253 | quantize_op_(coeff.TopLeftPixel(), count, skip_block, zbin_ptr_, | 339 | ASM_REGISTER_STATE_CHECK(quantize_op_( |
| 254 | round_ptr_, quant_ptr_, quant_shift_ptr_, | 340 | coeff.TopLeftPixel(), count, skip_block, zbin_ptr_, r_ptr, q_ptr, |
| 255 | qcoeff.TopLeftPixel(), dqcoeff.TopLeftPixel(), | 341 | quant_shift_ptr_, qcoeff.TopLeftPixel(), dqcoeff.TopLeftPixel(), |
| 256 | dequant_ptr_, &eob, scan_order->scan, scan_order->iscan)); | 342 | dequant_ptr_, &eob, scan_order->scan, scan_order->iscan)); |
| 257 | 343 | ||
| 258 | EXPECT_TRUE(qcoeff.CheckValues(ref_qcoeff)); | 344 | EXPECT_TRUE(qcoeff.CheckValues(ref_qcoeff)); |
| 259 | EXPECT_TRUE(dqcoeff.CheckValues(ref_dqcoeff)); | 345 | EXPECT_TRUE(dqcoeff.CheckValues(ref_dqcoeff)); |
| @@ -299,7 +385,10 @@ TEST_P(VP9QuantizeTest, DISABLED_Speed) { · 39 unmodified lines | |||
| 299 | const int count = (4 << sz) * (4 << sz); | 385 | const int count = (4 << sz) * (4 << sz); |
| 300 | 386 | ||
| 301 | GenerateHelperArrays(&rnd, zbin_ptr_, round_ptr_, quant_ptr_, | 387 | GenerateHelperArrays(&rnd, zbin_ptr_, round_ptr_, quant_ptr_, |
| 302 | quant_shift_ptr_, dequant_ptr_); | 388 | quant_shift_ptr_, dequant_ptr_, round_fp_ptr_, |
| 389 | quant_fp_ptr_); | ||
| 390 | int16_t *r_ptr = (is_fp_) ? round_fp_ptr_ : round_ptr_; | ||
| 391 | int16_t *q_ptr = (is_fp_) ? quant_fp_ptr_ : quant_ptr_; | ||
| 303 | 392 | ||
| 304 | if (i == 0) { | 393 | if (i == 0) { |
| 305 | // When |coeff values| are less than zbin the results are 0. | 394 | // When |coeff values| are less than zbin the results are 0. |
| @@ -319,10 +408,10 @@ TEST_P(VP9QuantizeTest, DISABLED_Speed) { · 13 unmodified lines | |||
| 319 | vpx_usec_timer timer; | 408 | vpx_usec_timer timer; |
| 320 | vpx_usec_timer_start(&timer); | 409 | vpx_usec_timer_start(&timer); |
| 321 | for (int j = 0; j < 100000000 / count; ++j) { | 410 | for (int j = 0; j < 100000000 / count; ++j) { |
| 322 | quantize_op_(coeff.TopLeftPixel(), count, skip_block, zbin_ptr_, | 411 | quantize_op_(coeff.TopLeftPixel(), count, skip_block, zbin_ptr_, r_ptr, |
| 323 | round_ptr_, quant_ptr_, quant_shift_ptr_, | 412 | q_ptr, quant_shift_ptr_, qcoeff.TopLeftPixel(), |
| 324 | qcoeff.TopLeftPixel(), dqcoeff.TopLeftPixel(), | 413 | dqcoeff.TopLeftPixel(), dequant_ptr_, &eob, |
| 325 | dequant_ptr_, &eob, scan_order->scan, scan_order->iscan); | 414 | scan_order->scan, scan_order->iscan); |
| 326 | } | 415 | } |
| 327 | vpx_usec_timer_mark(&timer); | 416 | vpx_usec_timer_mark(&timer); |
| 328 | const int elapsed_time = static_cast<int>(vpx_usec_timer_elapsed(&timer)); | 417 | const int elapsed_time = static_cast<int>(vpx_usec_timer_elapsed(&timer)); |
| @@ -345,50 +434,55 @@ INSTANTIATE_TEST_CASE_P( · 16 unmodified lines | |||
| 345 | SSE2, VP9QuantizeTest, | 434 | SSE2, VP9QuantizeTest, |
| 346 | ::testing::Values( | 435 | ::testing::Values( |
| 347 | make_tuple(&vpx_highbd_quantize_b_sse2, &vpx_highbd_quantize_b_c, | 436 | make_tuple(&vpx_highbd_quantize_b_sse2, &vpx_highbd_quantize_b_c, |
| 348 | VPX_BITS_8, 16), | 437 | VPX_BITS_8, 16, false), |
| 349 | make_tuple(&vpx_highbd_quantize_b_sse2, &vpx_highbd_quantize_b_c, | 438 | make_tuple(&vpx_highbd_quantize_b_sse2, &vpx_highbd_quantize_b_c, |
| 350 | VPX_BITS_10, 16), | 439 | VPX_BITS_10, 16, false), |
| 351 | make_tuple(&vpx_highbd_quantize_b_sse2, &vpx_highbd_quantize_b_c, | 440 | make_tuple(&vpx_highbd_quantize_b_sse2, &vpx_highbd_quantize_b_c, |
| 352 | VPX_BITS_12, 16), | 441 | VPX_BITS_12, 16, false), |
| 353 | make_tuple(&vpx_highbd_quantize_b_32x32_sse2, | 442 | make_tuple(&vpx_highbd_quantize_b_32x32_sse2, |
| 354 | &vpx_highbd_quantize_b_32x32_c, VPX_BITS_8, 32), | 443 | &vpx_highbd_quantize_b_32x32_c, VPX_BITS_8, 32, false), |
| 355 | make_tuple(&vpx_highbd_quantize_b_32x32_sse2, | 444 | make_tuple(&vpx_highbd_quantize_b_32x32_sse2, |
| 356 | &vpx_highbd_quantize_b_32x32_c, VPX_BITS_10, 32), | 445 | &vpx_highbd_quantize_b_32x32_c, VPX_BITS_10, 32, false), |
| 357 | make_tuple(&vpx_highbd_quantize_b_32x32_sse2, | 446 | make_tuple(&vpx_highbd_quantize_b_32x32_sse2, |
| 358 | &vpx_highbd_quantize_b_32x32_c, VPX_BITS_12, 32))); | 447 | &vpx_highbd_quantize_b_32x32_c, VPX_BITS_12, 32, false))); |
| 359 | 448 | ||
| 360 | #else | 449 | #else |
| 361 | INSTANTIATE_TEST_CASE_P(SSE2, VP9QuantizeTest, | ||
| 362 | ::testing::Values(make_tuple(&vpx_quantize_b_sse2, | ||
| 363 | &vpx_quantize_b_c, | ||
| 364 | VPX_BITS_8, 16))); | ||
| 365 | #endif // CONFIG_VP9_HIGHBITDEPTH | ||
| 366 | |||
| 367 | INSTANTIATE_TEST_CASE_P( | 450 | INSTANTIATE_TEST_CASE_P( |
| 368 | DISABLED_SSE2, VP9QuantizeTest, | 451 | SSE2, VP9QuantizeTest, |
| 369 | ::testing::Values(make_tuple(&QuantFPWrapper<vp9_quantize_fp_sse2>, | 452 | ::testing::Values(make_tuple(&vpx_quantize_b_sse2, &vpx_quantize_b_c, |
| 370 | &QuantFPWrapper<vp9_quantize_fp_c>, VPX_BITS_8, | 453 | VPX_BITS_8, 16, false), |
| 371 | 16))); | 454 | make_tuple(&QuantFPWrapper<vp9_quantize_fp_sse2>, |
| 455 | &QuantFPWrapper<quantize_fp_nz_c>, VPX_BITS_8, | ||
| 456 | 16, true))); | ||
| 457 | #endif // CONFIG_VP9_HIGHBITDEPTH | ||
| 372 | #endif // HAVE_SSE2 | 458 | #endif // HAVE_SSE2 |
| 373 | 459 | ||
| 374 | #if HAVE_SSSE3 && !CONFIG_VP9_HIGHBITDEPTH | 460 | #if HAVE_SSSE3 && !CONFIG_VP9_HIGHBITDEPTH |
| 461 | #if ARCH_X86_64 | ||
| 462 | INSTANTIATE_TEST_CASE_P( | ||
| 463 | SSSE3, VP9QuantizeTest, | ||
| 464 | ::testing::Values(make_tuple(&vpx_quantize_b_ssse3, &vpx_quantize_b_c, | ||
| 465 | VPX_BITS_8, 16, false), | ||
| 466 | make_tuple(&QuantFPWrapper<vp9_quantize_fp_ssse3>, | ||
| 467 | &QuantFPWrapper<quantize_fp_nz_c>, VPX_BITS_8, | ||
| 468 | 16, true))); | ||
| 469 | #else | ||
| 375 | INSTANTIATE_TEST_CASE_P(SSSE3, VP9QuantizeTest, | 470 | INSTANTIATE_TEST_CASE_P(SSSE3, VP9QuantizeTest, |
| 376 | ::testing::Values(make_tuple(&vpx_quantize_b_ssse3, | 471 | ::testing::Values(make_tuple(&vpx_quantize_b_ssse3, |
| 377 | &vpx_quantize_b_c, | 472 | &vpx_quantize_b_c, |
| 378 | VPX_BITS_8, 16))); | 473 | VPX_BITS_8, 16, false))); |
| 474 | #endif | ||
| 379 | 475 | ||
| 380 | #if ARCH_X86_64 | 476 | #if ARCH_X86_64 |
| 381 | // TODO(johannkoenig): SSSE3 optimizations do not yet pass this test. | 477 | // TODO(johannkoenig): SSSE3 optimizations do not yet pass this test. |
| 382 | INSTANTIATE_TEST_CASE_P( | 478 | INSTANTIATE_TEST_CASE_P( |
| 383 | DISABLED_SSSE3, VP9QuantizeTest, | 479 | DISABLED_SSSE3, VP9QuantizeTest, |
| 384 | ::testing::Values(make_tuple(&vpx_quantize_b_32x32_ssse3, | 480 | ::testing::Values(make_tuple(&vpx_quantize_b_32x32_ssse3, |
| 385 | &vpx_quantize_b_32x32_c, VPX_BITS_8, 32), | 481 | &vpx_quantize_b_32x32_c, VPX_BITS_8, 32, |
| 386 | make_tuple(&QuantFPWrapper<vp9_quantize_fp_ssse3>, | 482 | false), |
| 387 | &QuantFPWrapper<vp9_quantize_fp_c>, VPX_BITS_8, | ||
| 388 | 16), | ||
| 389 | make_tuple(&QuantFPWrapper<vp9_quantize_fp_32x32_ssse3>, | 483 | make_tuple(&QuantFPWrapper<vp9_quantize_fp_32x32_ssse3>, |
| 390 | &QuantFPWrapper<vp9_quantize_fp_32x32_c>, | 484 | &QuantFPWrapper<vp9_quantize_fp_32x32_c>, |
| 391 | VPX_BITS_8, 32))); | 485 | VPX_BITS_8, 32, true))); |
| 392 | #endif // ARCH_X86_64 | 486 | #endif // ARCH_X86_64 |
| 393 | #endif // HAVE_SSSE3 && !CONFIG_VP9_HIGHBITDEPTH | 487 | #endif // HAVE_SSSE3 && !CONFIG_VP9_HIGHBITDEPTH |
| 394 | 488 | ||
| @@ -398,36 +492,43 @@ INSTANTIATE_TEST_CASE_P( · 3 unmodified lines | |||
| 398 | INSTANTIATE_TEST_CASE_P( | 492 | INSTANTIATE_TEST_CASE_P( |
| 399 | AVX, VP9QuantizeTest, | 493 | AVX, VP9QuantizeTest, |
| 400 | ::testing::Values(make_tuple(&vpx_quantize_b_avx, &vpx_quantize_b_c, | 494 | ::testing::Values(make_tuple(&vpx_quantize_b_avx, &vpx_quantize_b_c, |
| 401 | VPX_BITS_8, 16), | 495 | VPX_BITS_8, 16, false), |
| 402 | // Even though SSSE3 and AVX do not match the reference | 496 | // Even though SSSE3 and AVX do not match the reference |
| 403 | // code, we can keep them in sync with each other. | 497 | // code, we can keep them in sync with each other. |
| 404 | make_tuple(&vpx_quantize_b_32x32_avx, | 498 | make_tuple(&vpx_quantize_b_32x32_avx, |
| 405 | &vpx_quantize_b_32x32_ssse3, VPX_BITS_8, 32))); | 499 | &vpx_quantize_b_32x32_ssse3, VPX_BITS_8, 32, |
| 500 | false))); | ||
| 406 | #endif // HAVE_AVX && !CONFIG_VP9_HIGHBITDEPTH | 501 | #endif // HAVE_AVX && !CONFIG_VP9_HIGHBITDEPTH |
| 407 | 502 | ||
| 408 | // TODO(webm:1448): dqcoeff is not handled correctly in HBD builds. | 503 | // TODO(webm:1448): dqcoeff is not handled correctly in HBD builds. |
| 409 | #if HAVE_NEON && !CONFIG_VP9_HIGHBITDEPTH | 504 | #if HAVE_NEON && !CONFIG_VP9_HIGHBITDEPTH |
| 410 | INSTANTIATE_TEST_CASE_P( | 505 | INSTANTIATE_TEST_CASE_P( |
| 411 | NEON, VP9QuantizeTest, | 506 | NEON, VP9QuantizeTest, |
| 412 | ::testing::Values( | 507 | ::testing::Values(make_tuple(&vpx_quantize_b_neon, &vpx_quantize_b_c, |
| 413 | make_tuple(&vpx_quantize_b_neon, &vpx_quantize_b_c, VPX_BITS_8, 16), | 508 | VPX_BITS_8, 16, false), |
| 414 | make_tuple(&vpx_quantize_b_32x32_neon, &vpx_quantize_b_32x32_c, | 509 | make_tuple(&vpx_quantize_b_32x32_neon, |
| 415 | VPX_BITS_8, 32), | 510 | &vpx_quantize_b_32x32_c, VPX_BITS_8, 32, |
| 416 | make_tuple(&QuantFPWrapper<vp9_quantize_fp_neon>, | 511 | false), |
| 417 | &QuantFPWrapper<vp9_quantize_fp_c>, VPX_BITS_8, 16), | 512 | make_tuple(&QuantFPWrapper<vp9_quantize_fp_neon>, |
| 418 | make_tuple(&QuantFPWrapper<vp9_quantize_fp_32x32_neon>, | 513 | &QuantFPWrapper<vp9_quantize_fp_c>, VPX_BITS_8, |
| 419 | &QuantFPWrapper<vp9_quantize_fp_32x32_c>, VPX_BITS_8, 32))); | 514 | 16, true), |
| 515 | make_tuple(&QuantFPWrapper<vp9_quantize_fp_32x32_neon>, | ||
| 516 | &QuantFPWrapper<vp9_quantize_fp_32x32_c>, | ||
| 517 | VPX_BITS_8, 32, true))); | ||
| 420 | #endif // HAVE_NEON && !CONFIG_VP9_HIGHBITDEPTH | 518 | #endif // HAVE_NEON && !CONFIG_VP9_HIGHBITDEPTH |
| 421 | 519 | ||
| 422 | // Only useful to compare "Speed" test results. | 520 | // Only useful to compare "Speed" test results. |
| 423 | INSTANTIATE_TEST_CASE_P( | 521 | INSTANTIATE_TEST_CASE_P( |
| 424 | DISABLED_C, VP9QuantizeTest, | 522 | DISABLED_C, VP9QuantizeTest, |
| 425 | ::testing::Values( | 523 | ::testing::Values( |
| 426 | make_tuple(&vpx_quantize_b_c, &vpx_quantize_b_c, VPX_BITS_8, 16), | 524 | make_tuple(&vpx_quantize_b_c, &vpx_quantize_b_c, VPX_BITS_8, 16, false), |
| 427 | make_tuple(&vpx_quantize_b_32x32_c, &vpx_quantize_b_32x32_c, VPX_BITS_8, | 525 | make_tuple(&vpx_quantize_b_32x32_c, &vpx_quantize_b_32x32_c, VPX_BITS_8, |
| 428 | 32), | 526 | 32, false), |
| 429 | make_tuple(&QuantFPWrapper<vp9_quantize_fp_c>, | 527 | make_tuple(&QuantFPWrapper<vp9_quantize_fp_c>, |
| 430 | &QuantFPWrapper<vp9_quantize_fp_c>, VPX_BITS_8, 16), | 528 | &QuantFPWrapper<vp9_quantize_fp_c>, VPX_BITS_8, 16, true), |
| 529 | make_tuple(&QuantFPWrapper<quantize_fp_nz_c>, | ||
| 530 | &QuantFPWrapper<quantize_fp_nz_c>, VPX_BITS_8, 16, true), | ||
| 431 | make_tuple(&QuantFPWrapper<vp9_quantize_fp_32x32_c>, | 531 | make_tuple(&QuantFPWrapper<vp9_quantize_fp_32x32_c>, |
| 432 | &QuantFPWrapper<vp9_quantize_fp_32x32_c>, VPX_BITS_8, 32))); | 532 | &QuantFPWrapper<vp9_quantize_fp_32x32_c>, VPX_BITS_8, 32, |
| 533 | true))); | ||
| 433 | } // namespace | 534 | } // namespace |