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

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

Issue 2903163002: Add unit tests for qp parser. (Closed)
Patch Set: Refactor. Created 3 years, 7 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
(...skipping 476 matching lines...) Expand 10 before | Expand all | Expand 10 after
487 487
488 void VerifyQuality(const test::QualityMetricsResult& psnr_result, 488 void VerifyQuality(const test::QualityMetricsResult& psnr_result,
489 const test::QualityMetricsResult& ssim_result, 489 const test::QualityMetricsResult& ssim_result,
490 const QualityThresholds& quality_thresholds) { 490 const QualityThresholds& quality_thresholds) {
491 EXPECT_GT(psnr_result.average, quality_thresholds.min_avg_psnr); 491 EXPECT_GT(psnr_result.average, quality_thresholds.min_avg_psnr);
492 EXPECT_GT(psnr_result.min, quality_thresholds.min_min_psnr); 492 EXPECT_GT(psnr_result.min, quality_thresholds.min_min_psnr);
493 EXPECT_GT(ssim_result.average, quality_thresholds.min_avg_ssim); 493 EXPECT_GT(ssim_result.average, quality_thresholds.min_avg_ssim);
494 EXPECT_GT(ssim_result.min, quality_thresholds.min_min_ssim); 494 EXPECT_GT(ssim_result.min, quality_thresholds.min_min_ssim);
495 } 495 }
496 496
497 void VerifyQpParser(const CodecParams& process, int frame_number) {
498 if (!process.hw_codec && (process.codec_type == kVideoCodecVP8 ||
499 process.codec_type == kVideoCodecVP9)) {
500 EXPECT_EQ(processor_->GetQpFromEncoder(frame_number),
501 processor_->GetQpFromBitstream(frame_number));
502 }
503 }
504
497 // Temporal layer index corresponding to frame number, for up to 3 layers. 505 // Temporal layer index corresponding to frame number, for up to 3 layers.
498 int TemporalLayerIndexForFrame(int frame_number) { 506 int TemporalLayerIndexForFrame(int frame_number) {
499 int tl_idx = -1; 507 int tl_idx = -1;
500 switch (num_temporal_layers_) { 508 switch (num_temporal_layers_) {
501 case 1: 509 case 1:
502 tl_idx = 0; 510 tl_idx = 0;
503 break; 511 break;
504 case 2: 512 case 2:
505 // temporal layer 0: 0 2 4 ... 513 // temporal layer 0: 0 2 4 ...
506 // temporal layer 1: 1 3 514 // temporal layer 1: 1 3
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
598 // In online mode, we calculate the metrics for a given frame right after 606 // In online mode, we calculate the metrics for a given frame right after
599 // it has been sent for encoding. 607 // it has been sent for encoding.
600 608
601 if (process.hw_codec) { 609 if (process.hw_codec) {
602 LOG(LS_WARNING) << "HW codecs should mostly be run in batch mode, " 610 LOG(LS_WARNING) << "HW codecs should mostly be run in batch mode, "
603 "since they may be pipelining."; 611 "since they may be pipelining.";
604 } 612 }
605 613
606 while (frame_number < num_frames) { 614 while (frame_number < num_frames) {
607 EXPECT_TRUE(processor_->ProcessFrame(frame_number)); 615 EXPECT_TRUE(processor_->ProcessFrame(frame_number));
608 616 VerifyQpParser(process, frame_number);
609 ++num_frames_per_update_[TemporalLayerIndexForFrame(frame_number)]; 617 ++num_frames_per_update_[TemporalLayerIndexForFrame(frame_number)];
610 ++num_frames_total_; 618 ++num_frames_total_;
611 UpdateRateControlMetrics(frame_number); 619 UpdateRateControlMetrics(frame_number);
612 620
613 ++frame_number; 621 ++frame_number;
614 622
615 // If we hit another/next update, verify stats for current state and 623 // If we hit another/next update, verify stats for current state and
616 // update layers and codec with new rates. 624 // update layers and codec with new rates.
617 if (frame_number == 625 if (frame_number ==
618 rate_profile.frame_index_rate_update[update_index + 1]) { 626 rate_profile.frame_index_rate_update[update_index + 1]) {
(...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after
819 827
820 // Codec and network settings. 828 // Codec and network settings.
821 float packet_loss_probability_; 829 float packet_loss_probability_;
822 int num_temporal_layers_; 830 int num_temporal_layers_;
823 }; 831 };
824 832
825 } // namespace test 833 } // namespace test
826 } // namespace webrtc 834 } // namespace webrtc
827 835
828 #endif // WEBRTC_MODULES_VIDEO_CODING_CODECS_TEST_VIDEOPROCESSOR_INTEGRATIONTES T_H_ 836 #endif // WEBRTC_MODULES_VIDEO_CODING_CODECS_TEST_VIDEOPROCESSOR_INTEGRATIONTES T_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698