rtc: Add datarate test with multi-threading Change-Id: I467598cacf566357e30c55a3345c410ff1f3a7f0
diff --git a/test/datarate_test.cc b/test/datarate_test.cc index 6501b47..d0b513d 100644 --- a/test/datarate_test.cc +++ b/test/datarate_test.cc
@@ -84,6 +84,33 @@ << " The datarate for the file is greater than target by too much!"; } + virtual void BasicRateTargetingMTCBRTest() { + ::libaom_test::I420VideoSource video("niklas_640_480_30.yuv", 640, 480, 30, + 1, 0, 400); + 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 = AOM_CBR; + cfg_.g_lag_in_frames = 0; + cfg_.g_threads = 4; + + const int bitrate_array[2] = { 250, 650 }; + cfg_.rc_target_bitrate = bitrate_array[GET_PARAM(4)]; + ResetModel(); + tile_column_ = 2; + 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_; + } + virtual void ErrorResilienceOnSceneCuts() { if (GET_PARAM(4) > 0) return; cfg_.rc_buf_initial_sz = 500; @@ -287,6 +314,11 @@ BasicRateTargetingCBRTest(); } +// Check basic rate targeting for CBR, with 4 threads +TEST_P(DatarateTestLarge, BasicRateTargetingMTCBR) { + BasicRateTargetingMTCBRTest(); +} + // Check basic rate targeting for periodic key frame. TEST_P(DatarateTestLarge, PeriodicKeyFrameCBR) { BasicRateTargetingCBRPeriodicKeyFrameTest(); @@ -382,6 +414,11 @@ BasicRateTargetingCBRTest(); } +// Check basic rate targeting for CBR, with 4 threads +TEST_P(DatarateTestRealtime, BasicRateTargetingMTCBR) { + BasicRateTargetingMTCBRTest(); +} + // Check basic rate targeting for periodic key frame. TEST_P(DatarateTestRealtime, PeriodicKeyFrameCBR) { BasicRateTargetingCBRPeriodicKeyFrameTest();
diff --git a/test/datarate_test.h b/test/datarate_test.h index c596b22..05df64d 100644 --- a/test/datarate_test.h +++ b/test/datarate_test.h
@@ -47,6 +47,7 @@ bits_total_ = 0; denoiser_offon_test_ = 0; denoiser_offon_period_ = -1; + tile_column_ = 0; } virtual void PreEncodeFrameHook(::libaom_test::VideoSource *video, @@ -54,7 +55,8 @@ if (video->frame() == 0) { encoder->Control(AOME_SET_CPUUSED, set_cpu_used_); encoder->Control(AV1E_SET_AQ_MODE, aq_mode_); - encoder->Control(AV1E_SET_TILE_COLUMNS, 0); + encoder->Control(AV1E_SET_TILE_COLUMNS, tile_column_); + encoder->Control(AV1E_SET_ROW_MT, 1); if (cfg_.g_usage == AOM_USAGE_REALTIME) { encoder->Control(AV1E_SET_ENABLE_GLOBAL_MOTION, 0); encoder->Control(AV1E_SET_ENABLE_WARPED_MOTION, 0); @@ -155,6 +157,7 @@ int denoiser_offon_period_; unsigned int aq_mode_; bool speed_change_test_; + int tile_column_; }; } // namespace