Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(647)

Side by Side Diff: webrtc/modules/video_coding/codecs/test/videoprocessor_integrationtest.cc

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

Powered by Google App Engine
This is Rietveld 408576698