| OLD | NEW | 
|---|
| 1 /* | 1 /* | 
| 2  *  Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. | 2  *  Copyright (c) 2012 The WebRTC 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 | 
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 77   int max_delta_frame_size_mismatch; | 77   int max_delta_frame_size_mismatch; | 
| 78   int max_encoding_rate_mismatch; | 78   int max_encoding_rate_mismatch; | 
| 79   int max_time_hit_target; | 79   int max_time_hit_target; | 
| 80   int num_spatial_resizes; | 80   int num_spatial_resizes; | 
| 81   int num_key_frames; | 81   int num_key_frames; | 
| 82 }; | 82 }; | 
| 83 | 83 | 
| 84 // Sequence used is foreman (CIF): may be better to use VGA for resize test. | 84 // Sequence used is foreman (CIF): may be better to use VGA for resize test. | 
| 85 const int kCIFWidth = 352; | 85 const int kCIFWidth = 352; | 
| 86 const int kCIFHeight = 288; | 86 const int kCIFHeight = 288; | 
|  | 87 #if !defined(WEBRTC_IOS) | 
| 87 const int kNbrFramesShort = 100;  // Some tests are run for shorter sequence. | 88 const int kNbrFramesShort = 100;  // Some tests are run for shorter sequence. | 
|  | 89 #endif | 
| 88 const int kNbrFramesLong = 299; | 90 const int kNbrFramesLong = 299; | 
| 89 | 91 | 
| 90 // Parameters from VP8 wrapper, which control target size of key frames. | 92 // Parameters from VP8 wrapper, which control target size of key frames. | 
| 91 const float kInitialBufferSize = 0.5f; | 93 const float kInitialBufferSize = 0.5f; | 
| 92 const float kOptimalBufferSize = 0.6f; | 94 const float kOptimalBufferSize = 0.6f; | 
| 93 const float kScaleKeyFrameSize = 0.5f; | 95 const float kScaleKeyFrameSize = 0.5f; | 
| 94 | 96 | 
| 95 // Integration test for video processor. Encodes+decodes a clip and | 97 // Integration test for video processor. Encodes+decodes a clip and | 
| 96 // writes it to the output directory. After completion, quality metrics | 98 // writes it to the output directory. After completion, quality metrics | 
| 97 // (PSNR and SSIM) and rate control metrics are computed to verify that the | 99 // (PSNR and SSIM) and rate control metrics are computed to verify that the | 
| (...skipping 516 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 614   RateControlMetrics rc_metrics[1]; | 616   RateControlMetrics rc_metrics[1]; | 
| 615   SetRateControlMetrics(rc_metrics, 0, 2, 60, 20, 10, 20, 0, 1); | 617   SetRateControlMetrics(rc_metrics, 0, 2, 60, 20, 10, 20, 0, 1); | 
| 616   ProcessFramesAndVerify(quality_metrics, | 618   ProcessFramesAndVerify(quality_metrics, | 
| 617                          rate_profile, | 619                          rate_profile, | 
| 618                          process_settings, | 620                          process_settings, | 
| 619                          rc_metrics); | 621                          rc_metrics); | 
| 620 } | 622 } | 
| 621 | 623 | 
| 622 #endif  // defined(WEBRTC_VIDEOPROCESSOR_H264_TESTS) | 624 #endif  // defined(WEBRTC_VIDEOPROCESSOR_H264_TESTS) | 
| 623 | 625 | 
|  | 626 // Fails on iOS. See webrtc:4755. | 
|  | 627 #if !defined(WEBRTC_IOS) | 
|  | 628 | 
| 624 // VP9: Run with no packet loss and fixed bitrate. Quality should be very high. | 629 // VP9: Run with no packet loss and fixed bitrate. Quality should be very high. | 
| 625 // One key frame (first frame only) in sequence. Setting |key_frame_interval| | 630 // One key frame (first frame only) in sequence. Setting |key_frame_interval| | 
| 626 // to -1 below means no periodic key frames in test. | 631 // to -1 below means no periodic key frames in test. | 
| 627 TEST_F(VideoProcessorIntegrationTest, Process0PercentPacketLossVP9) { | 632 TEST_F(VideoProcessorIntegrationTest, Process0PercentPacketLossVP9) { | 
| 628   // Bitrate and frame rate profile. | 633   // Bitrate and frame rate profile. | 
| 629   RateProfile rate_profile; | 634   RateProfile rate_profile; | 
| 630   SetRateProfilePars(&rate_profile, 0, 500, 30, 0); | 635   SetRateProfilePars(&rate_profile, 0, 500, 30, 0); | 
| 631   rate_profile.frame_index_rate_update[1] = kNbrFramesShort + 1; | 636   rate_profile.frame_index_rate_update[1] = kNbrFramesShort + 1; | 
| 632   rate_profile.num_frames = kNbrFramesShort; | 637   rate_profile.num_frames = kNbrFramesShort; | 
| 633   // Codec/network settings. | 638   // Codec/network settings. | 
| (...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 835   // Metrics for expected quality. | 840   // Metrics for expected quality. | 
| 836   QualityMetrics quality_metrics; | 841   QualityMetrics quality_metrics; | 
| 837   SetQualityMetrics(&quality_metrics, 19.0, 16.0, 0.50, 0.35); | 842   SetQualityMetrics(&quality_metrics, 19.0, 16.0, 0.50, 0.35); | 
| 838   // Metrics for rate control. | 843   // Metrics for rate control. | 
| 839   RateControlMetrics rc_metrics[1]; | 844   RateControlMetrics rc_metrics[1]; | 
| 840   SetRateControlMetrics(rc_metrics, 0, 0, 40, 20, 10, 15, 0, 1); | 845   SetRateControlMetrics(rc_metrics, 0, 0, 40, 20, 10, 15, 0, 1); | 
| 841   ProcessFramesAndVerify(quality_metrics, rate_profile, process_settings, | 846   ProcessFramesAndVerify(quality_metrics, rate_profile, process_settings, | 
| 842                          rc_metrics); | 847                          rc_metrics); | 
| 843 } | 848 } | 
| 844 | 849 | 
|  | 850 #endif  // !defined(WEBRTC_IOS) | 
|  | 851 | 
| 845 // The tests below are currently disabled for Android. For ARM, the encoder | 852 // The tests below are currently disabled for Android. For ARM, the encoder | 
| 846 // uses |cpu_speed| = 12, as opposed to default |cpu_speed| <= 6 for x86, | 853 // uses |cpu_speed| = 12, as opposed to default |cpu_speed| <= 6 for x86, | 
| 847 // which leads to significantly different quality. The quality and rate control | 854 // which leads to significantly different quality. The quality and rate control | 
| 848 // settings in the tests below are defined for encoder speed setting | 855 // settings in the tests below are defined for encoder speed setting | 
| 849 // |cpu_speed| <= ~6. A number of settings would need to be significantly | 856 // |cpu_speed| <= ~6. A number of settings would need to be significantly | 
| 850 // modified for the |cpu_speed| = 12 case. For now, keep the tests below | 857 // modified for the |cpu_speed| = 12 case. For now, keep the tests below | 
| 851 // disabled on Android. Some quality parameter in the above test has been | 858 // disabled on Android. Some quality parameter in the above test has been | 
| 852 // adjusted to also pass for |cpu_speed| <= 12. | 859 // adjusted to also pass for |cpu_speed| <= 12. | 
| 853 | 860 | 
| 854 // VP8: Run with no packet loss, with varying bitrate (3 rate updates): | 861 // VP8: Run with no packet loss, with varying bitrate (3 rate updates): | 
| 855 // low to high to medium. Check that quality and encoder response to the new | 862 // low to high to medium. Check that quality and encoder response to the new | 
| 856 // target rate/per-frame bandwidth (for each rate update) is within limits. | 863 // target rate/per-frame bandwidth (for each rate update) is within limits. | 
| 857 // One key frame (first frame only) in sequence. | 864 // One key frame (first frame only) in sequence. | 
| 858 #if defined(WEBRTC_ANDROID) | 865 // Too slow to finish before timeout on iOS. See webrtc:4755. | 
|  | 866 #if defined(WEBRTC_ANDROID) || defined(WEBRTC_IOS) | 
| 859 #define MAYBE_ProcessNoLossChangeBitRateVP8 \ | 867 #define MAYBE_ProcessNoLossChangeBitRateVP8 \ | 
| 860   DISABLED_ProcessNoLossChangeBitRateVP8 | 868   DISABLED_ProcessNoLossChangeBitRateVP8 | 
| 861 #else | 869 #else | 
| 862 #define MAYBE_ProcessNoLossChangeBitRateVP8 ProcessNoLossChangeBitRateVP8 | 870 #define MAYBE_ProcessNoLossChangeBitRateVP8 ProcessNoLossChangeBitRateVP8 | 
| 863 #endif | 871 #endif | 
| 864 TEST_F(VideoProcessorIntegrationTest, MAYBE_ProcessNoLossChangeBitRateVP8) { | 872 TEST_F(VideoProcessorIntegrationTest, MAYBE_ProcessNoLossChangeBitRateVP8) { | 
| 865   // Bitrate and frame rate profile. | 873   // Bitrate and frame rate profile. | 
| 866   RateProfile rate_profile; | 874   RateProfile rate_profile; | 
| 867   SetRateProfilePars(&rate_profile, 0, 200, 30, 0); | 875   SetRateProfilePars(&rate_profile, 0, 200, 30, 0); | 
| 868   SetRateProfilePars(&rate_profile, 1, 800, 30, 100); | 876   SetRateProfilePars(&rate_profile, 1, 800, 30, 100); | 
| (...skipping 16 matching lines...) Expand all  Loading... | 
| 885                          rc_metrics); | 893                          rc_metrics); | 
| 886 } | 894 } | 
| 887 | 895 | 
| 888 // VP8: Run with no packet loss, with an update (decrease) in frame rate. | 896 // VP8: Run with no packet loss, with an update (decrease) in frame rate. | 
| 889 // Lower frame rate means higher per-frame-bandwidth, so easier to encode. | 897 // Lower frame rate means higher per-frame-bandwidth, so easier to encode. | 
| 890 // At the bitrate in this test, this means better rate control after the | 898 // At the bitrate in this test, this means better rate control after the | 
| 891 // update(s) to lower frame rate. So expect less frame drops, and max values | 899 // update(s) to lower frame rate. So expect less frame drops, and max values | 
| 892 // for the rate control metrics can be lower. One key frame (first frame only). | 900 // for the rate control metrics can be lower. One key frame (first frame only). | 
| 893 // Note: quality after update should be higher but we currently compute quality | 901 // Note: quality after update should be higher but we currently compute quality | 
| 894 // metrics averaged over whole sequence run. | 902 // metrics averaged over whole sequence run. | 
| 895 #if defined(WEBRTC_ANDROID) | 903 // Too slow to finish before timeout on iOS. See webrtc:4755. | 
|  | 904 #if defined(WEBRTC_ANDROID) || defined(WEBRTC_IOS) | 
| 896 #define MAYBE_ProcessNoLossChangeFrameRateFrameDropVP8 \ | 905 #define MAYBE_ProcessNoLossChangeFrameRateFrameDropVP8 \ | 
| 897   DISABLED_ProcessNoLossChangeFrameRateFrameDropVP8 | 906   DISABLED_ProcessNoLossChangeFrameRateFrameDropVP8 | 
| 898 #else | 907 #else | 
| 899 #define MAYBE_ProcessNoLossChangeFrameRateFrameDropVP8 \ | 908 #define MAYBE_ProcessNoLossChangeFrameRateFrameDropVP8 \ | 
| 900   ProcessNoLossChangeFrameRateFrameDropVP8 | 909   ProcessNoLossChangeFrameRateFrameDropVP8 | 
| 901 #endif | 910 #endif | 
| 902 TEST_F(VideoProcessorIntegrationTest, | 911 TEST_F(VideoProcessorIntegrationTest, | 
| 903        MAYBE_ProcessNoLossChangeFrameRateFrameDropVP8) { | 912        MAYBE_ProcessNoLossChangeFrameRateFrameDropVP8) { | 
| 904   config_.networking_config.packet_loss_probability = 0; | 913   config_.networking_config.packet_loss_probability = 0; | 
| 905   // Bitrate and frame rate profile. | 914   // Bitrate and frame rate profile. | 
| (...skipping 14 matching lines...) Expand all  Loading... | 
| 920   RateControlMetrics rc_metrics[3]; | 929   RateControlMetrics rc_metrics[3]; | 
| 921   SetRateControlMetrics(rc_metrics, 0, 40, 20, 75, 15, 60, 0, 1); | 930   SetRateControlMetrics(rc_metrics, 0, 40, 20, 75, 15, 60, 0, 1); | 
| 922   SetRateControlMetrics(rc_metrics, 1, 10, 0, 25, 10, 35, 0, 0); | 931   SetRateControlMetrics(rc_metrics, 1, 10, 0, 25, 10, 35, 0, 0); | 
| 923   SetRateControlMetrics(rc_metrics, 2, 0, 0, 20, 10, 15, 0, 0); | 932   SetRateControlMetrics(rc_metrics, 2, 0, 0, 20, 10, 15, 0, 0); | 
| 924   ProcessFramesAndVerify(quality_metrics, rate_profile, process_settings, | 933   ProcessFramesAndVerify(quality_metrics, rate_profile, process_settings, | 
| 925                          rc_metrics); | 934                          rc_metrics); | 
| 926 } | 935 } | 
| 927 | 936 | 
| 928 // Run with no packet loss, at low bitrate. During this time we should've | 937 // Run with no packet loss, at low bitrate. During this time we should've | 
| 929 // resized once. Expect 2 key frames generated (first and one for resize). | 938 // resized once. Expect 2 key frames generated (first and one for resize). | 
| 930 #if defined(WEBRTC_ANDROID) | 939 // Too slow to finish before timeout on iOS. See webrtc:4755. | 
|  | 940 #if defined(WEBRTC_ANDROID) || defined(WEBRTC_IOS) | 
| 931 #define MAYBE_ProcessNoLossSpatialResizeFrameDropVP8 \ | 941 #define MAYBE_ProcessNoLossSpatialResizeFrameDropVP8 \ | 
| 932   DISABLED_ProcessNoLossSpatialResizeFrameDropVP8 | 942   DISABLED_ProcessNoLossSpatialResizeFrameDropVP8 | 
| 933 #else | 943 #else | 
| 934 #define MAYBE_ProcessNoLossSpatialResizeFrameDropVP8 \ | 944 #define MAYBE_ProcessNoLossSpatialResizeFrameDropVP8 \ | 
| 935   ProcessNoLossSpatialResizeFrameDropVP8 | 945   ProcessNoLossSpatialResizeFrameDropVP8 | 
| 936 #endif | 946 #endif | 
| 937 TEST_F(VideoProcessorIntegrationTest, | 947 TEST_F(VideoProcessorIntegrationTest, | 
| 938        MAYBE_ProcessNoLossSpatialResizeFrameDropVP8) { | 948        MAYBE_ProcessNoLossSpatialResizeFrameDropVP8) { | 
| 939   config_.networking_config.packet_loss_probability = 0; | 949   config_.networking_config.packet_loss_probability = 0; | 
| 940   // Bitrate and frame rate profile. | 950   // Bitrate and frame rate profile. | 
| (...skipping 13 matching lines...) Expand all  Loading... | 
| 954   SetRateControlMetrics(rc_metrics, 0, 160, 60, 120, 20, 70, 1, 2); | 964   SetRateControlMetrics(rc_metrics, 0, 160, 60, 120, 20, 70, 1, 2); | 
| 955   ProcessFramesAndVerify(quality_metrics, rate_profile, process_settings, | 965   ProcessFramesAndVerify(quality_metrics, rate_profile, process_settings, | 
| 956                          rc_metrics); | 966                          rc_metrics); | 
| 957 } | 967 } | 
| 958 | 968 | 
| 959 // VP8: Run with no packet loss, with 3 temporal layers, with a rate update in | 969 // VP8: Run with no packet loss, with 3 temporal layers, with a rate update in | 
| 960 // the middle of the sequence. The max values for the frame size mismatch and | 970 // the middle of the sequence. The max values for the frame size mismatch and | 
| 961 // encoding rate mismatch are applied to each layer. | 971 // encoding rate mismatch are applied to each layer. | 
| 962 // No dropped frames in this test, and internal spatial resizer is off. | 972 // No dropped frames in this test, and internal spatial resizer is off. | 
| 963 // One key frame (first frame only) in sequence, so no spatial resizing. | 973 // One key frame (first frame only) in sequence, so no spatial resizing. | 
| 964 #if defined(WEBRTC_ANDROID) | 974 // Too slow to finish before timeout on iOS. See webrtc:4755. | 
|  | 975 #if defined(WEBRTC_ANDROID) || defined(WEBRTC_IOS) | 
| 965 #define MAYBE_ProcessNoLossTemporalLayersVP8 \ | 976 #define MAYBE_ProcessNoLossTemporalLayersVP8 \ | 
| 966   DISABLED_ProcessNoLossTemporalLayersVP8 | 977   DISABLED_ProcessNoLossTemporalLayersVP8 | 
| 967 #else | 978 #else | 
| 968 #define MAYBE_ProcessNoLossTemporalLayersVP8 ProcessNoLossTemporalLayersVP8 | 979 #define MAYBE_ProcessNoLossTemporalLayersVP8 ProcessNoLossTemporalLayersVP8 | 
| 969 #endif | 980 #endif | 
| 970 TEST_F(VideoProcessorIntegrationTest, MAYBE_ProcessNoLossTemporalLayersVP8) { | 981 TEST_F(VideoProcessorIntegrationTest, MAYBE_ProcessNoLossTemporalLayersVP8) { | 
| 971   config_.networking_config.packet_loss_probability = 0; | 982   config_.networking_config.packet_loss_probability = 0; | 
| 972   // Bitrate and frame rate profile. | 983   // Bitrate and frame rate profile. | 
| 973   RateProfile rate_profile; | 984   RateProfile rate_profile; | 
| 974   SetRateProfilePars(&rate_profile, 0, 200, 30, 0); | 985   SetRateProfilePars(&rate_profile, 0, 200, 30, 0); | 
| 975   SetRateProfilePars(&rate_profile, 1, 400, 30, 150); | 986   SetRateProfilePars(&rate_profile, 1, 400, 30, 150); | 
| 976   rate_profile.frame_index_rate_update[2] = kNbrFramesLong + 1; | 987   rate_profile.frame_index_rate_update[2] = kNbrFramesLong + 1; | 
| 977   rate_profile.num_frames = kNbrFramesLong; | 988   rate_profile.num_frames = kNbrFramesLong; | 
| 978   // Codec/network settings. | 989   // Codec/network settings. | 
| 979   CodecConfigPars process_settings; | 990   CodecConfigPars process_settings; | 
| 980   SetCodecParameters(&process_settings, kVideoCodecVP8, 0.0f, -1, 3, false, | 991   SetCodecParameters(&process_settings, kVideoCodecVP8, 0.0f, -1, 3, false, | 
| 981                      true, true, false); | 992                      true, true, false); | 
| 982   // Metrics for expected quality. | 993   // Metrics for expected quality. | 
| 983   QualityMetrics quality_metrics; | 994   QualityMetrics quality_metrics; | 
| 984   SetQualityMetrics(&quality_metrics, 32.5, 30.0, 0.85, 0.80); | 995   SetQualityMetrics(&quality_metrics, 32.5, 30.0, 0.85, 0.80); | 
| 985   // Metrics for rate control. | 996   // Metrics for rate control. | 
| 986   RateControlMetrics rc_metrics[2]; | 997   RateControlMetrics rc_metrics[2]; | 
| 987   SetRateControlMetrics(rc_metrics, 0, 0, 20, 30, 10, 10, 0, 1); | 998   SetRateControlMetrics(rc_metrics, 0, 0, 20, 30, 10, 10, 0, 1); | 
| 988   SetRateControlMetrics(rc_metrics, 1, 0, 0, 30, 15, 10, 0, 0); | 999   SetRateControlMetrics(rc_metrics, 1, 0, 0, 30, 15, 10, 0, 0); | 
| 989   ProcessFramesAndVerify(quality_metrics, rate_profile, process_settings, | 1000   ProcessFramesAndVerify(quality_metrics, rate_profile, process_settings, | 
| 990                          rc_metrics); | 1001                          rc_metrics); | 
| 991 } | 1002 } | 
| 992 }  // namespace webrtc | 1003 }  // namespace webrtc | 
| OLD | NEW | 
|---|