Chromium Code Reviews| 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 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 55 | 55 |
| 56 const int kPercTargetvsActualMismatch = 20; | 56 const int kPercTargetvsActualMismatch = 20; |
| 57 const int kBaseKeyFrameInterval = 3000; | 57 const int kBaseKeyFrameInterval = 3000; |
| 58 | 58 |
| 59 // Default sequence is foreman (CIF): may be better to use VGA for resize test. | 59 // Default sequence is foreman (CIF): may be better to use VGA for resize test. |
| 60 const int kCifWidth = 352; | 60 const int kCifWidth = 352; |
| 61 const int kCifHeight = 288; | 61 const int kCifHeight = 288; |
| 62 const char kFilenameForemanCif[] = "foreman_cif"; | 62 const char kFilenameForemanCif[] = "foreman_cif"; |
| 63 | 63 |
| 64 // Codec and network settings. | 64 // Codec and network settings. |
| 65 struct CodecConfigPars { | 65 struct CodecParams { |
| 66 VideoCodecType codec_type; | 66 VideoCodecType codec_type; |
| 67 bool hw_codec; | 67 bool hw_codec; |
| 68 float packet_loss; | 68 |
| 69 int width; | |
| 70 int height; | |
| 71 | |
| 69 int num_temporal_layers; | 72 int num_temporal_layers; |
| 70 int key_frame_interval; | 73 int key_frame_interval; |
| 71 bool error_concealment_on; | 74 bool error_concealment_on; |
| 72 bool denoising_on; | 75 bool denoising_on; |
| 73 bool frame_dropper_on; | 76 bool frame_dropper_on; |
| 74 bool spatial_resize_on; | 77 bool spatial_resize_on; |
| 75 int width; | 78 |
| 76 int height; | 79 float packet_loss; |
| 80 | |
| 77 std::string filename; | 81 std::string filename; |
| 78 bool verbose_logging; | 82 bool verbose_logging; |
| 79 }; | 83 }; |
| 80 | 84 |
| 81 // Quality metrics. | 85 // Thresholds for the quality metrics. |
| 82 struct QualityMetrics { | 86 struct QualityThresholds { |
| 83 double minimum_avg_psnr; | 87 double min_avg_psnr; |
|
brandtr
2017/02/21 12:04:31
'minimum' -> 'min' to harmonize with RateControlTh
| |
| 84 double minimum_min_psnr; | 88 double min_min_psnr; |
| 85 double minimum_avg_ssim; | 89 double min_avg_ssim; |
| 86 double minimum_min_ssim; | 90 double min_min_ssim; |
| 87 }; | 91 }; |
| 88 | 92 |
| 89 // The sequence of bitrate and frame rate changes for the encoder, the frame | 93 // The sequence of bit rate and frame rate changes for the encoder, the frame |
| 90 // number where the changes are made, and the total number of frames for the | 94 // number where the changes are made, and the total number of frames for the |
| 91 // test. | 95 // test. |
| 92 struct RateProfile { | 96 struct RateProfile { |
| 93 int target_bit_rate[kMaxNumRateUpdates]; | 97 int target_bit_rate[kMaxNumRateUpdates]; |
| 94 int input_frame_rate[kMaxNumRateUpdates]; | 98 int input_frame_rate[kMaxNumRateUpdates]; |
| 95 int frame_index_rate_update[kMaxNumRateUpdates + 1]; | 99 int frame_index_rate_update[kMaxNumRateUpdates + 1]; |
| 96 int num_frames; | 100 int num_frames; |
| 97 }; | 101 }; |
| 98 | 102 |
| 99 // Metrics for the rate control. The rate mismatch metrics are defined as | 103 // Thresholds for the rate control metrics. The rate mismatch thresholds are |
| 100 // percentages.|max_time_hit_target| is defined as number of frames, after a | 104 // defined as percentages. |max_time_hit_target| is defined as number of frames, |
| 101 // rate update is made to the encoder, for the encoder to reach within | 105 // after a rate update is made to the encoder, for the encoder to reach within |
| 102 // |kPercTargetvsActualMismatch| of new target rate. The metrics are defined for | 106 // |kPercTargetvsActualMismatch| of new target rate. The thresholds are defined |
| 103 // each rate update sequence. | 107 // for each rate update sequence. |
| 104 struct RateControlMetrics { | 108 struct RateControlThresholds { |
| 105 int max_num_dropped_frames; | 109 int max_num_dropped_frames; |
| 106 int max_key_frame_size_mismatch; | 110 int max_key_frame_size_mismatch; |
| 107 int max_delta_frame_size_mismatch; | 111 int max_delta_frame_size_mismatch; |
| 108 int max_encoding_rate_mismatch; | 112 int max_encoding_rate_mismatch; |
| 109 int max_time_hit_target; | 113 int max_time_hit_target; |
| 110 int num_spatial_resizes; | 114 int num_spatial_resizes; |
| 111 int num_key_frames; | 115 int num_key_frames; |
| 112 }; | 116 }; |
| 113 | 117 |
| 114 // Should video files be saved persistently to disk for post-run visualization? | 118 // Should video files be saved persistently to disk for post-run visualization? |
| 115 struct VisualizationParams { | 119 struct VisualizationParams { |
| 116 bool save_source_y4m; | 120 bool save_source_y4m; |
| 117 bool save_encoded_ivf; | 121 bool save_encoded_ivf; |
| 118 bool save_decoded_y4m; | 122 bool save_decoded_y4m; |
| 119 }; | 123 }; |
| 120 | 124 |
| 121 #if !defined(WEBRTC_IOS) | 125 #if !defined(WEBRTC_IOS) |
| 122 const int kNumFramesShort = 100; | 126 const int kNumFramesShort = 100; |
| 123 #endif | 127 #endif |
| 124 const int kNumFramesLong = 299; | 128 const int kNumFramesLong = 299; |
| 125 | 129 |
| 126 // Parameters from VP8 wrapper, which control target size of key frames. | 130 // Parameters from VP8 wrapper, which control target size of key frames. |
| 127 const float kInitialBufferSize = 0.5f; | 131 const float kInitialBufferSize = 0.5f; |
| 128 const float kOptimalBufferSize = 0.6f; | 132 const float kOptimalBufferSize = 0.6f; |
| 129 const float kScaleKeyFrameSize = 0.5f; | 133 const float kScaleKeyFrameSize = 0.5f; |
| 130 | 134 |
| 131 // Integration test for video processor. Encodes+decodes a clip and | 135 // Integration test for video processor. Encodes+decodes a clip and |
| 132 // writes it to the output directory. After completion, quality metrics | 136 // writes it to the output directory. After completion, quality metrics |
| 133 // (PSNR and SSIM) and rate control metrics are computed to verify that the | 137 // (PSNR and SSIM) and rate control metrics are computed and compared to given |
| 134 // quality and encoder response is acceptable. The rate control tests allow us | 138 // thresholds, to verify that the quality and encoder response is acceptable. |
| 135 // to verify the behavior for changing bitrate, changing frame rate, frame | 139 // The rate control tests allow us to verify the behavior for changing bit rate, |
| 136 // dropping/spatial resize, and temporal layers. The limits for the rate | 140 // changing frame rate, frame dropping/spatial resize, and temporal layers. |
| 137 // control metrics are set to be fairly conservative, so failure should only | 141 // The thresholds for the rate control metrics are set to be fairly |
| 138 // happen when some significant regression or breakdown occurs. | 142 // conservative, so failure should only happen when some significant regression |
| 143 // or breakdown occurs. | |
| 139 class VideoProcessorIntegrationTest : public testing::Test { | 144 class VideoProcessorIntegrationTest : public testing::Test { |
| 140 protected: | 145 protected: |
| 141 VideoProcessorIntegrationTest() { | 146 VideoProcessorIntegrationTest() { |
| 142 #if defined(WEBRTC_VIDEOPROCESSOR_INTEGRATIONTEST_HW_CODECS_ENABLED) && \ | 147 #if defined(WEBRTC_VIDEOPROCESSOR_INTEGRATIONTEST_HW_CODECS_ENABLED) && \ |
| 143 defined(WEBRTC_ANDROID) | 148 defined(WEBRTC_ANDROID) |
| 144 InitializeAndroidObjects(); | 149 InitializeAndroidObjects(); |
| 145 | 150 |
| 146 external_encoder_factory_.reset( | 151 external_encoder_factory_.reset( |
| 147 new webrtc_jni::MediaCodecVideoEncoderFactory()); | 152 new webrtc_jni::MediaCodecVideoEncoderFactory()); |
| 148 external_decoder_factory_.reset( | 153 external_decoder_factory_.reset( |
| (...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 369 perc_encoding_rate_mismatch_ = | 374 perc_encoding_rate_mismatch_ = |
| 370 100 * fabs(encoding_bitrate_total_ - bit_rate_) / bit_rate_; | 375 100 * fabs(encoding_bitrate_total_ - bit_rate_) / bit_rate_; |
| 371 if (perc_encoding_rate_mismatch_ < kPercTargetvsActualMismatch && | 376 if (perc_encoding_rate_mismatch_ < kPercTargetvsActualMismatch && |
| 372 !encoding_rate_within_target_) { | 377 !encoding_rate_within_target_) { |
| 373 num_frames_to_hit_target_ = num_frames_total_; | 378 num_frames_to_hit_target_ = num_frames_total_; |
| 374 encoding_rate_within_target_ = true; | 379 encoding_rate_within_target_ = true; |
| 375 } | 380 } |
| 376 } | 381 } |
| 377 | 382 |
| 378 // Verify expected behavior of rate control and print out data. | 383 // Verify expected behavior of rate control and print out data. |
| 379 void VerifyRateControl(int update_index, | 384 void VerifyRateControlMetrics(int update_index, |
|
brandtr
2017/02/21 12:04:31
To harmonize with the "UpdateRateControlMetrics" m
| |
| 380 int max_key_frame_size_mismatch, | 385 int max_key_frame_size_mismatch, |
| 381 int max_delta_frame_size_mismatch, | 386 int max_delta_frame_size_mismatch, |
| 382 int max_encoding_rate_mismatch, | 387 int max_encoding_rate_mismatch, |
| 383 int max_time_hit_target, | 388 int max_time_hit_target, |
| 384 int max_num_dropped_frames, | 389 int max_num_dropped_frames, |
| 385 int num_spatial_resizes, | 390 int num_spatial_resizes, |
| 386 int num_key_frames) { | 391 int num_key_frames) { |
| 387 int num_dropped_frames = processor_->NumberDroppedFrames(); | 392 int num_dropped_frames = processor_->NumberDroppedFrames(); |
| 388 int num_resize_actions = processor_->NumberSpatialResizes(); | 393 int num_resize_actions = processor_->NumberSpatialResizes(); |
| 389 printf( | 394 printf( |
| 390 "For update #: %d,\n" | 395 "For update #: %d,\n" |
| 391 " Target Bitrate: %d,\n" | 396 " Target Bitrate: %d,\n" |
| 392 " Encoding bitrate: %f,\n" | 397 " Encoding bitrate: %f,\n" |
| 393 " Frame rate: %d \n", | 398 " Frame rate: %d \n", |
| 394 update_index, bit_rate_, encoding_bitrate_total_, frame_rate_); | 399 update_index, bit_rate_, encoding_bitrate_total_, frame_rate_); |
| 395 printf( | 400 printf( |
| 396 " Number of frames to approach target rate: %d, \n" | 401 " Number of frames to approach target rate: %d, \n" |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 430 EXPECT_LE(perc_frame_size_mismatch, max_delta_frame_size_mismatch); | 435 EXPECT_LE(perc_frame_size_mismatch, max_delta_frame_size_mismatch); |
| 431 EXPECT_LE(perc_encoding_rate_mismatch, max_encoding_rate_mismatch); | 436 EXPECT_LE(perc_encoding_rate_mismatch, max_encoding_rate_mismatch); |
| 432 } | 437 } |
| 433 printf("\n"); | 438 printf("\n"); |
| 434 EXPECT_LE(num_frames_to_hit_target_, max_time_hit_target); | 439 EXPECT_LE(num_frames_to_hit_target_, max_time_hit_target); |
| 435 EXPECT_LE(num_dropped_frames, max_num_dropped_frames); | 440 EXPECT_LE(num_dropped_frames, max_num_dropped_frames); |
| 436 EXPECT_EQ(num_resize_actions, num_spatial_resizes); | 441 EXPECT_EQ(num_resize_actions, num_spatial_resizes); |
| 437 EXPECT_EQ(num_key_frames_, num_key_frames); | 442 EXPECT_EQ(num_key_frames_, num_key_frames); |
| 438 } | 443 } |
| 439 | 444 |
| 445 void VerifyQuality(const test::QualityMetricsResult& psnr_result, | |
| 446 const test::QualityMetricsResult& ssim_result, | |
| 447 const QualityThresholds& quality_thresholds) { | |
| 448 EXPECT_GT(psnr_result.average, quality_thresholds.min_avg_psnr); | |
| 449 EXPECT_GT(psnr_result.min, quality_thresholds.min_min_psnr); | |
| 450 EXPECT_GT(ssim_result.average, quality_thresholds.min_avg_ssim); | |
| 451 EXPECT_GT(ssim_result.min, quality_thresholds.min_min_ssim); | |
| 452 } | |
| 453 | |
| 440 // Layer index corresponding to frame number, for up to 3 layers. | 454 // Layer index corresponding to frame number, for up to 3 layers. |
| 441 void LayerIndexForFrame(int frame_number) { | 455 void LayerIndexForFrame(int frame_number) { |
| 442 if (num_temporal_layers_ == 1) { | 456 if (num_temporal_layers_ == 1) { |
| 443 layer_ = 0; | 457 layer_ = 0; |
| 444 } else if (num_temporal_layers_ == 2) { | 458 } else if (num_temporal_layers_ == 2) { |
| 445 // layer 0: 0 2 4 ... | 459 // layer 0: 0 2 4 ... |
| 446 // layer 1: 1 3 | 460 // layer 1: 1 3 |
| 447 if (frame_number % 2 == 0) { | 461 if (frame_number % 2 == 0) { |
| 448 layer_ = 0; | 462 layer_ = 0; |
| 449 } else { | 463 } else { |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 481 } | 495 } |
| 482 frame_rate_layer_[i] = | 496 frame_rate_layer_[i] = |
| 483 frame_rate_ / static_cast<float>(1 << (num_temporal_layers_ - 1)); | 497 frame_rate_ / static_cast<float>(1 << (num_temporal_layers_ - 1)); |
| 484 } | 498 } |
| 485 if (num_temporal_layers_ == 3) { | 499 if (num_temporal_layers_ == 3) { |
| 486 frame_rate_layer_[2] = frame_rate_ / 2.0f; | 500 frame_rate_layer_[2] = frame_rate_ / 2.0f; |
| 487 } | 501 } |
| 488 } | 502 } |
| 489 | 503 |
| 490 // Processes all frames in the clip and verifies the result. | 504 // Processes all frames in the clip and verifies the result. |
| 491 void ProcessFramesAndVerify(QualityMetrics quality_metrics, | 505 void ProcessFramesAndVerify(QualityThresholds quality_thresholds, |
| 492 RateProfile rate_profile, | 506 RateProfile rate_profile, |
| 493 CodecConfigPars process, | 507 CodecParams process, |
| 494 RateControlMetrics* rc_metrics, | 508 RateControlThresholds* rc_thresholds, |
| 495 const VisualizationParams* visualization_params) { | 509 const VisualizationParams* visualization_params) { |
| 496 // Codec/config settings. | 510 // Codec/config settings. |
| 497 codec_type_ = process.codec_type; | 511 codec_type_ = process.codec_type; |
| 498 hw_codec_ = process.hw_codec; | 512 hw_codec_ = process.hw_codec; |
| 499 start_bitrate_ = rate_profile.target_bit_rate[0]; | 513 start_bitrate_ = rate_profile.target_bit_rate[0]; |
| 500 start_frame_rate_ = rate_profile.input_frame_rate[0]; | 514 start_frame_rate_ = rate_profile.input_frame_rate[0]; |
| 501 packet_loss_ = process.packet_loss; | 515 packet_loss_ = process.packet_loss; |
| 502 key_frame_interval_ = process.key_frame_interval; | 516 key_frame_interval_ = process.key_frame_interval; |
| 503 num_temporal_layers_ = process.num_temporal_layers; | 517 num_temporal_layers_ = process.num_temporal_layers; |
| 504 error_concealment_on_ = process.error_concealment_on; | 518 error_concealment_on_ = process.error_concealment_on; |
| (...skipping 28 matching lines...) Expand all Loading... | |
| 533 // Counter for whole sequence run. | 547 // Counter for whole sequence run. |
| 534 ++frame_number; | 548 ++frame_number; |
| 535 // Counters for each rate update. | 549 // Counters for each rate update. |
| 536 ++num_frames_per_update_[layer_]; | 550 ++num_frames_per_update_[layer_]; |
| 537 ++num_frames_total_; | 551 ++num_frames_total_; |
| 538 UpdateRateControlMetrics(frame_number, frame_type); | 552 UpdateRateControlMetrics(frame_number, frame_type); |
| 539 // If we hit another/next update, verify stats for current state and | 553 // If we hit another/next update, verify stats for current state and |
| 540 // update layers and codec with new rates. | 554 // update layers and codec with new rates. |
| 541 if (frame_number == | 555 if (frame_number == |
| 542 rate_profile.frame_index_rate_update[update_index + 1]) { | 556 rate_profile.frame_index_rate_update[update_index + 1]) { |
| 543 VerifyRateControl( | 557 VerifyRateControlMetrics( |
| 544 update_index, rc_metrics[update_index].max_key_frame_size_mismatch, | 558 update_index, |
| 545 rc_metrics[update_index].max_delta_frame_size_mismatch, | 559 rc_thresholds[update_index].max_key_frame_size_mismatch, |
| 546 rc_metrics[update_index].max_encoding_rate_mismatch, | 560 rc_thresholds[update_index].max_delta_frame_size_mismatch, |
| 547 rc_metrics[update_index].max_time_hit_target, | 561 rc_thresholds[update_index].max_encoding_rate_mismatch, |
| 548 rc_metrics[update_index].max_num_dropped_frames, | 562 rc_thresholds[update_index].max_time_hit_target, |
| 549 rc_metrics[update_index].num_spatial_resizes, | 563 rc_thresholds[update_index].max_num_dropped_frames, |
| 550 rc_metrics[update_index].num_key_frames); | 564 rc_thresholds[update_index].num_spatial_resizes, |
| 565 rc_thresholds[update_index].num_key_frames); | |
| 551 // Update layer rates and the codec with new rates. | 566 // Update layer rates and the codec with new rates. |
| 552 ++update_index; | 567 ++update_index; |
| 553 bit_rate_ = rate_profile.target_bit_rate[update_index]; | 568 bit_rate_ = rate_profile.target_bit_rate[update_index]; |
| 554 frame_rate_ = rate_profile.input_frame_rate[update_index]; | 569 frame_rate_ = rate_profile.input_frame_rate[update_index]; |
| 555 SetLayerRates(); | 570 SetLayerRates(); |
| 556 ResetRateControlMetrics( | 571 ResetRateControlMetrics( |
| 557 rate_profile.frame_index_rate_update[update_index + 1]); | 572 rate_profile.frame_index_rate_update[update_index + 1]); |
| 558 processor_->SetRates(bit_rate_, frame_rate_); | 573 processor_->SetRates(bit_rate_, frame_rate_); |
| 559 } | 574 } |
| 560 } | 575 } |
| 561 VerifyRateControl(update_index, | 576 VerifyRateControlMetrics( |
| 562 rc_metrics[update_index].max_key_frame_size_mismatch, | 577 update_index, rc_thresholds[update_index].max_key_frame_size_mismatch, |
| 563 rc_metrics[update_index].max_delta_frame_size_mismatch, | 578 rc_thresholds[update_index].max_delta_frame_size_mismatch, |
| 564 rc_metrics[update_index].max_encoding_rate_mismatch, | 579 rc_thresholds[update_index].max_encoding_rate_mismatch, |
| 565 rc_metrics[update_index].max_time_hit_target, | 580 rc_thresholds[update_index].max_time_hit_target, |
| 566 rc_metrics[update_index].max_num_dropped_frames, | 581 rc_thresholds[update_index].max_num_dropped_frames, |
| 567 rc_metrics[update_index].num_spatial_resizes, | 582 rc_thresholds[update_index].num_spatial_resizes, |
| 568 rc_metrics[update_index].num_key_frames); | 583 rc_thresholds[update_index].num_key_frames); |
| 569 EXPECT_EQ(num_frames, frame_number); | 584 EXPECT_EQ(num_frames, frame_number); |
| 570 EXPECT_EQ(num_frames + 1, static_cast<int>(stats_.stats_.size())); | 585 EXPECT_EQ(num_frames + 1, static_cast<int>(stats_.stats_.size())); |
| 571 | 586 |
| 572 // Release encoder and decoder to make sure they have finished processing: | 587 // Release encoder and decoder to make sure they have finished processing: |
| 573 RTC_DCHECK_EQ(WEBRTC_VIDEO_CODEC_OK, encoder_->Release()); | 588 RTC_DCHECK_EQ(WEBRTC_VIDEO_CODEC_OK, encoder_->Release()); |
| 574 RTC_DCHECK_EQ(WEBRTC_VIDEO_CODEC_OK, decoder_->Release()); | 589 RTC_DCHECK_EQ(WEBRTC_VIDEO_CODEC_OK, decoder_->Release()); |
| 575 | 590 |
| 576 // Close the analysis files before we use them for SSIM/PSNR calculations. | 591 // Close the analysis files before we use them for SSIM/PSNR calculations. |
| 577 analysis_frame_reader_->Close(); | 592 analysis_frame_reader_->Close(); |
| 578 analysis_frame_writer_->Close(); | 593 analysis_frame_writer_->Close(); |
| (...skipping 13 matching lines...) Expand all Loading... | |
| 592 test::QualityMetricsResult psnr_result, ssim_result; | 607 test::QualityMetricsResult psnr_result, ssim_result; |
| 593 RTC_DCHECK_EQ(0, test::I420MetricsFromFiles(config_.input_filename.c_str(), | 608 RTC_DCHECK_EQ(0, test::I420MetricsFromFiles(config_.input_filename.c_str(), |
| 594 config_.output_filename.c_str(), | 609 config_.output_filename.c_str(), |
| 595 config_.codec_settings->width, | 610 config_.codec_settings->width, |
| 596 config_.codec_settings->height, | 611 config_.codec_settings->height, |
| 597 &psnr_result, &ssim_result)); | 612 &psnr_result, &ssim_result)); |
| 598 printf("PSNR avg: %f, min: %f\nSSIM avg: %f, min: %f\n", | 613 printf("PSNR avg: %f, min: %f\nSSIM avg: %f, min: %f\n", |
| 599 psnr_result.average, psnr_result.min, ssim_result.average, | 614 psnr_result.average, psnr_result.min, ssim_result.average, |
| 600 ssim_result.min); | 615 ssim_result.min); |
| 601 stats_.PrintSummary(); | 616 stats_.PrintSummary(); |
| 602 EXPECT_GT(psnr_result.average, quality_metrics.minimum_avg_psnr); | 617 VerifyQuality(psnr_result, ssim_result, quality_thresholds); |
| 603 EXPECT_GT(psnr_result.min, quality_metrics.minimum_min_psnr); | |
| 604 EXPECT_GT(ssim_result.average, quality_metrics.minimum_avg_ssim); | |
| 605 EXPECT_GT(ssim_result.min, quality_metrics.minimum_min_ssim); | |
| 606 | 618 |
| 607 // Remove analysis file. | 619 // Remove analysis file. |
| 608 if (remove(config_.output_filename.c_str()) < 0) { | 620 if (remove(config_.output_filename.c_str()) < 0) { |
| 609 fprintf(stderr, "Failed to remove temporary file!\n"); | 621 fprintf(stderr, "Failed to remove temporary file!\n"); |
| 610 } | 622 } |
| 611 } | 623 } |
| 612 | 624 |
| 613 static void SetCodecParameters(CodecConfigPars* process_settings, | 625 static void SetCodecParams(CodecParams* process_settings, |
| 614 VideoCodecType codec_type, | 626 VideoCodecType codec_type, |
| 615 bool hw_codec, | 627 bool hw_codec, |
| 616 float packet_loss, | 628 float packet_loss, |
| 617 int key_frame_interval, | 629 int key_frame_interval, |
| 618 int num_temporal_layers, | 630 int num_temporal_layers, |
| 619 bool error_concealment_on, | 631 bool error_concealment_on, |
| 620 bool denoising_on, | 632 bool denoising_on, |
| 621 bool frame_dropper_on, | 633 bool frame_dropper_on, |
| 622 bool spatial_resize_on, | 634 bool spatial_resize_on, |
| 623 int width, | 635 int width, |
| 624 int height, | 636 int height, |
| 625 const std::string& filename, | 637 const std::string& filename, |
| 626 bool verbose_logging) { | 638 bool verbose_logging) { |
| 627 process_settings->codec_type = codec_type; | 639 process_settings->codec_type = codec_type; |
| 628 process_settings->hw_codec = hw_codec; | 640 process_settings->hw_codec = hw_codec; |
| 629 process_settings->packet_loss = packet_loss; | 641 process_settings->packet_loss = packet_loss; |
| 630 process_settings->key_frame_interval = key_frame_interval; | 642 process_settings->key_frame_interval = key_frame_interval; |
| 631 process_settings->num_temporal_layers = num_temporal_layers, | 643 process_settings->num_temporal_layers = num_temporal_layers, |
| 632 process_settings->error_concealment_on = error_concealment_on; | 644 process_settings->error_concealment_on = error_concealment_on; |
| 633 process_settings->denoising_on = denoising_on; | 645 process_settings->denoising_on = denoising_on; |
| 634 process_settings->frame_dropper_on = frame_dropper_on; | 646 process_settings->frame_dropper_on = frame_dropper_on; |
| 635 process_settings->spatial_resize_on = spatial_resize_on; | 647 process_settings->spatial_resize_on = spatial_resize_on; |
| 636 process_settings->width = width; | 648 process_settings->width = width; |
| 637 process_settings->height = height; | 649 process_settings->height = height; |
| 638 process_settings->filename = filename; | 650 process_settings->filename = filename; |
| 639 process_settings->verbose_logging = verbose_logging; | 651 process_settings->verbose_logging = verbose_logging; |
| 640 } | 652 } |
| 641 | 653 |
| 642 static void SetCodecParameters(CodecConfigPars* process_settings, | 654 static void SetCodecParams(CodecParams* process_settings, |
| 643 VideoCodecType codec_type, | 655 VideoCodecType codec_type, |
| 644 bool hw_codec, | 656 bool hw_codec, |
| 645 float packet_loss, | 657 float packet_loss, |
| 646 int key_frame_interval, | 658 int key_frame_interval, |
| 647 int num_temporal_layers, | 659 int num_temporal_layers, |
| 648 bool error_concealment_on, | 660 bool error_concealment_on, |
| 649 bool denoising_on, | 661 bool denoising_on, |
| 650 bool frame_dropper_on, | 662 bool frame_dropper_on, |
| 651 bool spatial_resize_on) { | 663 bool spatial_resize_on) { |
| 652 SetCodecParameters(process_settings, codec_type, hw_codec, packet_loss, | 664 SetCodecParams(process_settings, codec_type, hw_codec, packet_loss, |
| 653 key_frame_interval, num_temporal_layers, | 665 key_frame_interval, num_temporal_layers, |
| 654 error_concealment_on, denoising_on, frame_dropper_on, | 666 error_concealment_on, denoising_on, frame_dropper_on, |
| 655 spatial_resize_on, kCifWidth, kCifHeight, | 667 spatial_resize_on, kCifWidth, kCifHeight, |
| 656 kFilenameForemanCif, false /* verbose_logging */); | 668 kFilenameForemanCif, false /* verbose_logging */); |
| 657 } | 669 } |
| 658 | 670 |
| 659 static void SetQualityMetrics(QualityMetrics* quality_metrics, | 671 static void SetQualityThresholds(QualityThresholds* quality_thresholds, |
| 660 double minimum_avg_psnr, | 672 double min_avg_psnr, |
| 661 double minimum_min_psnr, | 673 double min_min_psnr, |
| 662 double minimum_avg_ssim, | 674 double min_avg_ssim, |
| 663 double minimum_min_ssim) { | 675 double min_min_ssim) { |
| 664 quality_metrics->minimum_avg_psnr = minimum_avg_psnr; | 676 quality_thresholds->min_avg_psnr = min_avg_psnr; |
| 665 quality_metrics->minimum_min_psnr = minimum_min_psnr; | 677 quality_thresholds->min_min_psnr = min_min_psnr; |
| 666 quality_metrics->minimum_avg_ssim = minimum_avg_ssim; | 678 quality_thresholds->min_avg_ssim = min_avg_ssim; |
| 667 quality_metrics->minimum_min_ssim = minimum_min_ssim; | 679 quality_thresholds->min_min_ssim = min_min_ssim; |
| 668 } | 680 } |
| 669 | 681 |
| 670 static void SetRateProfilePars(RateProfile* rate_profile, | 682 static void SetRateProfile(RateProfile* rate_profile, |
| 671 int update_index, | 683 int update_index, |
| 672 int bit_rate, | 684 int bit_rate, |
| 673 int frame_rate, | 685 int frame_rate, |
| 674 int frame_index_rate_update) { | 686 int frame_index_rate_update) { |
| 675 rate_profile->target_bit_rate[update_index] = bit_rate; | 687 rate_profile->target_bit_rate[update_index] = bit_rate; |
| 676 rate_profile->input_frame_rate[update_index] = frame_rate; | 688 rate_profile->input_frame_rate[update_index] = frame_rate; |
| 677 rate_profile->frame_index_rate_update[update_index] = | 689 rate_profile->frame_index_rate_update[update_index] = |
| 678 frame_index_rate_update; | 690 frame_index_rate_update; |
| 679 } | 691 } |
| 680 | 692 |
| 681 static void SetRateControlMetrics(RateControlMetrics* rc_metrics, | 693 static void SetRateControlThresholds(RateControlThresholds* rc_thresholds, |
| 682 int update_index, | 694 int update_index, |
| 683 int max_num_dropped_frames, | 695 int max_num_dropped_frames, |
| 684 int max_key_frame_size_mismatch, | 696 int max_key_frame_size_mismatch, |
| 685 int max_delta_frame_size_mismatch, | 697 int max_delta_frame_size_mismatch, |
| 686 int max_encoding_rate_mismatch, | 698 int max_encoding_rate_mismatch, |
| 687 int max_time_hit_target, | 699 int max_time_hit_target, |
| 688 int num_spatial_resizes, | 700 int num_spatial_resizes, |
| 689 int num_key_frames) { | 701 int num_key_frames) { |
| 690 rc_metrics[update_index].max_num_dropped_frames = max_num_dropped_frames; | 702 rc_thresholds[update_index].max_num_dropped_frames = max_num_dropped_frames; |
| 691 rc_metrics[update_index].max_key_frame_size_mismatch = | 703 rc_thresholds[update_index].max_key_frame_size_mismatch = |
| 692 max_key_frame_size_mismatch; | 704 max_key_frame_size_mismatch; |
| 693 rc_metrics[update_index].max_delta_frame_size_mismatch = | 705 rc_thresholds[update_index].max_delta_frame_size_mismatch = |
| 694 max_delta_frame_size_mismatch; | 706 max_delta_frame_size_mismatch; |
| 695 rc_metrics[update_index].max_encoding_rate_mismatch = | 707 rc_thresholds[update_index].max_encoding_rate_mismatch = |
| 696 max_encoding_rate_mismatch; | 708 max_encoding_rate_mismatch; |
| 697 rc_metrics[update_index].max_time_hit_target = max_time_hit_target; | 709 rc_thresholds[update_index].max_time_hit_target = max_time_hit_target; |
| 698 rc_metrics[update_index].num_spatial_resizes = num_spatial_resizes; | 710 rc_thresholds[update_index].num_spatial_resizes = num_spatial_resizes; |
| 699 rc_metrics[update_index].num_key_frames = num_key_frames; | 711 rc_thresholds[update_index].num_key_frames = num_key_frames; |
| 700 } | 712 } |
| 701 | 713 |
| 702 // Codecs. | 714 // Codecs. |
| 703 std::unique_ptr<VideoEncoder> encoder_; | 715 std::unique_ptr<VideoEncoder> encoder_; |
| 704 std::unique_ptr<cricket::WebRtcVideoEncoderFactory> external_encoder_factory_; | 716 std::unique_ptr<cricket::WebRtcVideoEncoderFactory> external_encoder_factory_; |
| 705 std::unique_ptr<VideoDecoder> decoder_; | 717 std::unique_ptr<VideoDecoder> decoder_; |
| 706 std::unique_ptr<cricket::WebRtcVideoDecoderFactory> external_decoder_factory_; | 718 std::unique_ptr<cricket::WebRtcVideoDecoderFactory> external_decoder_factory_; |
| 707 VideoCodec codec_settings_; | 719 VideoCodec codec_settings_; |
| 708 | 720 |
| 709 // Helper objects. | 721 // Helper objects. |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 755 bool error_concealment_on_; | 767 bool error_concealment_on_; |
| 756 bool denoising_on_; | 768 bool denoising_on_; |
| 757 bool frame_dropper_on_; | 769 bool frame_dropper_on_; |
| 758 bool spatial_resize_on_; | 770 bool spatial_resize_on_; |
| 759 }; | 771 }; |
| 760 | 772 |
| 761 } // namespace test | 773 } // namespace test |
| 762 } // namespace webrtc | 774 } // namespace webrtc |
| 763 | 775 |
| 764 #endif // WEBRTC_MODULES_VIDEO_CODING_CODECS_TEST_VIDEOPROCESSOR_INTEGRATIONTES T_H_ | 776 #endif // WEBRTC_MODULES_VIDEO_CODING_CODECS_TEST_VIDEOPROCESSOR_INTEGRATIONTES T_H_ |
| OLD | NEW |