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

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

Issue 2710913004: Step #3: Add flag for correctness mode in VideoProcessor integration tests. (Closed)
Patch Set: asapersson comments 3 (offline). Created 3 years, 9 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
« no previous file with comments | « webrtc/modules/video_coding/codecs/test/plot_videoprocessor_integrationtest.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
11 #ifndef WEBRTC_MODULES_VIDEO_CODING_CODECS_TEST_VIDEOPROCESSOR_INTEGRATIONTEST_H _ 11 #ifndef WEBRTC_MODULES_VIDEO_CODING_CODECS_TEST_VIDEOPROCESSOR_INTEGRATIONTEST_H _
12 #define WEBRTC_MODULES_VIDEO_CODING_CODECS_TEST_VIDEOPROCESSOR_INTEGRATIONTEST_H _ 12 #define WEBRTC_MODULES_VIDEO_CODING_CODECS_TEST_VIDEOPROCESSOR_INTEGRATIONTEST_H _
13 13
14 #include <math.h> 14 #include <math.h>
15 15
16 #include <limits>
16 #include <memory> 17 #include <memory>
17 #include <string> 18 #include <string>
18 #include <utility> 19 #include <utility>
19 20
20 #if defined(WEBRTC_ANDROID) 21 #if defined(WEBRTC_ANDROID)
21 #include "webrtc/modules/video_coding/codecs/test/android_test_initializer.h" 22 #include "webrtc/modules/video_coding/codecs/test/android_test_initializer.h"
22 #include "webrtc/sdk/android/src/jni/androidmediadecoder_jni.h" 23 #include "webrtc/sdk/android/src/jni/androidmediadecoder_jni.h"
23 #include "webrtc/sdk/android/src/jni/androidmediaencoder_jni.h" 24 #include "webrtc/sdk/android/src/jni/androidmediaencoder_jni.h"
24 #elif defined(WEBRTC_IOS) 25 #elif defined(WEBRTC_IOS)
25 #include "webrtc/sdk/objc/Framework/Classes/h264_video_toolbox_decoder.h" 26 #include "webrtc/sdk/objc/Framework/Classes/h264_video_toolbox_decoder.h"
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
86 std::string filename; 87 std::string filename;
87 bool verbose_logging; 88 bool verbose_logging;
88 89
89 // In batch mode, the VideoProcessor is fed all the frames for processing 90 // In batch mode, the VideoProcessor is fed all the frames for processing
90 // before any metrics are calculated. This is useful for pipelining HW codecs, 91 // before any metrics are calculated. This is useful for pipelining HW codecs,
91 // for which some calculated metrics otherwise would be incorrect. The 92 // for which some calculated metrics otherwise would be incorrect. The
92 // downside with batch mode is that mid-test rate allocation is not supported. 93 // downside with batch mode is that mid-test rate allocation is not supported.
93 bool batch_mode; 94 bool batch_mode;
94 }; 95 };
95 96
96 // Thresholds for the quality metrics. 97 // Thresholds for the quality metrics. Defaults are maximally minimal.
97 struct QualityThresholds { 98 struct QualityThresholds {
98 double min_avg_psnr; 99 double min_avg_psnr = std::numeric_limits<double>::min();
99 double min_min_psnr; 100 double min_min_psnr = std::numeric_limits<double>::min();
100 double min_avg_ssim; 101 double min_avg_ssim = 0;
101 double min_min_ssim; 102 double min_min_ssim = 0;
102 }; 103 };
103 104
104 // The sequence of bit rate and frame rate changes for the encoder, the frame 105 // The sequence of bit rate and frame rate changes for the encoder, the frame
105 // number where the changes are made, and the total number of frames for the 106 // number where the changes are made, and the total number of frames for the
106 // test. 107 // test.
107 struct RateProfile { 108 struct RateProfile {
108 int target_bit_rate[kMaxNumRateUpdates]; 109 int target_bit_rate[kMaxNumRateUpdates];
109 int input_frame_rate[kMaxNumRateUpdates]; 110 int input_frame_rate[kMaxNumRateUpdates];
110 int frame_index_rate_update[kMaxNumRateUpdates + 1]; 111 int frame_index_rate_update[kMaxNumRateUpdates + 1];
111 int num_frames; 112 int num_frames;
112 }; 113 };
113 114
114 // Thresholds for the rate control metrics. The rate mismatch thresholds are 115 // Thresholds for the rate control metrics. The rate mismatch thresholds are
115 // defined as percentages. |max_time_hit_target| is defined as number of frames, 116 // defined as percentages. |max_time_hit_target| is defined as number of frames,
116 // after a rate update is made to the encoder, for the encoder to reach within 117 // after a rate update is made to the encoder, for the encoder to reach within
117 // |kPercTargetvsActualMismatch| of new target rate. The thresholds are defined 118 // |kPercTargetvsActualMismatch| of new target rate. The thresholds are defined
118 // for each rate update sequence. 119 // for each rate update sequence.
119 struct RateControlThresholds { 120 struct RateControlThresholds {
120 int max_num_dropped_frames; 121 int max_num_dropped_frames;
121 int max_key_frame_size_mismatch; 122 int max_key_frame_size_mismatch;
122 int max_delta_frame_size_mismatch; 123 int max_delta_frame_size_mismatch;
123 int max_encoding_rate_mismatch; 124 int max_encoding_rate_mismatch;
124 int max_time_hit_target; 125 int max_time_hit_target;
125 int num_spatial_resizes; 126 int num_spatial_resizes; // Set to -1 to disable check.
126 int num_key_frames; 127 int num_key_frames; // Set to -1 to disable check.
127 }; 128 };
128 129
129 // Should video files be saved persistently to disk for post-run visualization? 130 // Should video files be saved persistently to disk for post-run visualization?
130 struct VisualizationParams { 131 struct VisualizationParams {
131 bool save_source_y4m; 132 bool save_source_y4m;
132 bool save_encoded_ivf; 133 bool save_encoded_ivf;
133 bool save_decoded_y4m; 134 bool save_decoded_y4m;
134 }; 135 };
135 136
136 #if !defined(WEBRTC_IOS) 137 #if !defined(WEBRTC_IOS)
(...skipping 330 matching lines...) Expand 10 before | Expand all | Expand 10 after
467 encoding_bitrate_[i], perc_frame_size_mismatch, 468 encoding_bitrate_[i], perc_frame_size_mismatch,
468 perc_encoding_rate_mismatch, num_frames_per_update_[i]); 469 perc_encoding_rate_mismatch, num_frames_per_update_[i]);
469 EXPECT_LE(perc_frame_size_mismatch, 470 EXPECT_LE(perc_frame_size_mismatch,
470 rc_expected.max_delta_frame_size_mismatch); 471 rc_expected.max_delta_frame_size_mismatch);
471 EXPECT_LE(perc_encoding_rate_mismatch, 472 EXPECT_LE(perc_encoding_rate_mismatch,
472 rc_expected.max_encoding_rate_mismatch); 473 rc_expected.max_encoding_rate_mismatch);
473 } 474 }
474 printf("\n"); 475 printf("\n");
475 EXPECT_LE(num_frames_to_hit_target_, rc_expected.max_time_hit_target); 476 EXPECT_LE(num_frames_to_hit_target_, rc_expected.max_time_hit_target);
476 EXPECT_LE(num_dropped_frames, rc_expected.max_num_dropped_frames); 477 EXPECT_LE(num_dropped_frames, rc_expected.max_num_dropped_frames);
477 EXPECT_EQ(rc_expected.num_spatial_resizes, num_resize_actions); 478 if (rc_expected.num_spatial_resizes >= 0) {
478 EXPECT_EQ(rc_expected.num_key_frames, num_key_frames_); 479 EXPECT_EQ(rc_expected.num_spatial_resizes, num_resize_actions);
480 }
481 if (rc_expected.num_key_frames >= 0) {
482 EXPECT_EQ(rc_expected.num_key_frames, num_key_frames_);
483 }
479 } 484 }
480 485
481 void VerifyQuality(const test::QualityMetricsResult& psnr_result, 486 void VerifyQuality(const test::QualityMetricsResult& psnr_result,
482 const test::QualityMetricsResult& ssim_result, 487 const test::QualityMetricsResult& ssim_result,
483 const QualityThresholds& quality_thresholds) { 488 const QualityThresholds& quality_thresholds) {
484 EXPECT_GT(psnr_result.average, quality_thresholds.min_avg_psnr); 489 EXPECT_GT(psnr_result.average, quality_thresholds.min_avg_psnr);
485 EXPECT_GT(psnr_result.min, quality_thresholds.min_min_psnr); 490 EXPECT_GT(psnr_result.min, quality_thresholds.min_min_psnr);
486 EXPECT_GT(ssim_result.average, quality_thresholds.min_avg_ssim); 491 EXPECT_GT(ssim_result.average, quality_thresholds.min_avg_ssim);
487 EXPECT_GT(ssim_result.min, quality_thresholds.min_min_ssim); 492 EXPECT_GT(ssim_result.min, quality_thresholds.min_min_ssim);
488 } 493 }
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
534 } 539 }
535 frame_rate_layer_[i] = 540 frame_rate_layer_[i] =
536 frame_rate_ / static_cast<float>(1 << (num_temporal_layers_ - 1)); 541 frame_rate_ / static_cast<float>(1 << (num_temporal_layers_ - 1));
537 } 542 }
538 if (num_temporal_layers_ == 3) { 543 if (num_temporal_layers_ == 3) {
539 frame_rate_layer_[2] = frame_rate_ / 2.0f; 544 frame_rate_layer_[2] = frame_rate_ / 2.0f;
540 } 545 }
541 } 546 }
542 547
543 // Processes all frames in the clip and verifies the result. 548 // Processes all frames in the clip and verifies the result.
549 // TODO(brandtr): Change the second last argument to be a
550 // const std::vector<RateControlThresholds>&, so we can ensure that the user
551 // does not expect us to do mid-clip rate updates when we are not able to,
552 // e.g., when we are operating in batch mode.
544 void ProcessFramesAndVerify(QualityThresholds quality_thresholds, 553 void ProcessFramesAndVerify(QualityThresholds quality_thresholds,
545 RateProfile rate_profile, 554 RateProfile rate_profile,
546 CodecParams process, 555 CodecParams process,
547 RateControlThresholds* rc_thresholds, 556 RateControlThresholds* rc_thresholds,
548 const VisualizationParams* visualization_params) { 557 const VisualizationParams* visualization_params) {
549 // Codec/config settings. 558 // Codec/config settings.
550 start_bitrate_ = rate_profile.target_bit_rate[0]; 559 start_bitrate_ = rate_profile.target_bit_rate[0];
551 start_frame_rate_ = rate_profile.input_frame_rate[0]; 560 start_frame_rate_ = rate_profile.input_frame_rate[0];
552 packet_loss_probability_ = process.packet_loss_probability; 561 packet_loss_probability_ = process.packet_loss_probability;
553 num_temporal_layers_ = process.num_temporal_layers; 562 num_temporal_layers_ = process.num_temporal_layers;
(...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after
808 817
809 // Codec and network settings. 818 // Codec and network settings.
810 float packet_loss_probability_; 819 float packet_loss_probability_;
811 int num_temporal_layers_; 820 int num_temporal_layers_;
812 }; 821 };
813 822
814 } // namespace test 823 } // namespace test
815 } // namespace webrtc 824 } // namespace webrtc
816 825
817 #endif // WEBRTC_MODULES_VIDEO_CODING_CODECS_TEST_VIDEOPROCESSOR_INTEGRATIONTES T_H_ 826 #endif // WEBRTC_MODULES_VIDEO_CODING_CODECS_TEST_VIDEOPROCESSOR_INTEGRATIONTES T_H_
OLDNEW
« no previous file with comments | « webrtc/modules/video_coding/codecs/test/plot_videoprocessor_integrationtest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698