diff --git a/test/datarate_test.cc b/test/datarate_test.cc index 0b4ddaeceeb7c6a414c5d0f42b11dfc4aace4a39..db7dfdb5352b81debf7cd87ca4aef0d2d755e9d4 100644 --- a/test/datarate_test.cc +++ b/test/datarate_test.cc @@ -7,11 +7,13 @@ * in the file PATENTS. All contributing project authors may * be found in the AUTHORS file in the root of the source tree. */ +#include "./vpx_config.h" #include "third_party/googletest/src/include/gtest/gtest.h" #include "test/codec_factory.h" #include "test/encode_test_driver.h" #include "test/i420_video_source.h" #include "test/util.h" +#include "test/y4m_video_source.h" namespace { @@ -286,6 +288,37 @@ TEST_P(DatarateTestVP9, BasicRateTargeting) { } } +#if CONFIG_NON420 +// Check basic rate targeting, +TEST_P(DatarateTestVP9, BasicRateTargeting444) { + ::libvpx_test::Y4mVideoSource video("rush_hour_444.y4m", 0, 140); + + cfg_.g_profile = 1; + cfg_.g_timebase = video.timebase(); + + cfg_.rc_buf_initial_sz = 500; + cfg_.rc_buf_optimal_sz = 500; + cfg_.rc_buf_sz = 1000; + cfg_.rc_dropframe_thresh = 1; + cfg_.rc_min_quantizer = 0; + cfg_.rc_max_quantizer = 63; + cfg_.rc_end_usage = VPX_CBR; + + for (int i = 250; i < 900; i += 200) { + cfg_.rc_target_bitrate = i; + ResetModel(); + ASSERT_NO_FATAL_FAILURE(RunLoop(&video)); + ASSERT_GE(static_cast<double>(cfg_.rc_target_bitrate), + effective_datarate_ * 0.85) + << " The datarate for the file exceeds the target by too much!"; + ASSERT_LE(static_cast<double>(cfg_.rc_target_bitrate), + effective_datarate_ * 1.15) + << " The datarate for the file missed the target!" + << cfg_.rc_target_bitrate << " "<< effective_datarate_; + } +} +#endif + // Check that (1) the first dropped frame gets earlier and earlier // as the drop frame threshold is increased, and (2) that the total number of // frame drops does not decrease as we increase frame drop threshold. diff --git a/test/test-data.sha1 b/test/test-data.sha1 index 4927059487581a87a5efa4b2f82b3df298d5c583..6daf69e634691f4d959ed84fe59f6926aa08e65f 100644 --- a/test/test-data.sha1 +++ b/test/test-data.sha1 @@ -1,5 +1,6 @@ d5dfb0151c9051f8c85999255645d7a23916d3c0 hantro_collage_w352h288.yuv b87815bf86020c592ccc7a846ba2e28ec8043902 hantro_odd.yuv +b1f1c3ec79114b9a0651af24ce634afb44a9a419 rush_hour_444.y4m 5184c46ddca8b1fadd16742e8500115bc8f749da vp80-00-comprehensive-001.ivf 65bf1bbbced81b97bd030f376d1b7f61a224793f vp80-00-comprehensive-002.ivf 906b4c1e99eb734504c504b3f1ad8052137ce672 vp80-00-comprehensive-003.ivf diff --git a/test/test.mk b/test/test.mk index 6d4f9693395c2418466455128ed477db326600c3..178b1621014610d77e4fb6ea2e3fa395fede312d 100644 --- a/test/test.mk +++ b/test/test.mk @@ -24,8 +24,8 @@ LIBVPX_TEST_SRCS-yes += encode_test_driver.cc LIBVPX_TEST_SRCS-yes += encode_test_driver.h LIBVPX_TEST_SRCS-$(CONFIG_ENCODERS) += error_resilience_test.cc LIBVPX_TEST_SRCS-$(CONFIG_ENCODERS) += i420_video_source.h -LIBVPX_TEST_SRCS-$(CONFIG_VP9_ENCODER) += y4m_video_source.h -LIBVPX_TEST_SRCS-$(CONFIG_VP9_ENCODER) += ../y4minput.h ../y4minput.c +LIBVPX_TEST_SRCS-$(CONFIG_ENCODERS) += y4m_video_source.h +LIBVPX_TEST_SRCS-$(CONFIG_ENCODERS) += ../y4minput.h ../y4minput.c LIBVPX_TEST_SRCS-$(CONFIG_VP8_ENCODER) += keyframe_test.cc LIBVPX_TEST_SRCS-$(CONFIG_VP9_ENCODER) += borders_test.cc LIBVPX_TEST_SRCS-$(CONFIG_VP9_ENCODER) += resize_test.cc @@ -120,6 +120,7 @@ endif ## LIBVPX_TEST_DATA-$(CONFIG_ENCODERS) += hantro_collage_w352h288.yuv LIBVPX_TEST_DATA-$(CONFIG_ENCODERS) += hantro_odd.yuv +LIBVPX_TEST_DATA-$(CONFIG_VP9_ENCODER) += rush_hour_444.y4m LIBVPX_TEST_DATA-$(CONFIG_VP8_DECODER) += vp80-00-comprehensive-001.ivf LIBVPX_TEST_DATA-$(CONFIG_VP8_DECODER) += vp80-00-comprehensive-002.ivf diff --git a/test/vp9_lossless_test.cc b/test/vp9_lossless_test.cc index 03b89f8df7859d419af927492e9b842fbe528643..2282687dce8476c6d0ee712d28b6a10ed824a449 100644 --- a/test/vp9_lossless_test.cc +++ b/test/vp9_lossless_test.cc @@ -7,12 +7,13 @@ * in the file PATENTS. All contributing project authors may * be found in the AUTHORS file in the root of the source tree. */ - +#include "./vpx_config.h" #include "third_party/googletest/src/include/gtest/gtest.h" #include "test/codec_factory.h" #include "test/encode_test_driver.h" #include "test/i420_video_source.h" #include "test/util.h" +#include "test/y4m_video_source.h" namespace { @@ -71,5 +72,25 @@ TEST_P(LossLessTest, TestLossLessEncoding) { const double psnr_lossless = GetMinPsnr(); EXPECT_GE(psnr_lossless, kMaxPsnr); } + +#if CONFIG_NON420 +TEST_P(LossLessTest, TestLossLessEncoding444) { + libvpx_test::Y4mVideoSource video("rush_hour_444.y4m", 0, 10); + + cfg_.g_profile = 1; + cfg_.g_timebase = video.timebase(); + cfg_.rc_target_bitrate = 2000; + cfg_.g_lag_in_frames = 25; + cfg_.rc_min_quantizer = 0; + cfg_.rc_max_quantizer = 0; + + init_flags_ = VPX_CODEC_USE_PSNR; + + ASSERT_NO_FATAL_FAILURE(RunLoop(&video)); + const double psnr_lossless = GetMinPsnr(); + EXPECT_GE(psnr_lossless, kMaxPsnr); +} +#endif + VP9_INSTANTIATE_TEST_CASE(LossLessTest, ALL_TEST_MODES); } // namespace