diff options
author | trav90 <travawine@palemoon.org> | 2018-10-19 21:52:15 -0500 |
---|---|---|
committer | trav90 <travawine@palemoon.org> | 2018-10-19 21:52:20 -0500 |
commit | bbcc64772580c8a979288791afa02d30bc476d2e (patch) | |
tree | 437ce94c3fdd7497508e5b55de06c6d011678597 /third_party/aom/test/quantize_func_test.cc | |
parent | 14805f6ddbfb173c327768fff9f81f40ce5e81b0 (diff) | |
download | UXP-bbcc64772580c8a979288791afa02d30bc476d2e.tar UXP-bbcc64772580c8a979288791afa02d30bc476d2e.tar.gz UXP-bbcc64772580c8a979288791afa02d30bc476d2e.tar.lz UXP-bbcc64772580c8a979288791afa02d30bc476d2e.tar.xz UXP-bbcc64772580c8a979288791afa02d30bc476d2e.zip |
Update aom to v1.0.0
Update aom to commit id d14c5bb4f336ef1842046089849dee4a301fbbf0.
Diffstat (limited to 'third_party/aom/test/quantize_func_test.cc')
-rw-r--r-- | third_party/aom/test/quantize_func_test.cc | 129 |
1 files changed, 85 insertions, 44 deletions
diff --git a/third_party/aom/test/quantize_func_test.cc b/third_party/aom/test/quantize_func_test.cc index 2e4829021..97e73bff0 100644 --- a/third_party/aom/test/quantize_func_test.cc +++ b/third_party/aom/test/quantize_func_test.cc @@ -11,13 +11,14 @@ #include "third_party/googletest/src/googletest/include/gtest/gtest.h" -#include "./aom_config.h" -#include "./aom_dsp_rtcd.h" -#include "./av1_rtcd.h" +#include "config/aom_config.h" +#include "config/aom_dsp_rtcd.h" +#include "config/av1_rtcd.h" + #include "aom/aom_codec.h" #include "aom_ports/aom_timer.h" #include "av1/encoder/encoder.h" -#include "av1/encoder/av1_quantize.h" +#include "av1/common/scan.h" #include "test/acm_random.h" #include "test/clear_system_state.h" #include "test/register_state_check.h" @@ -34,36 +35,56 @@ using libaom_test::ACMRandom; const int16_t *dequant_ptr, uint16_t *eob_ptr, const int16_t *scan, \ const int16_t *iscan +#define QUAN_PARAM_LIST_NO_SKIP \ + const tran_low_t *coeff_ptr, intptr_t n_coeffs, const int16_t *zbin_ptr, \ + const int16_t *round_ptr, const int16_t *quant_ptr, \ + const int16_t *quant_shift_ptr, tran_low_t *qcoeff_ptr, \ + tran_low_t *dqcoeff_ptr, const int16_t *dequant_ptr, uint16_t *eob_ptr, \ + const int16_t *scan, const int16_t *iscan + typedef void (*QuantizeFunc)(QUAN_PARAM_LIST); -typedef void (*QuantizeFuncHbd)(QUAN_PARAM_LIST, int log_scale); +typedef void (*QuantizeFuncHbd)(QUAN_PARAM_LIST_NO_SKIP, int log_scale); +typedef void (*QuantizeFuncNoSkip)(QUAN_PARAM_LIST_NO_SKIP); #define HBD_QUAN_FUNC \ - fn(coeff_ptr, n_coeffs, skip_block, zbin_ptr, round_ptr, quant_ptr, \ - quant_shift_ptr, qcoeff_ptr, dqcoeff_ptr, dequant_ptr, eob_ptr, scan, \ - iscan, log_scale) + fn(coeff_ptr, n_coeffs, zbin_ptr, round_ptr, quant_ptr, quant_shift_ptr, \ + qcoeff_ptr, dqcoeff_ptr, dequant_ptr, eob_ptr, scan, iscan, log_scale) + +#define LBD_QUAN_FUNC_NO_SKIP \ + fn(coeff_ptr, n_coeffs, zbin_ptr, round_ptr, quant_ptr, quant_shift_ptr, \ + qcoeff_ptr, dqcoeff_ptr, dequant_ptr, eob_ptr, scan, iscan) template <QuantizeFuncHbd fn> void highbd_quan16x16_wrapper(QUAN_PARAM_LIST) { + (void)skip_block; const int log_scale = 0; HBD_QUAN_FUNC; } template <QuantizeFuncHbd fn> void highbd_quan32x32_wrapper(QUAN_PARAM_LIST) { + (void)skip_block; const int log_scale = 1; HBD_QUAN_FUNC; } template <QuantizeFuncHbd fn> void highbd_quan64x64_wrapper(QUAN_PARAM_LIST) { + (void)skip_block; const int log_scale = 2; HBD_QUAN_FUNC; } +template <QuantizeFuncNoSkip fn> +void lowbd_quan_wrapper(QUAN_PARAM_LIST) { + (void)skip_block; + LBD_QUAN_FUNC_NO_SKIP; +} + typedef enum { TYPE_B, TYPE_DC, TYPE_FP } QuantType; -typedef std::tr1::tuple<QuantizeFunc, QuantizeFunc, TX_SIZE, QuantType, - aom_bit_depth_t> +using ::testing::tuple; +typedef tuple<QuantizeFunc, QuantizeFunc, TX_SIZE, QuantType, aom_bit_depth_t> QuantizeParam; typedef struct { @@ -98,7 +119,7 @@ class QuantizeTest : public ::testing::TestWithParam<QuantizeParam> { } void InitQuantizer() { - av1_build_quantizer(bd_, 0, 0, 0, &qtab_->quant, &qtab_->dequant); + av1_build_quantizer(bd_, 0, 0, 0, 0, 0, &qtab_->quant, &qtab_->dequant); } void QuantizeRun(bool is_loop, int q = 0, int test_num = 1) { @@ -114,7 +135,7 @@ class QuantizeTest : public ::testing::TestWithParam<QuantizeParam> { uint16_t *eob = (uint16_t *)(dqcoeff + n_coeffs); // Testing uses 2-D DCT scan order table - const SCAN_ORDER *const sc = get_default_scan(tx_size_, DCT_DCT, 0); + const SCAN_ORDER *const sc = get_default_scan(tx_size_, DCT_DCT); // Testing uses luminance quantization table const int16_t *zbin = qtab_->quant.y_zbin[q]; @@ -130,7 +151,7 @@ class QuantizeTest : public ::testing::TestWithParam<QuantizeParam> { } const int16_t *quant_shift = qtab_->quant.y_quant_shift[q]; - const int16_t *dequant = qtab_->dequant.y_dequant[q]; + const int16_t *dequant = qtab_->dequant.y_dequant_QTX[q]; for (int i = 0; i < test_num; ++i) { if (is_loop) FillCoeffRandom(); @@ -171,7 +192,7 @@ class QuantizeTest : public ::testing::TestWithParam<QuantizeParam> { } } - int coeff_num() const { return tx_size_2d[tx_size_]; } + int coeff_num() const { return av1_get_max_eob(tx_size_); } void FillCoeff(tran_low_t c) { const int n_coeffs = coeff_num(); @@ -255,6 +276,13 @@ TEST_P(QuantizeTest, MultipleQ) { } } +// Force the coeff to be half the value of the dequant. This exposes a +// mismatch found in av1_quantize_fp_sse2(). +TEST_P(QuantizeTest, CoeffHalfDequant) { + FillCoeff(16); + QuantizeRun(false, 25, 1); +} + TEST_P(QuantizeTest, DISABLED_Speed) { tran_low_t *coeff_ptr = coeff_; const intptr_t n_coeffs = coeff_num(); @@ -268,7 +296,7 @@ TEST_P(QuantizeTest, DISABLED_Speed) { uint16_t *eob = (uint16_t *)(dqcoeff + n_coeffs); // Testing uses 2-D DCT scan order table - const SCAN_ORDER *const sc = get_default_scan(tx_size_, DCT_DCT, 0); + const SCAN_ORDER *const sc = get_default_scan(tx_size_, DCT_DCT); // Testing uses luminance quantization table const int q = 22; @@ -276,7 +304,7 @@ TEST_P(QuantizeTest, DISABLED_Speed) { const int16_t *round_fp = qtab_->quant.y_round_fp[q]; const int16_t *quant_fp = qtab_->quant.y_quant_fp[q]; const int16_t *quant_shift = qtab_->quant.y_quant_shift[q]; - const int16_t *dequant = qtab_->dequant.y_dequant[q]; + const int16_t *dequant = qtab_->dequant.y_dequant_QTX[q]; const int kNumTests = 5000000; aom_usec_timer timer; @@ -293,15 +321,37 @@ TEST_P(QuantizeTest, DISABLED_Speed) { printf("Elapsed time: %d us\n", elapsed_time); } -using std::tr1::make_tuple; +using ::testing::make_tuple; #if HAVE_AVX2 const QuantizeParam kQParamArrayAvx2[] = { - make_tuple(&av1_quantize_fp_c, &av1_quantize_fp_avx2, TX_16X16, TYPE_FP, + make_tuple(&lowbd_quan_wrapper<av1_quantize_fp_c>, + &lowbd_quan_wrapper<av1_quantize_fp_avx2>, TX_16X16, TYPE_FP, + AOM_BITS_8), + make_tuple(&lowbd_quan_wrapper<av1_quantize_fp_c>, + &lowbd_quan_wrapper<av1_quantize_fp_avx2>, TX_4X16, TYPE_FP, + AOM_BITS_8), + make_tuple(&lowbd_quan_wrapper<av1_quantize_fp_c>, + &lowbd_quan_wrapper<av1_quantize_fp_avx2>, TX_16X4, TYPE_FP, + AOM_BITS_8), + make_tuple(&lowbd_quan_wrapper<av1_quantize_fp_c>, + &lowbd_quan_wrapper<av1_quantize_fp_avx2>, TX_32X8, TYPE_FP, + AOM_BITS_8), + make_tuple(&lowbd_quan_wrapper<av1_quantize_fp_c>, + &lowbd_quan_wrapper<av1_quantize_fp_avx2>, TX_8X32, TYPE_FP, + AOM_BITS_8), + make_tuple(&lowbd_quan_wrapper<av1_quantize_fp_32x32_c>, + &lowbd_quan_wrapper<av1_quantize_fp_32x32_avx2>, TX_32X32, TYPE_FP, + AOM_BITS_8), + make_tuple(&lowbd_quan_wrapper<av1_quantize_fp_32x32_c>, + &lowbd_quan_wrapper<av1_quantize_fp_32x32_avx2>, TX_16X64, TYPE_FP, + AOM_BITS_8), + make_tuple(&lowbd_quan_wrapper<av1_quantize_fp_32x32_c>, + &lowbd_quan_wrapper<av1_quantize_fp_32x32_avx2>, TX_64X16, TYPE_FP, + AOM_BITS_8), + make_tuple(&lowbd_quan_wrapper<av1_quantize_fp_64x64_c>, + &lowbd_quan_wrapper<av1_quantize_fp_64x64_avx2>, TX_64X64, TYPE_FP, AOM_BITS_8), - make_tuple(&av1_quantize_fp_32x32_c, &av1_quantize_fp_32x32_avx2, TX_32X32, - TYPE_FP, AOM_BITS_8), -#if CONFIG_HIGHBITDEPTH make_tuple(&highbd_quan16x16_wrapper<av1_highbd_quantize_fp_c>, &highbd_quan16x16_wrapper<av1_highbd_quantize_fp_avx2>, TX_16X16, TYPE_FP, AOM_BITS_8), @@ -320,7 +370,6 @@ const QuantizeParam kQParamArrayAvx2[] = { make_tuple(&highbd_quan32x32_wrapper<av1_highbd_quantize_fp_c>, &highbd_quan32x32_wrapper<av1_highbd_quantize_fp_avx2>, TX_32X32, TYPE_FP, AOM_BITS_12), -#if CONFIG_TX64X64 make_tuple(&highbd_quan64x64_wrapper<av1_highbd_quantize_fp_c>, &highbd_quan64x64_wrapper<av1_highbd_quantize_fp_avx2>, TX_64X64, TYPE_FP, AOM_BITS_8), @@ -330,14 +379,12 @@ const QuantizeParam kQParamArrayAvx2[] = { make_tuple(&highbd_quan64x64_wrapper<av1_highbd_quantize_fp_c>, &highbd_quan64x64_wrapper<av1_highbd_quantize_fp_avx2>, TX_64X64, TYPE_FP, AOM_BITS_12), -#endif // CONFIG_TX64X64 make_tuple(&aom_highbd_quantize_b_c, &aom_highbd_quantize_b_avx2, TX_16X16, TYPE_B, AOM_BITS_8), make_tuple(&aom_highbd_quantize_b_c, &aom_highbd_quantize_b_avx2, TX_16X16, TYPE_B, AOM_BITS_10), make_tuple(&aom_highbd_quantize_b_c, &aom_highbd_quantize_b_avx2, TX_16X16, TYPE_B, AOM_BITS_12), -#endif // CONFIG_HIGHBITDEPTH }; INSTANTIATE_TEST_CASE_P(AVX2, QuantizeTest, @@ -346,9 +393,21 @@ INSTANTIATE_TEST_CASE_P(AVX2, QuantizeTest, #if HAVE_SSE2 const QuantizeParam kQParamArraySSE2[] = { - make_tuple(&av1_quantize_fp_c, &av1_quantize_fp_sse2, TX_16X16, TYPE_FP, + make_tuple(&lowbd_quan_wrapper<av1_quantize_fp_c>, + &lowbd_quan_wrapper<av1_quantize_fp_sse2>, TX_16X16, TYPE_FP, + AOM_BITS_8), + make_tuple(&lowbd_quan_wrapper<av1_quantize_fp_c>, + &lowbd_quan_wrapper<av1_quantize_fp_sse2>, TX_4X16, TYPE_FP, + AOM_BITS_8), + make_tuple(&lowbd_quan_wrapper<av1_quantize_fp_c>, + &lowbd_quan_wrapper<av1_quantize_fp_sse2>, TX_16X4, TYPE_FP, + AOM_BITS_8), + make_tuple(&lowbd_quan_wrapper<av1_quantize_fp_c>, + &lowbd_quan_wrapper<av1_quantize_fp_sse2>, TX_8X32, TYPE_FP, + AOM_BITS_8), + make_tuple(&lowbd_quan_wrapper<av1_quantize_fp_c>, + &lowbd_quan_wrapper<av1_quantize_fp_sse2>, TX_32X8, TYPE_FP, AOM_BITS_8), -#if CONFIG_HIGHBITDEPTH make_tuple(&aom_highbd_quantize_b_c, &aom_highbd_quantize_b_sse2, TX_16X16, TYPE_B, AOM_BITS_8), make_tuple(&aom_highbd_quantize_b_c, &aom_highbd_quantize_b_sse2, TX_16X16, @@ -361,28 +420,10 @@ const QuantizeParam kQParamArraySSE2[] = { TX_32X32, TYPE_B, AOM_BITS_10), make_tuple(&aom_highbd_quantize_b_32x32_c, &aom_highbd_quantize_b_32x32_sse2, TX_32X32, TYPE_B, AOM_BITS_12), -#endif }; INSTANTIATE_TEST_CASE_P(SSE2, QuantizeTest, ::testing::ValuesIn(kQParamArraySSE2)); #endif -#if !CONFIG_HIGHBITDEPTH && HAVE_SSSE3 && ARCH_X86_64 -const QuantizeParam kQ16x16ParamArraySSSE3[] = { - make_tuple(&av1_quantize_fp_c, &av1_quantize_fp_ssse3, TX_16X16, TYPE_FP, - AOM_BITS_8), -}; -INSTANTIATE_TEST_CASE_P(SSSE3, QuantizeTest, - ::testing::ValuesIn(kQ16x16ParamArraySSSE3)); - -// TODO(any): -// The following test does not pass yet -const QuantizeParam kQ32x32ParamArraySSSE3[] = { make_tuple( - &av1_quantize_fp_32x32_c, &av1_quantize_fp_32x32_ssse3, TX_32X32, TYPE_FP, - AOM_BITS_8) }; -INSTANTIATE_TEST_CASE_P(DISABLED_SSSE3, QuantizeTest, - ::testing::ValuesIn(kQ32x32ParamArraySSSE3)); -#endif - } // namespace |