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 373 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
384 | 384 |
385 static void VerifyQuality(const QualityMetricsResult& psnr_result, | 385 static void VerifyQuality(const QualityMetricsResult& psnr_result, |
386 const QualityMetricsResult& ssim_result, | 386 const QualityMetricsResult& ssim_result, |
387 const QualityThresholds& quality_thresholds) { | 387 const QualityThresholds& quality_thresholds) { |
388 EXPECT_GT(psnr_result.average, quality_thresholds.min_avg_psnr); | 388 EXPECT_GT(psnr_result.average, quality_thresholds.min_avg_psnr); |
389 EXPECT_GT(psnr_result.min, quality_thresholds.min_min_psnr); | 389 EXPECT_GT(psnr_result.min, quality_thresholds.min_min_psnr); |
390 EXPECT_GT(ssim_result.average, quality_thresholds.min_avg_ssim); | 390 EXPECT_GT(ssim_result.average, quality_thresholds.min_avg_ssim); |
391 EXPECT_GT(ssim_result.min, quality_thresholds.min_min_ssim); | 391 EXPECT_GT(ssim_result.min, quality_thresholds.min_min_ssim); |
392 } | 392 } |
393 | 393 |
394 void VerifyQpParser(int frame_number) { | |
395 if (!config_.hw_codec && | |
396 (config_.codec_settings.codecType == kVideoCodecVP8 || | |
397 config_.codec_settings.codecType == kVideoCodecVP9)) { | |
398 EXPECT_EQ(processor_->GetQpFromEncoder(frame_number), | |
399 processor_->GetQpFromBitstream(frame_number)); | |
400 } | |
401 } | |
402 | |
403 static int NumberOfTemporalLayers(const VideoCodec& codec_settings) { | 394 static int NumberOfTemporalLayers(const VideoCodec& codec_settings) { |
404 if (codec_settings.codecType == kVideoCodecVP8) { | 395 if (codec_settings.codecType == kVideoCodecVP8) { |
405 return codec_settings.VP8().numberOfTemporalLayers; | 396 return codec_settings.VP8().numberOfTemporalLayers; |
406 } else if (codec_settings.codecType == kVideoCodecVP9) { | 397 } else if (codec_settings.codecType == kVideoCodecVP9) { |
407 return codec_settings.VP9().numberOfTemporalLayers; | 398 return codec_settings.VP9().numberOfTemporalLayers; |
408 } else { | 399 } else { |
409 return 1; | 400 return 1; |
410 } | 401 } |
411 } | 402 } |
412 | 403 |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
487 | 478 |
488 // Process each frame, up to |num_frames|. | 479 // Process each frame, up to |num_frames|. |
489 int frame_number = 0; | 480 int frame_number = 0; |
490 int update_index = 0; | 481 int update_index = 0; |
491 int num_frames = rate_profile.num_frames; | 482 int num_frames = rate_profile.num_frames; |
492 ResetRateControlMetrics( | 483 ResetRateControlMetrics( |
493 rate_profile.frame_index_rate_update[update_index + 1]); | 484 rate_profile.frame_index_rate_update[update_index + 1]); |
494 | 485 |
495 while (frame_number < num_frames) { | 486 while (frame_number < num_frames) { |
496 processor_->ProcessFrame(frame_number); | 487 processor_->ProcessFrame(frame_number); |
497 VerifyQpParser(frame_number); | |
498 const int tl_idx = TemporalLayerIndexForFrame(frame_number); | 488 const int tl_idx = TemporalLayerIndexForFrame(frame_number); |
499 ++num_frames_per_update_[tl_idx]; | 489 ++num_frames_per_update_[tl_idx]; |
500 ++num_frames_total_; | 490 ++num_frames_total_; |
501 UpdateRateControlMetrics(frame_number); | 491 UpdateRateControlMetrics(frame_number); |
502 | 492 |
503 ++frame_number; | 493 ++frame_number; |
504 | 494 |
505 // If we hit another/next update, verify stats for current state and | 495 // If we hit another/next update, verify stats for current state and |
506 // update layers and codec with new rates. | 496 // update layers and codec with new rates. |
507 if (frame_number == | 497 if (frame_number == |
(...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
697 float target_size_key_frame_initial_; | 687 float target_size_key_frame_initial_; |
698 float target_size_key_frame_; | 688 float target_size_key_frame_; |
699 float sum_key_frame_size_mismatch_; | 689 float sum_key_frame_size_mismatch_; |
700 int num_key_frames_; | 690 int num_key_frames_; |
701 }; | 691 }; |
702 | 692 |
703 } // namespace test | 693 } // namespace test |
704 } // namespace webrtc | 694 } // namespace webrtc |
705 | 695 |
706 #endif // WEBRTC_MODULES_VIDEO_CODING_CODECS_TEST_VIDEOPROCESSOR_INTEGRATIONTES
T_H_ | 696 #endif // WEBRTC_MODULES_VIDEO_CODING_CODECS_TEST_VIDEOPROCESSOR_INTEGRATIONTES
T_H_ |
OLD | NEW |