Jim Bankoski | 533470c | 2012-10-29 19:54:06 -0700 | [diff] [blame] | 1 | /* |
Yaowu Xu | 2ab7ff0 | 2016-09-02 12:04:54 -0700 | [diff] [blame] | 2 | * Copyright (c) 2016, Alliance for Open Media. All rights reserved |
Jim Bankoski | 533470c | 2012-10-29 19:54:06 -0700 | [diff] [blame] | 3 | * |
Yaowu Xu | 2ab7ff0 | 2016-09-02 12:04:54 -0700 | [diff] [blame] | 4 | * This source code is subject to the terms of the BSD 2 Clause License and |
| 5 | * the Alliance for Open Media Patent License 1.0. If the BSD 2 Clause License |
| 6 | * was not distributed with this source code in the LICENSE file, you can |
| 7 | * obtain it at www.aomedia.org/license/software. If the Alliance for Open |
| 8 | * Media Patent License 1.0 was not distributed with this source code in the |
| 9 | * PATENTS file, you can obtain it at www.aomedia.org/license/patent. |
Johann | 123e8a6 | 2017-12-28 14:40:49 -0800 | [diff] [blame] | 10 | */ |
Yaowu Xu | 2ab7ff0 | 2016-09-02 12:04:54 -0700 | [diff] [blame] | 11 | |
Tom Finegan | 60e653d | 2018-05-22 11:34:58 -0700 | [diff] [blame] | 12 | #include "config/aom_config.h" |
| 13 | |
Tom Finegan | 7a07ece | 2017-02-07 17:14:05 -0800 | [diff] [blame] | 14 | #include "third_party/googletest/src/googletest/include/gtest/gtest.h" |
John Koleszar | 706cafe | 2013-01-18 11:51:12 -0800 | [diff] [blame] | 15 | #include "test/codec_factory.h" |
Jerome Jiang | d960308 | 2019-08-14 17:24:17 -0700 | [diff] [blame] | 16 | #include "test/datarate_test.h" |
Jim Bankoski | 533470c | 2012-10-29 19:54:06 -0700 | [diff] [blame] | 17 | #include "test/encode_test_driver.h" |
| 18 | #include "test/i420_video_source.h" |
John Koleszar | 706cafe | 2013-01-18 11:51:12 -0800 | [diff] [blame] | 19 | #include "test/util.h" |
Alex Converse | f5949fa | 2014-01-17 13:52:23 -0800 | [diff] [blame] | 20 | #include "test/y4m_video_source.h" |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 21 | #include "aom/aom_codec.h" |
John Koleszar | 706cafe | 2013-01-18 11:51:12 -0800 | [diff] [blame] | 22 | |
Jerome Jiang | d960308 | 2019-08-14 17:24:17 -0700 | [diff] [blame] | 23 | namespace datarate_test { |
Jim Bankoski | 533470c | 2012-10-29 19:54:06 -0700 | [diff] [blame] | 24 | namespace { |
| 25 | |
Jerome Jiang | 6848689 | 2019-05-03 14:54:30 -0700 | [diff] [blame] | 26 | // Params: test mode, speed, aq mode and index for bitrate array. |
clang-format | 3a826f1 | 2016-08-11 17:46:05 -0700 | [diff] [blame] | 27 | class DatarateTestLarge |
Jerome Jiang | 6848689 | 2019-05-03 14:54:30 -0700 | [diff] [blame] | 28 | : public ::libaom_test::CodecTestWith4Params<libaom_test::TestMode, int, |
| 29 | unsigned int, int>, |
Jerome Jiang | d960308 | 2019-08-14 17:24:17 -0700 | [diff] [blame] | 30 | public DatarateTest { |
John Koleszar | 706cafe | 2013-01-18 11:51:12 -0800 | [diff] [blame] | 31 | public: |
Jerome Jiang | d960308 | 2019-08-14 17:24:17 -0700 | [diff] [blame] | 32 | DatarateTestLarge() : DatarateTest(GET_PARAM(0)) { |
| 33 | set_cpu_used_ = GET_PARAM(2); |
| 34 | aq_mode_ = GET_PARAM(3); |
| 35 | } |
Jim Bankoski | 6505b07 | 2014-03-12 17:20:16 -0700 | [diff] [blame] | 36 | |
James Zern | cc73e1f | 2016-08-08 15:09:30 -0700 | [diff] [blame] | 37 | protected: |
Jim Bankoski | 6505b07 | 2014-03-12 17:20:16 -0700 | [diff] [blame] | 38 | virtual ~DatarateTestLarge() {} |
John Koleszar | 706cafe | 2013-01-18 11:51:12 -0800 | [diff] [blame] | 39 | |
Marco Paniconi | b26ce8b | 2013-10-22 11:30:06 -0700 | [diff] [blame] | 40 | virtual void SetUp() { |
| 41 | InitializeConfig(); |
| 42 | SetMode(GET_PARAM(1)); |
Marco Paniconi | b26ce8b | 2013-10-22 11:30:06 -0700 | [diff] [blame] | 43 | ResetModel(); |
| 44 | } |
| 45 | |
Jerome Jiang | 6848689 | 2019-05-03 14:54:30 -0700 | [diff] [blame] | 46 | virtual void BasicRateTargetingVBRTest() { |
| 47 | cfg_.rc_min_quantizer = 0; |
| 48 | cfg_.rc_max_quantizer = 63; |
| 49 | cfg_.g_error_resilient = 0; |
| 50 | cfg_.rc_end_usage = AOM_VBR; |
| 51 | cfg_.g_lag_in_frames = 0; |
| 52 | |
| 53 | ::libaom_test::I420VideoSource video("hantro_collage_w352h288.yuv", 352, |
| 54 | 288, 30, 1, 0, 140); |
| 55 | const int bitrate_array[2] = { 400, 800 }; |
| 56 | cfg_.rc_target_bitrate = bitrate_array[GET_PARAM(4)]; |
| 57 | ResetModel(); |
| 58 | ASSERT_NO_FATAL_FAILURE(RunLoop(&video)); |
Debargha Mukherjee | ce847da | 2019-06-12 11:49:56 -0700 | [diff] [blame] | 59 | ASSERT_GE(effective_datarate_, cfg_.rc_target_bitrate * 0.7) |
Jerome Jiang | 6848689 | 2019-05-03 14:54:30 -0700 | [diff] [blame] | 60 | << " The datarate for the file is lower than target by too much!"; |
Debargha Mukherjee | ce847da | 2019-06-12 11:49:56 -0700 | [diff] [blame] | 61 | ASSERT_LE(effective_datarate_, cfg_.rc_target_bitrate * 1.3) |
Jerome Jiang | 6848689 | 2019-05-03 14:54:30 -0700 | [diff] [blame] | 62 | << " The datarate for the file is greater than target by too much!"; |
| 63 | } |
| 64 | |
| 65 | virtual void BasicRateTargetingCBRTest() { |
| 66 | cfg_.rc_buf_initial_sz = 500; |
| 67 | cfg_.rc_buf_optimal_sz = 500; |
| 68 | cfg_.rc_buf_sz = 1000; |
| 69 | cfg_.rc_dropframe_thresh = 1; |
| 70 | cfg_.rc_min_quantizer = 0; |
| 71 | cfg_.rc_max_quantizer = 63; |
| 72 | cfg_.rc_end_usage = AOM_CBR; |
| 73 | cfg_.g_lag_in_frames = 0; |
| 74 | |
| 75 | ::libaom_test::I420VideoSource video("hantro_collage_w352h288.yuv", 352, |
| 76 | 288, 30, 1, 0, 140); |
| 77 | const int bitrate_array[2] = { 150, 550 }; |
| 78 | cfg_.rc_target_bitrate = bitrate_array[GET_PARAM(4)]; |
| 79 | ResetModel(); |
| 80 | ASSERT_NO_FATAL_FAILURE(RunLoop(&video)); |
| 81 | ASSERT_GE(effective_datarate_, cfg_.rc_target_bitrate * 0.85) |
| 82 | << " The datarate for the file is lower than target by too much!"; |
| 83 | ASSERT_LE(effective_datarate_, cfg_.rc_target_bitrate * 1.15) |
| 84 | << " The datarate for the file is greater than target by too much!"; |
| 85 | } |
| 86 | |
Jerome Jiang | f7e6b90 | 2019-11-25 15:28:23 -0800 | [diff] [blame] | 87 | virtual void BasicRateTargetingCBRPeriodicKeyFrameTest() { |
| 88 | cfg_.rc_buf_initial_sz = 500; |
| 89 | cfg_.rc_buf_optimal_sz = 500; |
| 90 | cfg_.rc_buf_sz = 1000; |
| 91 | cfg_.rc_dropframe_thresh = 1; |
| 92 | cfg_.rc_min_quantizer = 0; |
| 93 | cfg_.rc_max_quantizer = 63; |
| 94 | cfg_.rc_end_usage = AOM_CBR; |
| 95 | cfg_.g_lag_in_frames = 0; |
| 96 | // Periodic keyframe |
| 97 | cfg_.kf_max_dist = 50; |
| 98 | |
| 99 | ::libaom_test::I420VideoSource video("pixel_capture_w320h240.yuv", 320, 240, |
| 100 | 30, 1, 0, 310); |
| 101 | const int bitrate_array[2] = { 150, 550 }; |
| 102 | cfg_.rc_target_bitrate = bitrate_array[GET_PARAM(4)]; |
| 103 | ResetModel(); |
| 104 | ASSERT_NO_FATAL_FAILURE(RunLoop(&video)); |
| 105 | ASSERT_GE(effective_datarate_, cfg_.rc_target_bitrate * 0.85) |
| 106 | << " The datarate for the file is lower than target by too much!"; |
| 107 | ASSERT_LE(effective_datarate_, cfg_.rc_target_bitrate * 1.15) |
| 108 | << " The datarate for the file is greater than target by too much!"; |
| 109 | } |
| 110 | |
Jerome Jiang | 95fcd32 | 2019-10-16 14:45:40 -0700 | [diff] [blame] | 111 | virtual void BasicRateTargetingAQModeOnOffCBRTest() { |
| 112 | if (GET_PARAM(4) > 0) return; |
| 113 | cfg_.rc_buf_initial_sz = 500; |
| 114 | cfg_.rc_buf_optimal_sz = 500; |
| 115 | cfg_.rc_buf_sz = 1000; |
| 116 | cfg_.rc_dropframe_thresh = 0; |
| 117 | cfg_.rc_min_quantizer = 2; |
| 118 | cfg_.rc_max_quantizer = 63; |
| 119 | cfg_.rc_end_usage = AOM_CBR; |
| 120 | cfg_.g_lag_in_frames = 0; |
| 121 | cfg_.g_error_resilient = 0; |
| 122 | cfg_.g_pass = AOM_RC_ONE_PASS; |
| 123 | cfg_.g_usage = AOM_USAGE_REALTIME; |
| 124 | cfg_.kf_mode = AOM_KF_DISABLED; |
| 125 | |
| 126 | ::libaom_test::I420VideoSource video("pixel_capture_w320h240.yuv", 320, 240, |
| 127 | 30, 1, 0, 310); |
| 128 | const int bitrate_array[1] = { 60 }; |
| 129 | cfg_.rc_target_bitrate = bitrate_array[GET_PARAM(4)]; |
| 130 | ResetModel(); |
| 131 | ASSERT_NO_FATAL_FAILURE(RunLoop(&video)); |
| 132 | ASSERT_GE(effective_datarate_, cfg_.rc_target_bitrate * 0.85) |
| 133 | << " The datarate for the file is lower than target by too much!"; |
| 134 | ASSERT_LE(effective_datarate_, cfg_.rc_target_bitrate * 1.15) |
| 135 | << " The datarate for the file is greater than target by too much!"; |
| 136 | } |
| 137 | |
Jerome Jiang | 6848689 | 2019-05-03 14:54:30 -0700 | [diff] [blame] | 138 | virtual void BasicRateTargeting444CBRTest() { |
| 139 | ::libaom_test::Y4mVideoSource video("rush_hour_444.y4m", 0, 140); |
| 140 | |
| 141 | cfg_.g_profile = 1; |
| 142 | cfg_.g_timebase = video.timebase(); |
| 143 | |
| 144 | cfg_.rc_buf_initial_sz = 500; |
| 145 | cfg_.rc_buf_optimal_sz = 500; |
| 146 | cfg_.rc_buf_sz = 1000; |
| 147 | cfg_.rc_dropframe_thresh = 1; |
| 148 | cfg_.rc_min_quantizer = 0; |
| 149 | cfg_.rc_max_quantizer = 63; |
| 150 | cfg_.rc_end_usage = AOM_CBR; |
| 151 | |
| 152 | const int bitrate_array[2] = { 250, 650 }; |
| 153 | cfg_.rc_target_bitrate = bitrate_array[GET_PARAM(4)]; |
| 154 | ResetModel(); |
| 155 | ASSERT_NO_FATAL_FAILURE(RunLoop(&video)); |
| 156 | ASSERT_GE(static_cast<double>(cfg_.rc_target_bitrate), |
| 157 | effective_datarate_ * 0.85) |
| 158 | << " The datarate for the file exceeds the target by too much!"; |
| 159 | ASSERT_LE(static_cast<double>(cfg_.rc_target_bitrate), |
| 160 | effective_datarate_ * 1.15) |
| 161 | << " The datarate for the file missed the target!" |
| 162 | << cfg_.rc_target_bitrate << " " << effective_datarate_; |
| 163 | } |
Jerome Jiang | 3c1f461 | 2019-11-21 14:06:38 -0800 | [diff] [blame] | 164 | }; |
| 165 | |
| 166 | // Params: test mode, speed, aq mode. |
| 167 | class DatarateTestFrameDropLarge |
| 168 | : public ::libaom_test::CodecTestWith3Params<libaom_test::TestMode, int, |
| 169 | unsigned int>, |
| 170 | public DatarateTest { |
| 171 | public: |
| 172 | DatarateTestFrameDropLarge() : DatarateTest(GET_PARAM(0)) { |
| 173 | set_cpu_used_ = GET_PARAM(2); |
| 174 | aq_mode_ = GET_PARAM(3); |
| 175 | } |
| 176 | |
| 177 | protected: |
| 178 | virtual ~DatarateTestFrameDropLarge() {} |
| 179 | |
| 180 | virtual void SetUp() { |
| 181 | InitializeConfig(); |
| 182 | SetMode(GET_PARAM(1)); |
| 183 | ResetModel(); |
| 184 | } |
Jerome Jiang | 6848689 | 2019-05-03 14:54:30 -0700 | [diff] [blame] | 185 | |
| 186 | virtual void ChangingDropFrameThreshTest() { |
| 187 | cfg_.rc_buf_initial_sz = 500; |
| 188 | cfg_.rc_buf_optimal_sz = 500; |
| 189 | cfg_.rc_buf_sz = 1000; |
| 190 | cfg_.rc_undershoot_pct = 20; |
| 191 | cfg_.rc_undershoot_pct = 20; |
| 192 | cfg_.rc_dropframe_thresh = 10; |
| 193 | cfg_.rc_min_quantizer = 0; |
| 194 | cfg_.rc_max_quantizer = 50; |
| 195 | cfg_.rc_end_usage = AOM_CBR; |
| 196 | cfg_.rc_target_bitrate = 200; |
| 197 | cfg_.g_lag_in_frames = 0; |
| 198 | cfg_.g_error_resilient = 1; |
| 199 | // TODO(marpan): Investigate datarate target failures with a smaller |
| 200 | // keyframe interval (128). |
| 201 | cfg_.kf_max_dist = 9999; |
| 202 | |
| 203 | ::libaom_test::I420VideoSource video("hantro_collage_w352h288.yuv", 352, |
| 204 | 288, 30, 1, 0, 100); |
| 205 | |
| 206 | const int kDropFrameThreshTestStep = 30; |
| 207 | aom_codec_pts_t last_drop = 140; |
| 208 | int last_num_drops = 0; |
| 209 | for (int i = 40; i < 100; i += kDropFrameThreshTestStep) { |
| 210 | cfg_.rc_dropframe_thresh = i; |
| 211 | ResetModel(); |
| 212 | ASSERT_NO_FATAL_FAILURE(RunLoop(&video)); |
| 213 | ASSERT_GE(effective_datarate_, cfg_.rc_target_bitrate * 0.85) |
| 214 | << " The datarate for the file is lower than target by too much!"; |
Fyodor Kyslov | f112a35 | 2019-11-18 10:41:17 -0800 | [diff] [blame] | 215 | ASSERT_LE(effective_datarate_, cfg_.rc_target_bitrate * 1.17) |
Jerome Jiang | 6848689 | 2019-05-03 14:54:30 -0700 | [diff] [blame] | 216 | << " The datarate for the file is greater than target by too much!"; |
Jerome Jiang | a1be240 | 2019-05-15 11:06:26 -0700 | [diff] [blame] | 217 | if (last_drop > 0) { |
Jerome Jiang | fb1ad5d | 2019-05-13 16:32:44 -0700 | [diff] [blame] | 218 | ASSERT_LE(first_drop_, last_drop) |
| 219 | << " The first dropped frame for drop_thresh " << i |
| 220 | << " > first dropped frame for drop_thresh " |
| 221 | << i - kDropFrameThreshTestStep; |
Jerome Jiang | a1be240 | 2019-05-15 11:06:26 -0700 | [diff] [blame] | 222 | } |
Jerome Jiang | 446d5d9 | 2019-10-28 14:45:23 -0700 | [diff] [blame] | 223 | ASSERT_GE(num_drops_, last_num_drops * 0.7) |
Jerome Jiang | 6848689 | 2019-05-03 14:54:30 -0700 | [diff] [blame] | 224 | << " The number of dropped frames for drop_thresh " << i |
| 225 | << " < number of dropped frames for drop_thresh " |
| 226 | << i - kDropFrameThreshTestStep; |
| 227 | last_drop = first_drop_; |
| 228 | last_num_drops = num_drops_; |
| 229 | } |
| 230 | } |
Jerome Jiang | d960308 | 2019-08-14 17:24:17 -0700 | [diff] [blame] | 231 | }; |
Marco Paniconi | e078c3d | 2013-10-02 17:13:59 -0700 | [diff] [blame] | 232 | |
Marco | 75d5517 | 2016-05-25 14:19:01 -0700 | [diff] [blame] | 233 | // Check basic rate targeting for VBR mode. |
James Zern | cc73e1f | 2016-08-08 15:09:30 -0700 | [diff] [blame] | 234 | TEST_P(DatarateTestLarge, BasicRateTargetingVBR) { |
Jerome Jiang | 6848689 | 2019-05-03 14:54:30 -0700 | [diff] [blame] | 235 | BasicRateTargetingVBRTest(); |
Marco | 75d5517 | 2016-05-25 14:19:01 -0700 | [diff] [blame] | 236 | } |
| 237 | |
Jerome Jiang | f7e6b90 | 2019-11-25 15:28:23 -0800 | [diff] [blame] | 238 | // Check basic rate targeting for CBR. |
Jerome Jiang | 6848689 | 2019-05-03 14:54:30 -0700 | [diff] [blame] | 239 | TEST_P(DatarateTestLarge, BasicRateTargetingCBR) { |
| 240 | BasicRateTargetingCBRTest(); |
Marco Paniconi | e078c3d | 2013-10-02 17:13:59 -0700 | [diff] [blame] | 241 | } |
| 242 | |
Jerome Jiang | f7e6b90 | 2019-11-25 15:28:23 -0800 | [diff] [blame] | 243 | // Check basic rate targeting for periodic key frame. |
| 244 | TEST_P(DatarateTestLarge, PeriodicKeyFrameCBR) { |
| 245 | BasicRateTargetingCBRPeriodicKeyFrameTest(); |
| 246 | } |
| 247 | |
Marco | 75d5517 | 2016-05-25 14:19:01 -0700 | [diff] [blame] | 248 | // Check basic rate targeting for CBR. |
Jerome Jiang | 6848689 | 2019-05-03 14:54:30 -0700 | [diff] [blame] | 249 | TEST_P(DatarateTestLarge, BasicRateTargeting444CBR) { |
| 250 | BasicRateTargeting444CBRTest(); |
Alex Converse | f5949fa | 2014-01-17 13:52:23 -0800 | [diff] [blame] | 251 | } |
Alex Converse | f5949fa | 2014-01-17 13:52:23 -0800 | [diff] [blame] | 252 | |
Marco Paniconi | 1b8b8b0 | 2013-12-17 15:45:30 -0800 | [diff] [blame] | 253 | // Check that (1) the first dropped frame gets earlier and earlier |
| 254 | // as the drop frame threshold is increased, and (2) that the total number of |
| 255 | // frame drops does not decrease as we increase frame drop threshold. |
| 256 | // Use a lower qp-max to force some frame drops. |
Jerome Jiang | 3c1f461 | 2019-11-21 14:06:38 -0800 | [diff] [blame] | 257 | TEST_P(DatarateTestFrameDropLarge, ChangingDropFrameThresh) { |
Jerome Jiang | 6848689 | 2019-05-03 14:54:30 -0700 | [diff] [blame] | 258 | ChangingDropFrameThreshTest(); |
Marco Paniconi | 1b8b8b0 | 2013-12-17 15:45:30 -0800 | [diff] [blame] | 259 | } |
| 260 | |
Jerome Jiang | 95fcd32 | 2019-10-16 14:45:40 -0700 | [diff] [blame] | 261 | TEST_P(DatarateTestLarge, BasicRateTargetingAQModeOnOffCBR) { |
| 262 | BasicRateTargetingAQModeOnOffCBRTest(); |
| 263 | } |
| 264 | |
Jerome Jiang | 6848689 | 2019-05-03 14:54:30 -0700 | [diff] [blame] | 265 | class DatarateTestRealtime : public DatarateTestLarge {}; |
| 266 | |
Jerome Jiang | 3c1f461 | 2019-11-21 14:06:38 -0800 | [diff] [blame] | 267 | class DatarateTestFrameDropRealtime : public DatarateTestFrameDropLarge {}; |
| 268 | |
Jerome Jiang | 8806886 | 2019-11-21 15:25:59 -0800 | [diff] [blame] | 269 | // Params: aq mode. |
| 270 | class DatarateTestSpeedChangeRealtime |
| 271 | : public ::libaom_test::CodecTestWith2Params<libaom_test::TestMode, |
| 272 | unsigned int>, |
| 273 | public DatarateTest { |
| 274 | public: |
| 275 | DatarateTestSpeedChangeRealtime() : DatarateTest(GET_PARAM(0)) { |
| 276 | aq_mode_ = GET_PARAM(1); |
| 277 | speed_change_test_ = true; |
| 278 | } |
| 279 | |
| 280 | protected: |
| 281 | virtual ~DatarateTestSpeedChangeRealtime() {} |
| 282 | |
| 283 | virtual void SetUp() { |
| 284 | InitializeConfig(); |
| 285 | SetMode(GET_PARAM(1)); |
| 286 | ResetModel(); |
| 287 | } |
| 288 | |
| 289 | virtual void ChangingSpeedTest() { |
| 290 | cfg_.rc_buf_initial_sz = 500; |
| 291 | cfg_.rc_buf_optimal_sz = 500; |
| 292 | cfg_.rc_buf_sz = 1000; |
| 293 | cfg_.rc_undershoot_pct = 20; |
| 294 | cfg_.rc_undershoot_pct = 20; |
| 295 | cfg_.rc_dropframe_thresh = 10; |
| 296 | cfg_.rc_min_quantizer = 0; |
| 297 | cfg_.rc_max_quantizer = 50; |
| 298 | cfg_.rc_end_usage = AOM_CBR; |
| 299 | cfg_.rc_target_bitrate = 200; |
| 300 | cfg_.g_lag_in_frames = 0; |
| 301 | cfg_.g_error_resilient = 1; |
| 302 | // TODO(marpan): Investigate datarate target failures with a smaller |
| 303 | // keyframe interval (128). |
| 304 | cfg_.kf_max_dist = 9999; |
| 305 | cfg_.rc_dropframe_thresh = 0; |
| 306 | ::libaom_test::I420VideoSource video("hantro_collage_w352h288.yuv", 352, |
| 307 | 288, 30, 1, 0, 100); |
| 308 | |
| 309 | ResetModel(); |
| 310 | ASSERT_NO_FATAL_FAILURE(RunLoop(&video)); |
Paul Wilkins | d6673a5 | 2019-11-22 11:55:16 +0000 | [diff] [blame] | 311 | ASSERT_GE(effective_datarate_, cfg_.rc_target_bitrate * 0.83) |
Jerome Jiang | 8806886 | 2019-11-21 15:25:59 -0800 | [diff] [blame] | 312 | << " The datarate for the file is lower than target by too much!"; |
Jerome Jiang | 8d1a1e4 | 2019-12-06 10:24:03 -0800 | [diff] [blame] | 313 | ASSERT_LE(effective_datarate_, cfg_.rc_target_bitrate * 1.20) |
Jerome Jiang | 8806886 | 2019-11-21 15:25:59 -0800 | [diff] [blame] | 314 | << " The datarate for the file is greater than target by too much!"; |
| 315 | } |
| 316 | }; |
| 317 | |
Jerome Jiang | 6848689 | 2019-05-03 14:54:30 -0700 | [diff] [blame] | 318 | // Check basic rate targeting for VBR mode. |
| 319 | TEST_P(DatarateTestRealtime, BasicRateTargetingVBR) { |
| 320 | BasicRateTargetingVBRTest(); |
| 321 | } |
| 322 | |
Jerome Jiang | f7e6b90 | 2019-11-25 15:28:23 -0800 | [diff] [blame] | 323 | // Check basic rate targeting for CBR. |
Jerome Jiang | 6848689 | 2019-05-03 14:54:30 -0700 | [diff] [blame] | 324 | TEST_P(DatarateTestRealtime, BasicRateTargetingCBR) { |
| 325 | BasicRateTargetingCBRTest(); |
| 326 | } |
| 327 | |
Jerome Jiang | f7e6b90 | 2019-11-25 15:28:23 -0800 | [diff] [blame] | 328 | // Check basic rate targeting for periodic key frame. |
| 329 | TEST_P(DatarateTestRealtime, PeriodicKeyFrameCBR) { |
| 330 | BasicRateTargetingCBRPeriodicKeyFrameTest(); |
| 331 | } |
| 332 | |
Jerome Jiang | 6848689 | 2019-05-03 14:54:30 -0700 | [diff] [blame] | 333 | // Check basic rate targeting for CBR. |
Jerome Jiang | 646082b | 2019-10-18 13:49:49 -0700 | [diff] [blame] | 334 | TEST_P(DatarateTestRealtime, BasicRateTargeting444CBR) { |
Jerome Jiang | 6848689 | 2019-05-03 14:54:30 -0700 | [diff] [blame] | 335 | BasicRateTargeting444CBRTest(); |
| 336 | } |
| 337 | |
| 338 | // Check that (1) the first dropped frame gets earlier and earlier |
| 339 | // as the drop frame threshold is increased, and (2) that the total number of |
| 340 | // frame drops does not decrease as we increase frame drop threshold. |
| 341 | // Use a lower qp-max to force some frame drops. |
Jerome Jiang | 3c1f461 | 2019-11-21 14:06:38 -0800 | [diff] [blame] | 342 | TEST_P(DatarateTestFrameDropRealtime, ChangingDropFrameThresh) { |
Jerome Jiang | 6848689 | 2019-05-03 14:54:30 -0700 | [diff] [blame] | 343 | ChangingDropFrameThreshTest(); |
| 344 | } |
Jerome Jiang | 04d5a63 | 2019-05-03 12:03:28 -0700 | [diff] [blame] | 345 | |
Jerome Jiang | 8806886 | 2019-11-21 15:25:59 -0800 | [diff] [blame] | 346 | TEST_P(DatarateTestSpeedChangeRealtime, ChangingSpeedTest) { |
| 347 | ChangingSpeedTest(); |
| 348 | } |
| 349 | |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 350 | AV1_INSTANTIATE_TEST_CASE(DatarateTestLarge, |
Jerome Jiang | 95fcd32 | 2019-10-16 14:45:40 -0700 | [diff] [blame] | 351 | ::testing::Values(::libaom_test::kRealTime), |
Jerome Jiang | 861fd02 | 2019-09-13 14:13:33 -0700 | [diff] [blame] | 352 | ::testing::Range(5, 7), ::testing::Values(0, 3), |
Jerome Jiang | 6848689 | 2019-05-03 14:54:30 -0700 | [diff] [blame] | 353 | ::testing::Values(0, 1)); |
Jerome Jiang | 04d5a63 | 2019-05-03 12:03:28 -0700 | [diff] [blame] | 354 | |
Jerome Jiang | 3c1f461 | 2019-11-21 14:06:38 -0800 | [diff] [blame] | 355 | AV1_INSTANTIATE_TEST_CASE(DatarateTestFrameDropLarge, |
| 356 | ::testing::Values(::libaom_test::kRealTime), |
| 357 | ::testing::Range(5, 7), ::testing::Values(0, 3)); |
| 358 | |
Jerome Jiang | 6848689 | 2019-05-03 14:54:30 -0700 | [diff] [blame] | 359 | AV1_INSTANTIATE_TEST_CASE(DatarateTestRealtime, |
Jerome Jiang | 04d5a63 | 2019-05-03 12:03:28 -0700 | [diff] [blame] | 360 | ::testing::Values(::libaom_test::kRealTime), |
Jerome Jiang | 861fd02 | 2019-09-13 14:13:33 -0700 | [diff] [blame] | 361 | ::testing::Range(7, 9), ::testing::Values(0, 3), |
Jerome Jiang | 6848689 | 2019-05-03 14:54:30 -0700 | [diff] [blame] | 362 | ::testing::Values(0, 1)); |
Jerome Jiang | 04d5a63 | 2019-05-03 12:03:28 -0700 | [diff] [blame] | 363 | |
Jerome Jiang | 3c1f461 | 2019-11-21 14:06:38 -0800 | [diff] [blame] | 364 | AV1_INSTANTIATE_TEST_CASE(DatarateTestFrameDropRealtime, |
| 365 | ::testing::Values(::libaom_test::kRealTime), |
| 366 | ::testing::Range(7, 9), ::testing::Values(0, 3)); |
| 367 | |
Jerome Jiang | 8806886 | 2019-11-21 15:25:59 -0800 | [diff] [blame] | 368 | AV1_INSTANTIATE_TEST_CASE(DatarateTestSpeedChangeRealtime, |
| 369 | ::testing::Values(::libaom_test::kRealTime), |
| 370 | ::testing::Values(0, 3)); |
| 371 | |
Jim Bankoski | 533470c | 2012-10-29 19:54:06 -0700 | [diff] [blame] | 372 | } // namespace |
Jerome Jiang | d960308 | 2019-08-14 17:24:17 -0700 | [diff] [blame] | 373 | } // namespace datarate_test |