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 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
71 // rate update is made to the encoder, for the encoder to reach within | 71 // rate update is made to the encoder, for the encoder to reach within |
72 // |kPercTargetvsActualMismatch| of new target rate. The metrics are defined for | 72 // |kPercTargetvsActualMismatch| of new target rate. The metrics are defined for |
73 // each rate update sequence. | 73 // each rate update sequence. |
74 struct RateControlMetrics { | 74 struct RateControlMetrics { |
75 int max_num_dropped_frames; | 75 int max_num_dropped_frames; |
76 int max_key_frame_size_mismatch; | 76 int max_key_frame_size_mismatch; |
77 int max_delta_frame_size_mismatch; | 77 int max_delta_frame_size_mismatch; |
78 int max_encoding_rate_mismatch; | 78 int max_encoding_rate_mismatch; |
79 int max_time_hit_target; | 79 int max_time_hit_target; |
80 int num_spatial_resizes; | 80 int num_spatial_resizes; |
81 int num_key_frames; | |
81 }; | 82 }; |
82 | 83 |
83 | 84 |
84 // Sequence used is foreman (CIF): may be better to use VGA for resize test. | 85 // Sequence used is foreman (CIF): may be better to use VGA for resize test. |
85 const int kCIFWidth = 352; | 86 const int kCIFWidth = 352; |
86 const int kCIFHeight = 288; | 87 const int kCIFHeight = 288; |
87 const int kNbrFramesShort = 100; // Some tests are run for shorter sequence. | 88 const int kNbrFramesShort = 100; // Some tests are run for shorter sequence. |
88 const int kNbrFramesLong = 299; | 89 const int kNbrFramesLong = 299; |
89 | 90 |
90 // Parameters from VP8 wrapper, which control target size of key frames. | 91 // Parameters from VP8 wrapper, which control target size of key frames. |
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
201 config_.codec_settings->codecSpecific.VP8.keyFrameInterval = | 202 config_.codec_settings->codecSpecific.VP8.keyFrameInterval = |
202 kBaseKeyFrameInterval; | 203 kBaseKeyFrameInterval; |
203 break; | 204 break; |
204 case kVideoCodecVP9: | 205 case kVideoCodecVP9: |
205 config_.codec_settings->codecSpecific.VP9.denoisingOn = | 206 config_.codec_settings->codecSpecific.VP9.denoisingOn = |
206 denoising_on_; | 207 denoising_on_; |
207 config_.codec_settings->codecSpecific.VP9.numberOfTemporalLayers = | 208 config_.codec_settings->codecSpecific.VP9.numberOfTemporalLayers = |
208 num_temporal_layers_; | 209 num_temporal_layers_; |
209 config_.codec_settings->codecSpecific.VP9.frameDroppingOn = | 210 config_.codec_settings->codecSpecific.VP9.frameDroppingOn = |
210 frame_dropper_on_; | 211 frame_dropper_on_; |
212 config_.codec_settings->codecSpecific.VP9.automaticResizeOn = | |
213 spatial_resize_on_; | |
211 config_.codec_settings->codecSpecific.VP9.keyFrameInterval = | 214 config_.codec_settings->codecSpecific.VP9.keyFrameInterval = |
212 kBaseKeyFrameInterval; | 215 kBaseKeyFrameInterval; |
213 break; | 216 break; |
214 default: | 217 default: |
215 assert(false); | 218 assert(false); |
216 break; | 219 break; |
217 } | 220 } |
218 frame_reader_ = | 221 frame_reader_ = |
219 new webrtc::test::FrameReaderImpl(config_.input_filename, | 222 new webrtc::test::FrameReaderImpl(config_.input_filename, |
220 config_.frame_length_in_bytes); | 223 config_.frame_length_in_bytes); |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
300 } | 303 } |
301 } | 304 } |
302 | 305 |
303 // Verify expected behavior of rate control and print out data. | 306 // Verify expected behavior of rate control and print out data. |
304 void VerifyRateControl(int update_index, | 307 void VerifyRateControl(int update_index, |
305 int max_key_frame_size_mismatch, | 308 int max_key_frame_size_mismatch, |
306 int max_delta_frame_size_mismatch, | 309 int max_delta_frame_size_mismatch, |
307 int max_encoding_rate_mismatch, | 310 int max_encoding_rate_mismatch, |
308 int max_time_hit_target, | 311 int max_time_hit_target, |
309 int max_num_dropped_frames, | 312 int max_num_dropped_frames, |
310 int num_spatial_resizes) { | 313 int num_spatial_resizes, |
314 int num_key_frames) { | |
311 int num_dropped_frames = processor_->NumberDroppedFrames(); | 315 int num_dropped_frames = processor_->NumberDroppedFrames(); |
312 int num_resize_actions = processor_->NumberSpatialResizes(); | 316 int num_resize_actions = processor_->NumberSpatialResizes(); |
313 printf("For update #: %d,\n " | 317 printf("For update #: %d,\n " |
314 " Target Bitrate: %d,\n" | 318 " Target Bitrate: %d,\n" |
315 " Encoding bitrate: %f,\n" | 319 " Encoding bitrate: %f,\n" |
316 " Frame rate: %d \n", | 320 " Frame rate: %d \n", |
317 update_index, bit_rate_, encoding_bitrate_total_, frame_rate_); | 321 update_index, bit_rate_, encoding_bitrate_total_, frame_rate_); |
318 printf(" Number of frames to approach target rate = %d, \n" | 322 printf(" Number of frames to approach target rate = %d, \n" |
319 " Number of dropped frames = %d, \n" | 323 " Number of dropped frames = %d, \n" |
320 " Number of spatial resizes = %d, \n", | 324 " Number of spatial resizes = %d, \n", |
(...skipping 26 matching lines...) Expand all Loading... | |
347 bit_rate_layer_[i], frame_rate_layer_[i], per_frame_bandwidth_[i], | 351 bit_rate_layer_[i], frame_rate_layer_[i], per_frame_bandwidth_[i], |
348 encoding_bitrate_[i], perc_frame_size_mismatch, | 352 encoding_bitrate_[i], perc_frame_size_mismatch, |
349 perc_encoding_rate_mismatch, num_frames_per_update_[i]); | 353 perc_encoding_rate_mismatch, num_frames_per_update_[i]); |
350 EXPECT_LE(perc_frame_size_mismatch, max_delta_frame_size_mismatch); | 354 EXPECT_LE(perc_frame_size_mismatch, max_delta_frame_size_mismatch); |
351 EXPECT_LE(perc_encoding_rate_mismatch, max_encoding_rate_mismatch); | 355 EXPECT_LE(perc_encoding_rate_mismatch, max_encoding_rate_mismatch); |
352 } | 356 } |
353 printf("\n"); | 357 printf("\n"); |
354 EXPECT_LE(num_frames_to_hit_target_, max_time_hit_target); | 358 EXPECT_LE(num_frames_to_hit_target_, max_time_hit_target); |
355 EXPECT_LE(num_dropped_frames, max_num_dropped_frames); | 359 EXPECT_LE(num_dropped_frames, max_num_dropped_frames); |
356 EXPECT_EQ(num_resize_actions, num_spatial_resizes); | 360 EXPECT_EQ(num_resize_actions, num_spatial_resizes); |
361 EXPECT_EQ(num_key_frames_, num_key_frames); | |
357 } | 362 } |
358 | 363 |
359 // Layer index corresponding to frame number, for up to 3 layers. | 364 // Layer index corresponding to frame number, for up to 3 layers. |
360 void LayerIndexForFrame(int frame_number) { | 365 void LayerIndexForFrame(int frame_number) { |
361 if (num_temporal_layers_ == 1) { | 366 if (num_temporal_layers_ == 1) { |
362 layer_ = 0; | 367 layer_ = 0; |
363 } else if (num_temporal_layers_ == 2) { | 368 } else if (num_temporal_layers_ == 2) { |
364 // layer 0: 0 2 4 ... | 369 // layer 0: 0 2 4 ... |
365 // layer 1: 1 3 | 370 // layer 1: 1 3 |
366 if (frame_number % 2 == 0) { | 371 if (frame_number % 2 == 0) { |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
399 bit_rate_layer_[i] = bit_rate_ * bit_rate_ratio; | 404 bit_rate_layer_[i] = bit_rate_ * bit_rate_ratio; |
400 } | 405 } |
401 frame_rate_layer_[i] = frame_rate_ / static_cast<float>( | 406 frame_rate_layer_[i] = frame_rate_ / static_cast<float>( |
402 1 << (num_temporal_layers_ - 1)); | 407 1 << (num_temporal_layers_ - 1)); |
403 } | 408 } |
404 if (num_temporal_layers_ == 3) { | 409 if (num_temporal_layers_ == 3) { |
405 frame_rate_layer_[2] = frame_rate_ / 2.0f; | 410 frame_rate_layer_[2] = frame_rate_ / 2.0f; |
406 } | 411 } |
407 } | 412 } |
408 | 413 |
409 VideoFrameType FrameType(int frame_number) { | |
410 if (frame_number == 0 || ((frame_number) % key_frame_interval_ == 0 && | |
411 key_frame_interval_ > 0)) { | |
412 return kKeyFrame; | |
413 } else { | |
414 return kDeltaFrame; | |
415 } | |
416 } | |
417 | |
418 void TearDown() { | 414 void TearDown() { |
419 delete processor_; | 415 delete processor_; |
420 delete packet_manipulator_; | 416 delete packet_manipulator_; |
421 delete frame_writer_; | 417 delete frame_writer_; |
422 delete frame_reader_; | 418 delete frame_reader_; |
423 delete decoder_; | 419 delete decoder_; |
424 delete encoder_; | 420 delete encoder_; |
425 } | 421 } |
426 | 422 |
427 // Processes all frames in the clip and verifies the result. | 423 // Processes all frames in the clip and verifies the result. |
(...skipping 19 matching lines...) Expand all Loading... | |
447 // Set the initial target size for key frame. | 443 // Set the initial target size for key frame. |
448 target_size_key_frame_initial_ = 0.5 * kInitialBufferSize * | 444 target_size_key_frame_initial_ = 0.5 * kInitialBufferSize * |
449 bit_rate_layer_[0]; | 445 bit_rate_layer_[0]; |
450 processor_->SetRates(bit_rate_, frame_rate_); | 446 processor_->SetRates(bit_rate_, frame_rate_); |
451 // Process each frame, up to |num_frames|. | 447 // Process each frame, up to |num_frames|. |
452 int num_frames = rate_profile.num_frames; | 448 int num_frames = rate_profile.num_frames; |
453 int update_index = 0; | 449 int update_index = 0; |
454 ResetRateControlMetrics( | 450 ResetRateControlMetrics( |
455 rate_profile.frame_index_rate_update[update_index + 1]); | 451 rate_profile.frame_index_rate_update[update_index + 1]); |
456 int frame_number = 0; | 452 int frame_number = 0; |
457 VideoFrameType frame_type = kDeltaFrame; | 453 VideoFrameType frame_type = kDeltaFrame; |
stefan-webrtc
2015/09/05 10:45:49
I would move this declaration into the loop instea
| |
458 while (processor_->ProcessFrame(frame_number) && | 454 while (processor_->ProcessFrame(frame_number) && |
459 frame_number < num_frames) { | 455 frame_number < num_frames) { |
460 // Get the layer index for the frame |frame_number|. | 456 // Get the layer index for the frame |frame_number|. |
461 LayerIndexForFrame(frame_number); | 457 LayerIndexForFrame(frame_number); |
462 frame_type = FrameType(frame_number); | 458 // Get the frame_type. |
459 frame_type = processor_->EncodedFrameType(); | |
463 // Counter for whole sequence run. | 460 // Counter for whole sequence run. |
464 ++frame_number; | 461 ++frame_number; |
465 // Counters for each rate update. | 462 // Counters for each rate update. |
466 ++num_frames_per_update_[layer_]; | 463 ++num_frames_per_update_[layer_]; |
467 ++num_frames_total_; | 464 ++num_frames_total_; |
468 UpdateRateControlMetrics(frame_number, frame_type); | 465 UpdateRateControlMetrics(frame_number, frame_type); |
469 // If we hit another/next update, verify stats for current state and | 466 // If we hit another/next update, verify stats for current state and |
470 // update layers and codec with new rates. | 467 // update layers and codec with new rates. |
471 if (frame_number == | 468 if (frame_number == |
472 rate_profile.frame_index_rate_update[update_index + 1]) { | 469 rate_profile.frame_index_rate_update[update_index + 1]) { |
473 VerifyRateControl( | 470 VerifyRateControl( |
474 update_index, | 471 update_index, |
475 rc_metrics[update_index].max_key_frame_size_mismatch, | 472 rc_metrics[update_index].max_key_frame_size_mismatch, |
476 rc_metrics[update_index].max_delta_frame_size_mismatch, | 473 rc_metrics[update_index].max_delta_frame_size_mismatch, |
477 rc_metrics[update_index].max_encoding_rate_mismatch, | 474 rc_metrics[update_index].max_encoding_rate_mismatch, |
478 rc_metrics[update_index].max_time_hit_target, | 475 rc_metrics[update_index].max_time_hit_target, |
479 rc_metrics[update_index].max_num_dropped_frames, | 476 rc_metrics[update_index].max_num_dropped_frames, |
480 rc_metrics[update_index].num_spatial_resizes); | 477 rc_metrics[update_index].num_spatial_resizes, |
478 rc_metrics[update_index].num_key_frames); | |
481 // Update layer rates and the codec with new rates. | 479 // Update layer rates and the codec with new rates. |
482 ++update_index; | 480 ++update_index; |
483 bit_rate_ = rate_profile.target_bit_rate[update_index]; | 481 bit_rate_ = rate_profile.target_bit_rate[update_index]; |
484 frame_rate_ = rate_profile.input_frame_rate[update_index]; | 482 frame_rate_ = rate_profile.input_frame_rate[update_index]; |
485 SetLayerRates(); | 483 SetLayerRates(); |
486 ResetRateControlMetrics(rate_profile. | 484 ResetRateControlMetrics(rate_profile. |
487 frame_index_rate_update[update_index + 1]); | 485 frame_index_rate_update[update_index + 1]); |
488 processor_->SetRates(bit_rate_, frame_rate_); | 486 processor_->SetRates(bit_rate_, frame_rate_); |
489 } | 487 } |
490 } | 488 } |
491 VerifyRateControl( | 489 VerifyRateControl( |
492 update_index, | 490 update_index, |
493 rc_metrics[update_index].max_key_frame_size_mismatch, | 491 rc_metrics[update_index].max_key_frame_size_mismatch, |
494 rc_metrics[update_index].max_delta_frame_size_mismatch, | 492 rc_metrics[update_index].max_delta_frame_size_mismatch, |
495 rc_metrics[update_index].max_encoding_rate_mismatch, | 493 rc_metrics[update_index].max_encoding_rate_mismatch, |
496 rc_metrics[update_index].max_time_hit_target, | 494 rc_metrics[update_index].max_time_hit_target, |
497 rc_metrics[update_index].max_num_dropped_frames, | 495 rc_metrics[update_index].max_num_dropped_frames, |
498 rc_metrics[update_index].num_spatial_resizes); | 496 rc_metrics[update_index].num_spatial_resizes, |
497 rc_metrics[update_index].num_key_frames); | |
499 EXPECT_EQ(num_frames, frame_number); | 498 EXPECT_EQ(num_frames, frame_number); |
500 EXPECT_EQ(num_frames + 1, static_cast<int>(stats_.stats_.size())); | 499 EXPECT_EQ(num_frames + 1, static_cast<int>(stats_.stats_.size())); |
501 | 500 |
502 // Release encoder and decoder to make sure they have finished processing: | 501 // Release encoder and decoder to make sure they have finished processing: |
503 EXPECT_EQ(WEBRTC_VIDEO_CODEC_OK, encoder_->Release()); | 502 EXPECT_EQ(WEBRTC_VIDEO_CODEC_OK, encoder_->Release()); |
504 EXPECT_EQ(WEBRTC_VIDEO_CODEC_OK, decoder_->Release()); | 503 EXPECT_EQ(WEBRTC_VIDEO_CODEC_OK, decoder_->Release()); |
505 // Close the files before we start using them for SSIM/PSNR calculations. | 504 // Close the files before we start using them for SSIM/PSNR calculations. |
506 frame_reader_->Close(); | 505 frame_reader_->Close(); |
507 frame_writer_->Close(); | 506 frame_writer_->Close(); |
508 | 507 |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
569 quality_metrics->minimum_min_ssim = minimum_min_ssim; | 568 quality_metrics->minimum_min_ssim = minimum_min_ssim; |
570 } | 569 } |
571 | 570 |
572 void SetRateControlMetrics(RateControlMetrics* rc_metrics, | 571 void SetRateControlMetrics(RateControlMetrics* rc_metrics, |
573 int update_index, | 572 int update_index, |
574 int max_num_dropped_frames, | 573 int max_num_dropped_frames, |
575 int max_key_frame_size_mismatch, | 574 int max_key_frame_size_mismatch, |
576 int max_delta_frame_size_mismatch, | 575 int max_delta_frame_size_mismatch, |
577 int max_encoding_rate_mismatch, | 576 int max_encoding_rate_mismatch, |
578 int max_time_hit_target, | 577 int max_time_hit_target, |
579 int num_spatial_resizes) { | 578 int num_spatial_resizes, |
579 int num_key_frames) { | |
580 rc_metrics[update_index].max_num_dropped_frames = max_num_dropped_frames; | 580 rc_metrics[update_index].max_num_dropped_frames = max_num_dropped_frames; |
581 rc_metrics[update_index].max_key_frame_size_mismatch = | 581 rc_metrics[update_index].max_key_frame_size_mismatch = |
582 max_key_frame_size_mismatch; | 582 max_key_frame_size_mismatch; |
583 rc_metrics[update_index].max_delta_frame_size_mismatch = | 583 rc_metrics[update_index].max_delta_frame_size_mismatch = |
584 max_delta_frame_size_mismatch; | 584 max_delta_frame_size_mismatch; |
585 rc_metrics[update_index].max_encoding_rate_mismatch = | 585 rc_metrics[update_index].max_encoding_rate_mismatch = |
586 max_encoding_rate_mismatch; | 586 max_encoding_rate_mismatch; |
587 rc_metrics[update_index].max_time_hit_target = max_time_hit_target; | 587 rc_metrics[update_index].max_time_hit_target = max_time_hit_target; |
588 rc_metrics[update_index].num_spatial_resizes = num_spatial_resizes; | 588 rc_metrics[update_index].num_spatial_resizes = num_spatial_resizes; |
589 rc_metrics[update_index].num_key_frames = num_key_frames; | |
589 } | 590 } |
590 | 591 |
591 // VP9: Run with no packet loss and fixed bitrate. Quality should be very high. | 592 // VP9: Run with no packet loss and fixed bitrate. Quality should be very high. |
592 // One key frame (first frame only) in sequence. Setting |key_frame_interval| | 593 // One key frame (first frame only) in sequence. Setting |key_frame_interval| |
593 // to -1 below means no periodic key frames in test. | 594 // to -1 below means no periodic key frames in test. |
594 TEST_F(VideoProcessorIntegrationTest, Process0PercentPacketLossVP9) { | 595 TEST_F(VideoProcessorIntegrationTest, Process0PercentPacketLossVP9) { |
595 // Bitrate and frame rate profile. | 596 // Bitrate and frame rate profile. |
596 RateProfile rate_profile; | 597 RateProfile rate_profile; |
597 SetRateProfilePars(&rate_profile, 0, 500, 30, 0); | 598 SetRateProfilePars(&rate_profile, 0, 500, 30, 0); |
598 rate_profile.frame_index_rate_update[1] = kNbrFramesShort + 1; | 599 rate_profile.frame_index_rate_update[1] = kNbrFramesShort + 1; |
599 rate_profile.num_frames = kNbrFramesShort; | 600 rate_profile.num_frames = kNbrFramesShort; |
600 // Codec/network settings. | 601 // Codec/network settings. |
601 CodecConfigPars process_settings; | 602 CodecConfigPars process_settings; |
602 SetCodecParameters(&process_settings, kVideoCodecVP9, 0.0f, -1, 1, false, | 603 SetCodecParameters(&process_settings, kVideoCodecVP9, 0.0f, -1, 1, false, |
603 false, true, false); | 604 false, true, false); |
604 // Metrics for expected quality. | 605 // Metrics for expected quality. |
605 QualityMetrics quality_metrics; | 606 QualityMetrics quality_metrics; |
606 SetQualityMetrics(&quality_metrics, 37.0, 36.0, 0.93, 0.92); | 607 SetQualityMetrics(&quality_metrics, 37.0, 36.0, 0.93, 0.92); |
607 // Metrics for rate control. | 608 // Metrics for rate control. |
608 RateControlMetrics rc_metrics[1]; | 609 RateControlMetrics rc_metrics[1]; |
609 SetRateControlMetrics(rc_metrics, 0, 0, 40, 20, 10, 20, 0); | 610 SetRateControlMetrics(rc_metrics, 0, 0, 40, 20, 10, 20, 0, 1); |
610 ProcessFramesAndVerify(quality_metrics, | 611 ProcessFramesAndVerify(quality_metrics, |
611 rate_profile, | 612 rate_profile, |
612 process_settings, | 613 process_settings, |
613 rc_metrics); | 614 rc_metrics); |
614 } | 615 } |
615 | 616 |
616 // VP9: Run with 5% packet loss and fixed bitrate. Quality should be a bit | 617 // VP9: Run with 5% packet loss and fixed bitrate. Quality should be a bit |
617 // lower. One key frame (first frame only) in sequence. | 618 // lower. One key frame (first frame only) in sequence. |
618 TEST_F(VideoProcessorIntegrationTest, Process5PercentPacketLossVP9) { | 619 TEST_F(VideoProcessorIntegrationTest, Process5PercentPacketLossVP9) { |
619 // Bitrate and frame rate profile. | 620 // Bitrate and frame rate profile. |
620 RateProfile rate_profile; | 621 RateProfile rate_profile; |
621 SetRateProfilePars(&rate_profile, 0, 500, 30, 0); | 622 SetRateProfilePars(&rate_profile, 0, 500, 30, 0); |
622 rate_profile.frame_index_rate_update[1] = kNbrFramesShort + 1; | 623 rate_profile.frame_index_rate_update[1] = kNbrFramesShort + 1; |
623 rate_profile.num_frames = kNbrFramesShort; | 624 rate_profile.num_frames = kNbrFramesShort; |
624 // Codec/network settings. | 625 // Codec/network settings. |
625 CodecConfigPars process_settings; | 626 CodecConfigPars process_settings; |
626 SetCodecParameters(&process_settings, kVideoCodecVP9, 0.05f, -1, 1, false, | 627 SetCodecParameters(&process_settings, kVideoCodecVP9, 0.05f, -1, 1, false, |
627 false, true, false); | 628 false, true, false); |
628 // Metrics for expected quality. | 629 // Metrics for expected quality. |
629 QualityMetrics quality_metrics; | 630 QualityMetrics quality_metrics; |
630 SetQualityMetrics(&quality_metrics, 17.0, 14.0, 0.45, 0.36); | 631 SetQualityMetrics(&quality_metrics, 17.0, 14.0, 0.45, 0.36); |
631 // Metrics for rate control. | 632 // Metrics for rate control. |
632 RateControlMetrics rc_metrics[1]; | 633 RateControlMetrics rc_metrics[1]; |
633 SetRateControlMetrics(rc_metrics, 0, 0, 40, 20, 10, 20, 0); | 634 SetRateControlMetrics(rc_metrics, 0, 0, 40, 20, 10, 20, 0, 1); |
634 ProcessFramesAndVerify(quality_metrics, | 635 ProcessFramesAndVerify(quality_metrics, |
635 rate_profile, | 636 rate_profile, |
636 process_settings, | 637 process_settings, |
637 rc_metrics); | 638 rc_metrics); |
638 } | 639 } |
639 | 640 |
640 | 641 |
641 // VP9: Run with no packet loss, with varying bitrate (3 rate updates): | 642 // VP9: Run with no packet loss, with varying bitrate (3 rate updates): |
642 // low to high to medium. Check that quality and encoder response to the new | 643 // low to high to medium. Check that quality and encoder response to the new |
643 // target rate/per-frame bandwidth (for each rate update) is within limits. | 644 // target rate/per-frame bandwidth (for each rate update) is within limits. |
644 // One key frame (first frame only) in sequence. | 645 // One key frame (first frame only) in sequence. |
645 TEST_F(VideoProcessorIntegrationTest, ProcessNoLossChangeBitRateVP9) { | 646 TEST_F(VideoProcessorIntegrationTest, ProcessNoLossChangeBitRateVP9) { |
646 // Bitrate and frame rate profile. | 647 // Bitrate and frame rate profile. |
647 RateProfile rate_profile; | 648 RateProfile rate_profile; |
648 SetRateProfilePars(&rate_profile, 0, 200, 30, 0); | 649 SetRateProfilePars(&rate_profile, 0, 200, 30, 0); |
649 SetRateProfilePars(&rate_profile, 1, 700, 30, 100); | 650 SetRateProfilePars(&rate_profile, 1, 700, 30, 100); |
650 SetRateProfilePars(&rate_profile, 2, 500, 30, 200); | 651 SetRateProfilePars(&rate_profile, 2, 500, 30, 200); |
651 rate_profile.frame_index_rate_update[3] = kNbrFramesLong + 1; | 652 rate_profile.frame_index_rate_update[3] = kNbrFramesLong + 1; |
652 rate_profile.num_frames = kNbrFramesLong; | 653 rate_profile.num_frames = kNbrFramesLong; |
653 // Codec/network settings. | 654 // Codec/network settings. |
654 CodecConfigPars process_settings; | 655 CodecConfigPars process_settings; |
655 SetCodecParameters(&process_settings, kVideoCodecVP9, 0.0f, -1, 1, false, | 656 SetCodecParameters(&process_settings, kVideoCodecVP9, 0.0f, -1, 1, false, |
656 false, true, false); | 657 false, true, false); |
657 // Metrics for expected quality. | 658 // Metrics for expected quality. |
658 QualityMetrics quality_metrics; | 659 QualityMetrics quality_metrics; |
659 SetQualityMetrics(&quality_metrics, 35.9, 30.0, 0.90, 0.85); | 660 SetQualityMetrics(&quality_metrics, 35.9, 30.0, 0.90, 0.85); |
660 // Metrics for rate control. | 661 // Metrics for rate control. |
661 RateControlMetrics rc_metrics[3]; | 662 RateControlMetrics rc_metrics[3]; |
662 SetRateControlMetrics(rc_metrics, 0, 0, 30, 20, 20, 30, 0); | 663 SetRateControlMetrics(rc_metrics, 0, 0, 30, 20, 20, 30, 0, 1); |
663 SetRateControlMetrics(rc_metrics, 1, 2, 0, 20, 20, 60, 0); | 664 SetRateControlMetrics(rc_metrics, 1, 2, 0, 20, 20, 60, 0, 0); |
664 SetRateControlMetrics(rc_metrics, 2, 0, 0, 25, 20, 40, 0); | 665 SetRateControlMetrics(rc_metrics, 2, 0, 0, 25, 20, 40, 0, 0); |
665 ProcessFramesAndVerify(quality_metrics, | 666 ProcessFramesAndVerify(quality_metrics, |
666 rate_profile, | 667 rate_profile, |
667 process_settings, | 668 process_settings, |
668 rc_metrics); | 669 rc_metrics); |
669 } | 670 } |
670 | 671 |
671 // VP9: Run with no packet loss, with an update (decrease) in frame rate. | 672 // VP9: Run with no packet loss, with an update (decrease) in frame rate. |
672 // Lower frame rate means higher per-frame-bandwidth, so easier to encode. | 673 // Lower frame rate means higher per-frame-bandwidth, so easier to encode. |
673 // At the low bitrate in this test, this means better rate control after the | 674 // At the low bitrate in this test, this means better rate control after the |
674 // update(s) to lower frame rate. So expect less frame drops, and max values | 675 // update(s) to lower frame rate. So expect less frame drops, and max values |
(...skipping 12 matching lines...) Expand all Loading... | |
687 rate_profile.num_frames = kNbrFramesLong; | 688 rate_profile.num_frames = kNbrFramesLong; |
688 // Codec/network settings. | 689 // Codec/network settings. |
689 CodecConfigPars process_settings; | 690 CodecConfigPars process_settings; |
690 SetCodecParameters(&process_settings, kVideoCodecVP9, 0.0f, -1, 1, false, | 691 SetCodecParameters(&process_settings, kVideoCodecVP9, 0.0f, -1, 1, false, |
691 false, true, false); | 692 false, true, false); |
692 // Metrics for expected quality. | 693 // Metrics for expected quality. |
693 QualityMetrics quality_metrics; | 694 QualityMetrics quality_metrics; |
694 SetQualityMetrics(&quality_metrics, 31.5, 18.0, 0.80, 0.44); | 695 SetQualityMetrics(&quality_metrics, 31.5, 18.0, 0.80, 0.44); |
695 // Metrics for rate control. | 696 // Metrics for rate control. |
696 RateControlMetrics rc_metrics[3]; | 697 RateControlMetrics rc_metrics[3]; |
697 SetRateControlMetrics(rc_metrics, 0, 35, 50, 70, 15, 45, 0); | 698 SetRateControlMetrics(rc_metrics, 0, 35, 50, 70, 15, 45, 0, 1); |
698 SetRateControlMetrics(rc_metrics, 1, 10, 0, 40, 10, 30, 0); | 699 SetRateControlMetrics(rc_metrics, 1, 10, 0, 40, 10, 30, 0, 0); |
699 SetRateControlMetrics(rc_metrics, 2, 5, 0, 30, 5, 20, 0); | 700 SetRateControlMetrics(rc_metrics, 2, 5, 0, 30, 5, 20, 0, 0); |
700 ProcessFramesAndVerify(quality_metrics, | 701 ProcessFramesAndVerify(quality_metrics, |
701 rate_profile, | 702 rate_profile, |
702 process_settings, | 703 process_settings, |
703 rc_metrics); | 704 rc_metrics); |
704 } | 705 } |
705 | 706 |
706 // VP9: Run with no packet loss and denoiser on. One key frame (first frame). | 707 // VP9: Run with no packet loss and denoiser on. One key frame (first frame). |
707 TEST_F(VideoProcessorIntegrationTest, ProcessNoLossDenoiserOnVP9) { | 708 TEST_F(VideoProcessorIntegrationTest, ProcessNoLossDenoiserOnVP9) { |
708 // Bitrate and frame rate profile. | 709 // Bitrate and frame rate profile. |
709 RateProfile rate_profile; | 710 RateProfile rate_profile; |
710 SetRateProfilePars(&rate_profile, 0, 500, 30, 0); | 711 SetRateProfilePars(&rate_profile, 0, 500, 30, 0); |
711 rate_profile.frame_index_rate_update[1] = kNbrFramesShort + 1; | 712 rate_profile.frame_index_rate_update[1] = kNbrFramesShort + 1; |
712 rate_profile.num_frames = kNbrFramesShort; | 713 rate_profile.num_frames = kNbrFramesShort; |
713 // Codec/network settings. | 714 // Codec/network settings. |
714 CodecConfigPars process_settings; | 715 CodecConfigPars process_settings; |
715 SetCodecParameters(&process_settings, kVideoCodecVP9, 0.0f, -1, 1, false, | 716 SetCodecParameters(&process_settings, kVideoCodecVP9, 0.0f, -1, 1, false, |
716 true, true, false); | 717 true, true, false); |
717 // Metrics for expected quality. | 718 // Metrics for expected quality. |
718 QualityMetrics quality_metrics; | 719 QualityMetrics quality_metrics; |
719 SetQualityMetrics(&quality_metrics, 36.8, 35.8, 0.92, 0.91); | 720 SetQualityMetrics(&quality_metrics, 36.8, 35.8, 0.92, 0.91); |
720 // Metrics for rate control. | 721 // Metrics for rate control. |
721 RateControlMetrics rc_metrics[1]; | 722 RateControlMetrics rc_metrics[1]; |
722 SetRateControlMetrics(rc_metrics, 0, 0, 40, 20, 10, 20, 0); | 723 SetRateControlMetrics(rc_metrics, 0, 0, 40, 20, 10, 20, 0, 1); |
723 ProcessFramesAndVerify(quality_metrics, | 724 ProcessFramesAndVerify(quality_metrics, |
724 rate_profile, | 725 rate_profile, |
725 process_settings, | 726 process_settings, |
727 rc_metrics); | |
728 } | |
729 | |
730 // Run with no packet loss, at low bitrate. | |
731 // spatial_resize is on, so expect one resize during the sequence, | |
732 // resize happens on delta frame. Expect only one key frame (first frame). | |
733 TEST_F(VideoProcessorIntegrationTest, ProcessNoLossSpatialResizeFrameDropVP9) { | |
734 config_.networking_config.packet_loss_probability = 0; | |
735 // Bitrate and frame rate profile. | |
736 RateProfile rate_profile; | |
737 SetRateProfilePars(&rate_profile, 0, 50, 30, 0); | |
738 rate_profile.frame_index_rate_update[1] = kNbrFramesLong + 1; | |
739 rate_profile.num_frames = kNbrFramesLong; | |
740 // Codec/network settings. | |
741 CodecConfigPars process_settings; | |
742 SetCodecParameters(&process_settings, kVideoCodecVP9, 0.0f, -1, | |
743 1, false, false, true, true); | |
744 // Metrics for expected quality. | |
745 QualityMetrics quality_metrics; | |
746 SetQualityMetrics(&quality_metrics, 25.0, 13.0, 0.70, 0.40); | |
747 // Metrics for rate control. | |
748 RateControlMetrics rc_metrics[1]; | |
749 SetRateControlMetrics(rc_metrics, 0, 160, 70, 120, 10, 80, 1, 1); | |
750 ProcessFramesAndVerify(quality_metrics, | |
751 rate_profile, | |
752 process_settings, | |
726 rc_metrics); | 753 rc_metrics); |
727 } | 754 } |
728 | 755 |
729 // TODO(marpan): Add temporal layer test for VP9, once changes are in | 756 // TODO(marpan): Add temporal layer test for VP9, once changes are in |
730 // vp9 wrapper for this. | 757 // vp9 wrapper for this. |
731 | 758 |
732 // VP8: Run with no packet loss and fixed bitrate. Quality should be very high. | 759 // VP8: Run with no packet loss and fixed bitrate. Quality should be very high. |
733 // One key frame (first frame only) in sequence. Setting |key_frame_interval| | 760 // One key frame (first frame only) in sequence. Setting |key_frame_interval| |
734 // to -1 below means no periodic key frames in test. | 761 // to -1 below means no periodic key frames in test. |
735 TEST_F(VideoProcessorIntegrationTest, ProcessZeroPacketLoss) { | 762 TEST_F(VideoProcessorIntegrationTest, ProcessZeroPacketLoss) { |
736 // Bitrate and frame rate profile. | 763 // Bitrate and frame rate profile. |
737 RateProfile rate_profile; | 764 RateProfile rate_profile; |
738 SetRateProfilePars(&rate_profile, 0, 500, 30, 0); | 765 SetRateProfilePars(&rate_profile, 0, 500, 30, 0); |
739 rate_profile.frame_index_rate_update[1] = kNbrFramesShort + 1; | 766 rate_profile.frame_index_rate_update[1] = kNbrFramesShort + 1; |
740 rate_profile.num_frames = kNbrFramesShort; | 767 rate_profile.num_frames = kNbrFramesShort; |
741 // Codec/network settings. | 768 // Codec/network settings. |
742 CodecConfigPars process_settings; | 769 CodecConfigPars process_settings; |
743 SetCodecParameters(&process_settings, kVideoCodecVP8, 0.0f, -1, 1, false, | 770 SetCodecParameters(&process_settings, kVideoCodecVP8, 0.0f, -1, 1, false, |
744 true, true, false); | 771 true, true, false); |
745 // Metrics for expected quality. | 772 // Metrics for expected quality. |
746 QualityMetrics quality_metrics; | 773 QualityMetrics quality_metrics; |
747 SetQualityMetrics(&quality_metrics, 34.95, 33.0, 0.90, 0.89); | 774 SetQualityMetrics(&quality_metrics, 34.95, 33.0, 0.90, 0.89); |
748 // Metrics for rate control. | 775 // Metrics for rate control. |
749 RateControlMetrics rc_metrics[1]; | 776 RateControlMetrics rc_metrics[1]; |
750 SetRateControlMetrics(rc_metrics, 0, 0, 40, 20, 10, 15, 0); | 777 SetRateControlMetrics(rc_metrics, 0, 0, 40, 20, 10, 15, 0, 1); |
751 ProcessFramesAndVerify(quality_metrics, | 778 ProcessFramesAndVerify(quality_metrics, |
752 rate_profile, | 779 rate_profile, |
753 process_settings, | 780 process_settings, |
754 rc_metrics); | 781 rc_metrics); |
755 } | 782 } |
756 | 783 |
757 // VP8: Run with 5% packet loss and fixed bitrate. Quality should be a bit | 784 // VP8: Run with 5% packet loss and fixed bitrate. Quality should be a bit |
758 // lower. One key frame (first frame only) in sequence. | 785 // lower. One key frame (first frame only) in sequence. |
759 TEST_F(VideoProcessorIntegrationTest, Process5PercentPacketLoss) { | 786 TEST_F(VideoProcessorIntegrationTest, Process5PercentPacketLoss) { |
760 // Bitrate and frame rate profile. | 787 // Bitrate and frame rate profile. |
761 RateProfile rate_profile; | 788 RateProfile rate_profile; |
762 SetRateProfilePars(&rate_profile, 0, 500, 30, 0); | 789 SetRateProfilePars(&rate_profile, 0, 500, 30, 0); |
763 rate_profile.frame_index_rate_update[1] = kNbrFramesShort + 1; | 790 rate_profile.frame_index_rate_update[1] = kNbrFramesShort + 1; |
764 rate_profile.num_frames = kNbrFramesShort; | 791 rate_profile.num_frames = kNbrFramesShort; |
765 // Codec/network settings. | 792 // Codec/network settings. |
766 CodecConfigPars process_settings; | 793 CodecConfigPars process_settings; |
767 SetCodecParameters(&process_settings, kVideoCodecVP8, 0.05f, -1, 1, false, | 794 SetCodecParameters(&process_settings, kVideoCodecVP8, 0.05f, -1, 1, false, |
768 true, true, false); | 795 true, true, false); |
769 // Metrics for expected quality. | 796 // Metrics for expected quality. |
770 QualityMetrics quality_metrics; | 797 QualityMetrics quality_metrics; |
771 SetQualityMetrics(&quality_metrics, 20.0, 16.0, 0.60, 0.40); | 798 SetQualityMetrics(&quality_metrics, 20.0, 16.0, 0.60, 0.40); |
772 // Metrics for rate control. | 799 // Metrics for rate control. |
773 RateControlMetrics rc_metrics[1]; | 800 RateControlMetrics rc_metrics[1]; |
774 SetRateControlMetrics(rc_metrics, 0, 0, 40, 20, 10, 15, 0); | 801 SetRateControlMetrics(rc_metrics, 0, 0, 40, 20, 10, 15, 0, 1); |
775 ProcessFramesAndVerify(quality_metrics, | 802 ProcessFramesAndVerify(quality_metrics, |
776 rate_profile, | 803 rate_profile, |
777 process_settings, | 804 process_settings, |
778 rc_metrics); | 805 rc_metrics); |
779 } | 806 } |
780 | 807 |
781 // VP8: Run with 10% packet loss and fixed bitrate. Quality should be lower. | 808 // VP8: Run with 10% packet loss and fixed bitrate. Quality should be lower. |
782 // One key frame (first frame only) in sequence. | 809 // One key frame (first frame only) in sequence. |
783 TEST_F(VideoProcessorIntegrationTest, Process10PercentPacketLoss) { | 810 TEST_F(VideoProcessorIntegrationTest, Process10PercentPacketLoss) { |
784 // Bitrate and frame rate profile. | 811 // Bitrate and frame rate profile. |
785 RateProfile rate_profile; | 812 RateProfile rate_profile; |
786 SetRateProfilePars(&rate_profile, 0, 500, 30, 0); | 813 SetRateProfilePars(&rate_profile, 0, 500, 30, 0); |
787 rate_profile.frame_index_rate_update[1] = kNbrFramesShort + 1; | 814 rate_profile.frame_index_rate_update[1] = kNbrFramesShort + 1; |
788 rate_profile.num_frames = kNbrFramesShort; | 815 rate_profile.num_frames = kNbrFramesShort; |
789 // Codec/network settings. | 816 // Codec/network settings. |
790 CodecConfigPars process_settings; | 817 CodecConfigPars process_settings; |
791 SetCodecParameters(&process_settings, kVideoCodecVP8, 0.1f, -1, 1, false, | 818 SetCodecParameters(&process_settings, kVideoCodecVP8, 0.1f, -1, 1, false, |
792 true, true, false); | 819 true, true, false); |
793 // Metrics for expected quality. | 820 // Metrics for expected quality. |
794 QualityMetrics quality_metrics; | 821 QualityMetrics quality_metrics; |
795 SetQualityMetrics(&quality_metrics, 19.0, 16.0, 0.50, 0.35); | 822 SetQualityMetrics(&quality_metrics, 19.0, 16.0, 0.50, 0.35); |
796 // Metrics for rate control. | 823 // Metrics for rate control. |
797 RateControlMetrics rc_metrics[1]; | 824 RateControlMetrics rc_metrics[1]; |
798 SetRateControlMetrics(rc_metrics, 0, 0, 40, 20, 10, 15, 0); | 825 SetRateControlMetrics(rc_metrics, 0, 0, 40, 20, 10, 15, 0, 1); |
799 ProcessFramesAndVerify(quality_metrics, | 826 ProcessFramesAndVerify(quality_metrics, |
800 rate_profile, | 827 rate_profile, |
801 process_settings, | 828 process_settings, |
802 rc_metrics); | 829 rc_metrics); |
803 } | 830 } |
804 | 831 |
805 // The tests below are currently disabled for Android. For ARM, the encoder | 832 // The tests below are currently disabled for Android. For ARM, the encoder |
806 // uses |cpu_speed| = 12, as opposed to default |cpu_speed| <= 6 for x86, | 833 // uses |cpu_speed| = 12, as opposed to default |cpu_speed| <= 6 for x86, |
807 // which leads to significantly different quality. The quality and rate control | 834 // which leads to significantly different quality. The quality and rate control |
808 // settings in the tests below are defined for encoder speed setting | 835 // settings in the tests below are defined for encoder speed setting |
(...skipping 17 matching lines...) Expand all Loading... | |
826 rate_profile.num_frames = kNbrFramesLong; | 853 rate_profile.num_frames = kNbrFramesLong; |
827 // Codec/network settings. | 854 // Codec/network settings. |
828 CodecConfigPars process_settings; | 855 CodecConfigPars process_settings; |
829 SetCodecParameters(&process_settings, kVideoCodecVP8, 0.0f, -1, 1, false, | 856 SetCodecParameters(&process_settings, kVideoCodecVP8, 0.0f, -1, 1, false, |
830 true, true, false); | 857 true, true, false); |
831 // Metrics for expected quality. | 858 // Metrics for expected quality. |
832 QualityMetrics quality_metrics; | 859 QualityMetrics quality_metrics; |
833 SetQualityMetrics(&quality_metrics, 34.0, 32.0, 0.85, 0.80); | 860 SetQualityMetrics(&quality_metrics, 34.0, 32.0, 0.85, 0.80); |
834 // Metrics for rate control. | 861 // Metrics for rate control. |
835 RateControlMetrics rc_metrics[3]; | 862 RateControlMetrics rc_metrics[3]; |
836 SetRateControlMetrics(rc_metrics, 0, 0, 45, 20, 10, 15, 0); | 863 SetRateControlMetrics(rc_metrics, 0, 0, 45, 20, 10, 15, 0, 1); |
837 SetRateControlMetrics(rc_metrics, 1, 0, 0, 25, 20, 10, 0); | 864 SetRateControlMetrics(rc_metrics, 1, 0, 0, 25, 20, 10, 0, 0); |
838 SetRateControlMetrics(rc_metrics, 2, 0, 0, 25, 15, 10, 0); | 865 SetRateControlMetrics(rc_metrics, 2, 0, 0, 25, 15, 10, 0, 0); |
839 ProcessFramesAndVerify(quality_metrics, | 866 ProcessFramesAndVerify(quality_metrics, |
840 rate_profile, | 867 rate_profile, |
841 process_settings, | 868 process_settings, |
842 rc_metrics); | 869 rc_metrics); |
843 } | 870 } |
844 | 871 |
845 // VP8: Run with no packet loss, with an update (decrease) in frame rate. | 872 // VP8: Run with no packet loss, with an update (decrease) in frame rate. |
846 // Lower frame rate means higher per-frame-bandwidth, so easier to encode. | 873 // Lower frame rate means higher per-frame-bandwidth, so easier to encode. |
847 // At the bitrate in this test, this means better rate control after the | 874 // At the bitrate in this test, this means better rate control after the |
848 // update(s) to lower frame rate. So expect less frame drops, and max values | 875 // update(s) to lower frame rate. So expect less frame drops, and max values |
(...skipping 12 matching lines...) Expand all Loading... | |
861 rate_profile.num_frames = kNbrFramesLong; | 888 rate_profile.num_frames = kNbrFramesLong; |
862 // Codec/network settings. | 889 // Codec/network settings. |
863 CodecConfigPars process_settings; | 890 CodecConfigPars process_settings; |
864 SetCodecParameters(&process_settings, kVideoCodecVP8, 0.0f, -1, 1, false, | 891 SetCodecParameters(&process_settings, kVideoCodecVP8, 0.0f, -1, 1, false, |
865 true, true, false); | 892 true, true, false); |
866 // Metrics for expected quality. | 893 // Metrics for expected quality. |
867 QualityMetrics quality_metrics; | 894 QualityMetrics quality_metrics; |
868 SetQualityMetrics(&quality_metrics, 31.0, 22.0, 0.80, 0.65); | 895 SetQualityMetrics(&quality_metrics, 31.0, 22.0, 0.80, 0.65); |
869 // Metrics for rate control. | 896 // Metrics for rate control. |
870 RateControlMetrics rc_metrics[3]; | 897 RateControlMetrics rc_metrics[3]; |
871 SetRateControlMetrics(rc_metrics, 0, 40, 20, 75, 15, 60, 0); | 898 SetRateControlMetrics(rc_metrics, 0, 40, 20, 75, 15, 60, 0, 1); |
872 SetRateControlMetrics(rc_metrics, 1, 10, 0, 25, 10, 35, 0); | 899 SetRateControlMetrics(rc_metrics, 1, 10, 0, 25, 10, 35, 0, 0); |
873 SetRateControlMetrics(rc_metrics, 2, 0, 0, 20, 10, 15, 0); | 900 SetRateControlMetrics(rc_metrics, 2, 0, 0, 20, 10, 15, 0, 0); |
874 ProcessFramesAndVerify(quality_metrics, | 901 ProcessFramesAndVerify(quality_metrics, |
875 rate_profile, | 902 rate_profile, |
876 process_settings, | 903 process_settings, |
877 rc_metrics); | 904 rc_metrics); |
878 } | 905 } |
879 | 906 |
880 // Run with no packet loss, at low bitrate. During this time we should've | 907 // Run with no packet loss, at low bitrate. During this time we should've |
881 // resized once. | 908 // resized once. Expect 2 key frames generated (first and one for resize). |
882 TEST_F(VideoProcessorIntegrationTest, | 909 TEST_F(VideoProcessorIntegrationTest, |
883 DISABLED_ON_ANDROID(ProcessNoLossSpatialResizeFrameDropVP8)) { | 910 DISABLED_ON_ANDROID(ProcessNoLossSpatialResizeFrameDropVP8)) { |
884 config_.networking_config.packet_loss_probability = 0; | 911 config_.networking_config.packet_loss_probability = 0; |
885 // Bitrate and frame rate profile. | 912 // Bitrate and frame rate profile. |
886 RateProfile rate_profile; | 913 RateProfile rate_profile; |
887 SetRateProfilePars(&rate_profile, 0, 50, 30, 0); | 914 SetRateProfilePars(&rate_profile, 0, 50, 30, 0); |
888 rate_profile.frame_index_rate_update[1] = kNbrFramesLong + 1; | 915 rate_profile.frame_index_rate_update[1] = kNbrFramesLong + 1; |
889 rate_profile.num_frames = kNbrFramesLong; | 916 rate_profile.num_frames = kNbrFramesLong; |
890 // Codec/network settings. | 917 // Codec/network settings. |
891 CodecConfigPars process_settings; | 918 CodecConfigPars process_settings; |
892 SetCodecParameters(&process_settings, kVideoCodecVP8, 0.0f, kNbrFramesLong, | 919 SetCodecParameters(&process_settings, kVideoCodecVP8, 0.0f, -1, |
893 1, false, true, true, true); | 920 1, false, true, true, true); |
894 // Metrics for expected quality. | 921 // Metrics for expected quality. |
895 QualityMetrics quality_metrics; | 922 QualityMetrics quality_metrics; |
896 SetQualityMetrics(&quality_metrics, 25.0, 15.0, 0.70, 0.40); | 923 SetQualityMetrics(&quality_metrics, 25.0, 15.0, 0.70, 0.40); |
897 // Metrics for rate control. | 924 // Metrics for rate control. |
898 RateControlMetrics rc_metrics[1]; | 925 RateControlMetrics rc_metrics[1]; |
899 SetRateControlMetrics(rc_metrics, 0, 160, 60, 120, 20, 70, 1); | 926 SetRateControlMetrics(rc_metrics, 0, 160, 60, 120, 20, 70, 1, 2); |
900 ProcessFramesAndVerify(quality_metrics, | 927 ProcessFramesAndVerify(quality_metrics, |
901 rate_profile, | 928 rate_profile, |
902 process_settings, | 929 process_settings, |
903 rc_metrics); | 930 rc_metrics); |
904 } | 931 } |
905 | 932 |
906 // VP8: Run with no packet loss, with 3 temporal layers, with a rate update in | 933 // VP8: Run with no packet loss, with 3 temporal layers, with a rate update in |
907 // the middle of the sequence. The max values for the frame size mismatch and | 934 // the middle of the sequence. The max values for the frame size mismatch and |
908 // encoding rate mismatch are applied to each layer. | 935 // encoding rate mismatch are applied to each layer. |
909 // No dropped frames in this test, and internal spatial resizer is off. | 936 // No dropped frames in this test, and internal spatial resizer is off. |
910 // One key frame (first frame only) in sequence, so no spatial resizing. | 937 // One key frame (first frame only) in sequence, so no spatial resizing. |
911 TEST_F(VideoProcessorIntegrationTest, | 938 TEST_F(VideoProcessorIntegrationTest, |
912 DISABLED_ON_ANDROID(ProcessNoLossTemporalLayersVP8)) { | 939 DISABLED_ON_ANDROID(ProcessNoLossTemporalLayersVP8)) { |
913 config_.networking_config.packet_loss_probability = 0; | 940 config_.networking_config.packet_loss_probability = 0; |
914 // Bitrate and frame rate profile. | 941 // Bitrate and frame rate profile. |
915 RateProfile rate_profile; | 942 RateProfile rate_profile; |
916 SetRateProfilePars(&rate_profile, 0, 200, 30, 0); | 943 SetRateProfilePars(&rate_profile, 0, 200, 30, 0); |
917 SetRateProfilePars(&rate_profile, 1, 400, 30, 150); | 944 SetRateProfilePars(&rate_profile, 1, 400, 30, 150); |
918 rate_profile.frame_index_rate_update[2] = kNbrFramesLong + 1; | 945 rate_profile.frame_index_rate_update[2] = kNbrFramesLong + 1; |
919 rate_profile.num_frames = kNbrFramesLong; | 946 rate_profile.num_frames = kNbrFramesLong; |
920 // Codec/network settings. | 947 // Codec/network settings. |
921 CodecConfigPars process_settings; | 948 CodecConfigPars process_settings; |
922 SetCodecParameters(&process_settings, kVideoCodecVP8, 0.0f, -1, 3, false, | 949 SetCodecParameters(&process_settings, kVideoCodecVP8, 0.0f, -1, 3, false, |
923 true, true, false); | 950 true, true, false); |
924 // Metrics for expected quality. | 951 // Metrics for expected quality. |
925 QualityMetrics quality_metrics; | 952 QualityMetrics quality_metrics; |
926 SetQualityMetrics(&quality_metrics, 32.5, 30.0, 0.85, 0.80); | 953 SetQualityMetrics(&quality_metrics, 32.5, 30.0, 0.85, 0.80); |
927 // Metrics for rate control. | 954 // Metrics for rate control. |
928 RateControlMetrics rc_metrics[2]; | 955 RateControlMetrics rc_metrics[2]; |
929 SetRateControlMetrics(rc_metrics, 0, 0, 20, 30, 10, 10, 0); | 956 SetRateControlMetrics(rc_metrics, 0, 0, 20, 30, 10, 10, 0, 1); |
930 SetRateControlMetrics(rc_metrics, 1, 0, 0, 30, 15, 10, 0); | 957 SetRateControlMetrics(rc_metrics, 1, 0, 0, 30, 15, 10, 0, 0); |
931 ProcessFramesAndVerify(quality_metrics, | 958 ProcessFramesAndVerify(quality_metrics, |
932 rate_profile, | 959 rate_profile, |
933 process_settings, | 960 process_settings, |
934 rc_metrics); | 961 rc_metrics); |
935 } | 962 } |
936 } // namespace webrtc | 963 } // namespace webrtc |
OLD | NEW |