Remove "vp9_" from filenames from vp10 tests Change-Id: I72650d5cf18b20301ac925865f63f4f6ec16f647
diff --git a/test/vp9_arf_freq_test.cc b/test/arf_freq_test.cc similarity index 100% rename from test/vp9_arf_freq_test.cc rename to test/arf_freq_test.cc
diff --git a/test/vp9_boolcoder_test.cc b/test/boolcoder_test.cc similarity index 100% rename from test/vp9_boolcoder_test.cc rename to test/boolcoder_test.cc
diff --git a/test/vp9_denoiser_sse2_test.cc b/test/denoiser_sse2_test.cc similarity index 100% rename from test/vp9_denoiser_sse2_test.cc rename to test/denoiser_sse2_test.cc
diff --git a/test/vp9_encoder_parms_get_to_decoder.cc b/test/encoder_parms_get_to_decoder.cc similarity index 100% rename from test/vp9_encoder_parms_get_to_decoder.cc rename to test/encoder_parms_get_to_decoder.cc
diff --git a/test/vp9_end_to_end_test.cc b/test/end_to_end_test.cc similarity index 100% rename from test/vp9_end_to_end_test.cc rename to test/end_to_end_test.cc
diff --git a/test/vp9_error_block_test.cc b/test/error_block_test.cc similarity index 100% rename from test/vp9_error_block_test.cc rename to test/error_block_test.cc
diff --git a/test/vp9_ethread_test.cc b/test/ethread_test.cc similarity index 100% rename from test/vp9_ethread_test.cc rename to test/ethread_test.cc
diff --git a/test/vp9_intrapred_test.cc b/test/intrapred_test.cc similarity index 100% rename from test/vp9_intrapred_test.cc rename to test/intrapred_test.cc
diff --git a/test/vp9_lossless_test.cc b/test/lossless_test.cc similarity index 100% rename from test/vp9_lossless_test.cc rename to test/lossless_test.cc
diff --git a/test/quantize_test.cc b/test/quantize_test.cc index 69da899..dc3a244 100644 --- a/test/quantize_test.cc +++ b/test/quantize_test.cc
@@ -8,196 +8,344 @@ * be found in the AUTHORS file in the root of the source tree. */ +#include <math.h> +#include <stdlib.h> #include <string.h> #include "third_party/googletest/src/include/gtest/gtest.h" #include "./vpx_config.h" -#include "./vp8_rtcd.h" +#include "./vpx_dsp_rtcd.h" #include "test/acm_random.h" #include "test/clear_system_state.h" #include "test/register_state_check.h" #include "test/util.h" -#include "vp8/common/blockd.h" -#include "vp8/common/onyx.h" -#include "vp8/encoder/block.h" -#include "vp8/encoder/onyx_int.h" -#include "vp8/encoder/quantize.h" +#include "vp10/common/entropy.h" +#include "vp10/common/scan.h" +#include "vpx/vpx_codec.h" #include "vpx/vpx_integer.h" -#include "vpx_mem/vpx_mem.h" - -namespace { - -const int kNumBlocks = 25; -const int kNumBlockEntries = 16; - -typedef void (*VP8Quantize)(BLOCK *b, BLOCKD *d); - -typedef std::tr1::tuple<VP8Quantize, VP8Quantize> VP8QuantizeParam; using libvpx_test::ACMRandom; -using std::tr1::make_tuple; -// Create and populate a VP8_COMP instance which has a complete set of -// quantization inputs as well as a second MACROBLOCKD for output. -class QuantizeTestBase { +namespace { +#if CONFIG_VP9_HIGHBITDEPTH +const int number_of_iterations = 100; + +typedef void (*QuantizeFunc)(const tran_low_t *coeff, intptr_t count, + int skip_block, const int16_t *zbin, + const int16_t *round, const int16_t *quant, + const int16_t *quant_shift, + tran_low_t *qcoeff, tran_low_t *dqcoeff, + const int16_t *dequant, + uint16_t *eob, const int16_t *scan, + const int16_t *iscan); +typedef std::tr1::tuple<QuantizeFunc, QuantizeFunc, vpx_bit_depth_t> + QuantizeParam; + +class VP9QuantizeTest : public ::testing::TestWithParam<QuantizeParam> { public: - virtual ~QuantizeTestBase() { - vp8_remove_compressor(&vp8_comp_); - vp8_comp_ = NULL; - vpx_free(macroblockd_dst_); - macroblockd_dst_ = NULL; - libvpx_test::ClearSystemState(); - } - - protected: - void SetupCompressor() { - rnd_.Reset(ACMRandom::DeterministicSeed()); - - // The full configuration is necessary to generate the quantization tables. - VP8_CONFIG vp8_config; - memset(&vp8_config, 0, sizeof(vp8_config)); - - vp8_comp_ = vp8_create_compressor(&vp8_config); - - // Set the tables based on a quantizer of 0. - vp8_set_quantizer(vp8_comp_, 0); - - // Set up all the block/blockd pointers for the mb in vp8_comp_. - vp8cx_frame_init_quantizer(vp8_comp_); - - // Copy macroblockd from the reference to get pre-set-up dequant values. - macroblockd_dst_ = reinterpret_cast<MACROBLOCKD *>( - vpx_memalign(32, sizeof(*macroblockd_dst_))); - memcpy(macroblockd_dst_, &vp8_comp_->mb.e_mbd, sizeof(*macroblockd_dst_)); - // Fix block pointers - currently they point to the blocks in the reference - // structure. - vp8_setup_block_dptrs(macroblockd_dst_); - } - - void UpdateQuantizer(int q) { - vp8_set_quantizer(vp8_comp_, q); - - memcpy(macroblockd_dst_, &vp8_comp_->mb.e_mbd, sizeof(*macroblockd_dst_)); - vp8_setup_block_dptrs(macroblockd_dst_); - } - - void FillCoeffConstant(int16_t c) { - for (int i = 0; i < kNumBlocks * kNumBlockEntries; ++i) { - vp8_comp_->mb.coeff[i] = c; - } - } - - void FillCoeffRandom() { - for (int i = 0; i < kNumBlocks * kNumBlockEntries; ++i) { - vp8_comp_->mb.coeff[i] = rnd_.Rand8(); - } - } - - void CheckOutput() { - EXPECT_EQ(0, memcmp(vp8_comp_->mb.e_mbd.qcoeff, macroblockd_dst_->qcoeff, - sizeof(*macroblockd_dst_->qcoeff) * kNumBlocks * - kNumBlockEntries)) - << "qcoeff mismatch"; - EXPECT_EQ(0, memcmp(vp8_comp_->mb.e_mbd.dqcoeff, macroblockd_dst_->dqcoeff, - sizeof(*macroblockd_dst_->dqcoeff) * kNumBlocks * - kNumBlockEntries)) - << "dqcoeff mismatch"; - EXPECT_EQ(0, memcmp(vp8_comp_->mb.e_mbd.eobs, macroblockd_dst_->eobs, - sizeof(*macroblockd_dst_->eobs) * kNumBlocks)) - << "eobs mismatch"; - } - - VP8_COMP *vp8_comp_; - MACROBLOCKD *macroblockd_dst_; - - private: - ACMRandom rnd_; -}; - -class QuantizeTest : public QuantizeTestBase, - public ::testing::TestWithParam<VP8QuantizeParam> { - protected: + virtual ~VP9QuantizeTest() {} virtual void SetUp() { - SetupCompressor(); - asm_quant_ = GET_PARAM(0); - c_quant_ = GET_PARAM(1); + quantize_op_ = GET_PARAM(0); + ref_quantize_op_ = GET_PARAM(1); + bit_depth_ = GET_PARAM(2); + mask_ = (1 << bit_depth_) - 1; } - void RunComparison() { - for (int i = 0; i < kNumBlocks; ++i) { - ASM_REGISTER_STATE_CHECK( - c_quant_(&vp8_comp_->mb.block[i], &vp8_comp_->mb.e_mbd.block[i])); - ASM_REGISTER_STATE_CHECK( - asm_quant_(&vp8_comp_->mb.block[i], ¯oblockd_dst_->block[i])); - } + virtual void TearDown() { libvpx_test::ClearSystemState(); } - CheckOutput(); - } - - private: - VP8Quantize asm_quant_; - VP8Quantize c_quant_; + protected: + vpx_bit_depth_t bit_depth_; + int mask_; + QuantizeFunc quantize_op_; + QuantizeFunc ref_quantize_op_; }; -TEST_P(QuantizeTest, TestZeroInput) { - FillCoeffConstant(0); - RunComparison(); -} - -TEST_P(QuantizeTest, TestLargeNegativeInput) { - FillCoeffConstant(0); - // Generate a qcoeff which contains 512/-512 (0x0100/0xFE00) to catch issues - // like BUG=883 where the constant being compared was incorrectly initialized. - vp8_comp_->mb.coeff[0] = -8191; - RunComparison(); -} - -TEST_P(QuantizeTest, TestRandomInput) { - FillCoeffRandom(); - RunComparison(); -} - -TEST_P(QuantizeTest, TestMultipleQ) { - for (int q = 0; q < QINDEX_RANGE; ++q) { - UpdateQuantizer(q); - FillCoeffRandom(); - RunComparison(); +class VP9Quantize32Test : public ::testing::TestWithParam<QuantizeParam> { + public: + virtual ~VP9Quantize32Test() {} + virtual void SetUp() { + quantize_op_ = GET_PARAM(0); + ref_quantize_op_ = GET_PARAM(1); + bit_depth_ = GET_PARAM(2); + mask_ = (1 << bit_depth_) - 1; } + + virtual void TearDown() { libvpx_test::ClearSystemState(); } + + protected: + vpx_bit_depth_t bit_depth_; + int mask_; + QuantizeFunc quantize_op_; + QuantizeFunc ref_quantize_op_; +}; + +TEST_P(VP9QuantizeTest, OperationCheck) { + ACMRandom rnd(ACMRandom::DeterministicSeed()); + DECLARE_ALIGNED(16, tran_low_t, coeff_ptr[256]); + DECLARE_ALIGNED(16, int16_t, zbin_ptr[2]); + DECLARE_ALIGNED(16, int16_t, round_ptr[2]); + DECLARE_ALIGNED(16, int16_t, quant_ptr[2]); + DECLARE_ALIGNED(16, int16_t, quant_shift_ptr[2]); + DECLARE_ALIGNED(16, tran_low_t, qcoeff_ptr[256]); + DECLARE_ALIGNED(16, tran_low_t, dqcoeff_ptr[256]); + DECLARE_ALIGNED(16, tran_low_t, ref_qcoeff_ptr[256]); + DECLARE_ALIGNED(16, tran_low_t, ref_dqcoeff_ptr[256]); + DECLARE_ALIGNED(16, int16_t, dequant_ptr[2]); + DECLARE_ALIGNED(16, uint16_t, eob_ptr[1]); + DECLARE_ALIGNED(16, uint16_t, ref_eob_ptr[1]); + int err_count_total = 0; + int first_failure = -1; + for (int i = 0; i < number_of_iterations; ++i) { + const int skip_block = i == 0; + const TX_SIZE sz = (TX_SIZE)(i % 3); // TX_4X4, TX_8X8 TX_16X16 + const TX_TYPE tx_type = (TX_TYPE)((i >> 2) % 3); + const scan_order *scan_order = &vp9_scan_orders[sz][tx_type]; + const int count = (4 << sz) * (4 << sz); // 16, 64, 256 + int err_count = 0; + *eob_ptr = rnd.Rand16(); + *ref_eob_ptr = *eob_ptr; + for (int j = 0; j < count; j++) { + coeff_ptr[j] = rnd.Rand16()&mask_; + } + for (int j = 0; j < 2; j++) { + zbin_ptr[j] = rnd.Rand16()&mask_; + round_ptr[j] = rnd.Rand16(); + quant_ptr[j] = rnd.Rand16(); + quant_shift_ptr[j] = rnd.Rand16(); + dequant_ptr[j] = rnd.Rand16(); + } + ref_quantize_op_(coeff_ptr, count, skip_block, zbin_ptr, round_ptr, + quant_ptr, quant_shift_ptr, ref_qcoeff_ptr, + ref_dqcoeff_ptr, dequant_ptr, + ref_eob_ptr, scan_order->scan, scan_order->iscan); + ASM_REGISTER_STATE_CHECK(quantize_op_(coeff_ptr, count, skip_block, + zbin_ptr, round_ptr, quant_ptr, + quant_shift_ptr, qcoeff_ptr, + dqcoeff_ptr, dequant_ptr, eob_ptr, + scan_order->scan, scan_order->iscan)); + for (int j = 0; j < sz; ++j) { + err_count += (ref_qcoeff_ptr[j] != qcoeff_ptr[j]) | + (ref_dqcoeff_ptr[j] != dqcoeff_ptr[j]); + } + err_count += (*ref_eob_ptr != *eob_ptr); + if (err_count && !err_count_total) { + first_failure = i; + } + err_count_total += err_count; + } + EXPECT_EQ(0, err_count_total) + << "Error: Quantization Test, C output doesn't match SSE2 output. " + << "First failed at test case " << first_failure; } +TEST_P(VP9Quantize32Test, OperationCheck) { + ACMRandom rnd(ACMRandom::DeterministicSeed()); + DECLARE_ALIGNED(16, tran_low_t, coeff_ptr[1024]); + DECLARE_ALIGNED(16, int16_t, zbin_ptr[2]); + DECLARE_ALIGNED(16, int16_t, round_ptr[2]); + DECLARE_ALIGNED(16, int16_t, quant_ptr[2]); + DECLARE_ALIGNED(16, int16_t, quant_shift_ptr[2]); + DECLARE_ALIGNED(16, tran_low_t, qcoeff_ptr[1024]); + DECLARE_ALIGNED(16, tran_low_t, dqcoeff_ptr[1024]); + DECLARE_ALIGNED(16, tran_low_t, ref_qcoeff_ptr[1024]); + DECLARE_ALIGNED(16, tran_low_t, ref_dqcoeff_ptr[1024]); + DECLARE_ALIGNED(16, int16_t, dequant_ptr[2]); + DECLARE_ALIGNED(16, uint16_t, eob_ptr[1]); + DECLARE_ALIGNED(16, uint16_t, ref_eob_ptr[1]); + int err_count_total = 0; + int first_failure = -1; + for (int i = 0; i < number_of_iterations; ++i) { + const int skip_block = i == 0; + const TX_SIZE sz = TX_32X32; + const TX_TYPE tx_type = (TX_TYPE)(i % 4); + const scan_order *scan_order = &vp9_scan_orders[sz][tx_type]; + const int count = (4 << sz) * (4 << sz); // 1024 + int err_count = 0; + *eob_ptr = rnd.Rand16(); + *ref_eob_ptr = *eob_ptr; + for (int j = 0; j < count; j++) { + coeff_ptr[j] = rnd.Rand16()&mask_; + } + for (int j = 0; j < 2; j++) { + zbin_ptr[j] = rnd.Rand16()&mask_; + round_ptr[j] = rnd.Rand16(); + quant_ptr[j] = rnd.Rand16(); + quant_shift_ptr[j] = rnd.Rand16(); + dequant_ptr[j] = rnd.Rand16(); + } + ref_quantize_op_(coeff_ptr, count, skip_block, zbin_ptr, round_ptr, + quant_ptr, quant_shift_ptr, ref_qcoeff_ptr, + ref_dqcoeff_ptr, dequant_ptr, + ref_eob_ptr, scan_order->scan, scan_order->iscan); + ASM_REGISTER_STATE_CHECK(quantize_op_(coeff_ptr, count, skip_block, + zbin_ptr, round_ptr, quant_ptr, + quant_shift_ptr, qcoeff_ptr, + dqcoeff_ptr, dequant_ptr, eob_ptr, + scan_order->scan, scan_order->iscan)); + for (int j = 0; j < sz; ++j) { + err_count += (ref_qcoeff_ptr[j] != qcoeff_ptr[j]) | + (ref_dqcoeff_ptr[j] != dqcoeff_ptr[j]); + } + err_count += (*ref_eob_ptr != *eob_ptr); + if (err_count && !err_count_total) { + first_failure = i; + } + err_count_total += err_count; + } + EXPECT_EQ(0, err_count_total) + << "Error: Quantization Test, C output doesn't match SSE2 output. " + << "First failed at test case " << first_failure; +} + +TEST_P(VP9QuantizeTest, EOBCheck) { + ACMRandom rnd(ACMRandom::DeterministicSeed()); + DECLARE_ALIGNED(16, tran_low_t, coeff_ptr[256]); + DECLARE_ALIGNED(16, int16_t, zbin_ptr[2]); + DECLARE_ALIGNED(16, int16_t, round_ptr[2]); + DECLARE_ALIGNED(16, int16_t, quant_ptr[2]); + DECLARE_ALIGNED(16, int16_t, quant_shift_ptr[2]); + DECLARE_ALIGNED(16, tran_low_t, qcoeff_ptr[256]); + DECLARE_ALIGNED(16, tran_low_t, dqcoeff_ptr[256]); + DECLARE_ALIGNED(16, tran_low_t, ref_qcoeff_ptr[256]); + DECLARE_ALIGNED(16, tran_low_t, ref_dqcoeff_ptr[256]); + DECLARE_ALIGNED(16, int16_t, dequant_ptr[2]); + DECLARE_ALIGNED(16, uint16_t, eob_ptr[1]); + DECLARE_ALIGNED(16, uint16_t, ref_eob_ptr[1]); + int err_count_total = 0; + int first_failure = -1; + for (int i = 0; i < number_of_iterations; ++i) { + int skip_block = i == 0; + TX_SIZE sz = (TX_SIZE)(i % 3); // TX_4X4, TX_8X8 TX_16X16 + TX_TYPE tx_type = (TX_TYPE)((i >> 2) % 3); + const scan_order *scan_order = &vp9_scan_orders[sz][tx_type]; + int count = (4 << sz) * (4 << sz); // 16, 64, 256 + int err_count = 0; + *eob_ptr = rnd.Rand16(); + *ref_eob_ptr = *eob_ptr; + // Two random entries + for (int j = 0; j < count; j++) { + coeff_ptr[j] = 0; + } + coeff_ptr[rnd(count)] = rnd.Rand16()&mask_; + coeff_ptr[rnd(count)] = rnd.Rand16()&mask_; + for (int j = 0; j < 2; j++) { + zbin_ptr[j] = rnd.Rand16()&mask_; + round_ptr[j] = rnd.Rand16(); + quant_ptr[j] = rnd.Rand16(); + quant_shift_ptr[j] = rnd.Rand16(); + dequant_ptr[j] = rnd.Rand16(); + } + + ref_quantize_op_(coeff_ptr, count, skip_block, zbin_ptr, round_ptr, + quant_ptr, quant_shift_ptr, ref_qcoeff_ptr, + ref_dqcoeff_ptr, dequant_ptr, + ref_eob_ptr, scan_order->scan, scan_order->iscan); + ASM_REGISTER_STATE_CHECK(quantize_op_(coeff_ptr, count, skip_block, + zbin_ptr, round_ptr, quant_ptr, + quant_shift_ptr, qcoeff_ptr, + dqcoeff_ptr, dequant_ptr, eob_ptr, + scan_order->scan, scan_order->iscan)); + + for (int j = 0; j < sz; ++j) { + err_count += (ref_qcoeff_ptr[j] != qcoeff_ptr[j]) | + (ref_dqcoeff_ptr[j] != dqcoeff_ptr[j]); + } + err_count += (*ref_eob_ptr != *eob_ptr); + if (err_count && !err_count_total) { + first_failure = i; + } + err_count_total += err_count; + } + EXPECT_EQ(0, err_count_total) + << "Error: Quantization Test, C output doesn't match SSE2 output. " + << "First failed at test case " << first_failure; +} + +TEST_P(VP9Quantize32Test, EOBCheck) { + ACMRandom rnd(ACMRandom::DeterministicSeed()); + DECLARE_ALIGNED(16, tran_low_t, coeff_ptr[1024]); + DECLARE_ALIGNED(16, int16_t, zbin_ptr[2]); + DECLARE_ALIGNED(16, int16_t, round_ptr[2]); + DECLARE_ALIGNED(16, int16_t, quant_ptr[2]); + DECLARE_ALIGNED(16, int16_t, quant_shift_ptr[2]); + DECLARE_ALIGNED(16, tran_low_t, qcoeff_ptr[1024]); + DECLARE_ALIGNED(16, tran_low_t, dqcoeff_ptr[1024]); + DECLARE_ALIGNED(16, tran_low_t, ref_qcoeff_ptr[1024]); + DECLARE_ALIGNED(16, tran_low_t, ref_dqcoeff_ptr[1024]); + DECLARE_ALIGNED(16, int16_t, dequant_ptr[2]); + DECLARE_ALIGNED(16, uint16_t, eob_ptr[1]); + DECLARE_ALIGNED(16, uint16_t, ref_eob_ptr[1]); + int err_count_total = 0; + int first_failure = -1; + for (int i = 0; i < number_of_iterations; ++i) { + int skip_block = i == 0; + TX_SIZE sz = TX_32X32; + TX_TYPE tx_type = (TX_TYPE)(i % 4); + const scan_order *scan_order = &vp9_scan_orders[sz][tx_type]; + int count = (4 << sz) * (4 << sz); // 1024 + int err_count = 0; + *eob_ptr = rnd.Rand16(); + *ref_eob_ptr = *eob_ptr; + for (int j = 0; j < count; j++) { + coeff_ptr[j] = 0; + } + // Two random entries + coeff_ptr[rnd(count)] = rnd.Rand16()&mask_; + coeff_ptr[rnd(count)] = rnd.Rand16()&mask_; + for (int j = 0; j < 2; j++) { + zbin_ptr[j] = rnd.Rand16()&mask_; + round_ptr[j] = rnd.Rand16(); + quant_ptr[j] = rnd.Rand16(); + quant_shift_ptr[j] = rnd.Rand16(); + dequant_ptr[j] = rnd.Rand16(); + } + + ref_quantize_op_(coeff_ptr, count, skip_block, zbin_ptr, round_ptr, + quant_ptr, quant_shift_ptr, ref_qcoeff_ptr, + ref_dqcoeff_ptr, dequant_ptr, + ref_eob_ptr, scan_order->scan, scan_order->iscan); + ASM_REGISTER_STATE_CHECK(quantize_op_(coeff_ptr, count, skip_block, + zbin_ptr, round_ptr, quant_ptr, + quant_shift_ptr, qcoeff_ptr, + dqcoeff_ptr, dequant_ptr, eob_ptr, + scan_order->scan, scan_order->iscan)); + + for (int j = 0; j < sz; ++j) { + err_count += (ref_qcoeff_ptr[j] != qcoeff_ptr[j]) | + (ref_dqcoeff_ptr[j] != dqcoeff_ptr[j]); + } + err_count += (*ref_eob_ptr != *eob_ptr); + if (err_count && !err_count_total) { + first_failure = i; + } + err_count_total += err_count; + } + EXPECT_EQ(0, err_count_total) + << "Error: Quantization Test, C output doesn't match SSE2 output. " + << "First failed at test case " << first_failure; +} +using std::tr1::make_tuple; + #if HAVE_SSE2 INSTANTIATE_TEST_CASE_P( - SSE2, QuantizeTest, + SSE2, VP9QuantizeTest, ::testing::Values( - make_tuple(&vp8_fast_quantize_b_sse2, &vp8_fast_quantize_b_c), - make_tuple(&vp8_regular_quantize_b_sse2, &vp8_regular_quantize_b_c))); + make_tuple(&vpx_highbd_quantize_b_sse2, + &vpx_highbd_quantize_b_c, VPX_BITS_8), + make_tuple(&vpx_highbd_quantize_b_sse2, + &vpx_highbd_quantize_b_c, VPX_BITS_10), + make_tuple(&vpx_highbd_quantize_b_sse2, + &vpx_highbd_quantize_b_c, VPX_BITS_12))); +INSTANTIATE_TEST_CASE_P( + SSE2, VP9Quantize32Test, + ::testing::Values( + make_tuple(&vpx_highbd_quantize_b_32x32_sse2, + &vpx_highbd_quantize_b_32x32_c, VPX_BITS_8), + make_tuple(&vpx_highbd_quantize_b_32x32_sse2, + &vpx_highbd_quantize_b_32x32_c, VPX_BITS_10), + make_tuple(&vpx_highbd_quantize_b_32x32_sse2, + &vpx_highbd_quantize_b_32x32_c, VPX_BITS_12))); #endif // HAVE_SSE2 - -#if HAVE_SSSE3 -INSTANTIATE_TEST_CASE_P(SSSE3, QuantizeTest, - ::testing::Values(make_tuple(&vp8_fast_quantize_b_ssse3, - &vp8_fast_quantize_b_c))); -#endif // HAVE_SSSE3 - -#if HAVE_SSE4_1 -INSTANTIATE_TEST_CASE_P( - SSE4_1, QuantizeTest, - ::testing::Values(make_tuple(&vp8_regular_quantize_b_sse4_1, - &vp8_regular_quantize_b_c))); -#endif // HAVE_SSE4_1 - -#if HAVE_NEON -INSTANTIATE_TEST_CASE_P(NEON, QuantizeTest, - ::testing::Values(make_tuple(&vp8_fast_quantize_b_neon, - &vp8_fast_quantize_b_c))); -#endif // HAVE_NEON - -#if HAVE_MSA -INSTANTIATE_TEST_CASE_P( - MSA, QuantizeTest, - ::testing::Values( - make_tuple(&vp8_fast_quantize_b_msa, &vp8_fast_quantize_b_c), - make_tuple(&vp8_regular_quantize_b_msa, &vp8_regular_quantize_b_c))); -#endif // HAVE_MSA +#endif // CONFIG_VP9_HIGHBITDEPTH } // namespace
diff --git a/test/vp9_subtract_test.cc b/test/subtract_test.cc similarity index 100% rename from test/vp9_subtract_test.cc rename to test/subtract_test.cc
diff --git a/test/test.mk b/test/test.mk index 29fdc67..654e754 100644 --- a/test/test.mk +++ b/test/test.mk
@@ -32,9 +32,9 @@ LIBVPX_TEST_SRCS-$(CONFIG_VP10_ENCODER) += borders_test.cc LIBVPX_TEST_SRCS-$(CONFIG_VP10_ENCODER) += cpu_speed_test.cc LIBVPX_TEST_SRCS-$(CONFIG_VP10_ENCODER) += frame_size_tests.cc -LIBVPX_TEST_SRCS-$(CONFIG_VP10_ENCODER) += vp9_lossless_test.cc -LIBVPX_TEST_SRCS-$(CONFIG_VP10_ENCODER) += vp9_end_to_end_test.cc -LIBVPX_TEST_SRCS-$(CONFIG_VP10_ENCODER) += vp9_ethread_test.cc +LIBVPX_TEST_SRCS-$(CONFIG_VP10_ENCODER) += lossless_test.cc +LIBVPX_TEST_SRCS-$(CONFIG_VP10_ENCODER) += end_to_end_test.cc +LIBVPX_TEST_SRCS-$(CONFIG_VP10_ENCODER) += ethread_test.cc LIBVPX_TEST_SRCS-yes += decode_test_driver.cc LIBVPX_TEST_SRCS-yes += decode_test_driver.h @@ -93,21 +93,21 @@ LIBVPX_TEST_SRCS-yes += partial_idct_test.cc LIBVPX_TEST_SRCS-yes += superframe_test.cc LIBVPX_TEST_SRCS-yes += tile_independence_test.cc -LIBVPX_TEST_SRCS-yes += vp9_boolcoder_test.cc -LIBVPX_TEST_SRCS-yes += vp9_encoder_parms_get_to_decoder.cc +LIBVPX_TEST_SRCS-yes += boolcoder_test.cc +LIBVPX_TEST_SRCS-yes += encoder_parms_get_to_decoder.cc endif LIBVPX_TEST_SRCS-yes += convolve_test.cc LIBVPX_TEST_SRCS-yes += lpf_8_test.cc -LIBVPX_TEST_SRCS-yes += vp9_intrapred_test.cc +LIBVPX_TEST_SRCS-yes += intrapred_test.cc LIBVPX_TEST_SRCS-$(CONFIG_VP10_ENCODER) += dct16x16_test.cc LIBVPX_TEST_SRCS-$(CONFIG_VP10_ENCODER) += dct32x32_test.cc LIBVPX_TEST_SRCS-$(CONFIG_VP10_ENCODER) += fdct4x4_test.cc LIBVPX_TEST_SRCS-$(CONFIG_VP10_ENCODER) += fdct8x8_test.cc LIBVPX_TEST_SRCS-$(CONFIG_VP10_ENCODER) += variance_test.cc -LIBVPX_TEST_SRCS-$(CONFIG_VP10_ENCODER) += vp9_error_block_test.cc -LIBVPX_TEST_SRCS-$(CONFIG_VP10_ENCODER) += vp9_quantize_test.cc -LIBVPX_TEST_SRCS-$(CONFIG_VP10_ENCODER) += vp9_subtract_test.cc +LIBVPX_TEST_SRCS-$(CONFIG_VP10_ENCODER) += error_block_test.cc +LIBVPX_TEST_SRCS-$(CONFIG_VP10_ENCODER) += quantize_test.cc +LIBVPX_TEST_SRCS-$(CONFIG_VP10_ENCODER) += subtract_test.cc ifeq ($(CONFIG_VP10_ENCODER),yes) LIBVPX_TEST_SRCS-$(CONFIG_SPATIAL_SVC) += svc_test.cc @@ -116,9 +116,9 @@ endif ifeq ($(CONFIG_VP10_ENCODER)$(CONFIG_VP10_TEMPORAL_DENOISING),yesyes) -LIBVPX_TEST_SRCS-$(HAVE_SSE2) += vp9_denoiser_sse2_test.cc +LIBVPX_TEST_SRCS-$(HAVE_SSE2) += denoiser_sse2_test.cc endif -LIBVPX_TEST_SRCS-$(CONFIG_VP10_ENCODER) += vp9_arf_freq_test.cc +LIBVPX_TEST_SRCS-$(CONFIG_VP10_ENCODER) += arf_freq_test.cc LIBVPX_TEST_SRCS-yes += vp10_inv_txfm_test.cc LIBVPX_TEST_SRCS-$(CONFIG_VP10_ENCODER) += vp10_dct_test.cc
diff --git a/test/vp9_quantize_test.cc b/test/vp9_quantize_test.cc deleted file mode 100644 index dc3a244..0000000 --- a/test/vp9_quantize_test.cc +++ /dev/null
@@ -1,351 +0,0 @@ -/* - * Copyright (c) 2014 The WebM project authors. All Rights Reserved. - * - * Use of this source code is governed by a BSD-style license - * that can be found in the LICENSE file in the root of the source - * tree. An additional intellectual property rights grant can be found - * in the file PATENTS. All contributing project authors may - * be found in the AUTHORS file in the root of the source tree. - */ - -#include <math.h> -#include <stdlib.h> -#include <string.h> - -#include "third_party/googletest/src/include/gtest/gtest.h" - -#include "./vpx_config.h" -#include "./vpx_dsp_rtcd.h" -#include "test/acm_random.h" -#include "test/clear_system_state.h" -#include "test/register_state_check.h" -#include "test/util.h" -#include "vp10/common/entropy.h" -#include "vp10/common/scan.h" -#include "vpx/vpx_codec.h" -#include "vpx/vpx_integer.h" - -using libvpx_test::ACMRandom; - -namespace { -#if CONFIG_VP9_HIGHBITDEPTH -const int number_of_iterations = 100; - -typedef void (*QuantizeFunc)(const tran_low_t *coeff, intptr_t count, - int skip_block, const int16_t *zbin, - const int16_t *round, const int16_t *quant, - const int16_t *quant_shift, - tran_low_t *qcoeff, tran_low_t *dqcoeff, - const int16_t *dequant, - uint16_t *eob, const int16_t *scan, - const int16_t *iscan); -typedef std::tr1::tuple<QuantizeFunc, QuantizeFunc, vpx_bit_depth_t> - QuantizeParam; - -class VP9QuantizeTest : public ::testing::TestWithParam<QuantizeParam> { - public: - virtual ~VP9QuantizeTest() {} - virtual void SetUp() { - quantize_op_ = GET_PARAM(0); - ref_quantize_op_ = GET_PARAM(1); - bit_depth_ = GET_PARAM(2); - mask_ = (1 << bit_depth_) - 1; - } - - virtual void TearDown() { libvpx_test::ClearSystemState(); } - - protected: - vpx_bit_depth_t bit_depth_; - int mask_; - QuantizeFunc quantize_op_; - QuantizeFunc ref_quantize_op_; -}; - -class VP9Quantize32Test : public ::testing::TestWithParam<QuantizeParam> { - public: - virtual ~VP9Quantize32Test() {} - virtual void SetUp() { - quantize_op_ = GET_PARAM(0); - ref_quantize_op_ = GET_PARAM(1); - bit_depth_ = GET_PARAM(2); - mask_ = (1 << bit_depth_) - 1; - } - - virtual void TearDown() { libvpx_test::ClearSystemState(); } - - protected: - vpx_bit_depth_t bit_depth_; - int mask_; - QuantizeFunc quantize_op_; - QuantizeFunc ref_quantize_op_; -}; - -TEST_P(VP9QuantizeTest, OperationCheck) { - ACMRandom rnd(ACMRandom::DeterministicSeed()); - DECLARE_ALIGNED(16, tran_low_t, coeff_ptr[256]); - DECLARE_ALIGNED(16, int16_t, zbin_ptr[2]); - DECLARE_ALIGNED(16, int16_t, round_ptr[2]); - DECLARE_ALIGNED(16, int16_t, quant_ptr[2]); - DECLARE_ALIGNED(16, int16_t, quant_shift_ptr[2]); - DECLARE_ALIGNED(16, tran_low_t, qcoeff_ptr[256]); - DECLARE_ALIGNED(16, tran_low_t, dqcoeff_ptr[256]); - DECLARE_ALIGNED(16, tran_low_t, ref_qcoeff_ptr[256]); - DECLARE_ALIGNED(16, tran_low_t, ref_dqcoeff_ptr[256]); - DECLARE_ALIGNED(16, int16_t, dequant_ptr[2]); - DECLARE_ALIGNED(16, uint16_t, eob_ptr[1]); - DECLARE_ALIGNED(16, uint16_t, ref_eob_ptr[1]); - int err_count_total = 0; - int first_failure = -1; - for (int i = 0; i < number_of_iterations; ++i) { - const int skip_block = i == 0; - const TX_SIZE sz = (TX_SIZE)(i % 3); // TX_4X4, TX_8X8 TX_16X16 - const TX_TYPE tx_type = (TX_TYPE)((i >> 2) % 3); - const scan_order *scan_order = &vp9_scan_orders[sz][tx_type]; - const int count = (4 << sz) * (4 << sz); // 16, 64, 256 - int err_count = 0; - *eob_ptr = rnd.Rand16(); - *ref_eob_ptr = *eob_ptr; - for (int j = 0; j < count; j++) { - coeff_ptr[j] = rnd.Rand16()&mask_; - } - for (int j = 0; j < 2; j++) { - zbin_ptr[j] = rnd.Rand16()&mask_; - round_ptr[j] = rnd.Rand16(); - quant_ptr[j] = rnd.Rand16(); - quant_shift_ptr[j] = rnd.Rand16(); - dequant_ptr[j] = rnd.Rand16(); - } - ref_quantize_op_(coeff_ptr, count, skip_block, zbin_ptr, round_ptr, - quant_ptr, quant_shift_ptr, ref_qcoeff_ptr, - ref_dqcoeff_ptr, dequant_ptr, - ref_eob_ptr, scan_order->scan, scan_order->iscan); - ASM_REGISTER_STATE_CHECK(quantize_op_(coeff_ptr, count, skip_block, - zbin_ptr, round_ptr, quant_ptr, - quant_shift_ptr, qcoeff_ptr, - dqcoeff_ptr, dequant_ptr, eob_ptr, - scan_order->scan, scan_order->iscan)); - for (int j = 0; j < sz; ++j) { - err_count += (ref_qcoeff_ptr[j] != qcoeff_ptr[j]) | - (ref_dqcoeff_ptr[j] != dqcoeff_ptr[j]); - } - err_count += (*ref_eob_ptr != *eob_ptr); - if (err_count && !err_count_total) { - first_failure = i; - } - err_count_total += err_count; - } - EXPECT_EQ(0, err_count_total) - << "Error: Quantization Test, C output doesn't match SSE2 output. " - << "First failed at test case " << first_failure; -} - -TEST_P(VP9Quantize32Test, OperationCheck) { - ACMRandom rnd(ACMRandom::DeterministicSeed()); - DECLARE_ALIGNED(16, tran_low_t, coeff_ptr[1024]); - DECLARE_ALIGNED(16, int16_t, zbin_ptr[2]); - DECLARE_ALIGNED(16, int16_t, round_ptr[2]); - DECLARE_ALIGNED(16, int16_t, quant_ptr[2]); - DECLARE_ALIGNED(16, int16_t, quant_shift_ptr[2]); - DECLARE_ALIGNED(16, tran_low_t, qcoeff_ptr[1024]); - DECLARE_ALIGNED(16, tran_low_t, dqcoeff_ptr[1024]); - DECLARE_ALIGNED(16, tran_low_t, ref_qcoeff_ptr[1024]); - DECLARE_ALIGNED(16, tran_low_t, ref_dqcoeff_ptr[1024]); - DECLARE_ALIGNED(16, int16_t, dequant_ptr[2]); - DECLARE_ALIGNED(16, uint16_t, eob_ptr[1]); - DECLARE_ALIGNED(16, uint16_t, ref_eob_ptr[1]); - int err_count_total = 0; - int first_failure = -1; - for (int i = 0; i < number_of_iterations; ++i) { - const int skip_block = i == 0; - const TX_SIZE sz = TX_32X32; - const TX_TYPE tx_type = (TX_TYPE)(i % 4); - const scan_order *scan_order = &vp9_scan_orders[sz][tx_type]; - const int count = (4 << sz) * (4 << sz); // 1024 - int err_count = 0; - *eob_ptr = rnd.Rand16(); - *ref_eob_ptr = *eob_ptr; - for (int j = 0; j < count; j++) { - coeff_ptr[j] = rnd.Rand16()&mask_; - } - for (int j = 0; j < 2; j++) { - zbin_ptr[j] = rnd.Rand16()&mask_; - round_ptr[j] = rnd.Rand16(); - quant_ptr[j] = rnd.Rand16(); - quant_shift_ptr[j] = rnd.Rand16(); - dequant_ptr[j] = rnd.Rand16(); - } - ref_quantize_op_(coeff_ptr, count, skip_block, zbin_ptr, round_ptr, - quant_ptr, quant_shift_ptr, ref_qcoeff_ptr, - ref_dqcoeff_ptr, dequant_ptr, - ref_eob_ptr, scan_order->scan, scan_order->iscan); - ASM_REGISTER_STATE_CHECK(quantize_op_(coeff_ptr, count, skip_block, - zbin_ptr, round_ptr, quant_ptr, - quant_shift_ptr, qcoeff_ptr, - dqcoeff_ptr, dequant_ptr, eob_ptr, - scan_order->scan, scan_order->iscan)); - for (int j = 0; j < sz; ++j) { - err_count += (ref_qcoeff_ptr[j] != qcoeff_ptr[j]) | - (ref_dqcoeff_ptr[j] != dqcoeff_ptr[j]); - } - err_count += (*ref_eob_ptr != *eob_ptr); - if (err_count && !err_count_total) { - first_failure = i; - } - err_count_total += err_count; - } - EXPECT_EQ(0, err_count_total) - << "Error: Quantization Test, C output doesn't match SSE2 output. " - << "First failed at test case " << first_failure; -} - -TEST_P(VP9QuantizeTest, EOBCheck) { - ACMRandom rnd(ACMRandom::DeterministicSeed()); - DECLARE_ALIGNED(16, tran_low_t, coeff_ptr[256]); - DECLARE_ALIGNED(16, int16_t, zbin_ptr[2]); - DECLARE_ALIGNED(16, int16_t, round_ptr[2]); - DECLARE_ALIGNED(16, int16_t, quant_ptr[2]); - DECLARE_ALIGNED(16, int16_t, quant_shift_ptr[2]); - DECLARE_ALIGNED(16, tran_low_t, qcoeff_ptr[256]); - DECLARE_ALIGNED(16, tran_low_t, dqcoeff_ptr[256]); - DECLARE_ALIGNED(16, tran_low_t, ref_qcoeff_ptr[256]); - DECLARE_ALIGNED(16, tran_low_t, ref_dqcoeff_ptr[256]); - DECLARE_ALIGNED(16, int16_t, dequant_ptr[2]); - DECLARE_ALIGNED(16, uint16_t, eob_ptr[1]); - DECLARE_ALIGNED(16, uint16_t, ref_eob_ptr[1]); - int err_count_total = 0; - int first_failure = -1; - for (int i = 0; i < number_of_iterations; ++i) { - int skip_block = i == 0; - TX_SIZE sz = (TX_SIZE)(i % 3); // TX_4X4, TX_8X8 TX_16X16 - TX_TYPE tx_type = (TX_TYPE)((i >> 2) % 3); - const scan_order *scan_order = &vp9_scan_orders[sz][tx_type]; - int count = (4 << sz) * (4 << sz); // 16, 64, 256 - int err_count = 0; - *eob_ptr = rnd.Rand16(); - *ref_eob_ptr = *eob_ptr; - // Two random entries - for (int j = 0; j < count; j++) { - coeff_ptr[j] = 0; - } - coeff_ptr[rnd(count)] = rnd.Rand16()&mask_; - coeff_ptr[rnd(count)] = rnd.Rand16()&mask_; - for (int j = 0; j < 2; j++) { - zbin_ptr[j] = rnd.Rand16()&mask_; - round_ptr[j] = rnd.Rand16(); - quant_ptr[j] = rnd.Rand16(); - quant_shift_ptr[j] = rnd.Rand16(); - dequant_ptr[j] = rnd.Rand16(); - } - - ref_quantize_op_(coeff_ptr, count, skip_block, zbin_ptr, round_ptr, - quant_ptr, quant_shift_ptr, ref_qcoeff_ptr, - ref_dqcoeff_ptr, dequant_ptr, - ref_eob_ptr, scan_order->scan, scan_order->iscan); - ASM_REGISTER_STATE_CHECK(quantize_op_(coeff_ptr, count, skip_block, - zbin_ptr, round_ptr, quant_ptr, - quant_shift_ptr, qcoeff_ptr, - dqcoeff_ptr, dequant_ptr, eob_ptr, - scan_order->scan, scan_order->iscan)); - - for (int j = 0; j < sz; ++j) { - err_count += (ref_qcoeff_ptr[j] != qcoeff_ptr[j]) | - (ref_dqcoeff_ptr[j] != dqcoeff_ptr[j]); - } - err_count += (*ref_eob_ptr != *eob_ptr); - if (err_count && !err_count_total) { - first_failure = i; - } - err_count_total += err_count; - } - EXPECT_EQ(0, err_count_total) - << "Error: Quantization Test, C output doesn't match SSE2 output. " - << "First failed at test case " << first_failure; -} - -TEST_P(VP9Quantize32Test, EOBCheck) { - ACMRandom rnd(ACMRandom::DeterministicSeed()); - DECLARE_ALIGNED(16, tran_low_t, coeff_ptr[1024]); - DECLARE_ALIGNED(16, int16_t, zbin_ptr[2]); - DECLARE_ALIGNED(16, int16_t, round_ptr[2]); - DECLARE_ALIGNED(16, int16_t, quant_ptr[2]); - DECLARE_ALIGNED(16, int16_t, quant_shift_ptr[2]); - DECLARE_ALIGNED(16, tran_low_t, qcoeff_ptr[1024]); - DECLARE_ALIGNED(16, tran_low_t, dqcoeff_ptr[1024]); - DECLARE_ALIGNED(16, tran_low_t, ref_qcoeff_ptr[1024]); - DECLARE_ALIGNED(16, tran_low_t, ref_dqcoeff_ptr[1024]); - DECLARE_ALIGNED(16, int16_t, dequant_ptr[2]); - DECLARE_ALIGNED(16, uint16_t, eob_ptr[1]); - DECLARE_ALIGNED(16, uint16_t, ref_eob_ptr[1]); - int err_count_total = 0; - int first_failure = -1; - for (int i = 0; i < number_of_iterations; ++i) { - int skip_block = i == 0; - TX_SIZE sz = TX_32X32; - TX_TYPE tx_type = (TX_TYPE)(i % 4); - const scan_order *scan_order = &vp9_scan_orders[sz][tx_type]; - int count = (4 << sz) * (4 << sz); // 1024 - int err_count = 0; - *eob_ptr = rnd.Rand16(); - *ref_eob_ptr = *eob_ptr; - for (int j = 0; j < count; j++) { - coeff_ptr[j] = 0; - } - // Two random entries - coeff_ptr[rnd(count)] = rnd.Rand16()&mask_; - coeff_ptr[rnd(count)] = rnd.Rand16()&mask_; - for (int j = 0; j < 2; j++) { - zbin_ptr[j] = rnd.Rand16()&mask_; - round_ptr[j] = rnd.Rand16(); - quant_ptr[j] = rnd.Rand16(); - quant_shift_ptr[j] = rnd.Rand16(); - dequant_ptr[j] = rnd.Rand16(); - } - - ref_quantize_op_(coeff_ptr, count, skip_block, zbin_ptr, round_ptr, - quant_ptr, quant_shift_ptr, ref_qcoeff_ptr, - ref_dqcoeff_ptr, dequant_ptr, - ref_eob_ptr, scan_order->scan, scan_order->iscan); - ASM_REGISTER_STATE_CHECK(quantize_op_(coeff_ptr, count, skip_block, - zbin_ptr, round_ptr, quant_ptr, - quant_shift_ptr, qcoeff_ptr, - dqcoeff_ptr, dequant_ptr, eob_ptr, - scan_order->scan, scan_order->iscan)); - - for (int j = 0; j < sz; ++j) { - err_count += (ref_qcoeff_ptr[j] != qcoeff_ptr[j]) | - (ref_dqcoeff_ptr[j] != dqcoeff_ptr[j]); - } - err_count += (*ref_eob_ptr != *eob_ptr); - if (err_count && !err_count_total) { - first_failure = i; - } - err_count_total += err_count; - } - EXPECT_EQ(0, err_count_total) - << "Error: Quantization Test, C output doesn't match SSE2 output. " - << "First failed at test case " << first_failure; -} -using std::tr1::make_tuple; - -#if HAVE_SSE2 -INSTANTIATE_TEST_CASE_P( - SSE2, VP9QuantizeTest, - ::testing::Values( - make_tuple(&vpx_highbd_quantize_b_sse2, - &vpx_highbd_quantize_b_c, VPX_BITS_8), - make_tuple(&vpx_highbd_quantize_b_sse2, - &vpx_highbd_quantize_b_c, VPX_BITS_10), - make_tuple(&vpx_highbd_quantize_b_sse2, - &vpx_highbd_quantize_b_c, VPX_BITS_12))); -INSTANTIATE_TEST_CASE_P( - SSE2, VP9Quantize32Test, - ::testing::Values( - make_tuple(&vpx_highbd_quantize_b_32x32_sse2, - &vpx_highbd_quantize_b_32x32_c, VPX_BITS_8), - make_tuple(&vpx_highbd_quantize_b_32x32_sse2, - &vpx_highbd_quantize_b_32x32_c, VPX_BITS_10), - make_tuple(&vpx_highbd_quantize_b_32x32_sse2, - &vpx_highbd_quantize_b_32x32_c, VPX_BITS_12))); -#endif // HAVE_SSE2 -#endif // CONFIG_VP9_HIGHBITDEPTH -} // namespace