diff options
Diffstat (limited to 'third_party/libaom/source/libaom/test/av1_quantize_test.cc')
-rw-r--r-- | third_party/libaom/source/libaom/test/av1_quantize_test.cc | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/third_party/libaom/source/libaom/test/av1_quantize_test.cc b/third_party/libaom/source/libaom/test/av1_quantize_test.cc index f0882c7099..bfb684effd 100644 --- a/third_party/libaom/source/libaom/test/av1_quantize_test.cc +++ b/third_party/libaom/source/libaom/test/av1_quantize_test.cc @@ -19,6 +19,7 @@ #include "test/clear_system_state.h" #include "test/register_state_check.h" #include "av1/common/scan.h" +#include "av1/encoder/av1_quantize.h" namespace { @@ -207,6 +208,32 @@ GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(AV1QuantizeTest); TEST_P(AV1QuantizeTest, BitExactCheck) { RunQuantizeTest(); } TEST_P(AV1QuantizeTest, EobVerify) { RunEobTest(); } +TEST(AV1QuantizeTest, QuantizeFpNoQmatrix) { + // Here we use a uniform quantizer as an example + const int16_t dequant_ptr[2] = { 78, 93 }; // quantize step + const int16_t round_ptr[2] = { 39, 46 }; // round ~= dequant / 2 + + // quant ~= 2^16 / dequant. This is a 16-bit fixed point representation of the + // inverse of quantize step. + const int16_t quant_ptr[2] = { 840, 704 }; + int log_scale = 0; + int coeff_count = 4; + const tran_low_t coeff_ptr[4] = { -449, 624, -14, 24 }; + const tran_low_t ref_qcoeff_ptr[4] = { -6, 7, 0, 0 }; + const tran_low_t ref_dqcoeff_ptr[4] = { -468, 651, 0, 0 }; + const int16_t scan[4] = { 0, 1, 2, 3 }; + tran_low_t qcoeff_ptr[4]; + tran_low_t dqcoeff_ptr[4]; + int eob = av1_quantize_fp_no_qmatrix(quant_ptr, dequant_ptr, round_ptr, + log_scale, scan, coeff_count, coeff_ptr, + qcoeff_ptr, dqcoeff_ptr); + EXPECT_EQ(eob, 2); + for (int i = 0; i < coeff_count; ++i) { + EXPECT_EQ(qcoeff_ptr[i], ref_qcoeff_ptr[i]); + EXPECT_EQ(dqcoeff_ptr[i], ref_dqcoeff_ptr[i]); + } +} + #if HAVE_SSE4_1 const QuantizeFuncParams qfps[4] = { QuantizeFuncParams(&av1_highbd_quantize_fp_sse4_1, &av1_highbd_quantize_fp_c, |