| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (c) 2012 The WebM project authors. All Rights Reserved. | 2 * Copyright (c) 2012 The WebM project authors. All Rights Reserved. |
| 3 * | 3 * |
| 4 * Use of this source code is governed by a BSD-style license | 4 * Use of this source code is governed by a BSD-style license |
| 5 * that can be found in the LICENSE file in the root of the source | 5 * that can be found in the LICENSE file in the root of the source |
| 6 * tree. An additional intellectual property rights grant can be found | 6 * tree. An additional intellectual property rights grant can be found |
| 7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
| 8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
| 9 */ | 9 */ |
| 10 #include "./vpx_config.h" | 10 #include "./vpx_config.h" |
| (...skipping 363 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 374 cfg_.rc_target_bitrate = i; | 374 cfg_.rc_target_bitrate = i; |
| 375 ResetModel(); | 375 ResetModel(); |
| 376 ASSERT_NO_FATAL_FAILURE(RunLoop(&video)); | 376 ASSERT_NO_FATAL_FAILURE(RunLoop(&video)); |
| 377 ASSERT_GE(effective_datarate_[0], cfg_.rc_target_bitrate * 0.85) | 377 ASSERT_GE(effective_datarate_[0], cfg_.rc_target_bitrate * 0.85) |
| 378 << " The datarate for the file is lower than target by too much!"; | 378 << " The datarate for the file is lower than target by too much!"; |
| 379 ASSERT_LE(effective_datarate_[0], cfg_.rc_target_bitrate * 1.15) | 379 ASSERT_LE(effective_datarate_[0], cfg_.rc_target_bitrate * 1.15) |
| 380 << " The datarate for the file is greater than target by too much!"; | 380 << " The datarate for the file is greater than target by too much!"; |
| 381 } | 381 } |
| 382 } | 382 } |
| 383 | 383 |
| 384 #if CONFIG_NON420 | |
| 385 // Check basic rate targeting, | 384 // Check basic rate targeting, |
| 386 TEST_P(DatarateTestVP9, BasicRateTargeting444) { | 385 TEST_P(DatarateTestVP9, BasicRateTargeting444) { |
| 387 ::libvpx_test::Y4mVideoSource video("rush_hour_444.y4m", 0, 140); | 386 ::libvpx_test::Y4mVideoSource video("rush_hour_444.y4m", 0, 140); |
| 388 | 387 |
| 389 cfg_.g_profile = 1; | 388 cfg_.g_profile = 1; |
| 390 cfg_.g_timebase = video.timebase(); | 389 cfg_.g_timebase = video.timebase(); |
| 391 | 390 |
| 392 cfg_.rc_buf_initial_sz = 500; | 391 cfg_.rc_buf_initial_sz = 500; |
| 393 cfg_.rc_buf_optimal_sz = 500; | 392 cfg_.rc_buf_optimal_sz = 500; |
| 394 cfg_.rc_buf_sz = 1000; | 393 cfg_.rc_buf_sz = 1000; |
| 395 cfg_.rc_dropframe_thresh = 1; | 394 cfg_.rc_dropframe_thresh = 1; |
| 396 cfg_.rc_min_quantizer = 0; | 395 cfg_.rc_min_quantizer = 0; |
| 397 cfg_.rc_max_quantizer = 63; | 396 cfg_.rc_max_quantizer = 63; |
| 398 cfg_.rc_end_usage = VPX_CBR; | 397 cfg_.rc_end_usage = VPX_CBR; |
| 399 | 398 |
| 400 for (int i = 250; i < 900; i += 200) { | 399 for (int i = 250; i < 900; i += 200) { |
| 401 cfg_.rc_target_bitrate = i; | 400 cfg_.rc_target_bitrate = i; |
| 402 ResetModel(); | 401 ResetModel(); |
| 403 ASSERT_NO_FATAL_FAILURE(RunLoop(&video)); | 402 ASSERT_NO_FATAL_FAILURE(RunLoop(&video)); |
| 404 ASSERT_GE(static_cast<double>(cfg_.rc_target_bitrate), | 403 ASSERT_GE(static_cast<double>(cfg_.rc_target_bitrate), |
| 405 effective_datarate_[0] * 0.85) | 404 effective_datarate_[0] * 0.85) |
| 406 << " The datarate for the file exceeds the target by too much!"; | 405 << " The datarate for the file exceeds the target by too much!"; |
| 407 ASSERT_LE(static_cast<double>(cfg_.rc_target_bitrate), | 406 ASSERT_LE(static_cast<double>(cfg_.rc_target_bitrate), |
| 408 effective_datarate_[0] * 1.15) | 407 effective_datarate_[0] * 1.15) |
| 409 << " The datarate for the file missed the target!" | 408 << " The datarate for the file missed the target!" |
| 410 << cfg_.rc_target_bitrate << " "<< effective_datarate_; | 409 << cfg_.rc_target_bitrate << " "<< effective_datarate_; |
| 411 } | 410 } |
| 412 } | 411 } |
| 413 #endif | |
| 414 | 412 |
| 415 // Check that (1) the first dropped frame gets earlier and earlier | 413 // Check that (1) the first dropped frame gets earlier and earlier |
| 416 // as the drop frame threshold is increased, and (2) that the total number of | 414 // as the drop frame threshold is increased, and (2) that the total number of |
| 417 // frame drops does not decrease as we increase frame drop threshold. | 415 // frame drops does not decrease as we increase frame drop threshold. |
| 418 // Use a lower qp-max to force some frame drops. | 416 // Use a lower qp-max to force some frame drops. |
| 419 TEST_P(DatarateTestVP9, ChangingDropFrameThresh) { | 417 TEST_P(DatarateTestVP9, ChangingDropFrameThresh) { |
| 420 cfg_.rc_buf_initial_sz = 500; | 418 cfg_.rc_buf_initial_sz = 500; |
| 421 cfg_.rc_buf_optimal_sz = 500; | 419 cfg_.rc_buf_optimal_sz = 500; |
| 422 cfg_.rc_buf_sz = 1000; | 420 cfg_.rc_buf_sz = 1000; |
| 423 cfg_.rc_undershoot_pct = 20; | 421 cfg_.rc_undershoot_pct = 20; |
| (...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 574 ASSERT_GE(num_drops_, 20); | 572 ASSERT_GE(num_drops_, 20); |
| 575 ASSERT_LE(num_drops_, 100); | 573 ASSERT_LE(num_drops_, 100); |
| 576 } | 574 } |
| 577 } | 575 } |
| 578 | 576 |
| 579 VP8_INSTANTIATE_TEST_CASE(DatarateTest, ALL_TEST_MODES); | 577 VP8_INSTANTIATE_TEST_CASE(DatarateTest, ALL_TEST_MODES); |
| 580 VP9_INSTANTIATE_TEST_CASE(DatarateTestVP9, | 578 VP9_INSTANTIATE_TEST_CASE(DatarateTestVP9, |
| 581 ::testing::Values(::libvpx_test::kOnePassGood), | 579 ::testing::Values(::libvpx_test::kOnePassGood), |
| 582 ::testing::Range(2, 5)); | 580 ::testing::Range(2, 5)); |
| 583 } // namespace | 581 } // namespace |
| OLD | NEW |