diff options
author | Minghai Shang <minghai@google.com> | 2014-03-27 16:59:44 -0700 |
---|---|---|
committer | Minghai Shang <minghai@google.com> | 2014-03-28 13:38:02 -0700 |
commit | 9ee6087f34db386ae40cdf4bc5e41120cb8075a6 (patch) | |
tree | 2624d9faa303946f65f3a2aeab33f420530522e4 /test | |
parent | 5cf036336830b564abf129d6f69a46d56cf8ae03 (diff) | |
download | libvpx-9ee6087f34db386ae40cdf4bc5e41120cb8075a6.tar libvpx-9ee6087f34db386ae40cdf4bc5e41120cb8075a6.tar.gz libvpx-9ee6087f34db386ae40cdf4bc5e41120cb8075a6.tar.bz2 libvpx-9ee6087f34db386ae40cdf4bc5e41120cb8075a6.zip |
[svc] Finalize first version of 2nd pass rc
Change-Id: I366850015004644c4fc7feabe27a782fdd8d8718
Diffstat (limited to 'test')
-rw-r--r-- | test/svc_test.cc | 45 |
1 files changed, 44 insertions, 1 deletions
diff --git a/test/svc_test.cc b/test/svc_test.cc index 30508dfec..fb9277bf7 100644 --- a/test/svc_test.cc +++ b/test/svc_test.cc @@ -419,9 +419,52 @@ TEST_F(SvcTest, SecondPassEncode) { fclose(stats_file); codec_enc_.rc_twopass_stats_in = stats_buf; - const vpx_codec_err_t res = + 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(); + // This frame is a keyframe. + res = vpx_svc_encode(&svc_, &codec_, video.img(), video.pts(), + video.duration(), VPX_DL_GOOD_QUALITY); + ASSERT_EQ(VPX_CODEC_OK, res); + EXPECT_EQ(1, vpx_svc_is_keyframe(&svc_)); + + vpx_codec_err_t res_dec = decoder_->DecodeFrame( + static_cast<const uint8_t *>(vpx_svc_get_buffer(&svc_)), + vpx_svc_get_frame_size(&svc_)); + ASSERT_EQ(VPX_CODEC_OK, res_dec) << decoder_->DecodeError(); + + // FRAME 1 + video.Next(); + // This is a P-frame. + res = vpx_svc_encode(&svc_, &codec_, video.img(), video.pts(), + video.duration(), VPX_DL_GOOD_QUALITY); + ASSERT_EQ(VPX_CODEC_OK, res); + EXPECT_EQ(0, vpx_svc_is_keyframe(&svc_)); + + res_dec = decoder_->DecodeFrame( + static_cast<const uint8_t *>(vpx_svc_get_buffer(&svc_)), + vpx_svc_get_frame_size(&svc_)); + ASSERT_EQ(VPX_CODEC_OK, res_dec) << decoder_->DecodeError(); + + // FRAME 2 + video.Next(); + // This is a P-frame. + res = vpx_svc_encode(&svc_, &codec_, video.img(), video.pts(), + video.duration(), VPX_DL_GOOD_QUALITY); + ASSERT_EQ(VPX_CODEC_OK, res); + EXPECT_EQ(0, vpx_svc_is_keyframe(&svc_)); + + res_dec = decoder_->DecodeFrame( + static_cast<const uint8_t *>(vpx_svc_get_buffer(&svc_)), + vpx_svc_get_frame_size(&svc_)); + ASSERT_EQ(VPX_CODEC_OK, res_dec) << decoder_->DecodeError(); free(stats_buf.buf); } |