From 05fe0f20a653c579f93545403815f12bbda5254f Mon Sep 17 00:00:00 2001 From: Marco Date: Wed, 17 Feb 2016 12:03:57 -0800 Subject: vp9: Allow usage of lookahead for real-time, 1 pass vbr. Allow usage of lookahead for VBR in real-time mode, for 1 pass vbr. Current usage is for fast checking of future scene cuts/changes, and adjusting rate control (gf interval and active_worst/target size). Added unittests (datarate) for 1 pass vbr mode, with non-zero lag. Added an experimental option to limit QP based on lookahead. Overall positive gain in metrics on ytlive set: avgPNSR/SSIM up on average ~1-3%; several clips up by 5, 7%. Change-Id: I960d57dfc89de121c4824b9a9bf88d2814e74b56 --- test/datarate_test.cc | 32 +++++++++++++++++++++++++++++--- 1 file changed, 29 insertions(+), 3 deletions(-) (limited to 'test') diff --git a/test/datarate_test.cc b/test/datarate_test.cc index 220cbf3a3..0b188b5d7 100644 --- a/test/datarate_test.cc +++ b/test/datarate_test.cc @@ -450,8 +450,8 @@ class DatarateTestVP9Large : public ::libvpx_test::EncoderTest, int denoiser_offon_period_; }; -// Check basic rate targeting for VBR mode. -TEST_P(DatarateTestVP9Large, BasicRateTargetingVBR) { +// Check basic rate targeting for VBR mode with 0 lag. +TEST_P(DatarateTestVP9Large, BasicRateTargetingVBRLagZero) { cfg_.rc_min_quantizer = 0; cfg_.rc_max_quantizer = 63; cfg_.g_error_resilient = 0; @@ -471,7 +471,33 @@ TEST_P(DatarateTestVP9Large, BasicRateTargetingVBR) { } } -// Check basic rate targeting for CBR, +// Check basic rate targeting for VBR mode with non-zero lag. +TEST_P(DatarateTestVP9Large, BasicRateTargetingVBRLagNonZero) { + cfg_.rc_min_quantizer = 0; + cfg_.rc_max_quantizer = 63; + cfg_.g_error_resilient = 0; + cfg_.rc_end_usage = VPX_VBR; + // For non-zero lag, rate control will work (be within bounds) for + // real-time mode. + if (deadline_ == VPX_DL_REALTIME) + cfg_.g_lag_in_frames = 15; + else + cfg_.g_lag_in_frames = 0; + + ::libvpx_test::I420VideoSource video("hantro_collage_w352h288.yuv", 352, 288, + 30, 1, 0, 300); + for (int i = 400; i <= 800; i += 400) { + cfg_.rc_target_bitrate = i; + ResetModel(); + ASSERT_NO_FATAL_FAILURE(RunLoop(&video)); + ASSERT_GE(effective_datarate_[0], cfg_.rc_target_bitrate * 0.75) + << " The datarate for the file is lower than target by too much!"; + ASSERT_LE(effective_datarate_[0], cfg_.rc_target_bitrate * 1.25) + << " The datarate for the file is greater than target by too much!"; + } +} + +// Check basic rate targeting for CBR mode. TEST_P(DatarateTestVP9Large, BasicRateTargeting) { cfg_.rc_buf_initial_sz = 500; cfg_.rc_buf_optimal_sz = 500; -- cgit v1.2.3