Index: webrtc/modules/video_coding/codecs/test/plot_videoprocessor_integrationtest.cc |
diff --git a/webrtc/modules/video_coding/codecs/test/plot_videoprocessor_integrationtest.cc b/webrtc/modules/video_coding/codecs/test/plot_videoprocessor_integrationtest.cc |
new file mode 100644 |
index 0000000000000000000000000000000000000000..b22d4fe6df43237dcfded8c78c9501476f84d82b |
--- /dev/null |
+++ b/webrtc/modules/video_coding/codecs/test/plot_videoprocessor_integrationtest.cc |
@@ -0,0 +1,106 @@ |
+/* |
+ * Copyright (c) 2017 The WebRTC project authors. All Rights Reserved. |
+ * |
+ * Use of this source code is governed by a BSD-style license |
+ * that can be found in the LICENSE file in the root of the source |
+ * tree. An additional intellectual property rights grant can be found |
+ * in the file PATENTS. All contributing project authors may |
+ * be found in the AUTHORS file in the root of the source tree. |
+ */ |
+ |
+#include "webrtc/modules/video_coding/codecs/test/videoprocessor_integrationtest.h" |
+ |
+namespace webrtc { |
+namespace test { |
+namespace { |
+// Codec settings. |
+const int kBitrates[] = {30, 50, 100, 200, 300, 500, 1000}; |
+const int kFps = 30; |
+const bool kErrorConcealmentOn = false; |
+const bool kDenoisingOn = false; |
+const bool kFrameDropperOn = true; |
+const bool kSpatialResizeOn = false; |
+const VideoCodecType kVideoCodecType = kVideoCodecVP8; |
+ |
+// Packet loss probability [0.0, 1.0]. |
+const float kPacketLoss = 0.0f; |
+ |
+const bool kVerboseLogging = true; |
+} // namespace |
+ |
+// Tests for plotting statistics from logs. |
+class PlotVideoProcessorIntegrationTest |
+ : public VideoProcessorIntegrationTest, |
+ public ::testing::WithParamInterface<int> { |
+ protected: |
+ PlotVideoProcessorIntegrationTest() {} |
+ virtual ~PlotVideoProcessorIntegrationTest() {} |
+ |
+ void SetUp() { VideoProcessorIntegrationTest::SetUp(); } |
brandtr
2017/02/09 13:32:42
Are these two member functions needed?
åsapersson
2017/02/09 16:39:37
Removed the functions.
|
+ void TearDown() { VideoProcessorIntegrationTest::TearDown(); } |
+ |
+ void RunTest(int bitrate, |
+ int width, |
+ int height, |
+ const std::string& filename) { |
+ // Bitrate and frame rate profile. |
+ RateProfile rate_profile; |
+ SetRateProfilePars(&rate_profile, |
+ 0, // update_index |
+ bitrate, kFps, |
+ 0); // frame_index_rate_update |
+ rate_profile.frame_index_rate_update[1] = kNbrFramesLong + 1; |
+ rate_profile.num_frames = kNbrFramesLong; |
+ // Codec/network settings. |
+ CodecConfigPars process_settings; |
+ SetCodecParameters(&process_settings, kVideoCodecType, kPacketLoss, |
+ -1, // key_frame_interval |
+ 1, // num_temporal_layers |
+ kErrorConcealmentOn, kDenoisingOn, kFrameDropperOn, |
+ kSpatialResizeOn, width, height, filename, |
+ kVerboseLogging); |
+ // Metrics for expected quality (PSNR avg, PSNR min, SSIM avg, SSIM min). |
+ QualityMetrics quality_metrics; |
+ SetQualityMetrics(&quality_metrics, 15.0, 10.0, 0.2, 0.1); |
+ // Metrics for rate control. |
+ RateControlMetrics rc_metrics[1]; |
+ SetRateControlMetrics(rc_metrics, |
+ 0, // update_index |
+ 300, // max_num_dropped_frames, |
+ 400, // max_key_frame_size_mismatch |
+ 200, // max_delta_frame_size_mismatch |
+ 100, // max_encoding_rate_mismatch |
+ 300, // max_time_hit_target |
+ 0, // num_spatial_resizes |
+ 1); // num_key_frames |
+ ProcessFramesAndVerify(quality_metrics, rate_profile, process_settings, |
+ rc_metrics); |
+ } |
+}; |
+ |
+INSTANTIATE_TEST_CASE_P(TestWithBitrate, |
+ PlotVideoProcessorIntegrationTest, |
+ ::testing::ValuesIn(kBitrates)); |
+ |
+TEST_P(PlotVideoProcessorIntegrationTest, ProcessSQCif) { |
+ RunTest(GetParam(), 128, 96, "foreman_128x96"); |
+} |
+ |
+TEST_P(PlotVideoProcessorIntegrationTest, ProcessQQVga) { |
+ RunTest(GetParam(), 160, 120, "foreman_160x120"); |
+} |
+ |
+TEST_P(PlotVideoProcessorIntegrationTest, ProcessQCif) { |
+ RunTest(GetParam(), 176, 144, "foreman_176x144"); |
+} |
+ |
+TEST_P(PlotVideoProcessorIntegrationTest, ProcessQVga) { |
+ RunTest(GetParam(), 320, 240, "foreman_320x240"); |
+} |
+ |
+TEST_P(PlotVideoProcessorIntegrationTest, ProcessCif) { |
+ RunTest(GetParam(), 352, 288, "foreman_cif"); |
+} |
+ |
+} // namespace test |
+} // namespace webrtc |