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 | 15 |
16 namespace { | 16 namespace { |
17 // Codec settings. | 17 // Codec settings. |
18 const int kBitrates[] = {30, 50, 100, 200, 300, 500, 1000}; | 18 const int kBitrates[] = {30, 50, 100, 200, 300, 500, 1000}; |
19 const int kFps[] = {30}; | 19 const int kFps[] = {30}; |
20 const bool kErrorConcealmentOn = false; | 20 const bool kErrorConcealmentOn = false; |
21 const bool kDenoisingOn = false; | 21 const bool kDenoisingOn = false; |
22 const bool kFrameDropperOn = true; | 22 const bool kFrameDropperOn = true; |
23 const bool kSpatialResizeOn = false; | 23 const bool kSpatialResizeOn = false; |
24 const VideoCodecType kVideoCodecType[] = {kVideoCodecVP8}; | 24 const VideoCodecType kVideoCodecType[] = {kVideoCodecVP8}; |
25 const bool kHwCodec = false; | 25 const bool kHwCodec[] = {false}; |
26 const bool kUseSingleCore = true; | 26 const bool kUseSingleCore = true; |
27 | 27 |
28 // Test settings. | 28 // Test settings. |
29 const bool kBatchMode = true; | 29 const bool kBatchMode = true; |
30 | 30 |
31 // Packet loss probability [0.0, 1.0]. | 31 // Packet loss probability [0.0, 1.0]. |
32 const float kPacketLoss = 0.0f; | 32 const float kPacketLoss = 0.0f; |
33 | 33 |
34 const VisualizationParams kVisualizationParams = { | 34 const VisualizationParams kVisualizationParams = { |
35 false, // save_source_y4m | 35 false, // save_source_y4m |
36 false, // save_encoded_ivf | 36 false, // save_encoded_ivf |
37 false, // save_decoded_y4m | 37 false, // save_decoded_y4m |
38 }; | 38 }; |
39 | 39 |
40 const bool kVerboseLogging = true; | 40 const bool kVerboseLogging = true; |
41 } // namespace | 41 } // namespace |
42 | 42 |
43 // Tests for plotting statistics from logs. | 43 // Tests for plotting statistics from logs. |
44 class PlotVideoProcessorIntegrationTest | 44 class PlotVideoProcessorIntegrationTest |
45 : public VideoProcessorIntegrationTest, | 45 : public VideoProcessorIntegrationTest, |
46 public ::testing::WithParamInterface< | 46 public ::testing::WithParamInterface< |
47 ::testing::tuple<int, int, VideoCodecType>> { | 47 ::testing::tuple<int, int, VideoCodecType, bool>> { |
48 protected: | 48 protected: |
49 PlotVideoProcessorIntegrationTest() | 49 PlotVideoProcessorIntegrationTest() |
50 : bitrate_(::testing::get<0>(GetParam())), | 50 : bitrate_(::testing::get<0>(GetParam())), |
51 framerate_(::testing::get<1>(GetParam())), | 51 framerate_(::testing::get<1>(GetParam())), |
52 codec_type_(::testing::get<2>(GetParam())) {} | 52 codec_type_(::testing::get<2>(GetParam())), |
| 53 hw_codec_(::testing::get<3>(GetParam())) {} |
53 | 54 |
54 virtual ~PlotVideoProcessorIntegrationTest() {} | 55 virtual ~PlotVideoProcessorIntegrationTest() {} |
55 | 56 |
56 void RunTest(int width, int height, const std::string& filename) { | 57 void RunTest(int width, int height, const std::string& filename) { |
57 // Bitrate and frame rate profile. | 58 // Bitrate and frame rate profile. |
58 RateProfile rate_profile; | 59 RateProfile rate_profile; |
59 SetRateProfile(&rate_profile, | 60 SetRateProfile(&rate_profile, |
60 0, // update_index | 61 0, // update_index |
61 bitrate_, framerate_, | 62 bitrate_, framerate_, |
62 0); // frame_index_rate_update | 63 0); // frame_index_rate_update |
63 rate_profile.frame_index_rate_update[1] = kNumFramesLong + 1; | 64 rate_profile.frame_index_rate_update[1] = kNumFramesLong + 1; |
64 rate_profile.num_frames = kNumFramesLong; | 65 rate_profile.num_frames = kNumFramesLong; |
65 | 66 |
66 // Codec/network settings. | 67 // Codec/network settings. |
67 CodecParams process_settings; | 68 CodecParams process_settings; |
68 SetCodecParams( | 69 SetCodecParams( |
69 &process_settings, codec_type_, kHwCodec, kUseSingleCore, kPacketLoss, | 70 &process_settings, codec_type_, hw_codec_, kUseSingleCore, kPacketLoss, |
70 -1, // key_frame_interval | 71 -1, // key_frame_interval |
71 1, // num_temporal_layers | 72 1, // num_temporal_layers |
72 kErrorConcealmentOn, kDenoisingOn, kFrameDropperOn, kSpatialResizeOn, | 73 kErrorConcealmentOn, kDenoisingOn, kFrameDropperOn, kSpatialResizeOn, |
73 width, height, filename, kVerboseLogging, kBatchMode); | 74 width, height, filename, kVerboseLogging, kBatchMode); |
74 | 75 |
75 // Use default thresholds for quality (PSNR and SSIM). | 76 // Use default thresholds for quality (PSNR and SSIM). |
76 QualityThresholds quality_thresholds; | 77 QualityThresholds quality_thresholds; |
77 | 78 |
78 // Use very loose thresholds for rate control, so even poor HW codecs will | 79 // Use very loose thresholds for rate control, so even poor HW codecs will |
79 // pass the requirements. | 80 // pass the requirements. |
(...skipping 11 matching lines...) Expand all Loading... |
91 1); // num_key_frames | 92 1); // num_key_frames |
92 // clang-format on | 93 // clang-format on |
93 | 94 |
94 ProcessFramesAndVerify(quality_thresholds, rate_profile, process_settings, | 95 ProcessFramesAndVerify(quality_thresholds, rate_profile, process_settings, |
95 rc_thresholds, &kVisualizationParams); | 96 rc_thresholds, &kVisualizationParams); |
96 } | 97 } |
97 | 98 |
98 const int bitrate_; | 99 const int bitrate_; |
99 const int framerate_; | 100 const int framerate_; |
100 const VideoCodecType codec_type_; | 101 const VideoCodecType codec_type_; |
| 102 const bool hw_codec_; |
101 }; | 103 }; |
102 | 104 |
103 INSTANTIATE_TEST_CASE_P( | 105 INSTANTIATE_TEST_CASE_P(CodecSettings, |
104 CodecSettings, | 106 PlotVideoProcessorIntegrationTest, |
105 PlotVideoProcessorIntegrationTest, | 107 ::testing::Combine(::testing::ValuesIn(kBitrates), |
106 ::testing::Combine(::testing::ValuesIn(kBitrates), | 108 ::testing::ValuesIn(kFps), |
107 ::testing::ValuesIn(kFps), | 109 ::testing::ValuesIn(kVideoCodecType), |
108 ::testing::ValuesIn(kVideoCodecType))); | 110 ::testing::ValuesIn(kHwCodec))); |
109 | 111 |
110 TEST_P(PlotVideoProcessorIntegrationTest, Process128x96) { | 112 TEST_P(PlotVideoProcessorIntegrationTest, Process128x96) { |
111 RunTest(128, 96, "foreman_128x96"); | 113 RunTest(128, 96, "foreman_128x96"); |
112 } | 114 } |
113 | 115 |
114 TEST_P(PlotVideoProcessorIntegrationTest, Process160x120) { | 116 TEST_P(PlotVideoProcessorIntegrationTest, Process160x120) { |
115 RunTest(160, 120, "foreman_160x120"); | 117 RunTest(160, 120, "foreman_160x120"); |
116 } | 118 } |
117 | 119 |
118 TEST_P(PlotVideoProcessorIntegrationTest, Process176x144) { | 120 TEST_P(PlotVideoProcessorIntegrationTest, Process176x144) { |
119 RunTest(176, 144, "foreman_176x144"); | 121 RunTest(176, 144, "foreman_176x144"); |
120 } | 122 } |
121 | 123 |
122 TEST_P(PlotVideoProcessorIntegrationTest, Process320x240) { | 124 TEST_P(PlotVideoProcessorIntegrationTest, Process320x240) { |
123 RunTest(320, 240, "foreman_320x240"); | 125 RunTest(320, 240, "foreman_320x240"); |
124 } | 126 } |
125 | 127 |
126 TEST_P(PlotVideoProcessorIntegrationTest, Process352x288) { | 128 TEST_P(PlotVideoProcessorIntegrationTest, Process352x288) { |
127 RunTest(352, 288, "foreman_cif"); | 129 RunTest(352, 288, "foreman_cif"); |
128 } | 130 } |
129 | 131 |
130 } // namespace test | 132 } // namespace test |
131 } // namespace webrtc | 133 } // namespace webrtc |
OLD | NEW |