svc test for error resilience: dropping mid-sequence This test checks for continued successful decoding when a set of enhancement layers are dropped within middle of sequence (instead of dropping all TL1/TL2, as in the other existing tests). This test more closely captures the real application case where any set/sequence of TL1/TL2 may be dropped (due to packet loss) and then decoding resumes on a TL0 frame. Succesful decoding with no mismatch is guaranteed in this test if the error resilience is enabled (1) on enhancement layers, but can remain off (0) on base TL0. Change-Id: I32d747945a007df484fbf779736b983643a3b420
diff --git a/test/svc_datarate_test.cc b/test/svc_datarate_test.cc index a851be7..07559d4 100644 --- a/test/svc_datarate_test.cc +++ b/test/svc_datarate_test.cc
@@ -1173,6 +1173,57 @@ EXPECT_EQ((int)GetMismatchFrames(), 0); } + virtual void BasicRateTargetingSVC3TL1SLDropSetEnhFrameERTest() { + cfg_.rc_buf_initial_sz = 500; + cfg_.rc_buf_optimal_sz = 500; + cfg_.rc_buf_sz = 1000; + cfg_.rc_dropframe_thresh = 0; + cfg_.rc_min_quantizer = 0; + cfg_.rc_max_quantizer = 63; + cfg_.rc_end_usage = AOM_CBR; + cfg_.g_lag_in_frames = 0; + + ::libaom_test::I420VideoSource video("hantro_collage_w352h288.yuv", 352, + 288, 30, 1, 0, 300); + const int bitrate_array[2] = { 200, 550 }; + cfg_.rc_target_bitrate = bitrate_array[GET_PARAM(4)]; + ResetModel(); + // Set error_resilience at frame level, with codec control, + // on/1 for enahancement layers and off/0 for base layer frames. + set_frame_level_er_ = 1; + + // Drop TL1 and TL2: for part of sequence. Start at first TL2 at + // frame 101, and end at second T2 at frame 199. Frame 200 is TL0, + // so we can continue decoding without mismatch (since LAST is the + // only reference and error_resil = 1 on TL1/TL2 frames). + int n = 0; + int num_nonref = 300 / 2; + for (int i = 101; i < 200; i++) { + if (i % 4 != 0) { + drop_frames_list_[n] = i; + n++; + if (i % 2 != 0) num_nonref -= 1; + } + } + drop_frames_ = n; + number_temporal_layers_ = 3; + target_layer_bitrate_[0] = 50 * cfg_.rc_target_bitrate / 100; + target_layer_bitrate_[1] = 70 * cfg_.rc_target_bitrate / 100; + target_layer_bitrate_[2] = cfg_.rc_target_bitrate; + ASSERT_NO_FATAL_FAILURE(RunLoop(&video)); + for (int i = 0; i < number_temporal_layers_ * number_spatial_layers_; i++) { + ASSERT_GE(effective_datarate_tl[i], target_layer_bitrate_[i] * 0.60) + << " The datarate for the file is lower than target by too much!"; + ASSERT_LE(effective_datarate_tl[i], target_layer_bitrate_[i] * 1.35) + << " The datarate for the file is greater than target by too much!"; + } + // Test that no mismatches have been found. + std::cout << " Decoded frames: " << GetDecodedFrames() << "\n"; + std::cout << " Mismatch frames: " << GetMismatchFrames() << "\n"; + EXPECT_EQ(300 - GetDecodedFrames(), drop_frames_); + EXPECT_EQ((int)GetMismatchFrames(), num_nonref); + } + virtual void BasicRateTargetingSVC3TL1SLMultiRefCompoundTest() { cfg_.rc_buf_initial_sz = 500; cfg_.rc_buf_optimal_sz = 500; @@ -1403,6 +1454,16 @@ } // Check basic rate targeting for CBR, for 3 temporal layers, 1 spatial layer, +// with dropping set of enhancement layers (TL 1 and TL2) in middle of sequence. +// Test that the error_resilient flag can be set at frame level, with on/1 on +// enhancement layers and off/0 on base layer. +// This allows for successful decoding after dropping a set enhancement layer +// frames in the sequence. +TEST_P(DatarateTestSVC, BasicRateTargetingSVC3TL1SLDropSetEnhFrameER) { + BasicRateTargetingSVC3TL1SLDropSetEnhFrameERTest(); +} + +// Check basic rate targeting for CBR, for 3 temporal layers, 1 spatial layer, // with compound prediction on, for pattern with two additional refereces // (golden and altref), both updated on base TLO frames. TEST_P(DatarateTestSVC, BasicRateTargetingSVC3TL1SLMultiRefCompound) {