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 |
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 Loading... | |
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 loose. |
sprang_webrtc
2017/03/10 09:25:10
Maximally minimal!
brandtr
2017/03/10 09:37:45
:)
| |
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 Loading... | |
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 319 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
808 | 813 |
809 // Codec and network settings. | 814 // Codec and network settings. |
810 float packet_loss_probability_; | 815 float packet_loss_probability_; |
811 int num_temporal_layers_; | 816 int num_temporal_layers_; |
812 }; | 817 }; |
813 | 818 |
814 } // namespace test | 819 } // namespace test |
815 } // namespace webrtc | 820 } // namespace webrtc |
816 | 821 |
817 #endif // WEBRTC_MODULES_VIDEO_CODING_CODECS_TEST_VIDEOPROCESSOR_INTEGRATIONTES T_H_ | 822 #endif // WEBRTC_MODULES_VIDEO_CODING_CODECS_TEST_VIDEOPROCESSOR_INTEGRATIONTES T_H_ |
OLD | NEW |