| 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" | 
| 11 #include "third_party/googletest/src/include/gtest/gtest.h" | 11 #include "third_party/googletest/src/include/gtest/gtest.h" | 
| 12 #include "test/codec_factory.h" | 12 #include "test/codec_factory.h" | 
| 13 #include "test/encode_test_driver.h" | 13 #include "test/encode_test_driver.h" | 
| 14 #include "test/i420_video_source.h" | 14 #include "test/i420_video_source.h" | 
| 15 #include "test/util.h" | 15 #include "test/util.h" | 
| 16 #include "test/y4m_video_source.h" | 16 #include "test/y4m_video_source.h" | 
| 17 | 17 | 
| 18 namespace { | 18 namespace { | 
| 19 | 19 | 
| 20 class DatarateTest : public ::libvpx_test::EncoderTest, | 20 class DatarateTestLarge : public ::libvpx_test::EncoderTest, | 
| 21     public ::libvpx_test::CodecTestWithParam<libvpx_test::TestMode> { | 21     public ::libvpx_test::CodecTestWithParam<libvpx_test::TestMode> { | 
| 22  public: | 22  public: | 
| 23   DatarateTest() : EncoderTest(GET_PARAM(0)) {} | 23   DatarateTestLarge() : EncoderTest(GET_PARAM(0)) {} | 
|  | 24 | 
|  | 25   virtual ~DatarateTestLarge() {} | 
| 24 | 26 | 
| 25  protected: | 27  protected: | 
| 26   virtual void SetUp() { | 28   virtual void SetUp() { | 
| 27     InitializeConfig(); | 29     InitializeConfig(); | 
| 28     SetMode(GET_PARAM(1)); | 30     SetMode(GET_PARAM(1)); | 
| 29     ResetModel(); | 31     ResetModel(); | 
| 30   } | 32   } | 
| 31 | 33 | 
| 32   virtual void ResetModel() { | 34   virtual void ResetModel() { | 
| 33     last_pts_ = 0; | 35     last_pts_ = 0; | 
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 113   double timebase_; | 115   double timebase_; | 
| 114   int frame_number_; | 116   int frame_number_; | 
| 115   vpx_codec_pts_t first_drop_; | 117   vpx_codec_pts_t first_drop_; | 
| 116   int64_t bits_total_; | 118   int64_t bits_total_; | 
| 117   double duration_; | 119   double duration_; | 
| 118   double file_datarate_; | 120   double file_datarate_; | 
| 119   double effective_datarate_; | 121   double effective_datarate_; | 
| 120   size_t bits_in_last_frame_; | 122   size_t bits_in_last_frame_; | 
| 121 }; | 123 }; | 
| 122 | 124 | 
| 123 TEST_P(DatarateTest, BasicBufferModel) { | 125 TEST_P(DatarateTestLarge, BasicBufferModel) { | 
| 124   cfg_.rc_buf_initial_sz = 500; | 126   cfg_.rc_buf_initial_sz = 500; | 
| 125   cfg_.rc_dropframe_thresh = 1; | 127   cfg_.rc_dropframe_thresh = 1; | 
| 126   cfg_.rc_max_quantizer = 56; | 128   cfg_.rc_max_quantizer = 56; | 
| 127   cfg_.rc_end_usage = VPX_CBR; | 129   cfg_.rc_end_usage = VPX_CBR; | 
| 128   // 2 pass cbr datarate control has a bug hidden by the small # of | 130   // 2 pass cbr datarate control has a bug hidden by the small # of | 
| 129   // frames selected in this encode. The problem is that even if the buffer is | 131   // frames selected in this encode. The problem is that even if the buffer is | 
| 130   // negative we produce a keyframe on a cutscene. Ignoring datarate | 132   // negative we produce a keyframe on a cutscene. Ignoring datarate | 
| 131   // constraints | 133   // constraints | 
| 132   // TODO(jimbankoski): ( Fix when issue | 134   // TODO(jimbankoski): ( Fix when issue | 
| 133   // http://code.google.com/p/webm/issues/detail?id=495 is addressed. ) | 135   // http://code.google.com/p/webm/issues/detail?id=495 is addressed. ) | 
| (...skipping 10 matching lines...) Expand all  Loading... | 
| 144     ResetModel(); | 146     ResetModel(); | 
| 145     ASSERT_NO_FATAL_FAILURE(RunLoop(&video)); | 147     ASSERT_NO_FATAL_FAILURE(RunLoop(&video)); | 
| 146     ASSERT_GE(cfg_.rc_target_bitrate, effective_datarate_) | 148     ASSERT_GE(cfg_.rc_target_bitrate, effective_datarate_) | 
| 147         << " The datarate for the file exceeds the target!"; | 149         << " The datarate for the file exceeds the target!"; | 
| 148 | 150 | 
| 149     ASSERT_LE(cfg_.rc_target_bitrate, file_datarate_ * 1.3) | 151     ASSERT_LE(cfg_.rc_target_bitrate, file_datarate_ * 1.3) | 
| 150         << " The datarate for the file missed the target!"; | 152         << " The datarate for the file missed the target!"; | 
| 151   } | 153   } | 
| 152 } | 154 } | 
| 153 | 155 | 
| 154 TEST_P(DatarateTest, ChangingDropFrameThresh) { | 156 TEST_P(DatarateTestLarge, ChangingDropFrameThresh) { | 
| 155   cfg_.rc_buf_initial_sz = 500; | 157   cfg_.rc_buf_initial_sz = 500; | 
| 156   cfg_.rc_max_quantizer = 36; | 158   cfg_.rc_max_quantizer = 36; | 
| 157   cfg_.rc_end_usage = VPX_CBR; | 159   cfg_.rc_end_usage = VPX_CBR; | 
| 158   cfg_.rc_target_bitrate = 200; | 160   cfg_.rc_target_bitrate = 200; | 
| 159   cfg_.kf_mode = VPX_KF_DISABLED; | 161   cfg_.kf_mode = VPX_KF_DISABLED; | 
| 160 | 162 | 
| 161   const int frame_count = 40; | 163   const int frame_count = 40; | 
| 162   ::libvpx_test::I420VideoSource video("hantro_collage_w352h288.yuv", 352, 288, | 164   ::libvpx_test::I420VideoSource video("hantro_collage_w352h288.yuv", 352, 288, | 
| 163                                        30, 1, 0, frame_count); | 165                                        30, 1, 0, frame_count); | 
| 164 | 166 | 
| 165   // Here we check that the first dropped frame gets earlier and earlier | 167   // Here we check that the first dropped frame gets earlier and earlier | 
| 166   // as the drop frame threshold is increased. | 168   // as the drop frame threshold is increased. | 
| 167 | 169 | 
| 168   const int kDropFrameThreshTestStep = 30; | 170   const int kDropFrameThreshTestStep = 30; | 
| 169   vpx_codec_pts_t last_drop = frame_count; | 171   vpx_codec_pts_t last_drop = frame_count; | 
| 170   for (int i = 1; i < 91; i += kDropFrameThreshTestStep) { | 172   for (int i = 1; i < 91; i += kDropFrameThreshTestStep) { | 
| 171     cfg_.rc_dropframe_thresh = i; | 173     cfg_.rc_dropframe_thresh = i; | 
| 172     ResetModel(); | 174     ResetModel(); | 
| 173     ASSERT_NO_FATAL_FAILURE(RunLoop(&video)); | 175     ASSERT_NO_FATAL_FAILURE(RunLoop(&video)); | 
| 174     ASSERT_LE(first_drop_, last_drop) | 176     ASSERT_LE(first_drop_, last_drop) | 
| 175         << " The first dropped frame for drop_thresh " << i | 177         << " The first dropped frame for drop_thresh " << i | 
| 176         << " > first dropped frame for drop_thresh " | 178         << " > first dropped frame for drop_thresh " | 
| 177         << i - kDropFrameThreshTestStep; | 179         << i - kDropFrameThreshTestStep; | 
| 178     last_drop = first_drop_; | 180     last_drop = first_drop_; | 
| 179   } | 181   } | 
| 180 } | 182 } | 
| 181 | 183 | 
| 182 class DatarateTestVP9 : public ::libvpx_test::EncoderTest, | 184 class DatarateTestVP9Large : public ::libvpx_test::EncoderTest, | 
| 183     public ::libvpx_test::CodecTestWith2Params<libvpx_test::TestMode, int> { | 185     public ::libvpx_test::CodecTestWith2Params<libvpx_test::TestMode, int> { | 
| 184  public: | 186  public: | 
| 185   DatarateTestVP9() : EncoderTest(GET_PARAM(0)) {} | 187   DatarateTestVP9Large() : EncoderTest(GET_PARAM(0)) {} | 
| 186 | 188 | 
| 187  protected: | 189  protected: | 
| 188   virtual ~DatarateTestVP9() {} | 190   virtual ~DatarateTestVP9Large() {} | 
| 189 | 191 | 
| 190   virtual void SetUp() { | 192   virtual void SetUp() { | 
| 191     InitializeConfig(); | 193     InitializeConfig(); | 
| 192     SetMode(GET_PARAM(1)); | 194     SetMode(GET_PARAM(1)); | 
| 193     set_cpu_used_ = GET_PARAM(2); | 195     set_cpu_used_ = GET_PARAM(2); | 
| 194     ResetModel(); | 196     ResetModel(); | 
| 195   } | 197   } | 
| 196 | 198 | 
| 197   virtual void ResetModel() { | 199   virtual void ResetModel() { | 
| 198     last_pts_ = 0; | 200     last_pts_ = 0; | 
| (...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 351   int64_t bits_total_[3]; | 353   int64_t bits_total_[3]; | 
| 352   double duration_; | 354   double duration_; | 
| 353   double effective_datarate_[3]; | 355   double effective_datarate_[3]; | 
| 354   int set_cpu_used_; | 356   int set_cpu_used_; | 
| 355   int64_t bits_in_buffer_model_; | 357   int64_t bits_in_buffer_model_; | 
| 356   vpx_codec_pts_t first_drop_; | 358   vpx_codec_pts_t first_drop_; | 
| 357   int num_drops_; | 359   int num_drops_; | 
| 358 }; | 360 }; | 
| 359 | 361 | 
| 360 // Check basic rate targeting, | 362 // Check basic rate targeting, | 
| 361 TEST_P(DatarateTestVP9, BasicRateTargeting) { | 363 TEST_P(DatarateTestVP9Large, BasicRateTargeting) { | 
| 362   cfg_.rc_buf_initial_sz = 500; | 364   cfg_.rc_buf_initial_sz = 500; | 
| 363   cfg_.rc_buf_optimal_sz = 500; | 365   cfg_.rc_buf_optimal_sz = 500; | 
| 364   cfg_.rc_buf_sz = 1000; | 366   cfg_.rc_buf_sz = 1000; | 
| 365   cfg_.rc_dropframe_thresh = 1; | 367   cfg_.rc_dropframe_thresh = 1; | 
| 366   cfg_.rc_min_quantizer = 0; | 368   cfg_.rc_min_quantizer = 0; | 
| 367   cfg_.rc_max_quantizer = 63; | 369   cfg_.rc_max_quantizer = 63; | 
| 368   cfg_.rc_end_usage = VPX_CBR; | 370   cfg_.rc_end_usage = VPX_CBR; | 
| 369   cfg_.g_lag_in_frames = 0; | 371   cfg_.g_lag_in_frames = 0; | 
| 370 | 372 | 
| 371   ::libvpx_test::I420VideoSource video("hantro_collage_w352h288.yuv", 352, 288, | 373   ::libvpx_test::I420VideoSource video("hantro_collage_w352h288.yuv", 352, 288, | 
| 372                                        30, 1, 0, 140); | 374                                        30, 1, 0, 140); | 
| 373   for (int i = 150; i < 800; i += 200) { | 375   for (int i = 150; i < 800; i += 200) { | 
| 374     cfg_.rc_target_bitrate = i; | 376     cfg_.rc_target_bitrate = i; | 
| 375     ResetModel(); | 377     ResetModel(); | 
| 376     ASSERT_NO_FATAL_FAILURE(RunLoop(&video)); | 378     ASSERT_NO_FATAL_FAILURE(RunLoop(&video)); | 
| 377     ASSERT_GE(effective_datarate_[0], cfg_.rc_target_bitrate * 0.85) | 379     ASSERT_GE(effective_datarate_[0], cfg_.rc_target_bitrate * 0.85) | 
| 378         << " The datarate for the file is lower than target by too much!"; | 380         << " The datarate for the file is lower than target by too much!"; | 
| 379     ASSERT_LE(effective_datarate_[0], cfg_.rc_target_bitrate * 1.15) | 381     ASSERT_LE(effective_datarate_[0], cfg_.rc_target_bitrate * 1.15) | 
| 380         << " The datarate for the file is greater than target by too much!"; | 382         << " The datarate for the file is greater than target by too much!"; | 
| 381   } | 383   } | 
| 382 } | 384 } | 
| 383 | 385 | 
| 384 // Check basic rate targeting, | 386 // Check basic rate targeting, | 
| 385 TEST_P(DatarateTestVP9, BasicRateTargeting444) { | 387 TEST_P(DatarateTestVP9Large, BasicRateTargeting444) { | 
| 386   ::libvpx_test::Y4mVideoSource video("rush_hour_444.y4m", 0, 140); | 388   ::libvpx_test::Y4mVideoSource video("rush_hour_444.y4m", 0, 140); | 
| 387 | 389 | 
| 388   cfg_.g_profile = 1; | 390   cfg_.g_profile = 1; | 
| 389   cfg_.g_timebase = video.timebase(); | 391   cfg_.g_timebase = video.timebase(); | 
| 390 | 392 | 
| 391   cfg_.rc_buf_initial_sz = 500; | 393   cfg_.rc_buf_initial_sz = 500; | 
| 392   cfg_.rc_buf_optimal_sz = 500; | 394   cfg_.rc_buf_optimal_sz = 500; | 
| 393   cfg_.rc_buf_sz = 1000; | 395   cfg_.rc_buf_sz = 1000; | 
| 394   cfg_.rc_dropframe_thresh = 1; | 396   cfg_.rc_dropframe_thresh = 1; | 
| 395   cfg_.rc_min_quantizer = 0; | 397   cfg_.rc_min_quantizer = 0; | 
| (...skipping 11 matching lines...) Expand all  Loading... | 
| 407               effective_datarate_[0] * 1.15) | 409               effective_datarate_[0] * 1.15) | 
| 408         << " The datarate for the file missed the target!" | 410         << " The datarate for the file missed the target!" | 
| 409         << cfg_.rc_target_bitrate << " "<< effective_datarate_; | 411         << cfg_.rc_target_bitrate << " "<< effective_datarate_; | 
| 410   } | 412   } | 
| 411 } | 413 } | 
| 412 | 414 | 
| 413 // Check that (1) the first dropped frame gets earlier and earlier | 415 // Check that (1) the first dropped frame gets earlier and earlier | 
| 414 // as the drop frame threshold is increased, and (2) that the total number of | 416 // as the drop frame threshold is increased, and (2) that the total number of | 
| 415 // frame drops does not decrease as we increase frame drop threshold. | 417 // frame drops does not decrease as we increase frame drop threshold. | 
| 416 // Use a lower qp-max to force some frame drops. | 418 // Use a lower qp-max to force some frame drops. | 
| 417 TEST_P(DatarateTestVP9, ChangingDropFrameThresh) { | 419 TEST_P(DatarateTestVP9Large, ChangingDropFrameThresh) { | 
| 418   cfg_.rc_buf_initial_sz = 500; | 420   cfg_.rc_buf_initial_sz = 500; | 
| 419   cfg_.rc_buf_optimal_sz = 500; | 421   cfg_.rc_buf_optimal_sz = 500; | 
| 420   cfg_.rc_buf_sz = 1000; | 422   cfg_.rc_buf_sz = 1000; | 
| 421   cfg_.rc_undershoot_pct = 20; | 423   cfg_.rc_undershoot_pct = 20; | 
| 422   cfg_.rc_undershoot_pct = 20; | 424   cfg_.rc_undershoot_pct = 20; | 
| 423   cfg_.rc_dropframe_thresh = 10; | 425   cfg_.rc_dropframe_thresh = 10; | 
| 424   cfg_.rc_min_quantizer = 0; | 426   cfg_.rc_min_quantizer = 0; | 
| 425   cfg_.rc_max_quantizer = 50; | 427   cfg_.rc_max_quantizer = 50; | 
| 426   cfg_.rc_end_usage = VPX_CBR; | 428   cfg_.rc_end_usage = VPX_CBR; | 
| 427   cfg_.rc_target_bitrate = 200; | 429   cfg_.rc_target_bitrate = 200; | 
| (...skipping 20 matching lines...) Expand all  Loading... | 
| 448     ASSERT_GE(num_drops_, last_num_drops) | 450     ASSERT_GE(num_drops_, last_num_drops) | 
| 449         << " The number of dropped frames for drop_thresh " << i | 451         << " The number of dropped frames for drop_thresh " << i | 
| 450         << " < number of dropped frames for drop_thresh " | 452         << " < number of dropped frames for drop_thresh " | 
| 451         << i - kDropFrameThreshTestStep; | 453         << i - kDropFrameThreshTestStep; | 
| 452     last_drop = first_drop_; | 454     last_drop = first_drop_; | 
| 453     last_num_drops = num_drops_; | 455     last_num_drops = num_drops_; | 
| 454   } | 456   } | 
| 455 } | 457 } | 
| 456 | 458 | 
| 457 // Check basic rate targeting for 2 temporal layers. | 459 // Check basic rate targeting for 2 temporal layers. | 
| 458 TEST_P(DatarateTestVP9, BasicRateTargeting2TemporalLayers) { | 460 TEST_P(DatarateTestVP9Large, BasicRateTargeting2TemporalLayers) { | 
| 459   cfg_.rc_buf_initial_sz = 500; | 461   cfg_.rc_buf_initial_sz = 500; | 
| 460   cfg_.rc_buf_optimal_sz = 500; | 462   cfg_.rc_buf_optimal_sz = 500; | 
| 461   cfg_.rc_buf_sz = 1000; | 463   cfg_.rc_buf_sz = 1000; | 
| 462   cfg_.rc_dropframe_thresh = 1; | 464   cfg_.rc_dropframe_thresh = 1; | 
| 463   cfg_.rc_min_quantizer = 0; | 465   cfg_.rc_min_quantizer = 0; | 
| 464   cfg_.rc_max_quantizer = 63; | 466   cfg_.rc_max_quantizer = 63; | 
| 465   cfg_.rc_end_usage = VPX_CBR; | 467   cfg_.rc_end_usage = VPX_CBR; | 
| 466   cfg_.g_lag_in_frames = 0; | 468   cfg_.g_lag_in_frames = 0; | 
| 467 | 469 | 
| 468   // 2 Temporal layers, no spatial layers: Framerate decimation (2, 1). | 470   // 2 Temporal layers, no spatial layers: Framerate decimation (2, 1). | 
| (...skipping 16 matching lines...) Expand all  Loading... | 
| 485           << " The datarate for the file is lower than target by too much, " | 487           << " The datarate for the file is lower than target by too much, " | 
| 486               "for layer: " << j; | 488               "for layer: " << j; | 
| 487       ASSERT_LE(effective_datarate_[j], cfg_.ts_target_bitrate[j] * 1.15) | 489       ASSERT_LE(effective_datarate_[j], cfg_.ts_target_bitrate[j] * 1.15) | 
| 488           << " The datarate for the file is greater than target by too much, " | 490           << " The datarate for the file is greater than target by too much, " | 
| 489               "for layer: " << j; | 491               "for layer: " << j; | 
| 490     } | 492     } | 
| 491   } | 493   } | 
| 492 } | 494 } | 
| 493 | 495 | 
| 494 // Check basic rate targeting for 3 temporal layers. | 496 // Check basic rate targeting for 3 temporal layers. | 
| 495 TEST_P(DatarateTestVP9, BasicRateTargeting3TemporalLayers) { | 497 TEST_P(DatarateTestVP9Large, BasicRateTargeting3TemporalLayers) { | 
| 496   cfg_.rc_buf_initial_sz = 500; | 498   cfg_.rc_buf_initial_sz = 500; | 
| 497   cfg_.rc_buf_optimal_sz = 500; | 499   cfg_.rc_buf_optimal_sz = 500; | 
| 498   cfg_.rc_buf_sz = 1000; | 500   cfg_.rc_buf_sz = 1000; | 
| 499   cfg_.rc_dropframe_thresh = 1; | 501   cfg_.rc_dropframe_thresh = 1; | 
| 500   cfg_.rc_min_quantizer = 0; | 502   cfg_.rc_min_quantizer = 0; | 
| 501   cfg_.rc_max_quantizer = 63; | 503   cfg_.rc_max_quantizer = 63; | 
| 502   cfg_.rc_end_usage = VPX_CBR; | 504   cfg_.rc_end_usage = VPX_CBR; | 
| 503   cfg_.g_lag_in_frames = 0; | 505   cfg_.g_lag_in_frames = 0; | 
| 504 | 506 | 
| 505   // 3 Temporal layers, no spatial layers: Framerate decimation (4, 2, 1). | 507   // 3 Temporal layers, no spatial layers: Framerate decimation (4, 2, 1). | 
| (...skipping 20 matching lines...) Expand all  Loading... | 
| 526       ASSERT_LE(effective_datarate_[j], cfg_.ts_target_bitrate[j] * 1.15) | 528       ASSERT_LE(effective_datarate_[j], cfg_.ts_target_bitrate[j] * 1.15) | 
| 527           << " The datarate for the file is greater than target by too much, " | 529           << " The datarate for the file is greater than target by too much, " | 
| 528               "for layer: " << j; | 530               "for layer: " << j; | 
| 529     } | 531     } | 
| 530   } | 532   } | 
| 531 } | 533 } | 
| 532 | 534 | 
| 533 // Check basic rate targeting for 3 temporal layers, with frame dropping. | 535 // Check basic rate targeting for 3 temporal layers, with frame dropping. | 
| 534 // Only for one (low) bitrate with lower max_quantizer, and somewhat higher | 536 // Only for one (low) bitrate with lower max_quantizer, and somewhat higher | 
| 535 // frame drop threshold, to force frame dropping. | 537 // frame drop threshold, to force frame dropping. | 
| 536 TEST_P(DatarateTestVP9, BasicRateTargeting3TemporalLayersFrameDropping) { | 538 TEST_P(DatarateTestVP9Large, BasicRateTargeting3TemporalLayersFrameDropping) { | 
| 537   cfg_.rc_buf_initial_sz = 500; | 539   cfg_.rc_buf_initial_sz = 500; | 
| 538   cfg_.rc_buf_optimal_sz = 500; | 540   cfg_.rc_buf_optimal_sz = 500; | 
| 539   cfg_.rc_buf_sz = 1000; | 541   cfg_.rc_buf_sz = 1000; | 
| 540   // Set frame drop threshold and rc_max_quantizer to force some frame drops. | 542   // Set frame drop threshold and rc_max_quantizer to force some frame drops. | 
| 541   cfg_.rc_dropframe_thresh = 20; | 543   cfg_.rc_dropframe_thresh = 20; | 
| 542   cfg_.rc_max_quantizer = 45; | 544   cfg_.rc_max_quantizer = 45; | 
| 543   cfg_.rc_min_quantizer = 0; | 545   cfg_.rc_min_quantizer = 0; | 
| 544   cfg_.rc_end_usage = VPX_CBR; | 546   cfg_.rc_end_usage = VPX_CBR; | 
| 545   cfg_.g_lag_in_frames = 0; | 547   cfg_.g_lag_in_frames = 0; | 
| 546 | 548 | 
| (...skipping 14 matching lines...) Expand all  Loading... | 
| 561   cfg_.ts_target_bitrate[2] = cfg_.rc_target_bitrate; | 563   cfg_.ts_target_bitrate[2] = cfg_.rc_target_bitrate; | 
| 562   ASSERT_NO_FATAL_FAILURE(RunLoop(&video)); | 564   ASSERT_NO_FATAL_FAILURE(RunLoop(&video)); | 
| 563   for (int j = 0; j < static_cast<int>(cfg_.ts_number_layers); ++j) { | 565   for (int j = 0; j < static_cast<int>(cfg_.ts_number_layers); ++j) { | 
| 564     ASSERT_GE(effective_datarate_[j], cfg_.ts_target_bitrate[j] * 0.85) | 566     ASSERT_GE(effective_datarate_[j], cfg_.ts_target_bitrate[j] * 0.85) | 
| 565         << " The datarate for the file is lower than target by too much, " | 567         << " The datarate for the file is lower than target by too much, " | 
| 566             "for layer: " << j; | 568             "for layer: " << j; | 
| 567     ASSERT_LE(effective_datarate_[j], cfg_.ts_target_bitrate[j] * 1.15) | 569     ASSERT_LE(effective_datarate_[j], cfg_.ts_target_bitrate[j] * 1.15) | 
| 568         << " The datarate for the file is greater than target by too much, " | 570         << " The datarate for the file is greater than target by too much, " | 
| 569             "for layer: " << j; | 571             "for layer: " << j; | 
| 570     // Expect some frame drops in this test: for this 200 frames test, | 572     // Expect some frame drops in this test: for this 200 frames test, | 
| 571     // expect at least 10% and not more than 50% drops. | 573     // expect at least 10% and not more than 60% drops. | 
| 572     ASSERT_GE(num_drops_, 20); | 574     ASSERT_GE(num_drops_, 20); | 
| 573     ASSERT_LE(num_drops_, 100); | 575     ASSERT_LE(num_drops_, 120); | 
| 574   } | 576   } | 
| 575 } | 577 } | 
| 576 | 578 | 
| 577 VP8_INSTANTIATE_TEST_CASE(DatarateTest, ALL_TEST_MODES); | 579 VP8_INSTANTIATE_TEST_CASE(DatarateTestLarge, ALL_TEST_MODES); | 
| 578 VP9_INSTANTIATE_TEST_CASE(DatarateTestVP9, | 580 VP9_INSTANTIATE_TEST_CASE(DatarateTestVP9Large, | 
| 579                           ::testing::Values(::libvpx_test::kOnePassGood), | 581                           ::testing::Values(::libvpx_test::kOnePassGood, | 
| 580                           ::testing::Range(2, 5)); | 582                           ::libvpx_test::kRealTime), | 
|  | 583                           ::testing::Range(2, 7)); | 
| 581 }  // namespace | 584 }  // namespace | 
| OLD | NEW | 
|---|