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,98 @@ 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 | memset(qcoeff_ptr, 0, n_coeffs * sizeof(*qcoeff_ptr)); | ||
| 151 | memset(dqcoeff_ptr, 0, n_coeffs * sizeof(*dqcoeff_ptr)); | ||
| 152 | |||
| 153 | // Quantization pass: All coefficients with index >= zero_flag are | ||
| 154 | // skippable. Note: zero_flag can be zero. | ||
| 155 | for (i = 0; i < n_coeffs; i++) { | ||
| 156 | // Work on row order in this loop. | ||
| 157 | const int rc = i; | ||
| 158 | const int coeff = coeff_ptr[rc]; | ||
| 159 | const int coeff_sign = (coeff >> 31); | ||
| 160 | const int abs_coeff = (coeff ^ coeff_sign) - coeff_sign; | ||
| 161 | int nzflag = 1; | ||
| 162 | |||
| 163 | // If all of the AC coeffs in a row has magnitude less than the | ||
| 164 | // quantization step_size/2, quantize to zero. | ||
| 165 | // | ||
| 166 | // The first 16 are skipped in the sse2 code. Do the same here to match. | ||
| 167 | if (i >= 16 && (abs_coeff <= thr)) { | ||
| 168 | nzflag = 0; | ||
| 169 | } | ||
| 170 | |||
| 171 | if (nzflag) { | ||
| 172 | int tmp = clamp(abs_coeff + round_ptr[rc != 0], INT16_MIN, INT16_MAX); | ||
| 173 | tmp = (tmp * quant_ptr[rc != 0]) >> 16; | ||
| 174 | qcoeff_ptr[rc] = (tmp ^ coeff_sign) - coeff_sign; | ||
| 175 | dqcoeff_ptr[rc] = qcoeff_ptr[rc] * dequant_ptr[rc != 0]; | ||
| 176 | } else { | ||
| 177 | qcoeff_ptr[rc] = 0; | ||
| 178 | dqcoeff_ptr[rc] = 0; | ||
| 179 | } | ||
| 180 | } | ||
| 181 | |||
| 182 | // Scan for eob. | ||
| 183 | for (i = 0; i < n_coeffs; i++) { | ||
| 184 | // Use the scan order to find the correct eob. | ||
| 185 | const int rc = scan[i]; | ||
| 186 | if (qcoeff_ptr[rc]) { | ||
| 187 | eob = i; | ||
| 188 | } | ||
| 189 | } | ||
| 190 | *eob_ptr = eob + 1; | ||
| 191 | } | ||
| 192 | |||
| 124 | void GenerateHelperArrays(ACMRandom *rnd, int16_t *zbin, int16_t *round, | 193 | void GenerateHelperArrays(ACMRandom *rnd, int16_t *zbin, int16_t *round, |
| 125 | int16_t *quant, int16_t *quant_shift, | 194 | int16_t *quant, int16_t *quant_shift, |
| 126 | int16_t *dequant) { | 195 | int16_t *dequant, int16_t *round_fp, |
| 196 | int16_t *quant_fp) { | ||
| 197 | // Max when q == 0. Otherwise, it is 48 for Y and 42 for U/V. | ||
| 198 | const int max_qrounding_factor_fp = 64; | ||
| 199 | |||
| 127 | for (int j = 0; j < 2; j++) { | 200 | for (int j = 0; j < 2; j++) { |
| 201 | // The max is 1828 in the VP9 tables. | ||
| 202 | const int qlookup = rnd->RandRange(1829); | ||
| 203 | round_fp[j] = (max_qrounding_factor_fp * qlookup) >> 7; | ||
| 204 | quant_fp[j] = (1 << 16) / qlookup; | ||
| 205 | |||
| 128 | // Values determined by deconstructing vp9_init_quantizer(). | 206 | // 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 | 207 | // 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 | 208 | // values or U/V values of any bit depth. This is because y_delta is not |
| 131 | // factored into the vp9_ac_quant() call. | 209 | // factored into the vp9_ac_quant() call. |
| 132 | zbin[j] = rnd->RandRange(1200); | 210 | zbin[j] = rnd->RandRange(1200); |
| 211 | |||
| 133 | // round may be up to 685 for Y values or 914 for U/V. | 212 | // round may be up to 685 for Y values or 914 for U/V. |
| 134 | round[j] = rnd->RandRange(914); | 213 | round[j] = rnd->RandRange(914); |
| 135 | // quant ranges from 1 to -32703 | 214 | // quant ranges from 1 to -32703 |
| @@ -141,6 +220,8 @@ void GenerateHelperArrays(ACMRandom *rnd, int16_t *zbin, int16_t *round, · 5 unmodified lines | |||
| 141 | } | 220 | } |
| 142 | for (int j = 2; j < 8; j++) { | 221 | for (int j = 2; j < 8; j++) { |
| 143 | zbin[j] = zbin[1]; | 222 | zbin[j] = zbin[1]; |
| 223 | round_fp[j] = round_fp[1]; | ||
| 224 | quant_fp[j] = quant_fp[1]; | ||
| 144 | round[j] = round[1]; | 225 | round[j] = round[1]; |
| 145 | quant[j] = quant[1]; | 226 | quant[j] = quant[1]; |
| 146 | quant_shift[j] = quant_shift[1]; | 227 | quant_shift[j] = quant_shift[1]; |
| @@ -179,19 +260,19 @@ TEST_P(VP9QuantizeTest, OperationCheck) { · 32 unmodified lines | |||
| 179 | const int count = (4 << sz) * (4 << sz); | 260 | const int count = (4 << sz) * (4 << sz); |
| 180 | coeff.Set(&rnd, -max_value_, max_value_); | 261 | coeff.Set(&rnd, -max_value_, max_value_); |
| 181 | GenerateHelperArrays(&rnd, zbin_ptr_, round_ptr_, quant_ptr_, | 262 | GenerateHelperArrays(&rnd, zbin_ptr_, round_ptr_, quant_ptr_, |
| 182 | quant_shift_ptr_, dequant_ptr_); | 263 | quant_shift_ptr_, dequant_ptr_, round_fp_ptr_, |
| 183 | 264 | quant_fp_ptr_); | |
| 184 | ref_quantize_op_(coeff.TopLeftPixel(), count, skip_block, zbin_ptr_, | 265 | int16_t *r_ptr = (is_fp_) ? round_fp_ptr_ : round_ptr_; |
| 185 | round_ptr_, quant_ptr_, quant_shift_ptr_, | 266 | int16_t *q_ptr = (is_fp_) ? quant_fp_ptr_ : quant_ptr_; |
| 186 | ref_qcoeff.TopLeftPixel(), ref_dqcoeff.TopLeftPixel(), | 267 | ref_quantize_op_(coeff.TopLeftPixel(), count, skip_block, zbin_ptr_, r_ptr, |
| 187 | dequant_ptr_, &ref_eob, scan_order->scan, | 268 | q_ptr, quant_shift_ptr_, ref_qcoeff.TopLeftPixel(), |
| 188 | scan_order->iscan); | 269 | ref_dqcoeff.TopLeftPixel(), dequant_ptr_, &ref_eob, |
| 189 | 270 | scan_order->scan, scan_order->iscan); | |
| 190 | ASM_REGISTER_STATE_CHECK( | 271 | |
| 191 | quantize_op_(coeff.TopLeftPixel(), count, skip_block, zbin_ptr_, | 272 | ASM_REGISTER_STATE_CHECK(quantize_op_( |
| 192 | round_ptr_, quant_ptr_, quant_shift_ptr_, | 273 | coeff.TopLeftPixel(), count, skip_block, zbin_ptr_, r_ptr, q_ptr, |
| 193 | qcoeff.TopLeftPixel(), dqcoeff.TopLeftPixel(), | 274 | quant_shift_ptr_, qcoeff.TopLeftPixel(), dqcoeff.TopLeftPixel(), |
| 194 | dequant_ptr_, &eob, scan_order->scan, scan_order->iscan)); | 275 | dequant_ptr_, &eob, scan_order->scan, scan_order->iscan)); |
| 195 | 276 | ||
| 196 | EXPECT_TRUE(qcoeff.CheckValues(ref_qcoeff)); | 277 | EXPECT_TRUE(qcoeff.CheckValues(ref_qcoeff)); |
| 197 | EXPECT_TRUE(dqcoeff.CheckValues(ref_dqcoeff)); | 278 | EXPECT_TRUE(dqcoeff.CheckValues(ref_dqcoeff)); |
| @@ -241,19 +322,19 @@ TEST_P(VP9QuantizeTest, EOBCheck) { · 43 unmodified lines | |||
| 241 | coeff.TopLeftPixel()[rnd(count)] = | 322 | coeff.TopLeftPixel()[rnd(count)] = |
| 242 | static_cast<int>(rnd.RandRange(max_value_ * 2)) - max_value_; | 323 | static_cast<int>(rnd.RandRange(max_value_ * 2)) - max_value_; |
| 243 | GenerateHelperArrays(&rnd, zbin_ptr_, round_ptr_, quant_ptr_, | 324 | GenerateHelperArrays(&rnd, zbin_ptr_, round_ptr_, quant_ptr_, |
| 244 | quant_shift_ptr_, dequant_ptr_); | 325 | quant_shift_ptr_, dequant_ptr_, round_fp_ptr_, |
| 245 | 326 | quant_fp_ptr_); | |
| 246 | ref_quantize_op_(coeff.TopLeftPixel(), count, skip_block, zbin_ptr_, | 327 | int16_t *r_ptr = (is_fp_) ? round_fp_ptr_ : round_ptr_; |
| 247 | round_ptr_, quant_ptr_, quant_shift_ptr_, | 328 | int16_t *q_ptr = (is_fp_) ? quant_fp_ptr_ : quant_ptr_; |
| 248 | ref_qcoeff.TopLeftPixel(), ref_dqcoeff.TopLeftPixel(), | 329 | ref_quantize_op_(coeff.TopLeftPixel(), count, skip_block, zbin_ptr_, r_ptr, |
| 249 | dequant_ptr_, &ref_eob, scan_order->scan, | 330 | q_ptr, quant_shift_ptr_, ref_qcoeff.TopLeftPixel(), |
| 250 | scan_order->iscan); | 331 | ref_dqcoeff.TopLeftPixel(), dequant_ptr_, &ref_eob, |
| 251 | 332 | scan_order->scan, scan_order->iscan); | |
| 252 | ASM_REGISTER_STATE_CHECK( | 333 | |
| 253 | quantize_op_(coeff.TopLeftPixel(), count, skip_block, zbin_ptr_, | 334 | ASM_REGISTER_STATE_CHECK(quantize_op_( |
| 254 | round_ptr_, quant_ptr_, quant_shift_ptr_, | 335 | coeff.TopLeftPixel(), count, skip_block, zbin_ptr_, r_ptr, q_ptr, |
| 255 | qcoeff.TopLeftPixel(), dqcoeff.TopLeftPixel(), | 336 | quant_shift_ptr_, qcoeff.TopLeftPixel(), dqcoeff.TopLeftPixel(), |
| 256 | dequant_ptr_, &eob, scan_order->scan, scan_order->iscan)); | 337 | dequant_ptr_, &eob, scan_order->scan, scan_order->iscan)); |
| 257 | 338 | ||
| 258 | EXPECT_TRUE(qcoeff.CheckValues(ref_qcoeff)); | 339 | EXPECT_TRUE(qcoeff.CheckValues(ref_qcoeff)); |
| 259 | EXPECT_TRUE(dqcoeff.CheckValues(ref_dqcoeff)); | 340 | EXPECT_TRUE(dqcoeff.CheckValues(ref_dqcoeff)); |
| @@ -299,7 +380,10 @@ TEST_P(VP9QuantizeTest, DISABLED_Speed) { · 39 unmodified lines | |||
| 299 | const int count = (4 << sz) * (4 << sz); | 380 | const int count = (4 << sz) * (4 << sz); |
| 300 | 381 | ||
| 301 | GenerateHelperArrays(&rnd, zbin_ptr_, round_ptr_, quant_ptr_, | 382 | GenerateHelperArrays(&rnd, zbin_ptr_, round_ptr_, quant_ptr_, |
| 302 | quant_shift_ptr_, dequant_ptr_); | 383 | quant_shift_ptr_, dequant_ptr_, round_fp_ptr_, |
| 384 | quant_fp_ptr_); | ||
| 385 | int16_t *r_ptr = (is_fp_) ? round_fp_ptr_ : round_ptr_; | ||
| 386 | int16_t *q_ptr = (is_fp_) ? quant_fp_ptr_ : quant_ptr_; | ||
| 303 | 387 | ||
| 304 | if (i == 0) { | 388 | if (i == 0) { |
| 305 | // When |coeff values| are less than zbin the results are 0. | 389 | // When |coeff values| are less than zbin the results are 0. |
| @@ -319,10 +403,10 @@ TEST_P(VP9QuantizeTest, DISABLED_Speed) { · 13 unmodified lines | |||
| 319 | vpx_usec_timer timer; | 403 | vpx_usec_timer timer; |
| 320 | vpx_usec_timer_start(&timer); | 404 | vpx_usec_timer_start(&timer); |
| 321 | for (int j = 0; j < 100000000 / count; ++j) { | 405 | for (int j = 0; j < 100000000 / count; ++j) { |
| 322 | quantize_op_(coeff.TopLeftPixel(), count, skip_block, zbin_ptr_, | 406 | quantize_op_(coeff.TopLeftPixel(), count, skip_block, zbin_ptr_, r_ptr, |
| 323 | round_ptr_, quant_ptr_, quant_shift_ptr_, | 407 | q_ptr, quant_shift_ptr_, qcoeff.TopLeftPixel(), |
| 324 | qcoeff.TopLeftPixel(), dqcoeff.TopLeftPixel(), | 408 | dqcoeff.TopLeftPixel(), dequant_ptr_, &eob, |
| 325 | dequant_ptr_, &eob, scan_order->scan, scan_order->iscan); | 409 | scan_order->scan, scan_order->iscan); |
| 326 | } | 410 | } |
| 327 | vpx_usec_timer_mark(&timer); | 411 | vpx_usec_timer_mark(&timer); |
| 328 | const int elapsed_time = static_cast<int>(vpx_usec_timer_elapsed(&timer)); | 412 | const int elapsed_time = static_cast<int>(vpx_usec_timer_elapsed(&timer)); |
| @@ -345,50 +429,53 @@ INSTANTIATE_TEST_CASE_P( · 16 unmodified lines | |||
| 345 | SSE2, VP9QuantizeTest, | 429 | SSE2, VP9QuantizeTest, |
| 346 | ::testing::Values( | 430 | ::testing::Values( |
| 347 | make_tuple(&vpx_highbd_quantize_b_sse2, &vpx_highbd_quantize_b_c, | 431 | make_tuple(&vpx_highbd_quantize_b_sse2, &vpx_highbd_quantize_b_c, |
| 348 | VPX_BITS_8, 16), | 432 | VPX_BITS_8, 16, false), |
| 349 | make_tuple(&vpx_highbd_quantize_b_sse2, &vpx_highbd_quantize_b_c, | 433 | make_tuple(&vpx_highbd_quantize_b_sse2, &vpx_highbd_quantize_b_c, |
| 350 | VPX_BITS_10, 16), | 434 | VPX_BITS_10, 16, false), |
| 351 | make_tuple(&vpx_highbd_quantize_b_sse2, &vpx_highbd_quantize_b_c, | 435 | make_tuple(&vpx_highbd_quantize_b_sse2, &vpx_highbd_quantize_b_c, |
| 352 | VPX_BITS_12, 16), | 436 | VPX_BITS_12, 16, false), |
| 353 | make_tuple(&vpx_highbd_quantize_b_32x32_sse2, | 437 | make_tuple(&vpx_highbd_quantize_b_32x32_sse2, |
| 354 | &vpx_highbd_quantize_b_32x32_c, VPX_BITS_8, 32), | 438 | &vpx_highbd_quantize_b_32x32_c, VPX_BITS_8, 32, false), |
| 355 | make_tuple(&vpx_highbd_quantize_b_32x32_sse2, | 439 | make_tuple(&vpx_highbd_quantize_b_32x32_sse2, |
| 356 | &vpx_highbd_quantize_b_32x32_c, VPX_BITS_10, 32), | 440 | &vpx_highbd_quantize_b_32x32_c, VPX_BITS_10, 32, false), |
| 357 | make_tuple(&vpx_highbd_quantize_b_32x32_sse2, | 441 | make_tuple(&vpx_highbd_quantize_b_32x32_sse2, |
| 358 | &vpx_highbd_quantize_b_32x32_c, VPX_BITS_12, 32))); | 442 | &vpx_highbd_quantize_b_32x32_c, VPX_BITS_12, 32, false))); |
| 359 | 443 | ||
| 360 | #else | 444 | #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( | 445 | INSTANTIATE_TEST_CASE_P( |
| 368 | DISABLED_SSE2, VP9QuantizeTest, | 446 | SSE2, VP9QuantizeTest, |
| 369 | ::testing::Values(make_tuple(&QuantFPWrapper<vp9_quantize_fp_sse2>, | 447 | ::testing::Values(make_tuple(&vpx_quantize_b_sse2, &vpx_quantize_b_c, |
| 370 | &QuantFPWrapper<vp9_quantize_fp_c>, VPX_BITS_8, | 448 | VPX_BITS_8, 16, false), |
| 371 | 16))); | 449 | make_tuple(&QuantFPWrapper<vp9_quantize_fp_sse2>, |
| 450 | &QuantFPWrapper<quantize_fp_nz_c>, VPX_BITS_8, | ||
| 451 | 16, true))); | ||
| 452 | #endif // CONFIG_VP9_HIGHBITDEPTH | ||
| 372 | #endif // HAVE_SSE2 | 453 | #endif // HAVE_SSE2 |
| 373 | 454 | ||
| 374 | #if HAVE_SSSE3 && !CONFIG_VP9_HIGHBITDEPTH | 455 | #if HAVE_SSSE3 && !CONFIG_VP9_HIGHBITDEPTH |
| 375 | INSTANTIATE_TEST_CASE_P(SSSE3, VP9QuantizeTest, | 456 | INSTANTIATE_TEST_CASE_P(SSSE3, VP9QuantizeTest, |
| 376 | ::testing::Values(make_tuple(&vpx_quantize_b_ssse3, | 457 | ::testing::Values( |
| 377 | &vpx_quantize_b_c, | 458 | #if ARCH_X86_64 |
| 378 | VPX_BITS_8, 16))); | 459 | make_tuple(&vpx_quantize_b_ssse3, &vpx_quantize_b_c, |
| 460 | VPX_BITS_8, 16, false), | ||
| 461 | make_tuple(&QuantFPWrapper<vp9_quantize_fp_ssse3>, | ||
| 462 | &QuantFPWrapper<quantize_fp_nz_c>, | ||
| 463 | VPX_BITS_8, 16, true))); | ||
| 464 | #else | ||
| 465 | make_tuple(&vpx_quantize_b_ssse3, &vpx_quantize_b_c, | ||
| 466 | VPX_BITS_8, 16, false))); | ||
| 467 | #endif | ||
| 379 | 468 | ||
| 380 | #if ARCH_X86_64 | 469 | #if ARCH_X86_64 |
| 381 | // TODO(johannkoenig): SSSE3 optimizations do not yet pass this test. | 470 | // TODO(johannkoenig): SSSE3 optimizations do not yet pass this test. |
| 382 | INSTANTIATE_TEST_CASE_P( | 471 | INSTANTIATE_TEST_CASE_P( |
| 383 | DISABLED_SSSE3, VP9QuantizeTest, | 472 | DISABLED_SSSE3, VP9QuantizeTest, |
| 384 | ::testing::Values(make_tuple(&vpx_quantize_b_32x32_ssse3, | 473 | ::testing::Values(make_tuple(&vpx_quantize_b_32x32_ssse3, |
| 385 | &vpx_quantize_b_32x32_c, VPX_BITS_8, 32), | 474 | &vpx_quantize_b_32x32_c, VPX_BITS_8, 32, |
| 386 | make_tuple(&QuantFPWrapper<vp9_quantize_fp_ssse3>, | 475 | false), |
| 387 | &QuantFPWrapper<vp9_quantize_fp_c>, VPX_BITS_8, | ||
| 388 | 16), | ||
| 389 | make_tuple(&QuantFPWrapper<vp9_quantize_fp_32x32_ssse3>, | 476 | make_tuple(&QuantFPWrapper<vp9_quantize_fp_32x32_ssse3>, |
| 390 | &QuantFPWrapper<vp9_quantize_fp_32x32_c>, | 477 | &QuantFPWrapper<vp9_quantize_fp_32x32_c>, |
| 391 | VPX_BITS_8, 32))); | 478 | VPX_BITS_8, 32, true))); |
| 392 | #endif // ARCH_X86_64 | 479 | #endif // ARCH_X86_64 |
| 393 | #endif // HAVE_SSSE3 && !CONFIG_VP9_HIGHBITDEPTH | 480 | #endif // HAVE_SSSE3 && !CONFIG_VP9_HIGHBITDEPTH |
| 394 | 481 | ||
| @@ -398,36 +485,43 @@ INSTANTIATE_TEST_CASE_P( · 3 unmodified lines | |||
| 398 | INSTANTIATE_TEST_CASE_P( | 485 | INSTANTIATE_TEST_CASE_P( |
| 399 | AVX, VP9QuantizeTest, | 486 | AVX, VP9QuantizeTest, |
| 400 | ::testing::Values(make_tuple(&vpx_quantize_b_avx, &vpx_quantize_b_c, | 487 | ::testing::Values(make_tuple(&vpx_quantize_b_avx, &vpx_quantize_b_c, |
| 401 | VPX_BITS_8, 16), | 488 | VPX_BITS_8, 16, false), |
| 402 | // Even though SSSE3 and AVX do not match the reference | 489 | // Even though SSSE3 and AVX do not match the reference |
| 403 | // code, we can keep them in sync with each other. | 490 | // code, we can keep them in sync with each other. |
| 404 | make_tuple(&vpx_quantize_b_32x32_avx, | 491 | make_tuple(&vpx_quantize_b_32x32_avx, |
| 405 | &vpx_quantize_b_32x32_ssse3, VPX_BITS_8, 32))); | 492 | &vpx_quantize_b_32x32_ssse3, VPX_BITS_8, 32, |
| 493 | false))); | ||
| 406 | #endif // HAVE_AVX && !CONFIG_VP9_HIGHBITDEPTH | 494 | #endif // HAVE_AVX && !CONFIG_VP9_HIGHBITDEPTH |
| 407 | 495 | ||
| 408 | // TODO(webm:1448): dqcoeff is not handled correctly in HBD builds. | 496 | // TODO(webm:1448): dqcoeff is not handled correctly in HBD builds. |
| 409 | #if HAVE_NEON && !CONFIG_VP9_HIGHBITDEPTH | 497 | #if HAVE_NEON && !CONFIG_VP9_HIGHBITDEPTH |
| 410 | INSTANTIATE_TEST_CASE_P( | 498 | INSTANTIATE_TEST_CASE_P( |
| 411 | NEON, VP9QuantizeTest, | 499 | NEON, VP9QuantizeTest, |
| 412 | ::testing::Values( | 500 | ::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), | 501 | VPX_BITS_8, 16, false), |
| 414 | make_tuple(&vpx_quantize_b_32x32_neon, &vpx_quantize_b_32x32_c, | 502 | make_tuple(&vpx_quantize_b_32x32_neon, |
| 415 | VPX_BITS_8, 32), | 503 | &vpx_quantize_b_32x32_c, VPX_BITS_8, 32, |
| 416 | make_tuple(&QuantFPWrapper<vp9_quantize_fp_neon>, | 504 | false), |
| 417 | &QuantFPWrapper<vp9_quantize_fp_c>, VPX_BITS_8, 16), | 505 | make_tuple(&QuantFPWrapper<vp9_quantize_fp_neon>, |
| 418 | make_tuple(&QuantFPWrapper<vp9_quantize_fp_32x32_neon>, | 506 | &QuantFPWrapper<vp9_quantize_fp_c>, VPX_BITS_8, |
| 419 | &QuantFPWrapper<vp9_quantize_fp_32x32_c>, VPX_BITS_8, 32))); | 507 | 16, true), |
| 508 | make_tuple(&QuantFPWrapper<vp9_quantize_fp_32x32_neon>, | ||
| 509 | &QuantFPWrapper<vp9_quantize_fp_32x32_c>, | ||
| 510 | VPX_BITS_8, 32, true))); | ||
| 420 | #endif // HAVE_NEON && !CONFIG_VP9_HIGHBITDEPTH | 511 | #endif // HAVE_NEON && !CONFIG_VP9_HIGHBITDEPTH |
| 421 | 512 | ||
| 422 | // Only useful to compare "Speed" test results. | 513 | // Only useful to compare "Speed" test results. |
| 423 | INSTANTIATE_TEST_CASE_P( | 514 | INSTANTIATE_TEST_CASE_P( |
| 424 | DISABLED_C, VP9QuantizeTest, | 515 | DISABLED_C, VP9QuantizeTest, |
| 425 | ::testing::Values( | 516 | ::testing::Values( |
| 426 | make_tuple(&vpx_quantize_b_c, &vpx_quantize_b_c, VPX_BITS_8, 16), | 517 | 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, | 518 | make_tuple(&vpx_quantize_b_32x32_c, &vpx_quantize_b_32x32_c, VPX_BITS_8, |
| 428 | 32), | 519 | 32, false), |
| 429 | make_tuple(&QuantFPWrapper<vp9_quantize_fp_c>, | 520 | make_tuple(&QuantFPWrapper<vp9_quantize_fp_c>, |
| 430 | &QuantFPWrapper<vp9_quantize_fp_c>, VPX_BITS_8, 16), | 521 | &QuantFPWrapper<vp9_quantize_fp_c>, VPX_BITS_8, 16, true), |
| 522 | make_tuple(&QuantFPWrapper<quantize_fp_nz_c>, | ||
| 523 | &QuantFPWrapper<quantize_fp_nz_c>, VPX_BITS_8, 16, true), | ||
| 431 | make_tuple(&QuantFPWrapper<vp9_quantize_fp_32x32_c>, | 524 | make_tuple(&QuantFPWrapper<vp9_quantize_fp_32x32_c>, |
| 432 | &QuantFPWrapper<vp9_quantize_fp_32x32_c>, VPX_BITS_8, 32))); | 525 | &QuantFPWrapper<vp9_quantize_fp_32x32_c>, VPX_BITS_8, 32, |
| 526 | true))); | ||
| 433 | } // namespace | 527 | } // namespace |