OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2017 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2017 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 11 matching lines...) Expand all Loading... |
22 | 22 |
23 // Codec settings. | 23 // Codec settings. |
24 const bool kUseSingleCore = false; | 24 const bool kUseSingleCore = false; |
25 const bool kResilienceOn = false; | 25 const bool kResilienceOn = false; |
26 const int kNumTemporalLayers = 1; | 26 const int kNumTemporalLayers = 1; |
27 const bool kDenoisingOn = false; | 27 const bool kDenoisingOn = false; |
28 const bool kErrorConcealmentOn = false; | 28 const bool kErrorConcealmentOn = false; |
29 const bool kSpatialResizeOn = false; | 29 const bool kSpatialResizeOn = false; |
30 const bool kFrameDropperOn = false; | 30 const bool kFrameDropperOn = false; |
31 | 31 |
32 // Test settings. | |
33 const bool kBatchMode = true; | |
34 const bool kVerboseLogging = true; | 32 const bool kVerboseLogging = true; |
35 const float kPacketLoss = 0.0f; | 33 const float kPacketLoss = 0.0f; |
36 const VisualizationParams kVisualizationParams = { | 34 const VisualizationParams kVisualizationParams = { |
37 false, // save_encoded_ivf | 35 false, // save_encoded_ivf |
38 false, // save_decoded_y4m | 36 false, // save_decoded_y4m |
39 }; | 37 }; |
40 | 38 |
41 const int kNumFrames = 299; | 39 const int kNumFrames = 300; |
42 | 40 |
43 } // namespace | 41 } // namespace |
44 | 42 |
45 // Tests for plotting statistics from logs. | 43 // Tests for plotting statistics from logs. |
46 class PlotVideoProcessorIntegrationTest | 44 class PlotVideoProcessorIntegrationTest |
47 : public VideoProcessorIntegrationTest, | 45 : public VideoProcessorIntegrationTest, |
48 public ::testing::WithParamInterface< | 46 public ::testing::WithParamInterface< |
49 ::testing::tuple<int, VideoCodecType, bool>> { | 47 ::testing::tuple<int, VideoCodecType, bool>> { |
50 protected: | 48 protected: |
51 PlotVideoProcessorIntegrationTest() | 49 PlotVideoProcessorIntegrationTest() |
52 : bitrate_(::testing::get<0>(GetParam())), | 50 : bitrate_(::testing::get<0>(GetParam())), |
53 codec_type_(::testing::get<1>(GetParam())), | 51 codec_type_(::testing::get<1>(GetParam())), |
54 hw_codec_(::testing::get<2>(GetParam())) {} | 52 hw_codec_(::testing::get<2>(GetParam())) {} |
55 ~PlotVideoProcessorIntegrationTest() override = default; | 53 ~PlotVideoProcessorIntegrationTest() override = default; |
56 | 54 |
57 void RunTest(int width, | 55 void RunTest(int width, |
58 int height, | 56 int height, |
59 int framerate, | 57 int framerate, |
60 const std::string& filename) { | 58 const std::string& filename) { |
61 // Bitrate and frame rate profile. | 59 SetTestConfig(&config_, hw_codec_, kUseSingleCore, kPacketLoss, filename, |
| 60 kVerboseLogging); |
| 61 SetCodecSettings(&config_, codec_type_, kNumTemporalLayers, |
| 62 kErrorConcealmentOn, kDenoisingOn, kFrameDropperOn, |
| 63 kSpatialResizeOn, kResilienceOn, width, height); |
| 64 |
62 RateProfile rate_profile; | 65 RateProfile rate_profile; |
63 SetRateProfile(&rate_profile, | 66 SetRateProfile(&rate_profile, |
64 0, // update_index | 67 0, // update_index |
65 bitrate_, framerate, | 68 bitrate_, framerate, |
66 0); // frame_index_rate_update | 69 0); // frame_index_rate_update |
67 rate_profile.frame_index_rate_update[1] = kNumFrames + 1; | 70 rate_profile.frame_index_rate_update[1] = kNumFrames + 1; |
68 rate_profile.num_frames = kNumFrames; | 71 rate_profile.num_frames = kNumFrames; |
69 | 72 |
70 // Codec/network settings. | 73 ProcessFramesAndMaybeVerify(rate_profile, nullptr, nullptr, |
71 SetTestConfig(&config_, hw_codec_, kUseSingleCore, kPacketLoss, filename, | 74 &kVisualizationParams); |
72 kVerboseLogging, kBatchMode); | |
73 SetCodecSettings(&config_, codec_type_, kNumTemporalLayers, | |
74 kErrorConcealmentOn, kDenoisingOn, kFrameDropperOn, | |
75 kSpatialResizeOn, kResilienceOn, width, height); | |
76 | |
77 // Use default thresholds for quality (PSNR and SSIM). | |
78 QualityThresholds quality_thresholds; | |
79 | |
80 // Use very loose thresholds for rate control, so even poor HW codecs will | |
81 // pass the requirements. | |
82 RateControlThresholds rc_thresholds[1]; | |
83 // clang-format off | |
84 SetRateControlThresholds( | |
85 rc_thresholds, | |
86 0, // update_index | |
87 kNumFrames + 1, // max_num_dropped_frames | |
88 10000, // max_key_frame_size_mismatch | |
89 10000, // max_delta_frame_size_mismatch | |
90 10000, // max_encoding_rate_mismatch | |
91 kNumFrames + 1, // max_time_hit_target | |
92 0, // num_spatial_resizes | |
93 1); // num_key_frames | |
94 // clang-format on | |
95 | |
96 ProcessFramesAndVerify(quality_thresholds, rate_profile, rc_thresholds, | |
97 &kVisualizationParams); | |
98 } | 75 } |
99 | 76 |
100 const int bitrate_; | 77 const int bitrate_; |
101 const VideoCodecType codec_type_; | 78 const VideoCodecType codec_type_; |
102 const bool hw_codec_; | 79 const bool hw_codec_; |
103 }; | 80 }; |
104 | 81 |
105 INSTANTIATE_TEST_CASE_P( | 82 INSTANTIATE_TEST_CASE_P( |
106 CodecSettings, | 83 CodecSettings, |
107 PlotVideoProcessorIntegrationTest, | 84 PlotVideoProcessorIntegrationTest, |
(...skipping 16 matching lines...) Expand all Loading... |
124 TEST_P(PlotVideoProcessorIntegrationTest, Process_320x240_30fps) { | 101 TEST_P(PlotVideoProcessorIntegrationTest, Process_320x240_30fps) { |
125 RunTest(320, 240, 30, "foreman_320x240"); | 102 RunTest(320, 240, 30, "foreman_320x240"); |
126 } | 103 } |
127 | 104 |
128 TEST_P(PlotVideoProcessorIntegrationTest, Process_352x288_30fps) { | 105 TEST_P(PlotVideoProcessorIntegrationTest, Process_352x288_30fps) { |
129 RunTest(352, 288, 30, "foreman_cif"); | 106 RunTest(352, 288, 30, "foreman_cif"); |
130 } | 107 } |
131 | 108 |
132 } // namespace test | 109 } // namespace test |
133 } // namespace webrtc | 110 } // namespace webrtc |
OLD | NEW |