From: Jerome Jiang Date: Mon, 9 Jul 2018 20:46:36 +0000 (-0700) Subject: vp9 svc: Add test for intra-only for 1 SL. X-Git-Tag: v1.8.0~541^2 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=6dc668eed6ab494e3ccde96a4e5831ac40e5a215;p=libvpx vp9 svc: Add test for intra-only for 1 SL. In this case, verify that a key frame is inserted. Change-Id: I70aa1974de956e657e413a34fd8bbcddf5d20c2c --- diff --git a/test/svc_end_to_end_test.cc b/test/svc_end_to_end_test.cc index 75f485af7..c90c8751c 100644 --- a/test/svc_end_to_end_test.cc +++ b/test/svc_end_to_end_test.cc @@ -110,6 +110,18 @@ class SyncFrameOnePassCbrSvc : public ::svc_test::OnePassCbrSvc, pkt->data.frame.spatial_layer_encoded[number_spatial_layers_ - 1] && current_video_frame_ >= frame_to_sync_) num_nonref_frames_++; + + if (intra_only_test_ && current_video_frame_ == frame_to_sync_) { + // Intra-only frame is only generated for spatial layers > 1 and <= 3, + // among other conditions (see constraint in set_intra_only_frame(). If + // intra-only is no allowed then encoder will insert key frame instead. + const bool key_frame = + (pkt->data.frame.flags & VPX_FRAME_IS_KEY) ? true : false; + if (number_spatial_layers_ == 1 || number_spatial_layers_ > 3) + ASSERT_TRUE(key_frame); + else + ASSERT_FALSE(key_frame); + } } virtual void MismatchHook(const vpx_image_t * /*img1*/, @@ -357,6 +369,31 @@ TEST_P(SyncFrameOnePassCbrSvc, OnePassCbrSvc3SL3TLSyncFrameIntraOnlyVGA) { #endif } +// Start decoding from sync frame, insert intra-only on base/qvga layer. Decode +// all layers. For 1 spatial layer, it inserts a key frame. +TEST_P(SyncFrameOnePassCbrSvc, OnePassCbrSvc1SL3TLSyncFrameIntraOnlyQVGA) { + SetSvcConfig(1, 3); + frame_to_start_decode_ = 20; + frame_to_sync_ = 20; + decode_to_layer_before_sync_ = 0; + decode_to_layer_after_sync_ = 0; + intra_only_test_ = true; + + // Set up svc layer sync structure. + svc_layer_sync_.base_layer_intra_only = 1; + svc_layer_sync_.spatial_layer_sync[0] = 1; + + ::libvpx_test::Y4mVideoSource video("niklas_1280_720_30.y4m", 0, 60); + cfg_.rc_target_bitrate = 600; + AssignLayerBitrates(); + ASSERT_NO_FATAL_FAILURE(RunLoop(&video)); +#if CONFIG_VP9_DECODER + // The non-reference frames are expected to be mismatched frames as the + // encoder will avoid loopfilter on these frames. + EXPECT_EQ(num_nonref_frames_, GetMismatchFrames()); +#endif +} + VP9_INSTANTIATE_TEST_CASE(SyncFrameOnePassCbrSvc, ::testing::Range(0, 3)); } // namespace