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 #include "webrtc/test/testsupport/fileutils.h" | |
14 | |
15 namespace webrtc { | |
16 namespace test { | |
17 | |
18 namespace { | |
19 | |
20 // Loop variables. | |
21 const int kBitrates[] = {30, 50, 100, 200, 300, 500, 1000}; | |
22 const VideoCodecType kVideoCodecType[] = {kVideoCodecVP8}; | |
23 const bool kHwCodec[] = {false}; | |
24 | |
25 // Codec settings. | |
26 const bool kResilienceOn = false; | |
27 const int kNumTemporalLayers = 1; | |
28 const bool kDenoisingOn = false; | |
29 const bool kErrorConcealmentOn = false; | |
30 const bool kSpatialResizeOn = false; | |
31 const bool kFrameDropperOn = false; | |
32 | |
33 // Test settings. | |
34 const bool kUseSingleCore = false; | |
35 const VisualizationParams kVisualizationParams = { | |
36 false, // save_encoded_ivf | |
37 false, // save_decoded_y4m | |
38 }; | |
39 | |
40 const int kNumFrames = 300; | |
41 | |
42 } // namespace | |
43 | |
44 // Tests for plotting statistics from logs. | |
45 class PlotVideoProcessorIntegrationTest | |
46 : public VideoProcessorIntegrationTest, | |
47 public ::testing::WithParamInterface< | |
48 ::testing::tuple<int, VideoCodecType, bool>> { | |
49 protected: | |
50 PlotVideoProcessorIntegrationTest() | |
51 : bitrate_(::testing::get<0>(GetParam())), | |
52 codec_type_(::testing::get<1>(GetParam())), | |
53 hw_codec_(::testing::get<2>(GetParam())) {} | |
54 ~PlotVideoProcessorIntegrationTest() override = default; | |
55 | |
56 void RunTest(int width, | |
57 int height, | |
58 int framerate, | |
59 const std::string& filename) { | |
60 config_.filename = filename; | |
61 config_.input_filename = ResourcePath(filename, "yuv"); | |
62 config_.output_filename = | |
63 TempFilename(OutputPath(), "plot_videoprocessor_integrationtest"); | |
64 config_.use_single_core = kUseSingleCore; | |
65 config_.verbose = true; | |
66 config_.hw_encoder = hw_codec_; | |
67 config_.hw_decoder = hw_codec_; | |
68 SetCodecSettings(&config_, codec_type_, kNumTemporalLayers, | |
69 kErrorConcealmentOn, kDenoisingOn, kFrameDropperOn, | |
70 kSpatialResizeOn, kResilienceOn, width, height); | |
71 | |
72 RateProfile rate_profile; | |
73 SetRateProfile(&rate_profile, | |
74 0, // update_index | |
75 bitrate_, framerate, | |
76 0); // frame_index_rate_update | |
77 rate_profile.frame_index_rate_update[1] = kNumFrames + 1; | |
78 rate_profile.num_frames = kNumFrames; | |
79 | |
80 ProcessFramesAndMaybeVerify(rate_profile, nullptr, nullptr, | |
81 &kVisualizationParams); | |
82 } | |
83 | |
84 const int bitrate_; | |
85 const VideoCodecType codec_type_; | |
86 const bool hw_codec_; | |
87 }; | |
88 | |
89 INSTANTIATE_TEST_CASE_P( | |
90 CodecSettings, | |
91 PlotVideoProcessorIntegrationTest, | |
92 ::testing::Combine(::testing::ValuesIn(kBitrates), | |
93 ::testing::ValuesIn(kVideoCodecType), | |
94 ::testing::ValuesIn(kHwCodec))); | |
95 | |
96 TEST_P(PlotVideoProcessorIntegrationTest, Process_128x96_30fps) { | |
97 RunTest(128, 96, 30, "foreman_128x96"); | |
98 } | |
99 | |
100 TEST_P(PlotVideoProcessorIntegrationTest, Process_160x120_30fps) { | |
101 RunTest(160, 120, 30, "foreman_160x120"); | |
102 } | |
103 | |
104 TEST_P(PlotVideoProcessorIntegrationTest, Process_176x144_30fps) { | |
105 RunTest(176, 144, 30, "foreman_176x144"); | |
106 } | |
107 | |
108 TEST_P(PlotVideoProcessorIntegrationTest, Process_320x240_30fps) { | |
109 RunTest(320, 240, 30, "foreman_320x240"); | |
110 } | |
111 | |
112 TEST_P(PlotVideoProcessorIntegrationTest, Process_352x288_30fps) { | |
113 RunTest(352, 288, 30, "foreman_cif"); | |
114 } | |
115 | |
116 } // namespace test | |
117 } // namespace webrtc | |
OLD | NEW |