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