summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorMinghai Shang <minghai@google.com>2014-03-19 11:06:20 -0700
committerMinghai Shang <minghai@google.com>2014-03-19 11:06:20 -0700
commitd205335060940b527639a69a2ea15eaaf263a821 (patch)
tree48f65bc1a8697907ee0e779d5fe3eb28fa4373d5 /test
parent39f95de83dd8cbdb42c84453f37bedab9ca8242d (diff)
downloadlibvpx-d205335060940b527639a69a2ea15eaaf263a821.tar
libvpx-d205335060940b527639a69a2ea15eaaf263a821.tar.gz
libvpx-d205335060940b527639a69a2ea15eaaf263a821.tar.bz2
libvpx-d205335060940b527639a69a2ea15eaaf263a821.zip
[svc] Finalize spatial svc first pass rate control
1. Save stats for each spatial layer 2. Add frame buffer management for svc first pass rc 3. Set default spatial layer to 1 4. Flush encoder at the end of stream in test app This only supports spatial svc. Change-Id: Ia89cfa87bb6394e6c0405b921d86c426d0a0c9ae
Diffstat (limited to 'test')
-rw-r--r--test/svc_test.cc35
1 files changed, 35 insertions, 0 deletions
diff --git a/test/svc_test.cc b/test/svc_test.cc
index 2e5653424..dff2ec767 100644
--- a/test/svc_test.cc
+++ b/test/svc_test.cc
@@ -362,4 +362,39 @@ TEST_F(SvcTest, GetLayerResolution) {
EXPECT_EQ(kHeight * 8 / 16, layer_height);
}
+TEST_F(SvcTest, FirstPassEncode) {
+ svc_.spatial_layers = 2;
+ codec_enc_.g_pass = VPX_RC_FIRST_PASS;
+ vpx_svc_set_scale_factors(&svc_, "4/16,16/16");
+ vpx_svc_set_quantizers(&svc_, "40,30", 0);
+
+ vpx_codec_err_t res =
+ vpx_svc_init(&svc_, &codec_, vpx_codec_vp9_cx(), &codec_enc_);
+ ASSERT_EQ(VPX_CODEC_OK, res);
+ codec_initialized_ = true;
+
+ libvpx_test::I420VideoSource video(test_file_name_, kWidth, kHeight,
+ codec_enc_.g_timebase.den,
+ codec_enc_.g_timebase.num, 0, 30);
+ // FRAME 0
+ video.Begin();
+ res = vpx_svc_encode(&svc_, &codec_, video.img(), video.pts(),
+ video.duration(), VPX_DL_GOOD_QUALITY);
+ ASSERT_EQ(VPX_CODEC_OK, res);
+ EXPECT_GT(vpx_svc_get_rc_stats_buffer_size(&svc_), 0U);
+
+ // FRAME 1
+ video.Next();
+ res = vpx_svc_encode(&svc_, &codec_, video.img(), video.pts(),
+ video.duration(), VPX_DL_GOOD_QUALITY);
+ ASSERT_EQ(VPX_CODEC_OK, res);
+ EXPECT_GT(vpx_svc_get_rc_stats_buffer_size(&svc_), 0U);
+
+ // Flush encoder and test EOS packet
+ res = vpx_svc_encode(&svc_, &codec_, NULL, video.pts(),
+ video.duration(), VPX_DL_GOOD_QUALITY);
+ ASSERT_EQ(VPX_CODEC_OK, res);
+ EXPECT_GT(vpx_svc_get_rc_stats_buffer_size(&svc_), 0U);
+}
+
} // namespace