| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (c) 2013 The WebM project authors. All Rights Reserved. | 2 * Copyright (c) 2013 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 | 10 |
| 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 | 16 |
| 17 namespace { | 17 namespace { |
| 18 | 18 |
| 19 const int kMaxErrorFrames = 12; | 19 const int kMaxErrorFrames = 12; |
| 20 const int kMaxDroppableFrames = 12; | 20 const int kMaxDroppableFrames = 12; |
| 21 | 21 |
| 22 class ErrorResilienceTestLarge : public ::libvpx_test::EncoderTest, | 22 class ErrorResilienceTestLarge : public ::libvpx_test::EncoderTest, |
| 23 public ::libvpx_test::CodecTestWithParam<libvpx_test::TestMode> { | 23 public ::libvpx_test::CodecTestWith2Params<libvpx_test::TestMode, bool> { |
| 24 protected: | 24 protected: |
| 25 ErrorResilienceTestLarge() | 25 ErrorResilienceTestLarge() |
| 26 : EncoderTest(GET_PARAM(0)), | 26 : EncoderTest(GET_PARAM(0)), |
| 27 svc_support_(GET_PARAM(2)), |
| 27 psnr_(0.0), | 28 psnr_(0.0), |
| 28 nframes_(0), | 29 nframes_(0), |
| 29 mismatch_psnr_(0.0), | 30 mismatch_psnr_(0.0), |
| 30 mismatch_nframes_(0), | 31 mismatch_nframes_(0), |
| 31 encoding_mode_(GET_PARAM(1)) { | 32 encoding_mode_(GET_PARAM(1)) { |
| 32 Reset(); | 33 Reset(); |
| 33 } | 34 } |
| 34 | 35 |
| 35 virtual ~ErrorResilienceTestLarge() {} | 36 virtual ~ErrorResilienceTestLarge() {} |
| 36 | 37 |
| (...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 186 } | 187 } |
| 187 | 188 |
| 188 unsigned int GetMismatchFrames() { | 189 unsigned int GetMismatchFrames() { |
| 189 return mismatch_nframes_; | 190 return mismatch_nframes_; |
| 190 } | 191 } |
| 191 | 192 |
| 192 void SetPatternSwitch(int frame_switch) { | 193 void SetPatternSwitch(int frame_switch) { |
| 193 pattern_switch_ = frame_switch; | 194 pattern_switch_ = frame_switch; |
| 194 } | 195 } |
| 195 | 196 |
| 197 bool svc_support_; |
| 198 |
| 196 private: | 199 private: |
| 197 double psnr_; | 200 double psnr_; |
| 198 unsigned int nframes_; | 201 unsigned int nframes_; |
| 199 unsigned int error_nframes_; | 202 unsigned int error_nframes_; |
| 200 unsigned int droppable_nframes_; | 203 unsigned int droppable_nframes_; |
| 201 unsigned int pattern_switch_; | 204 unsigned int pattern_switch_; |
| 202 double mismatch_psnr_; | 205 double mismatch_psnr_; |
| 203 unsigned int mismatch_nframes_; | 206 unsigned int mismatch_nframes_; |
| 204 unsigned int error_frames_[kMaxErrorFrames]; | 207 unsigned int error_frames_[kMaxErrorFrames]; |
| 205 unsigned int droppable_frames_[kMaxDroppableFrames]; | 208 unsigned int droppable_frames_[kMaxDroppableFrames]; |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 295 << psnr_resilience_mismatch << "\n"; | 298 << psnr_resilience_mismatch << "\n"; |
| 296 EXPECT_GT(psnr_resilience_mismatch, 20.0); | 299 EXPECT_GT(psnr_resilience_mismatch, 20.0); |
| 297 #endif | 300 #endif |
| 298 } | 301 } |
| 299 | 302 |
| 300 // Check for successful decoding and no encoder/decoder mismatch | 303 // Check for successful decoding and no encoder/decoder mismatch |
| 301 // if we lose (i.e., drop before decoding) the enhancement layer frames for a | 304 // if we lose (i.e., drop before decoding) the enhancement layer frames for a |
| 302 // two layer temporal pattern. The base layer does not predict from the top | 305 // two layer temporal pattern. The base layer does not predict from the top |
| 303 // layer, so successful decoding is expected. | 306 // layer, so successful decoding is expected. |
| 304 TEST_P(ErrorResilienceTestLarge, 2LayersDropEnhancement) { | 307 TEST_P(ErrorResilienceTestLarge, 2LayersDropEnhancement) { |
| 308 // This test doesn't run if SVC is not supported. |
| 309 if (!svc_support_) |
| 310 return; |
| 311 |
| 305 const vpx_rational timebase = { 33333333, 1000000000 }; | 312 const vpx_rational timebase = { 33333333, 1000000000 }; |
| 306 cfg_.g_timebase = timebase; | 313 cfg_.g_timebase = timebase; |
| 307 cfg_.rc_target_bitrate = 500; | 314 cfg_.rc_target_bitrate = 500; |
| 308 cfg_.g_lag_in_frames = 0; | 315 cfg_.g_lag_in_frames = 0; |
| 309 | 316 |
| 310 cfg_.rc_end_usage = VPX_CBR; | 317 cfg_.rc_end_usage = VPX_CBR; |
| 311 // 2 Temporal layers, no spatial layers, CBR mode. | 318 // 2 Temporal layers, no spatial layers, CBR mode. |
| 312 cfg_.ss_number_layers = 1; | 319 cfg_.ss_number_layers = 1; |
| 313 cfg_.ts_number_layers = 2; | 320 cfg_.ts_number_layers = 2; |
| 314 cfg_.ts_rate_decimator[0] = 2; | 321 cfg_.ts_rate_decimator[0] = 2; |
| (...skipping 25 matching lines...) Expand all Loading... |
| 340 EXPECT_EQ(GetMismatchFrames(), (unsigned int) 0); | 347 EXPECT_EQ(GetMismatchFrames(), (unsigned int) 0); |
| 341 | 348 |
| 342 // Reset previously set of error/droppable frames. | 349 // Reset previously set of error/droppable frames. |
| 343 Reset(); | 350 Reset(); |
| 344 } | 351 } |
| 345 | 352 |
| 346 // Check for successful decoding and no encoder/decoder mismatch | 353 // Check for successful decoding and no encoder/decoder mismatch |
| 347 // for a two layer temporal pattern, where at some point in the | 354 // for a two layer temporal pattern, where at some point in the |
| 348 // sequence, the LAST ref is not used anymore. | 355 // sequence, the LAST ref is not used anymore. |
| 349 TEST_P(ErrorResilienceTestLarge, 2LayersNoRefLast) { | 356 TEST_P(ErrorResilienceTestLarge, 2LayersNoRefLast) { |
| 357 // This test doesn't run if SVC is not supported. |
| 358 if (!svc_support_) |
| 359 return; |
| 360 |
| 350 const vpx_rational timebase = { 33333333, 1000000000 }; | 361 const vpx_rational timebase = { 33333333, 1000000000 }; |
| 351 cfg_.g_timebase = timebase; | 362 cfg_.g_timebase = timebase; |
| 352 cfg_.rc_target_bitrate = 500; | 363 cfg_.rc_target_bitrate = 500; |
| 353 cfg_.g_lag_in_frames = 0; | 364 cfg_.g_lag_in_frames = 0; |
| 354 | 365 |
| 355 cfg_.rc_end_usage = VPX_CBR; | 366 cfg_.rc_end_usage = VPX_CBR; |
| 356 // 2 Temporal layers, no spatial layers, CBR mode. | 367 // 2 Temporal layers, no spatial layers, CBR mode. |
| 357 cfg_.ss_number_layers = 1; | 368 cfg_.ss_number_layers = 1; |
| 358 cfg_.ts_number_layers = 2; | 369 cfg_.ts_number_layers = 2; |
| 359 cfg_.ts_rate_decimator[0] = 2; | 370 cfg_.ts_rate_decimator[0] = 2; |
| (...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 572 ASSERT_GE(effective_datarate_[j], cfg_.ts_target_bitrate[j] * 0.75) | 583 ASSERT_GE(effective_datarate_[j], cfg_.ts_target_bitrate[j] * 0.75) |
| 573 << " The datarate for the file is lower than target by too much, " | 584 << " The datarate for the file is lower than target by too much, " |
| 574 "for layer: " << j; | 585 "for layer: " << j; |
| 575 ASSERT_LE(effective_datarate_[j], cfg_.ts_target_bitrate[j] * 1.25) | 586 ASSERT_LE(effective_datarate_[j], cfg_.ts_target_bitrate[j] * 1.25) |
| 576 << " The datarate for the file is greater than target by too much, " | 587 << " The datarate for the file is greater than target by too much, " |
| 577 "for layer: " << j; | 588 "for layer: " << j; |
| 578 } | 589 } |
| 579 } | 590 } |
| 580 } | 591 } |
| 581 | 592 |
| 582 VP8_INSTANTIATE_TEST_CASE(ErrorResilienceTestLarge, ONE_PASS_TEST_MODES); | 593 VP8_INSTANTIATE_TEST_CASE(ErrorResilienceTestLarge, ONE_PASS_TEST_MODES, |
| 594 ::testing::Values(true)); |
| 583 VP8_INSTANTIATE_TEST_CASE(ErrorResilienceTestLargeCodecControls, | 595 VP8_INSTANTIATE_TEST_CASE(ErrorResilienceTestLargeCodecControls, |
| 584 ONE_PASS_TEST_MODES); | 596 ONE_PASS_TEST_MODES); |
| 585 VP9_INSTANTIATE_TEST_CASE(ErrorResilienceTestLarge, ONE_PASS_TEST_MODES); | 597 VP9_INSTANTIATE_TEST_CASE(ErrorResilienceTestLarge, ONE_PASS_TEST_MODES, |
| 586 VP10_INSTANTIATE_TEST_CASE(ErrorResilienceTestLarge, ONE_PASS_TEST_MODES); | 598 ::testing::Values(true)); |
| 599 // SVC-related tests don't run for VP10 since SVC is not supported. |
| 600 VP10_INSTANTIATE_TEST_CASE(ErrorResilienceTestLarge, ONE_PASS_TEST_MODES, |
| 601 ::testing::Values(false)); |
| 587 } // namespace | 602 } // namespace |
| OLD | NEW |