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