| 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 |
| 11 #include "webrtc/modules/video_coding/codecs/test/videoprocessor_integrationtest
.h" | 11 #include "webrtc/modules/video_coding/codecs/test/videoprocessor_integrationtest
.h" |
| 12 | 12 |
| 13 namespace webrtc { | 13 namespace webrtc { |
| 14 namespace test { | 14 namespace test { |
| 15 | 15 |
| 16 namespace { | 16 namespace { |
| 17 | 17 |
| 18 // In these correctness tests, we only consider SW codecs. | 18 // In these correctness tests, we only consider SW codecs. |
| 19 const bool kHwCodec = false; | 19 const bool kHwCodec = false; |
| 20 const bool kBatchMode = false; |
| 21 const bool kVerboseLogging = false; |
| 20 | 22 |
| 21 // Only allow encoder/decoder to use single core, for predictability. | 23 // Only allow encoder/decoder to use single core, for predictability. |
| 22 const bool kUseSingleCore = true; | 24 const bool kUseSingleCore = true; |
| 23 | 25 |
| 24 // Default codec setting is on. | 26 // Default codec setting is on. |
| 25 const bool kResilienceOn = true; | 27 const bool kResilienceOn = true; |
| 26 | 28 |
| 29 // Default sequence is foreman (CIF): may be better to use VGA for resize test. |
| 30 const int kCifWidth = 352; |
| 31 const int kCifHeight = 288; |
| 32 const char kForemanCif[] = "foreman_cif"; |
| 33 |
| 27 } // namespace | 34 } // namespace |
| 28 | 35 |
| 29 #if defined(WEBRTC_VIDEOPROCESSOR_H264_TESTS) | 36 #if defined(WEBRTC_VIDEOPROCESSOR_H264_TESTS) |
| 30 | 37 |
| 31 // H264: Run with no packet loss and fixed bitrate. Quality should be very high. | 38 // H264: Run with no packet loss and fixed bitrate. Quality should be very high. |
| 32 // Note(hbos): The PacketManipulatorImpl code used to simulate packet loss in | 39 // Note(hbos): The PacketManipulatorImpl code used to simulate packet loss in |
| 33 // these unittests appears to drop "packets" in a way that is not compatible | 40 // these unittests appears to drop "packets" in a way that is not compatible |
| 34 // with H264. Therefore ProcessXPercentPacketLossH264, X != 0, unittests have | 41 // with H264. Therefore ProcessXPercentPacketLossH264, X != 0, unittests have |
| 35 // not been added. | 42 // not been added. |
| 36 TEST_F(VideoProcessorIntegrationTest, Process0PercentPacketLossH264) { | 43 TEST_F(VideoProcessorIntegrationTest, Process0PercentPacketLossH264) { |
| 37 // Bit rate and frame rate profile. | 44 // Bit rate and frame rate profile. |
| 38 RateProfile rate_profile; | 45 RateProfile rate_profile; |
| 39 SetRateProfile(&rate_profile, 0, 500, 30, 0); | 46 SetRateProfile(&rate_profile, 0, 500, 30, 0); |
| 40 rate_profile.frame_index_rate_update[1] = kNumFramesShort + 1; | 47 rate_profile.frame_index_rate_update[1] = kNumFramesShort + 1; |
| 41 rate_profile.num_frames = kNumFramesShort; | 48 rate_profile.num_frames = kNumFramesShort; |
| 42 // Codec/network settings. | 49 // Codec/network settings. |
| 43 CodecParams process_settings; | 50 ProcessParams process_settings(kHwCodec, kUseSingleCore, 0.0f, -1, |
| 44 SetCodecParams(&process_settings, kVideoCodecH264, kHwCodec, kUseSingleCore, | 51 kForemanCif, kVerboseLogging, kBatchMode); |
| 45 0.0f, -1, 1, false, false, true, false, kResilienceOn); | 52 SetCodecSettings(&config_, &codec_settings_, kVideoCodecH264, 1, false, false, |
| 53 true, false, kResilienceOn, kCifWidth, kCifHeight); |
| 46 // Thresholds for expected quality. | 54 // Thresholds for expected quality. |
| 47 QualityThresholds quality_thresholds; | 55 QualityThresholds quality_thresholds; |
| 48 SetQualityThresholds(&quality_thresholds, 35.0, 25.0, 0.93, 0.70); | 56 SetQualityThresholds(&quality_thresholds, 35.0, 25.0, 0.93, 0.70); |
| 49 // Thresholds for rate control. | 57 // Thresholds for rate control. |
| 50 RateControlThresholds rc_thresholds[1]; | 58 RateControlThresholds rc_thresholds[1]; |
| 51 SetRateControlThresholds(rc_thresholds, 0, 2, 60, 20, 10, 20, 0, 1); | 59 SetRateControlThresholds(rc_thresholds, 0, 2, 60, 20, 10, 20, 0, 1); |
| 52 ProcessFramesAndVerify(quality_thresholds, rate_profile, process_settings, | 60 ProcessFramesAndVerify(quality_thresholds, rate_profile, process_settings, |
| 53 rc_thresholds, nullptr /* visualization_params */); | 61 rc_thresholds, nullptr /* visualization_params */); |
| 54 } | 62 } |
| 55 | 63 |
| 56 #endif // defined(WEBRTC_VIDEOPROCESSOR_H264_TESTS) | 64 #endif // defined(WEBRTC_VIDEOPROCESSOR_H264_TESTS) |
| 57 | 65 |
| 58 // Fails on iOS. See webrtc:4755. | 66 // Fails on iOS. See webrtc:4755. |
| 59 #if !defined(WEBRTC_IOS) | 67 #if !defined(WEBRTC_IOS) |
| 60 | 68 |
| 61 #if !defined(RTC_DISABLE_VP9) | 69 #if !defined(RTC_DISABLE_VP9) |
| 62 // VP9: Run with no packet loss and fixed bitrate. Quality should be very high. | 70 // VP9: Run with no packet loss and fixed bitrate. Quality should be very high. |
| 63 // One key frame (first frame only) in sequence. Setting |key_frame_interval| | 71 // One key frame (first frame only) in sequence. Setting |key_frame_interval| |
| 64 // to -1 below means no periodic key frames in test. | 72 // to -1 below means no periodic key frames in test. |
| 65 TEST_F(VideoProcessorIntegrationTest, Process0PercentPacketLossVP9) { | 73 TEST_F(VideoProcessorIntegrationTest, Process0PercentPacketLossVP9) { |
| 66 // Bit rate and frame rate profile. | 74 // Bit rate and frame rate profile. |
| 67 RateProfile rate_profile; | 75 RateProfile rate_profile; |
| 68 SetRateProfile(&rate_profile, 0, 500, 30, 0); | 76 SetRateProfile(&rate_profile, 0, 500, 30, 0); |
| 69 rate_profile.frame_index_rate_update[1] = kNumFramesShort + 1; | 77 rate_profile.frame_index_rate_update[1] = kNumFramesShort + 1; |
| 70 rate_profile.num_frames = kNumFramesShort; | 78 rate_profile.num_frames = kNumFramesShort; |
| 71 // Codec/network settings. | 79 // Codec/network settings. |
| 72 CodecParams process_settings; | 80 ProcessParams process_settings(kHwCodec, kUseSingleCore, 0.0f, -1, |
| 73 SetCodecParams(&process_settings, kVideoCodecVP9, kHwCodec, kUseSingleCore, | 81 kForemanCif, kVerboseLogging, kBatchMode); |
| 74 0.0f, -1, 1, false, false, true, false, kResilienceOn); | 82 SetCodecSettings(&config_, &codec_settings_, kVideoCodecVP9, 1, false, false, |
| 83 true, false, kResilienceOn, kCifWidth, kCifHeight); |
| 75 // Thresholds for expected quality. | 84 // Thresholds for expected quality. |
| 76 QualityThresholds quality_thresholds; | 85 QualityThresholds quality_thresholds; |
| 77 SetQualityThresholds(&quality_thresholds, 37.0, 36.0, 0.93, 0.92); | 86 SetQualityThresholds(&quality_thresholds, 37.0, 36.0, 0.93, 0.92); |
| 78 // Thresholds for rate control. | 87 // Thresholds for rate control. |
| 79 RateControlThresholds rc_thresholds[1]; | 88 RateControlThresholds rc_thresholds[1]; |
| 80 SetRateControlThresholds(rc_thresholds, 0, 0, 40, 20, 10, 20, 0, 1); | 89 SetRateControlThresholds(rc_thresholds, 0, 0, 40, 20, 10, 20, 0, 1); |
| 81 ProcessFramesAndVerify(quality_thresholds, rate_profile, process_settings, | 90 ProcessFramesAndVerify(quality_thresholds, rate_profile, process_settings, |
| 82 rc_thresholds, nullptr /* visualization_params */); | 91 rc_thresholds, nullptr /* visualization_params */); |
| 83 } | 92 } |
| 84 | 93 |
| 85 // VP9: Run with 5% packet loss and fixed bitrate. Quality should be a bit | 94 // VP9: Run with 5% packet loss and fixed bitrate. Quality should be a bit |
| 86 // lower. One key frame (first frame only) in sequence. | 95 // lower. One key frame (first frame only) in sequence. |
| 87 TEST_F(VideoProcessorIntegrationTest, Process5PercentPacketLossVP9) { | 96 TEST_F(VideoProcessorIntegrationTest, Process5PercentPacketLossVP9) { |
| 88 // Bit rate and frame rate profile. | 97 // Bit rate and frame rate profile. |
| 89 RateProfile rate_profile; | 98 RateProfile rate_profile; |
| 90 SetRateProfile(&rate_profile, 0, 500, 30, 0); | 99 SetRateProfile(&rate_profile, 0, 500, 30, 0); |
| 91 rate_profile.frame_index_rate_update[1] = kNumFramesShort + 1; | 100 rate_profile.frame_index_rate_update[1] = kNumFramesShort + 1; |
| 92 rate_profile.num_frames = kNumFramesShort; | 101 rate_profile.num_frames = kNumFramesShort; |
| 93 // Codec/network settings. | 102 // Codec/network settings. |
| 94 CodecParams process_settings; | 103 ProcessParams process_settings(kHwCodec, kUseSingleCore, 0.05f, -1, |
| 95 SetCodecParams(&process_settings, kVideoCodecVP9, kHwCodec, kUseSingleCore, | 104 kForemanCif, kVerboseLogging, kBatchMode); |
| 96 0.05f, -1, 1, false, false, true, false, kResilienceOn); | 105 SetCodecSettings(&config_, &codec_settings_, kVideoCodecVP9, 1, false, false, |
| 106 true, false, kResilienceOn, kCifWidth, kCifHeight); |
| 97 // Thresholds for expected quality. | 107 // Thresholds for expected quality. |
| 98 QualityThresholds quality_thresholds; | 108 QualityThresholds quality_thresholds; |
| 99 SetQualityThresholds(&quality_thresholds, 17.0, 14.0, 0.45, 0.36); | 109 SetQualityThresholds(&quality_thresholds, 17.0, 14.0, 0.45, 0.36); |
| 100 // Thresholds for rate control. | 110 // Thresholds for rate control. |
| 101 RateControlThresholds rc_thresholds[1]; | 111 RateControlThresholds rc_thresholds[1]; |
| 102 SetRateControlThresholds(rc_thresholds, 0, 0, 40, 20, 10, 20, 0, 1); | 112 SetRateControlThresholds(rc_thresholds, 0, 0, 40, 20, 10, 20, 0, 1); |
| 103 ProcessFramesAndVerify(quality_thresholds, rate_profile, process_settings, | 113 ProcessFramesAndVerify(quality_thresholds, rate_profile, process_settings, |
| 104 rc_thresholds, nullptr /* visualization_params */); | 114 rc_thresholds, nullptr /* visualization_params */); |
| 105 } | 115 } |
| 106 | 116 |
| 107 // VP9: Run with no packet loss, with varying bitrate (3 rate updates): | 117 // VP9: Run with no packet loss, with varying bitrate (3 rate updates): |
| 108 // low to high to medium. Check that quality and encoder response to the new | 118 // low to high to medium. Check that quality and encoder response to the new |
| 109 // target rate/per-frame bandwidth (for each rate update) is within limits. | 119 // target rate/per-frame bandwidth (for each rate update) is within limits. |
| 110 // One key frame (first frame only) in sequence. | 120 // One key frame (first frame only) in sequence. |
| 111 TEST_F(VideoProcessorIntegrationTest, ProcessNoLossChangeBitRateVP9) { | 121 TEST_F(VideoProcessorIntegrationTest, ProcessNoLossChangeBitRateVP9) { |
| 112 // Bit rate and frame rate profile. | 122 // Bit rate and frame rate profile. |
| 113 RateProfile rate_profile; | 123 RateProfile rate_profile; |
| 114 SetRateProfile(&rate_profile, 0, 200, 30, 0); | 124 SetRateProfile(&rate_profile, 0, 200, 30, 0); |
| 115 SetRateProfile(&rate_profile, 1, 700, 30, 100); | 125 SetRateProfile(&rate_profile, 1, 700, 30, 100); |
| 116 SetRateProfile(&rate_profile, 2, 500, 30, 200); | 126 SetRateProfile(&rate_profile, 2, 500, 30, 200); |
| 117 rate_profile.frame_index_rate_update[3] = kNumFramesLong + 1; | 127 rate_profile.frame_index_rate_update[3] = kNumFramesLong + 1; |
| 118 rate_profile.num_frames = kNumFramesLong; | 128 rate_profile.num_frames = kNumFramesLong; |
| 119 // Codec/network settings. | 129 // Codec/network settings. |
| 120 CodecParams process_settings; | 130 ProcessParams process_settings(kHwCodec, kUseSingleCore, 0.0f, -1, |
| 121 SetCodecParams(&process_settings, kVideoCodecVP9, kHwCodec, kUseSingleCore, | 131 kForemanCif, kVerboseLogging, kBatchMode); |
| 122 0.0f, -1, 1, false, false, true, false, kResilienceOn); | 132 SetCodecSettings(&config_, &codec_settings_, kVideoCodecVP9, 1, false, false, |
| 133 true, false, kResilienceOn, kCifWidth, kCifHeight); |
| 123 // Thresholds for expected quality. | 134 // Thresholds for expected quality. |
| 124 QualityThresholds quality_thresholds; | 135 QualityThresholds quality_thresholds; |
| 125 SetQualityThresholds(&quality_thresholds, 35.5, 30.0, 0.90, 0.85); | 136 SetQualityThresholds(&quality_thresholds, 35.5, 30.0, 0.90, 0.85); |
| 126 // Thresholds for rate control. | 137 // Thresholds for rate control. |
| 127 RateControlThresholds rc_thresholds[3]; | 138 RateControlThresholds rc_thresholds[3]; |
| 128 SetRateControlThresholds(rc_thresholds, 0, 0, 30, 20, 20, 35, 0, 1); | 139 SetRateControlThresholds(rc_thresholds, 0, 0, 30, 20, 20, 35, 0, 1); |
| 129 SetRateControlThresholds(rc_thresholds, 1, 2, 0, 20, 20, 60, 0, 0); | 140 SetRateControlThresholds(rc_thresholds, 1, 2, 0, 20, 20, 60, 0, 0); |
| 130 SetRateControlThresholds(rc_thresholds, 2, 0, 0, 25, 20, 40, 0, 0); | 141 SetRateControlThresholds(rc_thresholds, 2, 0, 0, 25, 20, 40, 0, 0); |
| 131 ProcessFramesAndVerify(quality_thresholds, rate_profile, process_settings, | 142 ProcessFramesAndVerify(quality_thresholds, rate_profile, process_settings, |
| 132 rc_thresholds, nullptr /* visualization_params */); | 143 rc_thresholds, nullptr /* visualization_params */); |
| (...skipping 10 matching lines...) Expand all Loading... |
| 143 ProcessNoLossChangeFrameRateFrameDropVP9) { | 154 ProcessNoLossChangeFrameRateFrameDropVP9) { |
| 144 config_.networking_config.packet_loss_probability = 0; | 155 config_.networking_config.packet_loss_probability = 0; |
| 145 // Bit rate and frame rate profile. | 156 // Bit rate and frame rate profile. |
| 146 RateProfile rate_profile; | 157 RateProfile rate_profile; |
| 147 SetRateProfile(&rate_profile, 0, 100, 24, 0); | 158 SetRateProfile(&rate_profile, 0, 100, 24, 0); |
| 148 SetRateProfile(&rate_profile, 1, 100, 15, 100); | 159 SetRateProfile(&rate_profile, 1, 100, 15, 100); |
| 149 SetRateProfile(&rate_profile, 2, 100, 10, 200); | 160 SetRateProfile(&rate_profile, 2, 100, 10, 200); |
| 150 rate_profile.frame_index_rate_update[3] = kNumFramesLong + 1; | 161 rate_profile.frame_index_rate_update[3] = kNumFramesLong + 1; |
| 151 rate_profile.num_frames = kNumFramesLong; | 162 rate_profile.num_frames = kNumFramesLong; |
| 152 // Codec/network settings. | 163 // Codec/network settings. |
| 153 CodecParams process_settings; | 164 ProcessParams process_settings(kHwCodec, kUseSingleCore, 0.0f, -1, |
| 154 SetCodecParams(&process_settings, kVideoCodecVP9, kHwCodec, kUseSingleCore, | 165 kForemanCif, kVerboseLogging, kBatchMode); |
| 155 0.0f, -1, 1, false, false, true, false, kResilienceOn); | 166 SetCodecSettings(&config_, &codec_settings_, kVideoCodecVP9, 1, false, false, |
| 167 true, false, kResilienceOn, kCifWidth, kCifHeight); |
| 156 // Thresholds for expected quality. | 168 // Thresholds for expected quality. |
| 157 QualityThresholds quality_thresholds; | 169 QualityThresholds quality_thresholds; |
| 158 SetQualityThresholds(&quality_thresholds, 31.5, 18.0, 0.80, 0.43); | 170 SetQualityThresholds(&quality_thresholds, 31.5, 18.0, 0.80, 0.43); |
| 159 // Thresholds for rate control. | 171 // Thresholds for rate control. |
| 160 RateControlThresholds rc_thresholds[3]; | 172 RateControlThresholds rc_thresholds[3]; |
| 161 SetRateControlThresholds(rc_thresholds, 0, 45, 50, 95, 15, 45, 0, 1); | 173 SetRateControlThresholds(rc_thresholds, 0, 45, 50, 95, 15, 45, 0, 1); |
| 162 SetRateControlThresholds(rc_thresholds, 1, 20, 0, 50, 10, 30, 0, 0); | 174 SetRateControlThresholds(rc_thresholds, 1, 20, 0, 50, 10, 30, 0, 0); |
| 163 SetRateControlThresholds(rc_thresholds, 2, 5, 0, 30, 5, 25, 0, 0); | 175 SetRateControlThresholds(rc_thresholds, 2, 5, 0, 30, 5, 25, 0, 0); |
| 164 ProcessFramesAndVerify(quality_thresholds, rate_profile, process_settings, | 176 ProcessFramesAndVerify(quality_thresholds, rate_profile, process_settings, |
| 165 rc_thresholds, nullptr /* visualization_params */); | 177 rc_thresholds, nullptr /* visualization_params */); |
| 166 } | 178 } |
| 167 | 179 |
| 168 // VP9: Run with no packet loss and denoiser on. One key frame (first frame). | 180 // VP9: Run with no packet loss and denoiser on. One key frame (first frame). |
| 169 TEST_F(VideoProcessorIntegrationTest, ProcessNoLossDenoiserOnVP9) { | 181 TEST_F(VideoProcessorIntegrationTest, ProcessNoLossDenoiserOnVP9) { |
| 170 // Bit rate and frame rate profile. | 182 // Bit rate and frame rate profile. |
| 171 RateProfile rate_profile; | 183 RateProfile rate_profile; |
| 172 SetRateProfile(&rate_profile, 0, 500, 30, 0); | 184 SetRateProfile(&rate_profile, 0, 500, 30, 0); |
| 173 rate_profile.frame_index_rate_update[1] = kNumFramesShort + 1; | 185 rate_profile.frame_index_rate_update[1] = kNumFramesShort + 1; |
| 174 rate_profile.num_frames = kNumFramesShort; | 186 rate_profile.num_frames = kNumFramesShort; |
| 175 // Codec/network settings. | 187 // Codec/network settings. |
| 176 CodecParams process_settings; | 188 ProcessParams process_settings(kHwCodec, kUseSingleCore, 0.0f, -1, |
| 177 SetCodecParams(&process_settings, kVideoCodecVP9, kHwCodec, kUseSingleCore, | 189 kForemanCif, kVerboseLogging, kBatchMode); |
| 178 0.0f, -1, 1, false, true, true, false, kResilienceOn); | 190 SetCodecSettings(&config_, &codec_settings_, kVideoCodecVP9, 1, false, true, |
| 191 true, false, kResilienceOn, kCifWidth, kCifHeight); |
| 179 // Thresholds for expected quality. | 192 // Thresholds for expected quality. |
| 180 QualityThresholds quality_thresholds; | 193 QualityThresholds quality_thresholds; |
| 181 SetQualityThresholds(&quality_thresholds, 36.8, 35.8, 0.92, 0.91); | 194 SetQualityThresholds(&quality_thresholds, 36.8, 35.8, 0.92, 0.91); |
| 182 // Thresholds for rate control. | 195 // Thresholds for rate control. |
| 183 RateControlThresholds rc_thresholds[1]; | 196 RateControlThresholds rc_thresholds[1]; |
| 184 SetRateControlThresholds(rc_thresholds, 0, 0, 40, 20, 10, 20, 0, 1); | 197 SetRateControlThresholds(rc_thresholds, 0, 0, 40, 20, 10, 20, 0, 1); |
| 185 ProcessFramesAndVerify(quality_thresholds, rate_profile, process_settings, | 198 ProcessFramesAndVerify(quality_thresholds, rate_profile, process_settings, |
| 186 rc_thresholds, nullptr /* visualization_params */); | 199 rc_thresholds, nullptr /* visualization_params */); |
| 187 } | 200 } |
| 188 | 201 |
| 189 // Run with no packet loss, at low bitrate. | 202 // Run with no packet loss, at low bitrate. |
| 190 // spatial_resize is on, for this low bitrate expect one resize in sequence. | 203 // spatial_resize is on, for this low bitrate expect one resize in sequence. |
| 191 // Resize happens on delta frame. Expect only one key frame (first frame). | 204 // Resize happens on delta frame. Expect only one key frame (first frame). |
| 192 TEST_F(VideoProcessorIntegrationTest, | 205 TEST_F(VideoProcessorIntegrationTest, |
| 193 DISABLED_ProcessNoLossSpatialResizeFrameDropVP9) { | 206 DISABLED_ProcessNoLossSpatialResizeFrameDropVP9) { |
| 194 config_.networking_config.packet_loss_probability = 0; | 207 config_.networking_config.packet_loss_probability = 0; |
| 195 // Bit rate and frame rate profile. | 208 // Bit rate and frame rate profile. |
| 196 RateProfile rate_profile; | 209 RateProfile rate_profile; |
| 197 SetRateProfile(&rate_profile, 0, 50, 30, 0); | 210 SetRateProfile(&rate_profile, 0, 50, 30, 0); |
| 198 rate_profile.frame_index_rate_update[1] = kNumFramesLong + 1; | 211 rate_profile.frame_index_rate_update[1] = kNumFramesLong + 1; |
| 199 rate_profile.num_frames = kNumFramesLong; | 212 rate_profile.num_frames = kNumFramesLong; |
| 200 // Codec/network settings. | 213 // Codec/network settings. |
| 201 CodecParams process_settings; | 214 ProcessParams process_settings(kHwCodec, kUseSingleCore, 0.0f, -1, |
| 202 SetCodecParams(&process_settings, kVideoCodecVP9, kHwCodec, kUseSingleCore, | 215 kForemanCif, kVerboseLogging, kBatchMode); |
| 203 0.0f, -1, 1, false, false, true, true, kResilienceOn); | 216 SetCodecSettings(&config_, &codec_settings_, kVideoCodecVP9, 1, false, false, |
| 217 true, true, kResilienceOn, kCifWidth, kCifHeight); |
| 204 // Thresholds for expected quality. | 218 // Thresholds for expected quality. |
| 205 QualityThresholds quality_thresholds; | 219 QualityThresholds quality_thresholds; |
| 206 SetQualityThresholds(&quality_thresholds, 24.0, 13.0, 0.65, 0.37); | 220 SetQualityThresholds(&quality_thresholds, 24.0, 13.0, 0.65, 0.37); |
| 207 // Thresholds for rate control. | 221 // Thresholds for rate control. |
| 208 RateControlThresholds rc_thresholds[1]; | 222 RateControlThresholds rc_thresholds[1]; |
| 209 SetRateControlThresholds(rc_thresholds, 0, 228, 70, 160, 15, 80, 1, 1); | 223 SetRateControlThresholds(rc_thresholds, 0, 228, 70, 160, 15, 80, 1, 1); |
| 210 ProcessFramesAndVerify(quality_thresholds, rate_profile, process_settings, | 224 ProcessFramesAndVerify(quality_thresholds, rate_profile, process_settings, |
| 211 rc_thresholds, nullptr /* visualization_params */); | 225 rc_thresholds, nullptr /* visualization_params */); |
| 212 } | 226 } |
| 213 | 227 |
| 214 // TODO(marpan): Add temporal layer test for VP9, once changes are in | 228 // TODO(marpan): Add temporal layer test for VP9, once changes are in |
| 215 // vp9 wrapper for this. | 229 // vp9 wrapper for this. |
| 216 | 230 |
| 217 #endif // !defined(RTC_DISABLE_VP9) | 231 #endif // !defined(RTC_DISABLE_VP9) |
| 218 | 232 |
| 219 // VP8: Run with no packet loss and fixed bitrate. Quality should be very high. | 233 // VP8: Run with no packet loss and fixed bitrate. Quality should be very high. |
| 220 // One key frame (first frame only) in sequence. Setting |key_frame_interval| | 234 // One key frame (first frame only) in sequence. Setting |key_frame_interval| |
| 221 // to -1 below means no periodic key frames in test. | 235 // to -1 below means no periodic key frames in test. |
| 222 TEST_F(VideoProcessorIntegrationTest, ProcessZeroPacketLoss) { | 236 TEST_F(VideoProcessorIntegrationTest, ProcessZeroPacketLoss) { |
| 223 // Bit rate and frame rate profile. | 237 // Bit rate and frame rate profile. |
| 224 RateProfile rate_profile; | 238 RateProfile rate_profile; |
| 225 SetRateProfile(&rate_profile, 0, 500, 30, 0); | 239 SetRateProfile(&rate_profile, 0, 500, 30, 0); |
| 226 rate_profile.frame_index_rate_update[1] = kNumFramesShort + 1; | 240 rate_profile.frame_index_rate_update[1] = kNumFramesShort + 1; |
| 227 rate_profile.num_frames = kNumFramesShort; | 241 rate_profile.num_frames = kNumFramesShort; |
| 228 // Codec/network settings. | 242 // Codec/network settings. |
| 229 CodecParams process_settings; | 243 ProcessParams process_settings(kHwCodec, kUseSingleCore, 0.0f, -1, |
| 230 SetCodecParams(&process_settings, kVideoCodecVP8, kHwCodec, kUseSingleCore, | 244 kForemanCif, kVerboseLogging, kBatchMode); |
| 231 0.0f, -1, 1, false, true, true, false, kResilienceOn); | 245 SetCodecSettings(&config_, &codec_settings_, kVideoCodecVP8, 1, false, true, |
| 246 true, false, kResilienceOn, kCifWidth, kCifHeight); |
| 232 // Thresholds for expected quality. | 247 // Thresholds for expected quality. |
| 233 QualityThresholds quality_thresholds; | 248 QualityThresholds quality_thresholds; |
| 234 SetQualityThresholds(&quality_thresholds, 34.95, 33.0, 0.90, 0.89); | 249 SetQualityThresholds(&quality_thresholds, 34.95, 33.0, 0.90, 0.89); |
| 235 // Thresholds for rate control. | 250 // Thresholds for rate control. |
| 236 RateControlThresholds rc_thresholds[1]; | 251 RateControlThresholds rc_thresholds[1]; |
| 237 SetRateControlThresholds(rc_thresholds, 0, 0, 40, 20, 10, 15, 0, 1); | 252 SetRateControlThresholds(rc_thresholds, 0, 0, 40, 20, 10, 15, 0, 1); |
| 238 ProcessFramesAndVerify(quality_thresholds, rate_profile, process_settings, | 253 ProcessFramesAndVerify(quality_thresholds, rate_profile, process_settings, |
| 239 rc_thresholds, nullptr /* visualization_params */); | 254 rc_thresholds, nullptr /* visualization_params */); |
| 240 } | 255 } |
| 241 | 256 |
| 242 // VP8: Run with 5% packet loss and fixed bitrate. Quality should be a bit | 257 // VP8: Run with 5% packet loss and fixed bitrate. Quality should be a bit |
| 243 // lower. One key frame (first frame only) in sequence. | 258 // lower. One key frame (first frame only) in sequence. |
| 244 TEST_F(VideoProcessorIntegrationTest, Process5PercentPacketLoss) { | 259 TEST_F(VideoProcessorIntegrationTest, Process5PercentPacketLoss) { |
| 245 // Bit rate and frame rate profile. | 260 // Bit rate and frame rate profile. |
| 246 RateProfile rate_profile; | 261 RateProfile rate_profile; |
| 247 SetRateProfile(&rate_profile, 0, 500, 30, 0); | 262 SetRateProfile(&rate_profile, 0, 500, 30, 0); |
| 248 rate_profile.frame_index_rate_update[1] = kNumFramesShort + 1; | 263 rate_profile.frame_index_rate_update[1] = kNumFramesShort + 1; |
| 249 rate_profile.num_frames = kNumFramesShort; | 264 rate_profile.num_frames = kNumFramesShort; |
| 250 // Codec/network settings. | 265 // Codec/network settings. |
| 251 CodecParams process_settings; | 266 ProcessParams process_settings(kHwCodec, kUseSingleCore, 0.05f, -1, |
| 252 SetCodecParams(&process_settings, kVideoCodecVP8, kHwCodec, kUseSingleCore, | 267 kForemanCif, kVerboseLogging, kBatchMode); |
| 253 0.05f, -1, 1, false, true, true, false, kResilienceOn); | 268 SetCodecSettings(&config_, &codec_settings_, kVideoCodecVP8, 1, false, true, |
| 269 true, false, kResilienceOn, kCifWidth, kCifHeight); |
| 254 // Thresholds for expected quality. | 270 // Thresholds for expected quality. |
| 255 QualityThresholds quality_thresholds; | 271 QualityThresholds quality_thresholds; |
| 256 SetQualityThresholds(&quality_thresholds, 20.0, 16.0, 0.60, 0.40); | 272 SetQualityThresholds(&quality_thresholds, 20.0, 16.0, 0.60, 0.40); |
| 257 // Thresholds for rate control. | 273 // Thresholds for rate control. |
| 258 RateControlThresholds rc_thresholds[1]; | 274 RateControlThresholds rc_thresholds[1]; |
| 259 SetRateControlThresholds(rc_thresholds, 0, 0, 40, 20, 10, 15, 0, 1); | 275 SetRateControlThresholds(rc_thresholds, 0, 0, 40, 20, 10, 15, 0, 1); |
| 260 ProcessFramesAndVerify(quality_thresholds, rate_profile, process_settings, | 276 ProcessFramesAndVerify(quality_thresholds, rate_profile, process_settings, |
| 261 rc_thresholds, nullptr /* visualization_params */); | 277 rc_thresholds, nullptr /* visualization_params */); |
| 262 } | 278 } |
| 263 | 279 |
| 264 // VP8: Run with 10% packet loss and fixed bitrate. Quality should be lower. | 280 // VP8: Run with 10% packet loss and fixed bitrate. Quality should be lower. |
| 265 // One key frame (first frame only) in sequence. | 281 // One key frame (first frame only) in sequence. |
| 266 TEST_F(VideoProcessorIntegrationTest, Process10PercentPacketLoss) { | 282 TEST_F(VideoProcessorIntegrationTest, Process10PercentPacketLoss) { |
| 267 // Bit rate and frame rate profile. | 283 // Bit rate and frame rate profile. |
| 268 RateProfile rate_profile; | 284 RateProfile rate_profile; |
| 269 SetRateProfile(&rate_profile, 0, 500, 30, 0); | 285 SetRateProfile(&rate_profile, 0, 500, 30, 0); |
| 270 rate_profile.frame_index_rate_update[1] = kNumFramesShort + 1; | 286 rate_profile.frame_index_rate_update[1] = kNumFramesShort + 1; |
| 271 rate_profile.num_frames = kNumFramesShort; | 287 rate_profile.num_frames = kNumFramesShort; |
| 272 // Codec/network settings. | 288 // Codec/network settings. |
| 273 CodecParams process_settings; | 289 ProcessParams process_settings(kHwCodec, kUseSingleCore, 0.1f, -1, |
| 274 SetCodecParams(&process_settings, kVideoCodecVP8, kHwCodec, kUseSingleCore, | 290 kForemanCif, kVerboseLogging, kBatchMode); |
| 275 0.1f, -1, 1, false, true, true, false, kResilienceOn); | 291 SetCodecSettings(&config_, &codec_settings_, kVideoCodecVP8, 1, false, true, |
| 292 true, false, kResilienceOn, kCifWidth, kCifHeight); |
| 276 // Thresholds for expected quality. | 293 // Thresholds for expected quality. |
| 277 QualityThresholds quality_thresholds; | 294 QualityThresholds quality_thresholds; |
| 278 SetQualityThresholds(&quality_thresholds, 19.0, 16.0, 0.50, 0.35); | 295 SetQualityThresholds(&quality_thresholds, 19.0, 16.0, 0.50, 0.35); |
| 279 // Thresholds for rate control. | 296 // Thresholds for rate control. |
| 280 RateControlThresholds rc_thresholds[1]; | 297 RateControlThresholds rc_thresholds[1]; |
| 281 SetRateControlThresholds(rc_thresholds, 0, 0, 40, 20, 10, 15, 0, 1); | 298 SetRateControlThresholds(rc_thresholds, 0, 0, 40, 20, 10, 15, 0, 1); |
| 282 ProcessFramesAndVerify(quality_thresholds, rate_profile, process_settings, | 299 ProcessFramesAndVerify(quality_thresholds, rate_profile, process_settings, |
| 283 rc_thresholds, nullptr /* visualization_params */); | 300 rc_thresholds, nullptr /* visualization_params */); |
| 284 } | 301 } |
| 285 | 302 |
| 286 // This test is identical to VideoProcessorIntegrationTest.ProcessZeroPacketLoss | 303 // This test is identical to VideoProcessorIntegrationTest.ProcessZeroPacketLoss |
| 287 // except that |batch_mode| is turned on. The main point of this test is to see | 304 // except that |batch_mode| is turned on. The main point of this test is to see |
| 288 // that the reported stats are not wildly varying between batch mode and the | 305 // that the reported stats are not wildly varying between batch mode and the |
| 289 // regular online mode. | 306 // regular online mode. |
| 290 TEST_F(VideoProcessorIntegrationTest, ProcessInBatchMode) { | 307 TEST_F(VideoProcessorIntegrationTest, ProcessInBatchMode) { |
| 291 // Bit rate and frame rate profile. | 308 // Bit rate and frame rate profile. |
| 292 RateProfile rate_profile; | 309 RateProfile rate_profile; |
| 293 SetRateProfile(&rate_profile, 0, 500, 30, 0); | 310 SetRateProfile(&rate_profile, 0, 500, 30, 0); |
| 294 rate_profile.frame_index_rate_update[1] = kNumFramesShort + 1; | 311 rate_profile.frame_index_rate_update[1] = kNumFramesShort + 1; |
| 295 rate_profile.num_frames = kNumFramesShort; | 312 rate_profile.num_frames = kNumFramesShort; |
| 296 // Codec/network settings. | 313 // Codec/network settings. |
| 297 CodecParams process_settings; | 314 ProcessParams process_settings(kHwCodec, kUseSingleCore, 0.0f, -1, |
| 298 SetCodecParams(&process_settings, kVideoCodecVP8, kHwCodec, kUseSingleCore, | 315 kForemanCif, kVerboseLogging, |
| 299 0.0f, -1, 1, false, true, true, false, kResilienceOn, 352, 288, | 316 true /* batch_mode */); |
| 300 "foreman_cif", false /* verbose_logging */, | 317 SetCodecSettings(&config_, &codec_settings_, kVideoCodecVP8, 1, false, true, |
| 301 true /* batch_mode */); | 318 true, false, kResilienceOn, kCifWidth, kCifHeight); |
| 302 // Thresholds for expected quality. | 319 // Thresholds for expected quality. |
| 303 QualityThresholds quality_thresholds; | 320 QualityThresholds quality_thresholds; |
| 304 SetQualityThresholds(&quality_thresholds, 34.95, 33.0, 0.90, 0.89); | 321 SetQualityThresholds(&quality_thresholds, 34.95, 33.0, 0.90, 0.89); |
| 305 // Thresholds for rate control. | 322 // Thresholds for rate control. |
| 306 RateControlThresholds rc_thresholds[1]; | 323 RateControlThresholds rc_thresholds[1]; |
| 307 SetRateControlThresholds(rc_thresholds, 0, 0, 40, 20, 10, 15, 0, 1); | 324 SetRateControlThresholds(rc_thresholds, 0, 0, 40, 20, 10, 15, 0, 1); |
| 308 ProcessFramesAndVerify(quality_thresholds, rate_profile, process_settings, | 325 ProcessFramesAndVerify(quality_thresholds, rate_profile, process_settings, |
| 309 rc_thresholds, nullptr /* visualization_params */); | 326 rc_thresholds, nullptr /* visualization_params */); |
| 310 } | 327 } |
| 311 | 328 |
| (...skipping 21 matching lines...) Expand all Loading... |
| 333 #endif | 350 #endif |
| 334 TEST_F(VideoProcessorIntegrationTest, MAYBE_ProcessNoLossChangeBitRateVP8) { | 351 TEST_F(VideoProcessorIntegrationTest, MAYBE_ProcessNoLossChangeBitRateVP8) { |
| 335 // Bit rate and frame rate profile. | 352 // Bit rate and frame rate profile. |
| 336 RateProfile rate_profile; | 353 RateProfile rate_profile; |
| 337 SetRateProfile(&rate_profile, 0, 200, 30, 0); | 354 SetRateProfile(&rate_profile, 0, 200, 30, 0); |
| 338 SetRateProfile(&rate_profile, 1, 800, 30, 100); | 355 SetRateProfile(&rate_profile, 1, 800, 30, 100); |
| 339 SetRateProfile(&rate_profile, 2, 500, 30, 200); | 356 SetRateProfile(&rate_profile, 2, 500, 30, 200); |
| 340 rate_profile.frame_index_rate_update[3] = kNumFramesLong + 1; | 357 rate_profile.frame_index_rate_update[3] = kNumFramesLong + 1; |
| 341 rate_profile.num_frames = kNumFramesLong; | 358 rate_profile.num_frames = kNumFramesLong; |
| 342 // Codec/network settings. | 359 // Codec/network settings. |
| 343 CodecParams process_settings; | 360 ProcessParams process_settings(kHwCodec, kUseSingleCore, 0.0f, -1, |
| 344 SetCodecParams(&process_settings, kVideoCodecVP8, kHwCodec, kUseSingleCore, | 361 kForemanCif, kVerboseLogging, kBatchMode); |
| 345 0.0f, -1, 1, false, true, true, false, kResilienceOn); | 362 SetCodecSettings(&config_, &codec_settings_, kVideoCodecVP8, 1, false, true, |
| 363 true, false, kResilienceOn, kCifWidth, kCifHeight); |
| 346 // Thresholds for expected quality. | 364 // Thresholds for expected quality. |
| 347 QualityThresholds quality_thresholds; | 365 QualityThresholds quality_thresholds; |
| 348 SetQualityThresholds(&quality_thresholds, 34.0, 32.0, 0.85, 0.80); | 366 SetQualityThresholds(&quality_thresholds, 34.0, 32.0, 0.85, 0.80); |
| 349 // Thresholds for rate control. | 367 // Thresholds for rate control. |
| 350 RateControlThresholds rc_thresholds[3]; | 368 RateControlThresholds rc_thresholds[3]; |
| 351 SetRateControlThresholds(rc_thresholds, 0, 0, 45, 20, 10, 15, 0, 1); | 369 SetRateControlThresholds(rc_thresholds, 0, 0, 45, 20, 10, 15, 0, 1); |
| 352 SetRateControlThresholds(rc_thresholds, 1, 0, 0, 25, 20, 10, 0, 0); | 370 SetRateControlThresholds(rc_thresholds, 1, 0, 0, 25, 20, 10, 0, 0); |
| 353 SetRateControlThresholds(rc_thresholds, 2, 0, 0, 25, 15, 10, 0, 0); | 371 SetRateControlThresholds(rc_thresholds, 2, 0, 0, 25, 15, 10, 0, 0); |
| 354 ProcessFramesAndVerify(quality_thresholds, rate_profile, process_settings, | 372 ProcessFramesAndVerify(quality_thresholds, rate_profile, process_settings, |
| 355 rc_thresholds, nullptr /* visualization_params */); | 373 rc_thresholds, nullptr /* visualization_params */); |
| (...skipping 18 matching lines...) Expand all Loading... |
| 374 MAYBE_ProcessNoLossChangeFrameRateFrameDropVP8) { | 392 MAYBE_ProcessNoLossChangeFrameRateFrameDropVP8) { |
| 375 config_.networking_config.packet_loss_probability = 0; | 393 config_.networking_config.packet_loss_probability = 0; |
| 376 // Bit rate and frame rate profile. | 394 // Bit rate and frame rate profile. |
| 377 RateProfile rate_profile; | 395 RateProfile rate_profile; |
| 378 SetRateProfile(&rate_profile, 0, 80, 24, 0); | 396 SetRateProfile(&rate_profile, 0, 80, 24, 0); |
| 379 SetRateProfile(&rate_profile, 1, 80, 15, 100); | 397 SetRateProfile(&rate_profile, 1, 80, 15, 100); |
| 380 SetRateProfile(&rate_profile, 2, 80, 10, 200); | 398 SetRateProfile(&rate_profile, 2, 80, 10, 200); |
| 381 rate_profile.frame_index_rate_update[3] = kNumFramesLong + 1; | 399 rate_profile.frame_index_rate_update[3] = kNumFramesLong + 1; |
| 382 rate_profile.num_frames = kNumFramesLong; | 400 rate_profile.num_frames = kNumFramesLong; |
| 383 // Codec/network settings. | 401 // Codec/network settings. |
| 384 CodecParams process_settings; | 402 ProcessParams process_settings(kHwCodec, kUseSingleCore, 0.0f, -1, |
| 385 SetCodecParams(&process_settings, kVideoCodecVP8, kHwCodec, kUseSingleCore, | 403 kForemanCif, kVerboseLogging, kBatchMode); |
| 386 0.0f, -1, 1, false, true, true, false, kResilienceOn); | 404 SetCodecSettings(&config_, &codec_settings_, kVideoCodecVP8, 1, false, true, |
| 405 true, false, kResilienceOn, kCifWidth, kCifHeight); |
| 387 // Thresholds for expected quality. | 406 // Thresholds for expected quality. |
| 388 QualityThresholds quality_thresholds; | 407 QualityThresholds quality_thresholds; |
| 389 SetQualityThresholds(&quality_thresholds, 31.0, 22.0, 0.80, 0.65); | 408 SetQualityThresholds(&quality_thresholds, 31.0, 22.0, 0.80, 0.65); |
| 390 // Thresholds for rate control. | 409 // Thresholds for rate control. |
| 391 RateControlThresholds rc_thresholds[3]; | 410 RateControlThresholds rc_thresholds[3]; |
| 392 SetRateControlThresholds(rc_thresholds, 0, 40, 20, 75, 15, 60, 0, 1); | 411 SetRateControlThresholds(rc_thresholds, 0, 40, 20, 75, 15, 60, 0, 1); |
| 393 SetRateControlThresholds(rc_thresholds, 1, 10, 0, 25, 10, 35, 0, 0); | 412 SetRateControlThresholds(rc_thresholds, 1, 10, 0, 25, 10, 35, 0, 0); |
| 394 SetRateControlThresholds(rc_thresholds, 2, 0, 0, 20, 10, 15, 0, 0); | 413 SetRateControlThresholds(rc_thresholds, 2, 0, 0, 20, 10, 15, 0, 0); |
| 395 ProcessFramesAndVerify(quality_thresholds, rate_profile, process_settings, | 414 ProcessFramesAndVerify(quality_thresholds, rate_profile, process_settings, |
| 396 rc_thresholds, nullptr /* visualization_params */); | 415 rc_thresholds, nullptr /* visualization_params */); |
| (...skipping 13 matching lines...) Expand all Loading... |
| 410 #endif | 429 #endif |
| 411 TEST_F(VideoProcessorIntegrationTest, MAYBE_ProcessNoLossTemporalLayersVP8) { | 430 TEST_F(VideoProcessorIntegrationTest, MAYBE_ProcessNoLossTemporalLayersVP8) { |
| 412 config_.networking_config.packet_loss_probability = 0; | 431 config_.networking_config.packet_loss_probability = 0; |
| 413 // Bit rate and frame rate profile. | 432 // Bit rate and frame rate profile. |
| 414 RateProfile rate_profile; | 433 RateProfile rate_profile; |
| 415 SetRateProfile(&rate_profile, 0, 200, 30, 0); | 434 SetRateProfile(&rate_profile, 0, 200, 30, 0); |
| 416 SetRateProfile(&rate_profile, 1, 400, 30, 150); | 435 SetRateProfile(&rate_profile, 1, 400, 30, 150); |
| 417 rate_profile.frame_index_rate_update[2] = kNumFramesLong + 1; | 436 rate_profile.frame_index_rate_update[2] = kNumFramesLong + 1; |
| 418 rate_profile.num_frames = kNumFramesLong; | 437 rate_profile.num_frames = kNumFramesLong; |
| 419 // Codec/network settings. | 438 // Codec/network settings. |
| 420 CodecParams process_settings; | 439 ProcessParams process_settings(kHwCodec, kUseSingleCore, 0.0f, -1, |
| 421 SetCodecParams(&process_settings, kVideoCodecVP8, kHwCodec, kUseSingleCore, | 440 kForemanCif, kVerboseLogging, kBatchMode); |
| 422 0.0f, -1, 3, false, true, true, false, kResilienceOn); | 441 SetCodecSettings(&config_, &codec_settings_, kVideoCodecVP8, 3, false, true, |
| 442 true, false, kResilienceOn, kCifWidth, kCifHeight); |
| 423 // Thresholds for expected quality. | 443 // Thresholds for expected quality. |
| 424 QualityThresholds quality_thresholds; | 444 QualityThresholds quality_thresholds; |
| 425 SetQualityThresholds(&quality_thresholds, 32.5, 30.0, 0.85, 0.80); | 445 SetQualityThresholds(&quality_thresholds, 32.5, 30.0, 0.85, 0.80); |
| 426 // Thresholds for rate control. | 446 // Thresholds for rate control. |
| 427 RateControlThresholds rc_thresholds[2]; | 447 RateControlThresholds rc_thresholds[2]; |
| 428 SetRateControlThresholds(rc_thresholds, 0, 0, 20, 30, 10, 10, 0, 1); | 448 SetRateControlThresholds(rc_thresholds, 0, 0, 20, 30, 10, 10, 0, 1); |
| 429 SetRateControlThresholds(rc_thresholds, 1, 0, 0, 30, 15, 10, 0, 0); | 449 SetRateControlThresholds(rc_thresholds, 1, 0, 0, 30, 15, 10, 0, 0); |
| 430 ProcessFramesAndVerify(quality_thresholds, rate_profile, process_settings, | 450 ProcessFramesAndVerify(quality_thresholds, rate_profile, process_settings, |
| 431 rc_thresholds, nullptr /* visualization_params */); | 451 rc_thresholds, nullptr /* visualization_params */); |
| 432 } | 452 } |
| 433 } // namespace test | 453 } // namespace test |
| 434 } // namespace webrtc | 454 } // namespace webrtc |
| OLD | NEW |