VP9: add unit test for realtime external resize.
Change-Id: I9bfa80de73847d9be88b6ce9865d7bb5fafaaa57
This commit is contained in:
parent
7155f7ab78
commit
55c8843791
@ -286,11 +286,11 @@ TEST_P(ResizeInternalTest, TestInternalResizeChangeConfig) {
|
|||||||
ASSERT_NO_FATAL_FAILURE(RunLoop(&video));
|
ASSERT_NO_FATAL_FAILURE(RunLoop(&video));
|
||||||
}
|
}
|
||||||
|
|
||||||
class ResizeInternalRealtimeTest : public ::libvpx_test::EncoderTest,
|
class ResizeRealtimeTest : public ::libvpx_test::EncoderTest,
|
||||||
public ::libvpx_test::CodecTestWith2Params<libvpx_test::TestMode, int> {
|
public ::libvpx_test::CodecTestWith2Params<libvpx_test::TestMode, int> {
|
||||||
protected:
|
protected:
|
||||||
ResizeInternalRealtimeTest() : EncoderTest(GET_PARAM(0)) {}
|
ResizeRealtimeTest() : EncoderTest(GET_PARAM(0)) {}
|
||||||
virtual ~ResizeInternalRealtimeTest() {}
|
virtual ~ResizeRealtimeTest() {}
|
||||||
|
|
||||||
virtual void PreEncodeFrameHook(libvpx_test::VideoSource *video,
|
virtual void PreEncodeFrameHook(libvpx_test::VideoSource *video,
|
||||||
libvpx_test::Encoder *encoder) {
|
libvpx_test::Encoder *encoder) {
|
||||||
@ -318,8 +318,6 @@ class ResizeInternalRealtimeTest : public ::libvpx_test::EncoderTest,
|
|||||||
}
|
}
|
||||||
|
|
||||||
void DefaultConfig() {
|
void DefaultConfig() {
|
||||||
cfg_.g_w = 352;
|
|
||||||
cfg_.g_h = 288;
|
|
||||||
cfg_.rc_buf_initial_sz = 500;
|
cfg_.rc_buf_initial_sz = 500;
|
||||||
cfg_.rc_buf_optimal_sz = 600;
|
cfg_.rc_buf_optimal_sz = 600;
|
||||||
cfg_.rc_buf_sz = 1000;
|
cfg_.rc_buf_sz = 1000;
|
||||||
@ -346,13 +344,34 @@ class ResizeInternalRealtimeTest : public ::libvpx_test::EncoderTest,
|
|||||||
bool change_bitrate_;
|
bool change_bitrate_;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
TEST_P(ResizeRealtimeTest, TestExternalResizeWorks) {
|
||||||
|
ResizingVideoSource video;
|
||||||
|
DefaultConfig();
|
||||||
|
change_bitrate_ = false;
|
||||||
|
ASSERT_NO_FATAL_FAILURE(RunLoop(&video));
|
||||||
|
|
||||||
|
for (std::vector<FrameInfo>::const_iterator info = frame_info_list_.begin();
|
||||||
|
info != frame_info_list_.end(); ++info) {
|
||||||
|
const unsigned int frame = static_cast<unsigned>(info->pts);
|
||||||
|
const unsigned int expected_w = ScaleForFrameNumber(frame, kInitialWidth);
|
||||||
|
const unsigned int expected_h = ScaleForFrameNumber(frame, kInitialHeight);
|
||||||
|
|
||||||
|
EXPECT_EQ(expected_w, info->w)
|
||||||
|
<< "Frame " << frame << " had unexpected width";
|
||||||
|
EXPECT_EQ(expected_h, info->h)
|
||||||
|
<< "Frame " << frame << " had unexpected height";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Verify the dynamic resizer behavior for real time, 1 pass CBR mode.
|
// Verify the dynamic resizer behavior for real time, 1 pass CBR mode.
|
||||||
// Run at low bitrate, with resize_allowed = 1, and verify that we get
|
// Run at low bitrate, with resize_allowed = 1, and verify that we get
|
||||||
// one resize down event.
|
// one resize down event.
|
||||||
TEST_P(ResizeInternalRealtimeTest, TestInternalResizeDown) {
|
TEST_P(ResizeRealtimeTest, TestInternalResizeDown) {
|
||||||
::libvpx_test::I420VideoSource video("hantro_collage_w352h288.yuv", 352, 288,
|
::libvpx_test::I420VideoSource video("hantro_collage_w352h288.yuv", 352, 288,
|
||||||
30, 1, 0, 299);
|
30, 1, 0, 299);
|
||||||
DefaultConfig();
|
DefaultConfig();
|
||||||
|
cfg_.g_w = 352;
|
||||||
|
cfg_.g_h = 288;
|
||||||
change_bitrate_ = false;
|
change_bitrate_ = false;
|
||||||
ASSERT_NO_FATAL_FAILURE(RunLoop(&video));
|
ASSERT_NO_FATAL_FAILURE(RunLoop(&video));
|
||||||
|
|
||||||
@ -378,10 +397,12 @@ TEST_P(ResizeInternalRealtimeTest, TestInternalResizeDown) {
|
|||||||
// Verify the dynamic resizer behavior for real time, 1 pass CBR mode.
|
// Verify the dynamic resizer behavior for real time, 1 pass CBR mode.
|
||||||
// Start at low target bitrate, raise the bitrate in the middle of the clip,
|
// Start at low target bitrate, raise the bitrate in the middle of the clip,
|
||||||
// scaling-up should occur after bitrate changed.
|
// scaling-up should occur after bitrate changed.
|
||||||
TEST_P(ResizeInternalRealtimeTest, TestInternalResizeDownUpChangeBitRate) {
|
TEST_P(ResizeRealtimeTest, TestInternalResizeDownUpChangeBitRate) {
|
||||||
::libvpx_test::I420VideoSource video("hantro_collage_w352h288.yuv", 352, 288,
|
::libvpx_test::I420VideoSource video("hantro_collage_w352h288.yuv", 352, 288,
|
||||||
30, 1, 0, 359);
|
30, 1, 0, 359);
|
||||||
DefaultConfig();
|
DefaultConfig();
|
||||||
|
cfg_.g_w = 352;
|
||||||
|
cfg_.g_h = 288;
|
||||||
change_bitrate_ = true;
|
change_bitrate_ = true;
|
||||||
// Disable dropped frames.
|
// Disable dropped frames.
|
||||||
cfg_.rc_dropframe_thresh = 0;
|
cfg_.rc_dropframe_thresh = 0;
|
||||||
@ -524,7 +545,7 @@ VP9_INSTANTIATE_TEST_CASE(ResizeTest,
|
|||||||
::testing::Values(::libvpx_test::kRealTime));
|
::testing::Values(::libvpx_test::kRealTime));
|
||||||
VP9_INSTANTIATE_TEST_CASE(ResizeInternalTest,
|
VP9_INSTANTIATE_TEST_CASE(ResizeInternalTest,
|
||||||
::testing::Values(::libvpx_test::kOnePassBest));
|
::testing::Values(::libvpx_test::kOnePassBest));
|
||||||
VP9_INSTANTIATE_TEST_CASE(ResizeInternalRealtimeTest,
|
VP9_INSTANTIATE_TEST_CASE(ResizeRealtimeTest,
|
||||||
::testing::Values(::libvpx_test::kRealTime),
|
::testing::Values(::libvpx_test::kRealTime),
|
||||||
::testing::Range(5, 9));
|
::testing::Range(5, 9));
|
||||||
VP9_INSTANTIATE_TEST_CASE(ResizeCspTest,
|
VP9_INSTANTIATE_TEST_CASE(ResizeCspTest,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user