diff options
author | hkuang <hkuang@google.com> | 2014-04-09 14:20:00 -0700 |
---|---|---|
committer | hkuang <hkuang@google.com> | 2014-04-09 14:20:00 -0700 |
commit | 6ac915abcdb404a00d927fe6308a47fcf09d9519 (patch) | |
tree | e1b38724c6741b657c04a788d42226d5f69d5c3d /libvpx/test/svc_test.cc | |
parent | cf2f478820e07635bb013420f0498ab685190718 (diff) | |
download | android_external_libvpx-6ac915abcdb404a00d927fe6308a47fcf09d9519.tar.gz android_external_libvpx-6ac915abcdb404a00d927fe6308a47fcf09d9519.tar.bz2 android_external_libvpx-6ac915abcdb404a00d927fe6308a47fcf09d9519.zip |
Roll latest libvpx to fix hang when doing adaptive playback.
VP9 decoder will hang when switching from frames with 2 tiles to
4 tiles on a 4 core device.
libvpx hash:4fffefe189a9123d4b04482c26a1be5eb632b397
Bug: 13931133
Change-Id: I24a51fd572ca7e872bc440491e2c645a20e9a736
Diffstat (limited to 'libvpx/test/svc_test.cc')
-rw-r--r-- | libvpx/test/svc_test.cc | 72 |
1 files changed, 72 insertions, 0 deletions
diff --git a/libvpx/test/svc_test.cc b/libvpx/test/svc_test.cc index dff2ec7..fb9277b 100644 --- a/libvpx/test/svc_test.cc +++ b/libvpx/test/svc_test.cc @@ -31,6 +31,7 @@ class SvcTest : public ::testing::Test { SvcTest() : codec_iface_(0), test_file_name_("hantro_collage_w352h288.yuv"), + stats_file_name_("hantro_collage_w352h288.stat"), codec_initialized_(false), decoder_(0) { memset(&svc_, 0, sizeof(svc_)); @@ -73,6 +74,7 @@ class SvcTest : public ::testing::Test { struct vpx_codec_enc_cfg codec_enc_; vpx_codec_iface_t *codec_iface_; std::string test_file_name_; + std::string stats_file_name_; bool codec_initialized_; Decoder *decoder_; }; @@ -397,4 +399,74 @@ TEST_F(SvcTest, FirstPassEncode) { EXPECT_GT(vpx_svc_get_rc_stats_buffer_size(&svc_), 0U); } +TEST_F(SvcTest, SecondPassEncode) { + svc_.spatial_layers = 2; + codec_enc_.g_pass = VPX_RC_LAST_PASS; + + FILE *const stats_file = libvpx_test::OpenTestDataFile(stats_file_name_); + ASSERT_TRUE(stats_file != NULL) << "Stats file open failed. Filename: " + << stats_file; + + struct vpx_fixed_buf stats_buf; + fseek(stats_file, 0, SEEK_END); + stats_buf.sz = static_cast<size_t>(ftell(stats_file)); + fseek(stats_file, 0, SEEK_SET); + + stats_buf.buf = malloc(stats_buf.sz); + ASSERT_TRUE(stats_buf.buf != NULL); + const size_t bytes_read = fread(stats_buf.buf, 1, stats_buf.sz, stats_file); + ASSERT_EQ(bytes_read, stats_buf.sz); + fclose(stats_file); + codec_enc_.rc_twopass_stats_in = stats_buf; + + 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); +} + } // namespace |