Chromium Code Reviews| 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<int> { | |
| 35 protected: | |
| 36 PlotVideoProcessorIntegrationTest() {} | |
| 37 virtual ~PlotVideoProcessorIntegrationTest() {} | |
| 38 | |
| 39 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.
| |
| 40 void TearDown() { VideoProcessorIntegrationTest::TearDown(); } | |
| 41 | |
| 42 void RunTest(int bitrate, | |
| 43 int width, | |
| 44 int height, | |
| 45 const std::string& filename) { | |
| 46 // Bitrate and frame rate profile. | |
| 47 RateProfile rate_profile; | |
| 48 SetRateProfilePars(&rate_profile, | |
| 49 0, // update_index | |
| 50 bitrate, kFps, | |
| 51 0); // frame_index_rate_update | |
| 52 rate_profile.frame_index_rate_update[1] = kNbrFramesLong + 1; | |
| 53 rate_profile.num_frames = kNbrFramesLong; | |
| 54 // Codec/network settings. | |
| 55 CodecConfigPars process_settings; | |
| 56 SetCodecParameters(&process_settings, kVideoCodecType, kPacketLoss, | |
| 57 -1, // key_frame_interval | |
| 58 1, // num_temporal_layers | |
| 59 kErrorConcealmentOn, kDenoisingOn, kFrameDropperOn, | |
| 60 kSpatialResizeOn, width, height, filename, | |
| 61 kVerboseLogging); | |
| 62 // Metrics for expected quality (PSNR avg, PSNR min, SSIM avg, SSIM min). | |
| 63 QualityMetrics quality_metrics; | |
| 64 SetQualityMetrics(&quality_metrics, 15.0, 10.0, 0.2, 0.1); | |
| 65 // Metrics for rate control. | |
| 66 RateControlMetrics rc_metrics[1]; | |
| 67 SetRateControlMetrics(rc_metrics, | |
| 68 0, // update_index | |
| 69 300, // max_num_dropped_frames, | |
| 70 400, // max_key_frame_size_mismatch | |
| 71 200, // max_delta_frame_size_mismatch | |
| 72 100, // max_encoding_rate_mismatch | |
| 73 300, // max_time_hit_target | |
| 74 0, // num_spatial_resizes | |
| 75 1); // num_key_frames | |
| 76 ProcessFramesAndVerify(quality_metrics, rate_profile, process_settings, | |
| 77 rc_metrics); | |
| 78 } | |
| 79 }; | |
| 80 | |
| 81 INSTANTIATE_TEST_CASE_P(TestWithBitrate, | |
| 82 PlotVideoProcessorIntegrationTest, | |
| 83 ::testing::ValuesIn(kBitrates)); | |
| 84 | |
| 85 TEST_P(PlotVideoProcessorIntegrationTest, ProcessSQCif) { | |
| 86 RunTest(GetParam(), 128, 96, "foreman_128x96"); | |
| 87 } | |
| 88 | |
| 89 TEST_P(PlotVideoProcessorIntegrationTest, ProcessQQVga) { | |
| 90 RunTest(GetParam(), 160, 120, "foreman_160x120"); | |
| 91 } | |
| 92 | |
| 93 TEST_P(PlotVideoProcessorIntegrationTest, ProcessQCif) { | |
| 94 RunTest(GetParam(), 176, 144, "foreman_176x144"); | |
| 95 } | |
| 96 | |
| 97 TEST_P(PlotVideoProcessorIntegrationTest, ProcessQVga) { | |
| 98 RunTest(GetParam(), 320, 240, "foreman_320x240"); | |
| 99 } | |
| 100 | |
| 101 TEST_P(PlotVideoProcessorIntegrationTest, ProcessCif) { | |
| 102 RunTest(GetParam(), 352, 288, "foreman_cif"); | |
| 103 } | |
| 104 | |
| 105 } // namespace test | |
| 106 } // namespace webrtc | |
| OLD | NEW |