Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(596)

Side by Side Diff: webrtc/modules/video_coding/codecs/test/plot_videoprocessor_integrationtest.cc

Issue 3000613002: Reorganize code in plot_videoprocessor_integrationtest.cc. (Closed)
Patch Set: Rebase. Created 3 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
18 // Loop variables.
19 const int kBitrates[] = {30, 50, 100, 200, 300, 500, 1000};
20 const VideoCodecType kVideoCodecType[] = {kVideoCodecVP8};
21 const bool kHwCodec[] = {false};
22
17 // Codec settings. 23 // Codec settings.
18 const int kBitrates[] = {30, 50, 100, 200, 300, 500, 1000}; 24 const bool kUseSingleCore = false;
19 const int kFps[] = {30}; 25 const bool kResilienceOn = false;
20 const int kNumTemporalLayers = 1; 26 const int kNumTemporalLayers = 1;
27 const bool kDenoisingOn = false;
28 const bool kErrorConcealmentOn = false;
29 const bool kSpatialResizeOn = false;
30 const bool kFrameDropperOn = false;
21 const int kKeyFrameInterval = -1; 31 const int kKeyFrameInterval = -1;
22 const bool kErrorConcealmentOn = false;
23 const bool kDenoisingOn = false;
24 const bool kFrameDropperOn = true;
25 const bool kSpatialResizeOn = false;
26 const bool kResilienceOn = false;
27 const VideoCodecType kVideoCodecType[] = {kVideoCodecVP8};
28 const bool kHwCodec = false;
29 const bool kUseSingleCore = true;
30 32
31 // Test settings. 33 // Test settings.
32 const bool kBatchMode = true; 34 const bool kBatchMode = true;
33 35 const bool kVerboseLogging = true;
34 // Packet loss probability [0.0, 1.0].
35 const float kPacketLoss = 0.0f; 36 const float kPacketLoss = 0.0f;
36
37 const VisualizationParams kVisualizationParams = { 37 const VisualizationParams kVisualizationParams = {
38 false, // save_encoded_ivf 38 false, // save_encoded_ivf
39 false, // save_decoded_y4m 39 false, // save_decoded_y4m
40 }; 40 };
41 41
42 const bool kVerboseLogging = true; 42 const int kNumFrames = 299;
43 43
44 const int kNumFrames = 299;
45 } // namespace 44 } // namespace
46 45
47 // Tests for plotting statistics from logs. 46 // Tests for plotting statistics from logs.
48 class PlotVideoProcessorIntegrationTest 47 class PlotVideoProcessorIntegrationTest
49 : public VideoProcessorIntegrationTest, 48 : public VideoProcessorIntegrationTest,
50 public ::testing::WithParamInterface< 49 public ::testing::WithParamInterface<
51 ::testing::tuple<int, int, VideoCodecType>> { 50 ::testing::tuple<int, VideoCodecType, bool>> {
52 protected: 51 protected:
53 PlotVideoProcessorIntegrationTest() 52 PlotVideoProcessorIntegrationTest()
54 : bitrate_(::testing::get<0>(GetParam())), 53 : bitrate_(::testing::get<0>(GetParam())),
55 framerate_(::testing::get<1>(GetParam())), 54 codec_type_(::testing::get<1>(GetParam())),
56 codec_type_(::testing::get<2>(GetParam())) {} 55 hw_codec_(::testing::get<2>(GetParam())) {}
56 ~PlotVideoProcessorIntegrationTest() override = default;
57 57
58 virtual ~PlotVideoProcessorIntegrationTest() {} 58 void RunTest(int width,
59 59 int height,
60 void RunTest(int width, int height, const std::string& filename) { 60 int framerate,
61 const std::string& filename) {
61 // Bitrate and frame rate profile. 62 // Bitrate and frame rate profile.
62 RateProfile rate_profile; 63 RateProfile rate_profile;
63 SetRateProfile(&rate_profile, 64 SetRateProfile(&rate_profile,
64 0, // update_index 65 0, // update_index
65 bitrate_, framerate_, 66 bitrate_, framerate,
66 0); // frame_index_rate_update 67 0); // frame_index_rate_update
67 rate_profile.frame_index_rate_update[1] = kNumFrames + 1; 68 rate_profile.frame_index_rate_update[1] = kNumFrames + 1;
68 rate_profile.num_frames = kNumFrames; 69 rate_profile.num_frames = kNumFrames;
69 70
70 // Codec/network settings. 71 // Codec/network settings.
71 SetProcessParams(&config_, kHwCodec, kUseSingleCore, kPacketLoss, 72 SetProcessParams(&config_, hw_codec_, kUseSingleCore, kPacketLoss,
72 kKeyFrameInterval, filename, kVerboseLogging, kBatchMode); 73 kKeyFrameInterval, filename, kVerboseLogging, kBatchMode);
73 SetCodecSettings(&config_, codec_type_, kNumTemporalLayers, 74 SetCodecSettings(&config_, codec_type_, kNumTemporalLayers,
74 kErrorConcealmentOn, kDenoisingOn, kFrameDropperOn, 75 kErrorConcealmentOn, kDenoisingOn, kFrameDropperOn,
75 kSpatialResizeOn, kResilienceOn, width, height); 76 kSpatialResizeOn, kResilienceOn, width, height);
76 77
77 // Use default thresholds for quality (PSNR and SSIM). 78 // Use default thresholds for quality (PSNR and SSIM).
78 QualityThresholds quality_thresholds; 79 QualityThresholds quality_thresholds;
79 80
80 // Use very loose thresholds for rate control, so even poor HW codecs will 81 // Use very loose thresholds for rate control, so even poor HW codecs will
81 // pass the requirements. 82 // pass the requirements.
82 RateControlThresholds rc_thresholds[1]; 83 RateControlThresholds rc_thresholds[1];
83 // clang-format off 84 // clang-format off
84 SetRateControlThresholds( 85 SetRateControlThresholds(
85 rc_thresholds, 86 rc_thresholds,
86 0, // update_index 87 0, // update_index
87 kNumFrames + 1, // max_num_dropped_frames 88 kNumFrames + 1, // max_num_dropped_frames
88 10000, // max_key_frame_size_mismatch 89 10000, // max_key_frame_size_mismatch
89 10000, // max_delta_frame_size_mismatch 90 10000, // max_delta_frame_size_mismatch
90 10000, // max_encoding_rate_mismatch 91 10000, // max_encoding_rate_mismatch
91 kNumFrames + 1, // max_time_hit_target 92 kNumFrames + 1, // max_time_hit_target
92 0, // num_spatial_resizes 93 0, // num_spatial_resizes
93 1); // num_key_frames 94 1); // num_key_frames
94 // clang-format on 95 // clang-format on
95 96
96 ProcessFramesAndVerify(quality_thresholds, rate_profile, rc_thresholds, 97 ProcessFramesAndVerify(quality_thresholds, rate_profile, rc_thresholds,
97 &kVisualizationParams); 98 &kVisualizationParams);
98 } 99 }
99 100
100 const int bitrate_; 101 const int bitrate_;
101 const int framerate_;
102 const VideoCodecType codec_type_; 102 const VideoCodecType codec_type_;
103 const bool hw_codec_;
103 }; 104 };
104 105
105 INSTANTIATE_TEST_CASE_P( 106 INSTANTIATE_TEST_CASE_P(
106 CodecSettings, 107 CodecSettings,
107 PlotVideoProcessorIntegrationTest, 108 PlotVideoProcessorIntegrationTest,
108 ::testing::Combine(::testing::ValuesIn(kBitrates), 109 ::testing::Combine(::testing::ValuesIn(kBitrates),
109 ::testing::ValuesIn(kFps), 110 ::testing::ValuesIn(kVideoCodecType),
110 ::testing::ValuesIn(kVideoCodecType))); 111 ::testing::ValuesIn(kHwCodec)));
111 112
112 TEST_P(PlotVideoProcessorIntegrationTest, Process128x96) { 113 TEST_P(PlotVideoProcessorIntegrationTest, Process_128x96_30fps) {
113 RunTest(128, 96, "foreman_128x96"); 114 RunTest(128, 96, 30, "foreman_128x96");
114 } 115 }
115 116
116 TEST_P(PlotVideoProcessorIntegrationTest, Process160x120) { 117 TEST_P(PlotVideoProcessorIntegrationTest, Process_160x120_30fps) {
117 RunTest(160, 120, "foreman_160x120"); 118 RunTest(160, 120, 30, "foreman_160x120");
118 } 119 }
119 120
120 TEST_P(PlotVideoProcessorIntegrationTest, Process176x144) { 121 TEST_P(PlotVideoProcessorIntegrationTest, Process_176x144_30fps) {
121 RunTest(176, 144, "foreman_176x144"); 122 RunTest(176, 144, 30, "foreman_176x144");
122 } 123 }
123 124
124 TEST_P(PlotVideoProcessorIntegrationTest, Process320x240) { 125 TEST_P(PlotVideoProcessorIntegrationTest, Process_320x240_30fps) {
125 RunTest(320, 240, "foreman_320x240"); 126 RunTest(320, 240, 30, "foreman_320x240");
126 } 127 }
127 128
128 TEST_P(PlotVideoProcessorIntegrationTest, Process352x288) { 129 TEST_P(PlotVideoProcessorIntegrationTest, Process_352x288_30fps) {
129 RunTest(352, 288, "foreman_cif"); 130 RunTest(352, 288, 30, "foreman_cif");
130 } 131 }
131 132
132 } // namespace test 133 } // namespace test
133 } // namespace webrtc 134 } // namespace webrtc
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698