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 13 matching lines...) Expand all Loading... |
24 } // namespace | 24 } // namespace |
25 | 25 |
26 #if defined(WEBRTC_VIDEOPROCESSOR_H264_TESTS) | 26 #if defined(WEBRTC_VIDEOPROCESSOR_H264_TESTS) |
27 | 27 |
28 // H264: Run with no packet loss and fixed bitrate. Quality should be very high. | 28 // H264: Run with no packet loss and fixed bitrate. Quality should be very high. |
29 // Note(hbos): The PacketManipulatorImpl code used to simulate packet loss in | 29 // Note(hbos): The PacketManipulatorImpl code used to simulate packet loss in |
30 // these unittests appears to drop "packets" in a way that is not compatible | 30 // these unittests appears to drop "packets" in a way that is not compatible |
31 // with H264. Therefore ProcessXPercentPacketLossH264, X != 0, unittests have | 31 // with H264. Therefore ProcessXPercentPacketLossH264, X != 0, unittests have |
32 // not been added. | 32 // not been added. |
33 TEST_F(VideoProcessorIntegrationTest, Process0PercentPacketLossH264) { | 33 TEST_F(VideoProcessorIntegrationTest, Process0PercentPacketLossH264) { |
34 // Bitrate and frame rate profile. | 34 // Bit rate and frame rate profile. |
35 RateProfile rate_profile; | 35 RateProfile rate_profile; |
36 SetRateProfilePars(&rate_profile, 0, 500, 30, 0); | 36 SetRateProfile(&rate_profile, 0, 500, 30, 0); |
37 rate_profile.frame_index_rate_update[1] = kNumFramesShort + 1; | 37 rate_profile.frame_index_rate_update[1] = kNumFramesShort + 1; |
38 rate_profile.num_frames = kNumFramesShort; | 38 rate_profile.num_frames = kNumFramesShort; |
39 // Codec/network settings. | 39 // Codec/network settings. |
40 CodecConfigPars process_settings; | 40 CodecParams process_settings; |
41 SetCodecParameters(&process_settings, kVideoCodecH264, kHwCodec, | 41 SetCodecParams(&process_settings, kVideoCodecH264, kHwCodec, kUseSingleCore, |
42 kUseSingleCore, 0.0f, -1, 1, false, false, true, false); | 42 0.0f, -1, 1, false, false, true, false); |
43 // Metrics for expected quality. | 43 // Thresholds for expected quality. |
44 QualityMetrics quality_metrics; | 44 QualityThresholds quality_thresholds; |
45 SetQualityMetrics(&quality_metrics, 35.0, 25.0, 0.93, 0.70); | 45 SetQualityThresholds(&quality_thresholds, 35.0, 25.0, 0.93, 0.70); |
46 // Metrics for rate control. | 46 // Thresholds for rate control. |
47 RateControlMetrics rc_metrics[1]; | 47 RateControlThresholds rc_thresholds[1]; |
48 SetRateControlMetrics(rc_metrics, 0, 2, 60, 20, 10, 20, 0, 1); | 48 SetRateControlThresholds(rc_thresholds, 0, 2, 60, 20, 10, 20, 0, 1); |
49 ProcessFramesAndVerify(quality_metrics, rate_profile, process_settings, | 49 ProcessFramesAndVerify(quality_thresholds, rate_profile, process_settings, |
50 rc_metrics, nullptr /* visualization_params */); | 50 rc_thresholds, nullptr /* visualization_params */); |
51 } | 51 } |
52 | 52 |
53 #endif // defined(WEBRTC_VIDEOPROCESSOR_H264_TESTS) | 53 #endif // defined(WEBRTC_VIDEOPROCESSOR_H264_TESTS) |
54 | 54 |
55 // Fails on iOS. See webrtc:4755. | 55 // Fails on iOS. See webrtc:4755. |
56 #if !defined(WEBRTC_IOS) | 56 #if !defined(WEBRTC_IOS) |
57 | 57 |
58 #if !defined(RTC_DISABLE_VP9) | 58 #if !defined(RTC_DISABLE_VP9) |
59 // VP9: Run with no packet loss and fixed bitrate. Quality should be very high. | 59 // VP9: Run with no packet loss and fixed bitrate. Quality should be very high. |
60 // One key frame (first frame only) in sequence. Setting |key_frame_interval| | 60 // One key frame (first frame only) in sequence. Setting |key_frame_interval| |
61 // to -1 below means no periodic key frames in test. | 61 // to -1 below means no periodic key frames in test. |
62 TEST_F(VideoProcessorIntegrationTest, Process0PercentPacketLossVP9) { | 62 TEST_F(VideoProcessorIntegrationTest, Process0PercentPacketLossVP9) { |
63 // Bitrate and frame rate profile. | 63 // Bit rate and frame rate profile. |
64 RateProfile rate_profile; | 64 RateProfile rate_profile; |
65 SetRateProfilePars(&rate_profile, 0, 500, 30, 0); | 65 SetRateProfile(&rate_profile, 0, 500, 30, 0); |
66 rate_profile.frame_index_rate_update[1] = kNumFramesShort + 1; | 66 rate_profile.frame_index_rate_update[1] = kNumFramesShort + 1; |
67 rate_profile.num_frames = kNumFramesShort; | 67 rate_profile.num_frames = kNumFramesShort; |
68 // Codec/network settings. | 68 // Codec/network settings. |
69 CodecConfigPars process_settings; | 69 CodecParams process_settings; |
70 SetCodecParameters(&process_settings, kVideoCodecVP9, kHwCodec, | 70 SetCodecParams(&process_settings, kVideoCodecVP9, kHwCodec, kUseSingleCore, |
71 kUseSingleCore, 0.0f, -1, 1, false, false, true, false); | 71 0.0f, -1, 1, false, false, true, false); |
72 // Metrics for expected quality. | 72 // Thresholds for expected quality. |
73 QualityMetrics quality_metrics; | 73 QualityThresholds quality_thresholds; |
74 SetQualityMetrics(&quality_metrics, 37.0, 36.0, 0.93, 0.92); | 74 SetQualityThresholds(&quality_thresholds, 37.0, 36.0, 0.93, 0.92); |
75 // Metrics for rate control. | 75 // Thresholds for rate control. |
76 RateControlMetrics rc_metrics[1]; | 76 RateControlThresholds rc_thresholds[1]; |
77 SetRateControlMetrics(rc_metrics, 0, 0, 40, 20, 10, 20, 0, 1); | 77 SetRateControlThresholds(rc_thresholds, 0, 0, 40, 20, 10, 20, 0, 1); |
78 ProcessFramesAndVerify(quality_metrics, rate_profile, process_settings, | 78 ProcessFramesAndVerify(quality_thresholds, rate_profile, process_settings, |
79 rc_metrics, nullptr /* visualization_params */); | 79 rc_thresholds, nullptr /* visualization_params */); |
80 } | 80 } |
81 | 81 |
82 // VP9: Run with 5% packet loss and fixed bitrate. Quality should be a bit | 82 // VP9: Run with 5% packet loss and fixed bitrate. Quality should be a bit |
83 // lower. One key frame (first frame only) in sequence. | 83 // lower. One key frame (first frame only) in sequence. |
84 TEST_F(VideoProcessorIntegrationTest, Process5PercentPacketLossVP9) { | 84 TEST_F(VideoProcessorIntegrationTest, Process5PercentPacketLossVP9) { |
85 // Bitrate and frame rate profile. | 85 // Bit rate and frame rate profile. |
86 RateProfile rate_profile; | 86 RateProfile rate_profile; |
87 SetRateProfilePars(&rate_profile, 0, 500, 30, 0); | 87 SetRateProfile(&rate_profile, 0, 500, 30, 0); |
88 rate_profile.frame_index_rate_update[1] = kNumFramesShort + 1; | 88 rate_profile.frame_index_rate_update[1] = kNumFramesShort + 1; |
89 rate_profile.num_frames = kNumFramesShort; | 89 rate_profile.num_frames = kNumFramesShort; |
90 // Codec/network settings. | 90 // Codec/network settings. |
91 CodecConfigPars process_settings; | 91 CodecParams process_settings; |
92 SetCodecParameters(&process_settings, kVideoCodecVP9, kHwCodec, | 92 SetCodecParams(&process_settings, kVideoCodecVP9, kHwCodec, kUseSingleCore, |
93 kUseSingleCore, 0.05f, -1, 1, false, false, true, false); | 93 0.05f, -1, 1, false, false, true, false); |
94 // Metrics for expected quality. | 94 // Thresholds for expected quality. |
95 QualityMetrics quality_metrics; | 95 QualityThresholds quality_thresholds; |
96 SetQualityMetrics(&quality_metrics, 17.0, 14.0, 0.45, 0.36); | 96 SetQualityThresholds(&quality_thresholds, 17.0, 14.0, 0.45, 0.36); |
97 // Metrics for rate control. | 97 // Thresholds for rate control. |
98 RateControlMetrics rc_metrics[1]; | 98 RateControlThresholds rc_thresholds[1]; |
99 SetRateControlMetrics(rc_metrics, 0, 0, 40, 20, 10, 20, 0, 1); | 99 SetRateControlThresholds(rc_thresholds, 0, 0, 40, 20, 10, 20, 0, 1); |
100 ProcessFramesAndVerify(quality_metrics, rate_profile, process_settings, | 100 ProcessFramesAndVerify(quality_thresholds, rate_profile, process_settings, |
101 rc_metrics, nullptr /* visualization_params */); | 101 rc_thresholds, nullptr /* visualization_params */); |
102 } | 102 } |
103 | 103 |
104 // VP9: Run with no packet loss, with varying bitrate (3 rate updates): | 104 // VP9: Run with no packet loss, with varying bitrate (3 rate updates): |
105 // low to high to medium. Check that quality and encoder response to the new | 105 // low to high to medium. Check that quality and encoder response to the new |
106 // target rate/per-frame bandwidth (for each rate update) is within limits. | 106 // target rate/per-frame bandwidth (for each rate update) is within limits. |
107 // One key frame (first frame only) in sequence. | 107 // One key frame (first frame only) in sequence. |
108 TEST_F(VideoProcessorIntegrationTest, ProcessNoLossChangeBitRateVP9) { | 108 TEST_F(VideoProcessorIntegrationTest, ProcessNoLossChangeBitRateVP9) { |
109 // Bitrate and frame rate profile. | 109 // Bit rate and frame rate profile. |
110 RateProfile rate_profile; | 110 RateProfile rate_profile; |
111 SetRateProfilePars(&rate_profile, 0, 200, 30, 0); | 111 SetRateProfile(&rate_profile, 0, 200, 30, 0); |
112 SetRateProfilePars(&rate_profile, 1, 700, 30, 100); | 112 SetRateProfile(&rate_profile, 1, 700, 30, 100); |
113 SetRateProfilePars(&rate_profile, 2, 500, 30, 200); | 113 SetRateProfile(&rate_profile, 2, 500, 30, 200); |
114 rate_profile.frame_index_rate_update[3] = kNumFramesLong + 1; | 114 rate_profile.frame_index_rate_update[3] = kNumFramesLong + 1; |
115 rate_profile.num_frames = kNumFramesLong; | 115 rate_profile.num_frames = kNumFramesLong; |
116 // Codec/network settings. | 116 // Codec/network settings. |
117 CodecConfigPars process_settings; | 117 CodecParams process_settings; |
118 SetCodecParameters(&process_settings, kVideoCodecVP9, kHwCodec, | 118 SetCodecParams(&process_settings, kVideoCodecVP9, kHwCodec, kUseSingleCore, |
119 kUseSingleCore, 0.0f, -1, 1, false, false, true, false); | 119 0.0f, -1, 1, false, false, true, false); |
120 // Metrics for expected quality. | 120 // Thresholds for expected quality. |
121 QualityMetrics quality_metrics; | 121 QualityThresholds quality_thresholds; |
122 SetQualityMetrics(&quality_metrics, 35.5, 30.0, 0.90, 0.85); | 122 SetQualityThresholds(&quality_thresholds, 35.5, 30.0, 0.90, 0.85); |
123 // Metrics for rate control. | 123 // Thresholds for rate control. |
124 RateControlMetrics rc_metrics[3]; | 124 RateControlThresholds rc_thresholds[3]; |
125 SetRateControlMetrics(rc_metrics, 0, 0, 30, 20, 20, 30, 0, 1); | 125 SetRateControlThresholds(rc_thresholds, 0, 0, 30, 20, 20, 30, 0, 1); |
126 SetRateControlMetrics(rc_metrics, 1, 2, 0, 20, 20, 60, 0, 0); | 126 SetRateControlThresholds(rc_thresholds, 1, 2, 0, 20, 20, 60, 0, 0); |
127 SetRateControlMetrics(rc_metrics, 2, 0, 0, 25, 20, 40, 0, 0); | 127 SetRateControlThresholds(rc_thresholds, 2, 0, 0, 25, 20, 40, 0, 0); |
128 ProcessFramesAndVerify(quality_metrics, rate_profile, process_settings, | 128 ProcessFramesAndVerify(quality_thresholds, rate_profile, process_settings, |
129 rc_metrics, nullptr /* visualization_params */); | 129 rc_thresholds, nullptr /* visualization_params */); |
130 } | 130 } |
131 | 131 |
132 // VP9: Run with no packet loss, with an update (decrease) in frame rate. | 132 // VP9: Run with no packet loss, with an update (decrease) in frame rate. |
133 // Lower frame rate means higher per-frame-bandwidth, so easier to encode. | 133 // Lower frame rate means higher per-frame-bandwidth, so easier to encode. |
134 // At the low bitrate in this test, this means better rate control after the | 134 // At the low bitrate in this test, this means better rate control after the |
135 // update(s) to lower frame rate. So expect less frame drops, and max values | 135 // update(s) to lower frame rate. So expect less frame drops, and max values |
136 // for the rate control metrics can be lower. One key frame (first frame only). | 136 // for the rate control metrics can be lower. One key frame (first frame only). |
137 // Note: quality after update should be higher but we currently compute quality | 137 // Note: quality after update should be higher but we currently compute quality |
138 // metrics averaged over whole sequence run. | 138 // metrics averaged over whole sequence run. |
139 TEST_F(VideoProcessorIntegrationTest, | 139 TEST_F(VideoProcessorIntegrationTest, |
140 ProcessNoLossChangeFrameRateFrameDropVP9) { | 140 ProcessNoLossChangeFrameRateFrameDropVP9) { |
141 config_.networking_config.packet_loss_probability = 0; | 141 config_.networking_config.packet_loss_probability = 0; |
142 // Bitrate and frame rate profile. | 142 // Bit rate and frame rate profile. |
143 RateProfile rate_profile; | 143 RateProfile rate_profile; |
144 SetRateProfilePars(&rate_profile, 0, 100, 24, 0); | 144 SetRateProfile(&rate_profile, 0, 100, 24, 0); |
145 SetRateProfilePars(&rate_profile, 1, 100, 15, 100); | 145 SetRateProfile(&rate_profile, 1, 100, 15, 100); |
146 SetRateProfilePars(&rate_profile, 2, 100, 10, 200); | 146 SetRateProfile(&rate_profile, 2, 100, 10, 200); |
147 rate_profile.frame_index_rate_update[3] = kNumFramesLong + 1; | 147 rate_profile.frame_index_rate_update[3] = kNumFramesLong + 1; |
148 rate_profile.num_frames = kNumFramesLong; | 148 rate_profile.num_frames = kNumFramesLong; |
149 // Codec/network settings. | 149 // Codec/network settings. |
150 CodecConfigPars process_settings; | 150 CodecParams process_settings; |
151 SetCodecParameters(&process_settings, kVideoCodecVP9, kHwCodec, | 151 SetCodecParams(&process_settings, kVideoCodecVP9, kHwCodec, kUseSingleCore, |
152 kUseSingleCore, 0.0f, -1, 1, false, false, true, false); | 152 0.0f, -1, 1, false, false, true, false); |
153 // Metrics for expected quality. | 153 // Thresholds for expected quality. |
154 QualityMetrics quality_metrics; | 154 QualityThresholds quality_thresholds; |
155 SetQualityMetrics(&quality_metrics, 31.5, 18.0, 0.80, 0.43); | 155 SetQualityThresholds(&quality_thresholds, 31.5, 18.0, 0.80, 0.43); |
156 // Metrics for rate control. | 156 // Thresholds for rate control. |
157 RateControlMetrics rc_metrics[3]; | 157 RateControlThresholds rc_thresholds[3]; |
158 SetRateControlMetrics(rc_metrics, 0, 38, 50, 75, 15, 45, 0, 1); | 158 SetRateControlThresholds(rc_thresholds, 0, 38, 50, 75, 15, 45, 0, 1); |
159 SetRateControlMetrics(rc_metrics, 1, 10, 0, 40, 10, 30, 0, 0); | 159 SetRateControlThresholds(rc_thresholds, 1, 10, 0, 40, 10, 30, 0, 0); |
160 SetRateControlMetrics(rc_metrics, 2, 5, 0, 30, 5, 20, 0, 0); | 160 SetRateControlThresholds(rc_thresholds, 2, 5, 0, 30, 5, 20, 0, 0); |
161 ProcessFramesAndVerify(quality_metrics, rate_profile, process_settings, | 161 ProcessFramesAndVerify(quality_thresholds, rate_profile, process_settings, |
162 rc_metrics, nullptr /* visualization_params */); | 162 rc_thresholds, nullptr /* visualization_params */); |
163 } | 163 } |
164 | 164 |
165 // VP9: Run with no packet loss and denoiser on. One key frame (first frame). | 165 // VP9: Run with no packet loss and denoiser on. One key frame (first frame). |
166 TEST_F(VideoProcessorIntegrationTest, ProcessNoLossDenoiserOnVP9) { | 166 TEST_F(VideoProcessorIntegrationTest, ProcessNoLossDenoiserOnVP9) { |
167 // Bitrate and frame rate profile. | 167 // Bit rate and frame rate profile. |
168 RateProfile rate_profile; | 168 RateProfile rate_profile; |
169 SetRateProfilePars(&rate_profile, 0, 500, 30, 0); | 169 SetRateProfile(&rate_profile, 0, 500, 30, 0); |
170 rate_profile.frame_index_rate_update[1] = kNumFramesShort + 1; | 170 rate_profile.frame_index_rate_update[1] = kNumFramesShort + 1; |
171 rate_profile.num_frames = kNumFramesShort; | 171 rate_profile.num_frames = kNumFramesShort; |
172 // Codec/network settings. | 172 // Codec/network settings. |
173 CodecConfigPars process_settings; | 173 CodecParams process_settings; |
174 SetCodecParameters(&process_settings, kVideoCodecVP9, kHwCodec, | 174 SetCodecParams(&process_settings, kVideoCodecVP9, kHwCodec, kUseSingleCore, |
175 kUseSingleCore, 0.0f, -1, 1, false, true, true, false); | 175 0.0f, -1, 1, false, true, true, false); |
176 // Metrics for expected quality. | 176 // Thresholds for expected quality. |
177 QualityMetrics quality_metrics; | 177 QualityThresholds quality_thresholds; |
178 SetQualityMetrics(&quality_metrics, 36.8, 35.8, 0.92, 0.91); | 178 SetQualityThresholds(&quality_thresholds, 36.8, 35.8, 0.92, 0.91); |
179 // Metrics for rate control. | 179 // Thresholds for rate control. |
180 RateControlMetrics rc_metrics[1]; | 180 RateControlThresholds rc_thresholds[1]; |
181 SetRateControlMetrics(rc_metrics, 0, 0, 40, 20, 10, 20, 0, 1); | 181 SetRateControlThresholds(rc_thresholds, 0, 0, 40, 20, 10, 20, 0, 1); |
182 ProcessFramesAndVerify(quality_metrics, rate_profile, process_settings, | 182 ProcessFramesAndVerify(quality_thresholds, rate_profile, process_settings, |
183 rc_metrics, nullptr /* visualization_params */); | 183 rc_thresholds, nullptr /* visualization_params */); |
184 } | 184 } |
185 | 185 |
186 // Run with no packet loss, at low bitrate. | 186 // Run with no packet loss, at low bitrate. |
187 // spatial_resize is on, for this low bitrate expect one resize in sequence. | 187 // spatial_resize is on, for this low bitrate expect one resize in sequence. |
188 // Resize happens on delta frame. Expect only one key frame (first frame). | 188 // Resize happens on delta frame. Expect only one key frame (first frame). |
189 TEST_F(VideoProcessorIntegrationTest, | 189 TEST_F(VideoProcessorIntegrationTest, |
190 DISABLED_ProcessNoLossSpatialResizeFrameDropVP9) { | 190 DISABLED_ProcessNoLossSpatialResizeFrameDropVP9) { |
191 config_.networking_config.packet_loss_probability = 0; | 191 config_.networking_config.packet_loss_probability = 0; |
192 // Bitrate and frame rate profile. | 192 // Bit rate and frame rate profile. |
193 RateProfile rate_profile; | 193 RateProfile rate_profile; |
194 SetRateProfilePars(&rate_profile, 0, 50, 30, 0); | 194 SetRateProfile(&rate_profile, 0, 50, 30, 0); |
195 rate_profile.frame_index_rate_update[1] = kNumFramesLong + 1; | 195 rate_profile.frame_index_rate_update[1] = kNumFramesLong + 1; |
196 rate_profile.num_frames = kNumFramesLong; | 196 rate_profile.num_frames = kNumFramesLong; |
197 // Codec/network settings. | 197 // Codec/network settings. |
198 CodecConfigPars process_settings; | 198 CodecParams process_settings; |
199 SetCodecParameters(&process_settings, kVideoCodecVP9, kHwCodec, | 199 SetCodecParams(&process_settings, kVideoCodecVP9, kHwCodec, kUseSingleCore, |
200 kUseSingleCore, 0.0f, -1, 1, false, false, true, true); | 200 0.0f, -1, 1, false, false, true, true); |
201 // Metrics for expected quality. | 201 // Thresholds for expected quality. |
202 QualityMetrics quality_metrics; | 202 QualityThresholds quality_thresholds; |
203 SetQualityMetrics(&quality_metrics, 24.0, 13.0, 0.65, 0.37); | 203 SetQualityThresholds(&quality_thresholds, 24.0, 13.0, 0.65, 0.37); |
204 // Metrics for rate control. | 204 // Thresholds for rate control. |
205 RateControlMetrics rc_metrics[1]; | 205 RateControlThresholds rc_thresholds[1]; |
206 SetRateControlMetrics(rc_metrics, 0, 228, 70, 160, 15, 80, 1, 1); | 206 SetRateControlThresholds(rc_thresholds, 0, 228, 70, 160, 15, 80, 1, 1); |
207 ProcessFramesAndVerify(quality_metrics, rate_profile, process_settings, | 207 ProcessFramesAndVerify(quality_thresholds, rate_profile, process_settings, |
208 rc_metrics, nullptr /* visualization_params */); | 208 rc_thresholds, nullptr /* visualization_params */); |
209 } | 209 } |
210 | 210 |
211 // TODO(marpan): Add temporal layer test for VP9, once changes are in | 211 // TODO(marpan): Add temporal layer test for VP9, once changes are in |
212 // vp9 wrapper for this. | 212 // vp9 wrapper for this. |
213 | 213 |
214 #endif // !defined(RTC_DISABLE_VP9) | 214 #endif // !defined(RTC_DISABLE_VP9) |
215 | 215 |
216 // VP8: Run with no packet loss and fixed bitrate. Quality should be very high. | 216 // VP8: Run with no packet loss and fixed bitrate. Quality should be very high. |
217 // One key frame (first frame only) in sequence. Setting |key_frame_interval| | 217 // One key frame (first frame only) in sequence. Setting |key_frame_interval| |
218 // to -1 below means no periodic key frames in test. | 218 // to -1 below means no periodic key frames in test. |
219 TEST_F(VideoProcessorIntegrationTest, ProcessZeroPacketLoss) { | 219 TEST_F(VideoProcessorIntegrationTest, ProcessZeroPacketLoss) { |
220 // Bitrate and frame rate profile. | 220 // Bit rate and frame rate profile. |
221 RateProfile rate_profile; | 221 RateProfile rate_profile; |
222 SetRateProfilePars(&rate_profile, 0, 500, 30, 0); | 222 SetRateProfile(&rate_profile, 0, 500, 30, 0); |
223 rate_profile.frame_index_rate_update[1] = kNumFramesShort + 1; | 223 rate_profile.frame_index_rate_update[1] = kNumFramesShort + 1; |
224 rate_profile.num_frames = kNumFramesShort; | 224 rate_profile.num_frames = kNumFramesShort; |
225 // Codec/network settings. | 225 // Codec/network settings. |
226 CodecConfigPars process_settings; | 226 CodecParams process_settings; |
227 SetCodecParameters(&process_settings, kVideoCodecVP8, kHwCodec, | 227 SetCodecParams(&process_settings, kVideoCodecVP8, kHwCodec, kUseSingleCore, |
228 kUseSingleCore, 0.0f, -1, 1, false, true, true, false); | 228 0.0f, -1, 1, false, true, true, false); |
229 // Metrics for expected quality. | 229 // Thresholds for expected quality. |
230 QualityMetrics quality_metrics; | 230 QualityThresholds quality_thresholds; |
231 SetQualityMetrics(&quality_metrics, 34.95, 33.0, 0.90, 0.89); | 231 SetQualityThresholds(&quality_thresholds, 34.95, 33.0, 0.90, 0.89); |
232 // Metrics for rate control. | 232 // Thresholds for rate control. |
233 RateControlMetrics rc_metrics[1]; | 233 RateControlThresholds rc_thresholds[1]; |
234 SetRateControlMetrics(rc_metrics, 0, 0, 40, 20, 10, 15, 0, 1); | 234 SetRateControlThresholds(rc_thresholds, 0, 0, 40, 20, 10, 15, 0, 1); |
235 ProcessFramesAndVerify(quality_metrics, rate_profile, process_settings, | 235 ProcessFramesAndVerify(quality_thresholds, rate_profile, process_settings, |
236 rc_metrics, nullptr /* visualization_params */); | 236 rc_thresholds, nullptr /* visualization_params */); |
237 } | 237 } |
238 | 238 |
239 // VP8: Run with 5% packet loss and fixed bitrate. Quality should be a bit | 239 // VP8: Run with 5% packet loss and fixed bitrate. Quality should be a bit |
240 // lower. One key frame (first frame only) in sequence. | 240 // lower. One key frame (first frame only) in sequence. |
241 TEST_F(VideoProcessorIntegrationTest, Process5PercentPacketLoss) { | 241 TEST_F(VideoProcessorIntegrationTest, Process5PercentPacketLoss) { |
242 // Bitrate and frame rate profile. | 242 // Bit rate and frame rate profile. |
243 RateProfile rate_profile; | 243 RateProfile rate_profile; |
244 SetRateProfilePars(&rate_profile, 0, 500, 30, 0); | 244 SetRateProfile(&rate_profile, 0, 500, 30, 0); |
245 rate_profile.frame_index_rate_update[1] = kNumFramesShort + 1; | 245 rate_profile.frame_index_rate_update[1] = kNumFramesShort + 1; |
246 rate_profile.num_frames = kNumFramesShort; | 246 rate_profile.num_frames = kNumFramesShort; |
247 // Codec/network settings. | 247 // Codec/network settings. |
248 CodecConfigPars process_settings; | 248 CodecParams process_settings; |
249 SetCodecParameters(&process_settings, kVideoCodecVP8, kHwCodec, | 249 SetCodecParams(&process_settings, kVideoCodecVP8, kHwCodec, kUseSingleCore, |
250 kUseSingleCore, 0.05f, -1, 1, false, true, true, false); | 250 0.05f, -1, 1, false, true, true, false); |
251 // Metrics for expected quality. | 251 // Thresholds for expected quality. |
252 QualityMetrics quality_metrics; | 252 QualityThresholds quality_thresholds; |
253 SetQualityMetrics(&quality_metrics, 20.0, 16.0, 0.60, 0.40); | 253 SetQualityThresholds(&quality_thresholds, 20.0, 16.0, 0.60, 0.40); |
254 // Metrics for rate control. | 254 // Thresholds for rate control. |
255 RateControlMetrics rc_metrics[1]; | 255 RateControlThresholds rc_thresholds[1]; |
256 SetRateControlMetrics(rc_metrics, 0, 0, 40, 20, 10, 15, 0, 1); | 256 SetRateControlThresholds(rc_thresholds, 0, 0, 40, 20, 10, 15, 0, 1); |
257 ProcessFramesAndVerify(quality_metrics, rate_profile, process_settings, | 257 ProcessFramesAndVerify(quality_thresholds, rate_profile, process_settings, |
258 rc_metrics, nullptr /* visualization_params */); | 258 rc_thresholds, nullptr /* visualization_params */); |
259 } | 259 } |
260 | 260 |
261 // VP8: Run with 10% packet loss and fixed bitrate. Quality should be lower. | 261 // VP8: Run with 10% packet loss and fixed bitrate. Quality should be lower. |
262 // One key frame (first frame only) in sequence. | 262 // One key frame (first frame only) in sequence. |
263 TEST_F(VideoProcessorIntegrationTest, Process10PercentPacketLoss) { | 263 TEST_F(VideoProcessorIntegrationTest, Process10PercentPacketLoss) { |
264 // Bitrate and frame rate profile. | 264 // Bit rate and frame rate profile. |
265 RateProfile rate_profile; | 265 RateProfile rate_profile; |
266 SetRateProfilePars(&rate_profile, 0, 500, 30, 0); | 266 SetRateProfile(&rate_profile, 0, 500, 30, 0); |
267 rate_profile.frame_index_rate_update[1] = kNumFramesShort + 1; | 267 rate_profile.frame_index_rate_update[1] = kNumFramesShort + 1; |
268 rate_profile.num_frames = kNumFramesShort; | 268 rate_profile.num_frames = kNumFramesShort; |
269 // Codec/network settings. | 269 // Codec/network settings. |
270 CodecConfigPars process_settings; | 270 CodecParams process_settings; |
271 SetCodecParameters(&process_settings, kVideoCodecVP8, kHwCodec, | 271 SetCodecParams(&process_settings, kVideoCodecVP8, kHwCodec, kUseSingleCore, |
272 kUseSingleCore, 0.1f, -1, 1, false, true, true, false); | 272 0.1f, -1, 1, false, true, true, false); |
273 // Metrics for expected quality. | 273 // Thresholds for expected quality. |
274 QualityMetrics quality_metrics; | 274 QualityThresholds quality_thresholds; |
275 SetQualityMetrics(&quality_metrics, 19.0, 16.0, 0.50, 0.35); | 275 SetQualityThresholds(&quality_thresholds, 19.0, 16.0, 0.50, 0.35); |
276 // Metrics for rate control. | 276 // Thresholds for rate control. |
277 RateControlMetrics rc_metrics[1]; | 277 RateControlThresholds rc_thresholds[1]; |
278 SetRateControlMetrics(rc_metrics, 0, 0, 40, 20, 10, 15, 0, 1); | 278 SetRateControlThresholds(rc_thresholds, 0, 0, 40, 20, 10, 15, 0, 1); |
279 ProcessFramesAndVerify(quality_metrics, rate_profile, process_settings, | 279 ProcessFramesAndVerify(quality_thresholds, rate_profile, process_settings, |
280 rc_metrics, nullptr /* visualization_params */); | 280 rc_thresholds, nullptr /* visualization_params */); |
281 } | 281 } |
282 | 282 |
283 #endif // !defined(WEBRTC_IOS) | 283 #endif // !defined(WEBRTC_IOS) |
284 | 284 |
285 // The tests below are currently disabled for Android. For ARM, the encoder | 285 // The tests below are currently disabled for Android. For ARM, the encoder |
286 // uses |cpu_speed| = 12, as opposed to default |cpu_speed| <= 6 for x86, | 286 // uses |cpu_speed| = 12, as opposed to default |cpu_speed| <= 6 for x86, |
287 // which leads to significantly different quality. The quality and rate control | 287 // which leads to significantly different quality. The quality and rate control |
288 // settings in the tests below are defined for encoder speed setting | 288 // settings in the tests below are defined for encoder speed setting |
289 // |cpu_speed| <= ~6. A number of settings would need to be significantly | 289 // |cpu_speed| <= ~6. A number of settings would need to be significantly |
290 // modified for the |cpu_speed| = 12 case. For now, keep the tests below | 290 // modified for the |cpu_speed| = 12 case. For now, keep the tests below |
291 // disabled on Android. Some quality parameter in the above test has been | 291 // disabled on Android. Some quality parameter in the above test has been |
292 // adjusted to also pass for |cpu_speed| <= 12. | 292 // adjusted to also pass for |cpu_speed| <= 12. |
293 | 293 |
294 // VP8: Run with no packet loss, with varying bitrate (3 rate updates): | 294 // VP8: Run with no packet loss, with varying bitrate (3 rate updates): |
295 // low to high to medium. Check that quality and encoder response to the new | 295 // low to high to medium. Check that quality and encoder response to the new |
296 // target rate/per-frame bandwidth (for each rate update) is within limits. | 296 // target rate/per-frame bandwidth (for each rate update) is within limits. |
297 // One key frame (first frame only) in sequence. | 297 // One key frame (first frame only) in sequence. |
298 // Too slow to finish before timeout on iOS. See webrtc:4755. | 298 // Too slow to finish before timeout on iOS. See webrtc:4755. |
299 #if defined(WEBRTC_ANDROID) || defined(WEBRTC_IOS) | 299 #if defined(WEBRTC_ANDROID) || defined(WEBRTC_IOS) |
300 #define MAYBE_ProcessNoLossChangeBitRateVP8 \ | 300 #define MAYBE_ProcessNoLossChangeBitRateVP8 \ |
301 DISABLED_ProcessNoLossChangeBitRateVP8 | 301 DISABLED_ProcessNoLossChangeBitRateVP8 |
302 #else | 302 #else |
303 #define MAYBE_ProcessNoLossChangeBitRateVP8 ProcessNoLossChangeBitRateVP8 | 303 #define MAYBE_ProcessNoLossChangeBitRateVP8 ProcessNoLossChangeBitRateVP8 |
304 #endif | 304 #endif |
305 TEST_F(VideoProcessorIntegrationTest, MAYBE_ProcessNoLossChangeBitRateVP8) { | 305 TEST_F(VideoProcessorIntegrationTest, MAYBE_ProcessNoLossChangeBitRateVP8) { |
306 // Bitrate and frame rate profile. | 306 // Bit rate and frame rate profile. |
307 RateProfile rate_profile; | 307 RateProfile rate_profile; |
308 SetRateProfilePars(&rate_profile, 0, 200, 30, 0); | 308 SetRateProfile(&rate_profile, 0, 200, 30, 0); |
309 SetRateProfilePars(&rate_profile, 1, 800, 30, 100); | 309 SetRateProfile(&rate_profile, 1, 800, 30, 100); |
310 SetRateProfilePars(&rate_profile, 2, 500, 30, 200); | 310 SetRateProfile(&rate_profile, 2, 500, 30, 200); |
311 rate_profile.frame_index_rate_update[3] = kNumFramesLong + 1; | 311 rate_profile.frame_index_rate_update[3] = kNumFramesLong + 1; |
312 rate_profile.num_frames = kNumFramesLong; | 312 rate_profile.num_frames = kNumFramesLong; |
313 // Codec/network settings. | 313 // Codec/network settings. |
314 CodecConfigPars process_settings; | 314 CodecParams process_settings; |
315 SetCodecParameters(&process_settings, kVideoCodecVP8, kHwCodec, | 315 SetCodecParams(&process_settings, kVideoCodecVP8, kHwCodec, kUseSingleCore, |
316 kUseSingleCore, 0.0f, -1, 1, false, true, true, false); | 316 0.0f, -1, 1, false, true, true, false); |
317 // Metrics for expected quality. | 317 // Thresholds for expected quality. |
318 QualityMetrics quality_metrics; | 318 QualityThresholds quality_thresholds; |
319 SetQualityMetrics(&quality_metrics, 34.0, 32.0, 0.85, 0.80); | 319 SetQualityThresholds(&quality_thresholds, 34.0, 32.0, 0.85, 0.80); |
320 // Metrics for rate control. | 320 // Thresholds for rate control. |
321 RateControlMetrics rc_metrics[3]; | 321 RateControlThresholds rc_thresholds[3]; |
322 SetRateControlMetrics(rc_metrics, 0, 0, 45, 20, 10, 15, 0, 1); | 322 SetRateControlThresholds(rc_thresholds, 0, 0, 45, 20, 10, 15, 0, 1); |
323 SetRateControlMetrics(rc_metrics, 1, 0, 0, 25, 20, 10, 0, 0); | 323 SetRateControlThresholds(rc_thresholds, 1, 0, 0, 25, 20, 10, 0, 0); |
324 SetRateControlMetrics(rc_metrics, 2, 0, 0, 25, 15, 10, 0, 0); | 324 SetRateControlThresholds(rc_thresholds, 2, 0, 0, 25, 15, 10, 0, 0); |
325 ProcessFramesAndVerify(quality_metrics, rate_profile, process_settings, | 325 ProcessFramesAndVerify(quality_thresholds, rate_profile, process_settings, |
326 rc_metrics, nullptr /* visualization_params */); | 326 rc_thresholds, nullptr /* visualization_params */); |
327 } | 327 } |
328 | 328 |
329 // VP8: Run with no packet loss, with an update (decrease) in frame rate. | 329 // VP8: Run with no packet loss, with an update (decrease) in frame rate. |
330 // Lower frame rate means higher per-frame-bandwidth, so easier to encode. | 330 // Lower frame rate means higher per-frame-bandwidth, so easier to encode. |
331 // At the bitrate in this test, this means better rate control after the | 331 // At the bitrate in this test, this means better rate control after the |
332 // update(s) to lower frame rate. So expect less frame drops, and max values | 332 // update(s) to lower frame rate. So expect less frame drops, and max values |
333 // for the rate control metrics can be lower. One key frame (first frame only). | 333 // for the rate control metrics can be lower. One key frame (first frame only). |
334 // Note: quality after update should be higher but we currently compute quality | 334 // Note: quality after update should be higher but we currently compute quality |
335 // metrics averaged over whole sequence run. | 335 // metrics averaged over whole sequence run. |
336 // Too slow to finish before timeout on iOS. See webrtc:4755. | 336 // Too slow to finish before timeout on iOS. See webrtc:4755. |
337 #if defined(WEBRTC_ANDROID) || defined(WEBRTC_IOS) | 337 #if defined(WEBRTC_ANDROID) || defined(WEBRTC_IOS) |
338 #define MAYBE_ProcessNoLossChangeFrameRateFrameDropVP8 \ | 338 #define MAYBE_ProcessNoLossChangeFrameRateFrameDropVP8 \ |
339 DISABLED_ProcessNoLossChangeFrameRateFrameDropVP8 | 339 DISABLED_ProcessNoLossChangeFrameRateFrameDropVP8 |
340 #else | 340 #else |
341 #define MAYBE_ProcessNoLossChangeFrameRateFrameDropVP8 \ | 341 #define MAYBE_ProcessNoLossChangeFrameRateFrameDropVP8 \ |
342 ProcessNoLossChangeFrameRateFrameDropVP8 | 342 ProcessNoLossChangeFrameRateFrameDropVP8 |
343 #endif | 343 #endif |
344 TEST_F(VideoProcessorIntegrationTest, | 344 TEST_F(VideoProcessorIntegrationTest, |
345 MAYBE_ProcessNoLossChangeFrameRateFrameDropVP8) { | 345 MAYBE_ProcessNoLossChangeFrameRateFrameDropVP8) { |
346 config_.networking_config.packet_loss_probability = 0; | 346 config_.networking_config.packet_loss_probability = 0; |
347 // Bitrate and frame rate profile. | 347 // Bit rate and frame rate profile. |
348 RateProfile rate_profile; | 348 RateProfile rate_profile; |
349 SetRateProfilePars(&rate_profile, 0, 80, 24, 0); | 349 SetRateProfile(&rate_profile, 0, 80, 24, 0); |
350 SetRateProfilePars(&rate_profile, 1, 80, 15, 100); | 350 SetRateProfile(&rate_profile, 1, 80, 15, 100); |
351 SetRateProfilePars(&rate_profile, 2, 80, 10, 200); | 351 SetRateProfile(&rate_profile, 2, 80, 10, 200); |
352 rate_profile.frame_index_rate_update[3] = kNumFramesLong + 1; | 352 rate_profile.frame_index_rate_update[3] = kNumFramesLong + 1; |
353 rate_profile.num_frames = kNumFramesLong; | 353 rate_profile.num_frames = kNumFramesLong; |
354 // Codec/network settings. | 354 // Codec/network settings. |
355 CodecConfigPars process_settings; | 355 CodecParams process_settings; |
356 SetCodecParameters(&process_settings, kVideoCodecVP8, kHwCodec, | 356 SetCodecParams(&process_settings, kVideoCodecVP8, kHwCodec, kUseSingleCore, |
357 kUseSingleCore, 0.0f, -1, 1, false, true, true, false); | 357 0.0f, -1, 1, false, true, true, false); |
358 // Metrics for expected quality. | 358 // Thresholds for expected quality. |
359 QualityMetrics quality_metrics; | 359 QualityThresholds quality_thresholds; |
360 SetQualityMetrics(&quality_metrics, 31.0, 22.0, 0.80, 0.65); | 360 SetQualityThresholds(&quality_thresholds, 31.0, 22.0, 0.80, 0.65); |
361 // Metrics for rate control. | 361 // Thresholds for rate control. |
362 RateControlMetrics rc_metrics[3]; | 362 RateControlThresholds rc_thresholds[3]; |
363 SetRateControlMetrics(rc_metrics, 0, 40, 20, 75, 15, 60, 0, 1); | 363 SetRateControlThresholds(rc_thresholds, 0, 40, 20, 75, 15, 60, 0, 1); |
364 SetRateControlMetrics(rc_metrics, 1, 10, 0, 25, 10, 35, 0, 0); | 364 SetRateControlThresholds(rc_thresholds, 1, 10, 0, 25, 10, 35, 0, 0); |
365 SetRateControlMetrics(rc_metrics, 2, 0, 0, 20, 10, 15, 0, 0); | 365 SetRateControlThresholds(rc_thresholds, 2, 0, 0, 20, 10, 15, 0, 0); |
366 ProcessFramesAndVerify(quality_metrics, rate_profile, process_settings, | 366 ProcessFramesAndVerify(quality_thresholds, rate_profile, process_settings, |
367 rc_metrics, nullptr /* visualization_params */); | 367 rc_thresholds, nullptr /* visualization_params */); |
368 } | 368 } |
369 | 369 |
370 // VP8: Run with no packet loss, with 3 temporal layers, with a rate update in | 370 // VP8: Run with no packet loss, with 3 temporal layers, with a rate update in |
371 // the middle of the sequence. The max values for the frame size mismatch and | 371 // the middle of the sequence. The max values for the frame size mismatch and |
372 // encoding rate mismatch are applied to each layer. | 372 // encoding rate mismatch are applied to each layer. |
373 // No dropped frames in this test, and internal spatial resizer is off. | 373 // No dropped frames in this test, and internal spatial resizer is off. |
374 // One key frame (first frame only) in sequence, so no spatial resizing. | 374 // One key frame (first frame only) in sequence, so no spatial resizing. |
375 // Too slow to finish before timeout on iOS. See webrtc:4755. | 375 // Too slow to finish before timeout on iOS. See webrtc:4755. |
376 #if defined(WEBRTC_ANDROID) || defined(WEBRTC_IOS) | 376 #if defined(WEBRTC_ANDROID) || defined(WEBRTC_IOS) |
377 #define MAYBE_ProcessNoLossTemporalLayersVP8 \ | 377 #define MAYBE_ProcessNoLossTemporalLayersVP8 \ |
378 DISABLED_ProcessNoLossTemporalLayersVP8 | 378 DISABLED_ProcessNoLossTemporalLayersVP8 |
379 #else | 379 #else |
380 #define MAYBE_ProcessNoLossTemporalLayersVP8 ProcessNoLossTemporalLayersVP8 | 380 #define MAYBE_ProcessNoLossTemporalLayersVP8 ProcessNoLossTemporalLayersVP8 |
381 #endif | 381 #endif |
382 TEST_F(VideoProcessorIntegrationTest, MAYBE_ProcessNoLossTemporalLayersVP8) { | 382 TEST_F(VideoProcessorIntegrationTest, MAYBE_ProcessNoLossTemporalLayersVP8) { |
383 config_.networking_config.packet_loss_probability = 0; | 383 config_.networking_config.packet_loss_probability = 0; |
384 // Bitrate and frame rate profile. | 384 // Bit rate and frame rate profile. |
385 RateProfile rate_profile; | 385 RateProfile rate_profile; |
386 SetRateProfilePars(&rate_profile, 0, 200, 30, 0); | 386 SetRateProfile(&rate_profile, 0, 200, 30, 0); |
387 SetRateProfilePars(&rate_profile, 1, 400, 30, 150); | 387 SetRateProfile(&rate_profile, 1, 400, 30, 150); |
388 rate_profile.frame_index_rate_update[2] = kNumFramesLong + 1; | 388 rate_profile.frame_index_rate_update[2] = kNumFramesLong + 1; |
389 rate_profile.num_frames = kNumFramesLong; | 389 rate_profile.num_frames = kNumFramesLong; |
390 // Codec/network settings. | 390 // Codec/network settings. |
391 CodecConfigPars process_settings; | 391 CodecParams process_settings; |
392 SetCodecParameters(&process_settings, kVideoCodecVP8, kHwCodec, | 392 SetCodecParams(&process_settings, kVideoCodecVP8, kHwCodec, kUseSingleCore, |
393 kUseSingleCore, 0.0f, -1, 3, false, true, true, false); | 393 0.0f, -1, 3, false, true, true, false); |
394 // Metrics for expected quality. | 394 // Thresholds for expected quality. |
395 QualityMetrics quality_metrics; | 395 QualityThresholds quality_thresholds; |
396 SetQualityMetrics(&quality_metrics, 32.5, 30.0, 0.85, 0.80); | 396 SetQualityThresholds(&quality_thresholds, 32.5, 30.0, 0.85, 0.80); |
397 // Metrics for rate control. | 397 // Thresholds for rate control. |
398 RateControlMetrics rc_metrics[2]; | 398 RateControlThresholds rc_thresholds[2]; |
399 SetRateControlMetrics(rc_metrics, 0, 0, 20, 30, 10, 10, 0, 1); | 399 SetRateControlThresholds(rc_thresholds, 0, 0, 20, 30, 10, 10, 0, 1); |
400 SetRateControlMetrics(rc_metrics, 1, 0, 0, 30, 15, 10, 0, 0); | 400 SetRateControlThresholds(rc_thresholds, 1, 0, 0, 30, 15, 10, 0, 0); |
401 ProcessFramesAndVerify(quality_metrics, rate_profile, process_settings, | 401 ProcessFramesAndVerify(quality_thresholds, rate_profile, process_settings, |
402 rc_metrics, nullptr /* visualization_params */); | 402 rc_thresholds, nullptr /* visualization_params */); |
403 } | 403 } |
404 } // namespace test | 404 } // namespace test |
405 } // namespace webrtc | 405 } // namespace webrtc |
OLD | NEW |