diff options
Diffstat (limited to 'test')
-rw-r--r-- | test/datarate_test.cc | 70 | ||||
-rw-r--r-- | test/encode_test_driver.h | 7 | ||||
-rw-r--r-- | test/hadamard_test.cc | 5 | ||||
-rw-r--r-- | test/set_roi.cc | 8 |
4 files changed, 82 insertions, 8 deletions
diff --git a/test/datarate_test.cc b/test/datarate_test.cc index 7b0d62818..7ae761fd4 100644 --- a/test/datarate_test.cc +++ b/test/datarate_test.cc @@ -44,6 +44,7 @@ class DatarateTestLarge denoiser_offon_test_ = 0; denoiser_offon_period_ = -1; gf_boost_ = 0; + use_roi_ = 0; } virtual void PreEncodeFrameHook(::libvpx_test::VideoSource *video, @@ -54,6 +55,12 @@ class DatarateTestLarge encoder->Control(VP8E_SET_GF_CBR_BOOST_PCT, gf_boost_); } +#if CONFIG_VP8_ENCODER + if (use_roi_ == 1) { + encoder->Control(VP8E_SET_ROI_MAP, &roi_); + } +#endif + if (denoiser_offon_test_) { ASSERT_GT(denoiser_offon_period_, 0) << "denoiser_offon_period_ is not positive."; @@ -145,6 +152,8 @@ class DatarateTestLarge int denoiser_offon_period_; int set_cpu_used_; int gf_boost_; + int use_roi_; + vpx_roi_map_t roi_; }; #if CONFIG_TEMPORAL_DENOISING @@ -414,6 +423,67 @@ TEST_P(DatarateTestRealTime, DropFramesMultiThreads) { << " The datarate for the file missed the target!"; } +TEST_P(DatarateTestRealTime, RegionOfInterest) { + denoiser_on_ = 0; + cfg_.rc_buf_initial_sz = 500; + cfg_.rc_dropframe_thresh = 0; + cfg_.rc_max_quantizer = 56; + cfg_.rc_end_usage = VPX_CBR; + // Encode using multiple threads. + cfg_.g_threads = 2; + + ::libvpx_test::I420VideoSource video("hantro_collage_w352h288.yuv", 352, 288, + 30, 1, 0, 300); + cfg_.rc_target_bitrate = 450; + cfg_.g_w = 352; + cfg_.g_h = 288; + + ResetModel(); + + // Set ROI parameters + use_roi_ = 1; + memset(&roi_, 0, sizeof(roi_)); + + roi_.rows = (cfg_.g_h + 15) / 16; + roi_.cols = (cfg_.g_w + 15) / 16; + + roi_.delta_q[0] = 0; + roi_.delta_q[1] = -20; + roi_.delta_q[2] = 0; + roi_.delta_q[3] = 0; + + roi_.delta_lf[0] = 0; + roi_.delta_lf[1] = -20; + roi_.delta_lf[2] = 0; + roi_.delta_lf[3] = 0; + + roi_.static_threshold[0] = 0; + roi_.static_threshold[1] = 1000; + roi_.static_threshold[2] = 0; + roi_.static_threshold[3] = 0; + + // Use 2 states: 1 is center square, 0 is the rest. + roi_.roi_map = + (uint8_t *)calloc(roi_.rows * roi_.cols, sizeof(*roi_.roi_map)); + for (unsigned int i = 0; i < roi_.rows; ++i) { + for (unsigned int j = 0; j < roi_.cols; ++j) { + if (i > (roi_.rows >> 2) && i < ((roi_.rows * 3) >> 2) && + j > (roi_.cols >> 2) && j < ((roi_.cols * 3) >> 2)) { + roi_.roi_map[i * roi_.cols + j] = 1; + } + } + } + + ASSERT_NO_FATAL_FAILURE(RunLoop(&video)); + ASSERT_GE(cfg_.rc_target_bitrate, effective_datarate_ * 0.95) + << " The datarate for the file exceeds the target!"; + + ASSERT_LE(cfg_.rc_target_bitrate, file_datarate_ * 1.4) + << " The datarate for the file missed the target!"; + + free(roi_.roi_map); +} + TEST_P(DatarateTestRealTime, GFBoost) { denoiser_on_ = 0; cfg_.rc_buf_initial_sz = 500; diff --git a/test/encode_test_driver.h b/test/encode_test_driver.h index 08a57ad77..1b4a5a671 100644 --- a/test/encode_test_driver.h +++ b/test/encode_test_driver.h @@ -139,6 +139,13 @@ class Encoder { } #endif +#if CONFIG_VP8_ENCODER + void Control(int ctrl_id, vpx_roi_map_t *arg) { + const vpx_codec_err_t res = vpx_codec_control_(&encoder_, ctrl_id, arg); + ASSERT_EQ(VPX_CODEC_OK, res) << EncoderError(); + } +#endif + void Config(const vpx_codec_enc_cfg_t *cfg) { const vpx_codec_err_t res = vpx_codec_enc_config_set(&encoder_, cfg); ASSERT_EQ(VPX_CODEC_OK, res) << EncoderError(); diff --git a/test/hadamard_test.cc b/test/hadamard_test.cc index a55b15ad0..eacd84635 100644 --- a/test/hadamard_test.cc +++ b/test/hadamard_test.cc @@ -268,6 +268,11 @@ INSTANTIATE_TEST_CASE_P(SSE2, Hadamard16x16Test, ::testing::Values(&vpx_hadamard_16x16_sse2)); #endif // HAVE_SSE2 +#if HAVE_AVX2 +INSTANTIATE_TEST_CASE_P(AVX2, Hadamard16x16Test, + ::testing::Values(&vpx_hadamard_16x16_avx2)); +#endif // HAVE_AVX2 + #if HAVE_VSX INSTANTIATE_TEST_CASE_P(VSX, Hadamard16x16Test, ::testing::Values(&vpx_hadamard_16x16_vsx)); diff --git a/test/set_roi.cc b/test/set_roi.cc index 38711a806..f63954752 100644 --- a/test/set_roi.cc +++ b/test/set_roi.cc @@ -146,14 +146,6 @@ TEST(VP8RoiMapTest, ParameterCheck) { if (deltas_valid != roi_retval) break; } - // Test that we report and error if cyclic refresh is enabled. - cpi.cyclic_refresh_mode_enabled = 1; - roi_retval = - vp8_set_roimap(&cpi, roi_map, cpi.common.mb_rows, cpi.common.mb_cols, - delta_q, delta_lf, threshold); - EXPECT_EQ(-1, roi_retval) << "cyclic refresh check error"; - cpi.cyclic_refresh_mode_enabled = 0; - // Test invalid number of rows or colums. roi_retval = vp8_set_roimap(&cpi, roi_map, cpi.common.mb_rows + 1, |