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 |
11 #include "webrtc/modules/video_coding/codecs/test/videoprocessor_integrationtest
.h" | 11 #include "webrtc/modules/video_coding/codecs/test/videoprocessor_integrationtest
.h" |
12 | 12 |
13 namespace webrtc { | 13 namespace webrtc { |
14 namespace test { | 14 namespace test { |
15 namespace { | 15 namespace { |
16 // Codec settings. | 16 // Codec settings. |
17 const int kBitrates[] = {30, 50, 100, 200, 300, 500, 1000}; | 17 const int kBitrates[] = {30, 50, 100, 200, 300, 500, 1000}; |
18 const int kFps[] = {30}; | 18 const int kFps[] = {30}; |
19 const bool kErrorConcealmentOn = false; | 19 const bool kErrorConcealmentOn = false; |
20 const bool kDenoisingOn = false; | 20 const bool kDenoisingOn = false; |
21 const bool kFrameDropperOn = true; | 21 const bool kFrameDropperOn = true; |
22 const bool kSpatialResizeOn = false; | 22 const bool kSpatialResizeOn = false; |
23 const VideoCodecType kVideoCodecType = kVideoCodecVP8; | 23 const VideoCodecType kVideoCodecType[] = {kVideoCodecVP8}; |
24 | 24 |
25 // Packet loss probability [0.0, 1.0]. | 25 // Packet loss probability [0.0, 1.0]. |
26 const float kPacketLoss = 0.0f; | 26 const float kPacketLoss = 0.0f; |
27 | 27 |
28 const bool kVerboseLogging = true; | 28 const bool kVerboseLogging = true; |
29 } // namespace | 29 } // namespace |
30 | 30 |
31 // Tests for plotting statistics from logs. | 31 // Tests for plotting statistics from logs. |
32 class PlotVideoProcessorIntegrationTest | 32 class PlotVideoProcessorIntegrationTest |
33 : public VideoProcessorIntegrationTest, | 33 : public VideoProcessorIntegrationTest, |
34 public ::testing::WithParamInterface<::testing::tuple<int, int>> { | 34 public ::testing::WithParamInterface< |
| 35 ::testing::tuple<int, int, VideoCodecType>> { |
35 protected: | 36 protected: |
36 PlotVideoProcessorIntegrationTest() | 37 PlotVideoProcessorIntegrationTest() |
37 : bitrate_(::testing::get<0>(GetParam())), | 38 : bitrate_(::testing::get<0>(GetParam())), |
38 framerate_(::testing::get<1>(GetParam())) {} | 39 framerate_(::testing::get<1>(GetParam())), |
| 40 codec_type_(::testing::get<2>(GetParam())) {} |
39 | 41 |
40 virtual ~PlotVideoProcessorIntegrationTest() {} | 42 virtual ~PlotVideoProcessorIntegrationTest() {} |
41 | 43 |
42 void RunTest(int bitrate, | 44 void RunTest(int width, int height, const std::string& filename) { |
43 int framerate, | |
44 int width, | |
45 int height, | |
46 const std::string& filename) { | |
47 // Bitrate and frame rate profile. | 45 // Bitrate and frame rate profile. |
48 RateProfile rate_profile; | 46 RateProfile rate_profile; |
49 SetRateProfilePars(&rate_profile, | 47 SetRateProfilePars(&rate_profile, |
50 0, // update_index | 48 0, // update_index |
51 bitrate, framerate, | 49 bitrate_, framerate_, |
52 0); // frame_index_rate_update | 50 0); // frame_index_rate_update |
53 rate_profile.frame_index_rate_update[1] = kNbrFramesLong + 1; | 51 rate_profile.frame_index_rate_update[1] = kNbrFramesLong + 1; |
54 rate_profile.num_frames = kNbrFramesLong; | 52 rate_profile.num_frames = kNbrFramesLong; |
55 // Codec/network settings. | 53 // Codec/network settings. |
56 CodecConfigPars process_settings; | 54 CodecConfigPars process_settings; |
57 SetCodecParameters(&process_settings, kVideoCodecType, kPacketLoss, | 55 SetCodecParameters(&process_settings, codec_type_, kPacketLoss, |
58 -1, // key_frame_interval | 56 -1, // key_frame_interval |
59 1, // num_temporal_layers | 57 1, // num_temporal_layers |
60 kErrorConcealmentOn, kDenoisingOn, kFrameDropperOn, | 58 kErrorConcealmentOn, kDenoisingOn, kFrameDropperOn, |
61 kSpatialResizeOn, width, height, filename, | 59 kSpatialResizeOn, width, height, filename, |
62 kVerboseLogging); | 60 kVerboseLogging); |
63 // Metrics for expected quality (PSNR avg, PSNR min, SSIM avg, SSIM min). | 61 // Metrics for expected quality (PSNR avg, PSNR min, SSIM avg, SSIM min). |
64 QualityMetrics quality_metrics; | 62 QualityMetrics quality_metrics; |
65 SetQualityMetrics(&quality_metrics, 15.0, 10.0, 0.2, 0.1); | 63 SetQualityMetrics(&quality_metrics, 15.0, 10.0, 0.2, 0.1); |
66 // Metrics for rate control. | 64 // Metrics for rate control. |
67 RateControlMetrics rc_metrics[1]; | 65 RateControlMetrics rc_metrics[1]; |
68 SetRateControlMetrics(rc_metrics, | 66 SetRateControlMetrics(rc_metrics, |
69 0, // update_index | 67 0, // update_index |
70 300, // max_num_dropped_frames, | 68 300, // max_num_dropped_frames, |
71 400, // max_key_frame_size_mismatch | 69 400, // max_key_frame_size_mismatch |
72 200, // max_delta_frame_size_mismatch | 70 200, // max_delta_frame_size_mismatch |
73 100, // max_encoding_rate_mismatch | 71 100, // max_encoding_rate_mismatch |
74 300, // max_time_hit_target | 72 300, // max_time_hit_target |
75 0, // num_spatial_resizes | 73 0, // num_spatial_resizes |
76 1); // num_key_frames | 74 1); // num_key_frames |
77 ProcessFramesAndVerify(quality_metrics, rate_profile, process_settings, | 75 ProcessFramesAndVerify(quality_metrics, rate_profile, process_settings, |
78 rc_metrics); | 76 rc_metrics); |
79 } | 77 } |
80 const int bitrate_; | 78 const int bitrate_; |
81 const int framerate_; | 79 const int framerate_; |
| 80 const VideoCodecType codec_type_; |
82 }; | 81 }; |
83 | 82 |
84 INSTANTIATE_TEST_CASE_P(CodecSettings, | 83 INSTANTIATE_TEST_CASE_P( |
85 PlotVideoProcessorIntegrationTest, | 84 CodecSettings, |
86 ::testing::Combine(::testing::ValuesIn(kBitrates), | 85 PlotVideoProcessorIntegrationTest, |
87 ::testing::ValuesIn(kFps))); | 86 ::testing::Combine(::testing::ValuesIn(kBitrates), |
| 87 ::testing::ValuesIn(kFps), |
| 88 ::testing::ValuesIn(kVideoCodecType))); |
88 | 89 |
89 TEST_P(PlotVideoProcessorIntegrationTest, ProcessSQCif) { | 90 TEST_P(PlotVideoProcessorIntegrationTest, ProcessSQCif) { |
90 RunTest(bitrate_, framerate_, 128, 96, "foreman_128x96"); | 91 RunTest(128, 96, "foreman_128x96"); |
91 } | 92 } |
92 | 93 |
93 TEST_P(PlotVideoProcessorIntegrationTest, ProcessQQVga) { | 94 TEST_P(PlotVideoProcessorIntegrationTest, ProcessQQVga) { |
94 RunTest(bitrate_, framerate_, 160, 120, "foreman_160x120"); | 95 RunTest(160, 120, "foreman_160x120"); |
95 } | 96 } |
96 | 97 |
97 TEST_P(PlotVideoProcessorIntegrationTest, ProcessQCif) { | 98 TEST_P(PlotVideoProcessorIntegrationTest, ProcessQCif) { |
98 RunTest(bitrate_, framerate_, 176, 144, "foreman_176x144"); | 99 RunTest(176, 144, "foreman_176x144"); |
99 } | 100 } |
100 | 101 |
101 TEST_P(PlotVideoProcessorIntegrationTest, ProcessQVga) { | 102 TEST_P(PlotVideoProcessorIntegrationTest, ProcessQVga) { |
102 RunTest(bitrate_, framerate_, 320, 240, "foreman_320x240"); | 103 RunTest(320, 240, "foreman_320x240"); |
103 } | 104 } |
104 | 105 |
105 TEST_P(PlotVideoProcessorIntegrationTest, ProcessCif) { | 106 TEST_P(PlotVideoProcessorIntegrationTest, ProcessCif) { |
106 RunTest(bitrate_, framerate_, 352, 288, "foreman_cif"); | 107 RunTest(352, 288, "foreman_cif"); |
107 } | 108 } |
108 | 109 |
109 } // namespace test | 110 } // namespace test |
110 } // namespace webrtc | 111 } // namespace webrtc |
OLD | NEW |