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

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

Issue 3011373002: Updating OpenH264 to v1.7.0 (Closed)
Patch Set: increasing frame size mismatch threshold Created 3 years, 2 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) 2017 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2017 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 157 matching lines...) Expand 10 before | Expand all | Expand 10 after
168 rc_threshold->max_num_frames_to_hit_target = max_num_frames_to_hit_target; 168 rc_threshold->max_num_frames_to_hit_target = max_num_frames_to_hit_target;
169 rc_threshold->num_spatial_resizes = num_spatial_resizes; 169 rc_threshold->num_spatial_resizes = num_spatial_resizes;
170 rc_threshold->num_key_frames = num_key_frames; 170 rc_threshold->num_key_frames = num_key_frames;
171 } 171 }
172 172
173 // Processes all frames in the clip and verifies the result. 173 // Processes all frames in the clip and verifies the result.
174 void VideoProcessorIntegrationTest::ProcessFramesAndMaybeVerify( 174 void VideoProcessorIntegrationTest::ProcessFramesAndMaybeVerify(
175 const RateProfile& rate_profile, 175 const RateProfile& rate_profile,
176 const std::vector<RateControlThresholds>* rc_thresholds, 176 const std::vector<RateControlThresholds>* rc_thresholds,
177 const QualityThresholds* quality_thresholds, 177 const QualityThresholds* quality_thresholds,
178 const BitstreamThresholds* bs_thresholds,
178 const VisualizationParams* visualization_params) { 179 const VisualizationParams* visualization_params) {
179 // The Android HW codec needs to be run on a task queue, so we simply always 180 // The Android HW codec needs to be run on a task queue, so we simply always
180 // run the test on a task queue. 181 // run the test on a task queue.
181 rtc::TaskQueue task_queue("VidProc TQ"); 182 rtc::TaskQueue task_queue("VidProc TQ");
182 rtc::Event sync_event(false, false); 183 rtc::Event sync_event(false, false);
183 184
184 SetUpAndInitObjects(&task_queue, rate_profile.target_bit_rate[0], 185 SetUpAndInitObjects(&task_queue, rate_profile.target_bit_rate[0],
185 rate_profile.input_frame_rate[0], visualization_params); 186 rate_profile.input_frame_rate[0], visualization_params);
186 187
187 // Set initial rates. 188 // Set initial rates.
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
238 sync_event.Set(); 239 sync_event.Set();
239 }); 240 });
240 sync_event.Wait(rtc::Event::kForever); 241 sync_event.Wait(rtc::Event::kForever);
241 242
242 rate_update_index = 0; 243 rate_update_index = 0;
243 frame_number = 0; 244 frame_number = 0;
244 ResetRateControlMetrics(rate_update_index, rate_profile); 245 ResetRateControlMetrics(rate_update_index, rate_profile);
245 while (frame_number < num_frames) { 246 while (frame_number < num_frames) {
246 UpdateRateControlMetrics(frame_number); 247 UpdateRateControlMetrics(frame_number);
247 248
249 if (bs_thresholds) {
250 VerifyBitstream(frame_number, bs_thresholds);
251 }
252
248 ++frame_number; 253 ++frame_number;
249 254
250 if (frame_number == 255 if (frame_number ==
251 rate_profile.frame_index_rate_update[rate_update_index + 1]) { 256 rate_profile.frame_index_rate_update[rate_update_index + 1]) {
252 PrintRateControlMetrics(rate_update_index, num_dropped_frames, 257 PrintRateControlMetrics(rate_update_index, num_dropped_frames,
253 num_spatial_resizes); 258 num_spatial_resizes);
254 VerifyRateControlMetrics(rate_update_index, rc_thresholds, 259 VerifyRateControlMetrics(rate_update_index, rc_thresholds,
255 num_dropped_frames, num_spatial_resizes); 260 num_dropped_frames, num_spatial_resizes);
256 ++rate_update_index; 261 ++rate_update_index;
257 ResetRateControlMetrics(rate_update_index, rate_profile); 262 ResetRateControlMetrics(rate_update_index, rate_profile);
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
327 break; 332 break;
328 case kVideoCodecVP9: 333 case kVideoCodecVP9:
329 codec = cricket::VideoCodec(cricket::kVp9CodecName); 334 codec = cricket::VideoCodec(cricket::kVp9CodecName);
330 encoder_.reset(encoder_factory->CreateVideoEncoder(codec)); 335 encoder_.reset(encoder_factory->CreateVideoEncoder(codec));
331 decoder_ = 336 decoder_ =
332 decoder_factory_->CreateVideoDecoderWithParams(codec, decoder_params); 337 decoder_factory_->CreateVideoDecoderWithParams(codec, decoder_params);
333 break; 338 break;
334 case kVideoCodecH264: 339 case kVideoCodecH264:
335 // TODO(brandtr): Generalize so that we support multiple profiles here. 340 // TODO(brandtr): Generalize so that we support multiple profiles here.
336 codec = cricket::VideoCodec(cricket::kH264CodecName); 341 codec = cricket::VideoCodec(cricket::kH264CodecName);
342 if (config_.packetization_mode == H264PacketizationMode::NonInterleaved) {
343 codec.SetParam(cricket::kH264FmtpPacketizationMode, "1");
344 } else {
345 codec.SetParam(cricket::kH264FmtpPacketizationMode, "0");
hbos 2017/09/25 11:02:35 nit: RTC_DCHECK_EQ(config_packetization_mode, H264
346 }
337 encoder_.reset(encoder_factory->CreateVideoEncoder(codec)); 347 encoder_.reset(encoder_factory->CreateVideoEncoder(codec));
338 decoder_ = 348 decoder_ =
339 decoder_factory_->CreateVideoDecoderWithParams(codec, decoder_params); 349 decoder_factory_->CreateVideoDecoderWithParams(codec, decoder_params);
340 break; 350 break;
341 default: 351 default:
342 RTC_NOTREACHED(); 352 RTC_NOTREACHED();
343 break; 353 break;
344 } 354 }
345 355
346 if (config_.sw_fallback_encoder) { 356 if (config_.sw_fallback_encoder) {
(...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after
553 printf(" Layer encoded bitrate : %f\n", actual_.kbps_layer[i]); 563 printf(" Layer encoded bitrate : %f\n", actual_.kbps_layer[i]);
554 printf(" Layer frame size %% mismatch : %d\n", 564 printf(" Layer frame size %% mismatch : %d\n",
555 actual_.DeltaFrameSizeMismatchPercent(i)); 565 actual_.DeltaFrameSizeMismatchPercent(i));
556 printf(" Layer bitrate %% mismatch : %d\n", 566 printf(" Layer bitrate %% mismatch : %d\n",
557 actual_.BitrateMismatchPercent(i, target_.kbps_layer[i])); 567 actual_.BitrateMismatchPercent(i, target_.kbps_layer[i]));
558 printf(" # processed frames per layer: %d\n", actual_.num_frames_layer[i]); 568 printf(" # processed frames per layer: %d\n", actual_.num_frames_layer[i]);
559 } 569 }
560 printf("\n"); 570 printf("\n");
561 } 571 }
562 572
573 void VideoProcessorIntegrationTest::VerifyBitstream(
574 int frame_number,
575 const BitstreamThresholds *bs_thresholds) {
576 RTC_CHECK_GE(frame_number, 0);
577 const FrameStatistic* frame_stat = stats_.GetFrame(frame_number);
578 EXPECT_LE(frame_stat->max_nalu_length, bs_thresholds->max_nalu_length);
579 }
580
563 // Temporal layer index corresponding to frame number, for up to 3 layers. 581 // Temporal layer index corresponding to frame number, for up to 3 layers.
564 int VideoProcessorIntegrationTest::TemporalLayerIndexForFrame( 582 int VideoProcessorIntegrationTest::TemporalLayerIndexForFrame(
565 int frame_number) const { 583 int frame_number) const {
566 int tl_idx = -1; 584 int tl_idx = -1;
567 switch (NumberOfTemporalLayers(config_.codec_settings)) { 585 switch (NumberOfTemporalLayers(config_.codec_settings)) {
568 case 1: 586 case 1:
569 tl_idx = 0; 587 tl_idx = 0;
570 break; 588 break;
571 case 2: 589 case 2:
572 // temporal layer 0: 0 2 4 ... 590 // temporal layer 0: 0 2 4 ...
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
646 664
647 // Update layer per-frame-bandwidth. 665 // Update layer per-frame-bandwidth.
648 for (int i = 0; i < num_temporal_layers; ++i) { 666 for (int i = 0; i < num_temporal_layers; ++i) {
649 target_.framesize_kbits_layer[i] = 667 target_.framesize_kbits_layer[i] =
650 target_.kbps_layer[i] / target_.fps_layer[i]; 668 target_.kbps_layer[i] / target_.fps_layer[i];
651 } 669 }
652 } 670 }
653 671
654 } // namespace test 672 } // namespace test
655 } // namespace webrtc 673 } // namespace webrtc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698