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

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

Issue 1306813009: H.264 video codec support using OpenH264/FFmpeg (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Re-enable H264 in video_loopback and screenshare_loopback after rebase (video_quality_test) Created 5 years, 2 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
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2012 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 <math.h> 11 #include <math.h>
12 12
13 #include "testing/gtest/include/gtest/gtest.h" 13 #include "testing/gtest/include/gtest/gtest.h"
14 14
15 #include "webrtc/modules/video_coding/codecs/interface/video_codec_interface.h" 15 #include "webrtc/modules/video_coding/codecs/interface/video_codec_interface.h"
16 #include "webrtc/modules/video_coding/codecs/test/packet_manipulator.h" 16 #include "webrtc/modules/video_coding/codecs/test/packet_manipulator.h"
17 #include "webrtc/modules/video_coding/codecs/test/videoprocessor.h" 17 #include "webrtc/modules/video_coding/codecs/test/videoprocessor.h"
18 #include "webrtc/modules/video_coding/codecs/h264/include/h264.h"
18 #include "webrtc/modules/video_coding/codecs/vp8/include/vp8.h" 19 #include "webrtc/modules/video_coding/codecs/vp8/include/vp8.h"
20 #include "webrtc/modules/video_coding/codecs/vp8/include/vp8_common_types.h"
19 #include "webrtc/modules/video_coding/codecs/vp9/include/vp9.h" 21 #include "webrtc/modules/video_coding/codecs/vp9/include/vp9.h"
20 #include "webrtc/modules/video_coding/codecs/vp8/include/vp8_common_types.h"
21 #include "webrtc/modules/video_coding/main/interface/video_coding.h" 22 #include "webrtc/modules/video_coding/main/interface/video_coding.h"
22 #include "webrtc/test/testsupport/fileutils.h" 23 #include "webrtc/test/testsupport/fileutils.h"
23 #include "webrtc/test/testsupport/frame_reader.h" 24 #include "webrtc/test/testsupport/frame_reader.h"
24 #include "webrtc/test/testsupport/frame_writer.h" 25 #include "webrtc/test/testsupport/frame_writer.h"
25 #include "webrtc/test/testsupport/gtest_disable.h" 26 #include "webrtc/test/testsupport/gtest_disable.h"
26 #include "webrtc/test/testsupport/metrics/video_metrics.h" 27 #include "webrtc/test/testsupport/metrics/video_metrics.h"
27 #include "webrtc/test/testsupport/packet_reader.h" 28 #include "webrtc/test/testsupport/packet_reader.h"
28 #include "webrtc/typedefs.h" 29 #include "webrtc/typedefs.h"
29 30
30 namespace webrtc { 31 namespace webrtc {
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
146 bool error_concealment_on_; 147 bool error_concealment_on_;
147 bool denoising_on_; 148 bool denoising_on_;
148 bool frame_dropper_on_; 149 bool frame_dropper_on_;
149 bool spatial_resize_on_; 150 bool spatial_resize_on_;
150 151
151 152
152 VideoProcessorIntegrationTest() {} 153 VideoProcessorIntegrationTest() {}
153 virtual ~VideoProcessorIntegrationTest() {} 154 virtual ~VideoProcessorIntegrationTest() {}
154 155
155 void SetUpCodecConfig() { 156 void SetUpCodecConfig() {
156 if (codec_type_ == kVideoCodecVP8) { 157 if (codec_type_ == kVideoCodecH264) {
158 encoder_ = H264Encoder::Create();
159 decoder_ = H264Decoder::Create();
160 VideoCodingModule::Codec(kVideoCodecH264, &codec_settings_);
161 } else if (codec_type_ == kVideoCodecVP8) {
157 encoder_ = VP8Encoder::Create(); 162 encoder_ = VP8Encoder::Create();
158 decoder_ = VP8Decoder::Create(); 163 decoder_ = VP8Decoder::Create();
159 VideoCodingModule::Codec(kVideoCodecVP8, &codec_settings_); 164 VideoCodingModule::Codec(kVideoCodecVP8, &codec_settings_);
160 } else if (codec_type_ == kVideoCodecVP9) { 165 } else if (codec_type_ == kVideoCodecVP9) {
161 encoder_ = VP9Encoder::Create(); 166 encoder_ = VP9Encoder::Create();
162 decoder_ = VP9Decoder::Create(); 167 decoder_ = VP9Decoder::Create();
163 VideoCodingModule::Codec(kVideoCodecVP9, &codec_settings_); 168 VideoCodingModule::Codec(kVideoCodecVP9, &codec_settings_);
164 } 169 }
165 170
166 // CIF is currently used for all tests below. 171 // CIF is currently used for all tests below.
(...skipping 14 matching lines...) Expand all
181 config_.networking_config.packet_loss_probability = packet_loss_; 186 config_.networking_config.packet_loss_probability = packet_loss_;
182 187
183 // Configure codec settings. 188 // Configure codec settings.
184 config_.codec_settings = &codec_settings_; 189 config_.codec_settings = &codec_settings_;
185 config_.codec_settings->startBitrate = start_bitrate_; 190 config_.codec_settings->startBitrate = start_bitrate_;
186 config_.codec_settings->width = kCIFWidth; 191 config_.codec_settings->width = kCIFWidth;
187 config_.codec_settings->height = kCIFHeight; 192 config_.codec_settings->height = kCIFHeight;
188 193
189 // These features may be set depending on the test. 194 // These features may be set depending on the test.
190 switch (config_.codec_settings->codecType) { 195 switch (config_.codec_settings->codecType) {
196 case kVideoCodecH264:
197 config_.codec_settings->codecSpecific.H264.frameDroppingOn =
198 frame_dropper_on_;
199 config_.codec_settings->codecSpecific.H264.keyFrameInterval =
200 kBaseKeyFrameInterval;
201 break;
191 case kVideoCodecVP8: 202 case kVideoCodecVP8:
192 config_.codec_settings->codecSpecific.VP8.errorConcealmentOn = 203 config_.codec_settings->codecSpecific.VP8.errorConcealmentOn =
193 error_concealment_on_; 204 error_concealment_on_;
194 config_.codec_settings->codecSpecific.VP8.denoisingOn = 205 config_.codec_settings->codecSpecific.VP8.denoisingOn =
195 denoising_on_; 206 denoising_on_;
196 config_.codec_settings->codecSpecific.VP8.numberOfTemporalLayers = 207 config_.codec_settings->codecSpecific.VP8.numberOfTemporalLayers =
197 num_temporal_layers_; 208 num_temporal_layers_;
198 config_.codec_settings->codecSpecific.VP8.frameDroppingOn = 209 config_.codec_settings->codecSpecific.VP8.frameDroppingOn =
199 frame_dropper_on_; 210 frame_dropper_on_;
200 config_.codec_settings->codecSpecific.VP8.automaticResizeOn = 211 config_.codec_settings->codecSpecific.VP8.automaticResizeOn =
201 spatial_resize_on_; 212 spatial_resize_on_;
202 config_.codec_settings->codecSpecific.VP8.keyFrameInterval = 213 config_.codec_settings->codecSpecific.VP8.keyFrameInterval =
203 kBaseKeyFrameInterval; 214 kBaseKeyFrameInterval;
204 break; 215 break;
205 case kVideoCodecVP9: 216 case kVideoCodecVP9:
206 config_.codec_settings->codecSpecific.VP9.denoisingOn = 217 config_.codec_settings->codecSpecific.VP9.denoisingOn =
207 denoising_on_; 218 denoising_on_;
208 config_.codec_settings->codecSpecific.VP9.numberOfTemporalLayers = 219 config_.codec_settings->codecSpecific.VP9.numberOfTemporalLayers =
209 num_temporal_layers_; 220 num_temporal_layers_;
210 config_.codec_settings->codecSpecific.VP9.frameDroppingOn = 221 config_.codec_settings->codecSpecific.VP9.frameDroppingOn =
211 frame_dropper_on_; 222 frame_dropper_on_;
212 config_.codec_settings->codecSpecific.VP9.automaticResizeOn = 223 config_.codec_settings->codecSpecific.VP9.automaticResizeOn =
213 spatial_resize_on_; 224 spatial_resize_on_;
214 config_.codec_settings->codecSpecific.VP9.keyFrameInterval = 225 config_.codec_settings->codecSpecific.VP9.keyFrameInterval =
215 kBaseKeyFrameInterval; 226 kBaseKeyFrameInterval;
216 break; 227 break;
217 default: 228 default:
218 assert(false); 229 assert(false);
219 break; 230 break;
220 } 231 }
221 frame_reader_ = 232 frame_reader_ =
222 new webrtc::test::FrameReaderImpl(config_.input_filename, 233 new webrtc::test::FrameReaderImpl(config_.input_filename,
223 config_.frame_length_in_bytes); 234 config_.frame_length_in_bytes);
224 frame_writer_ = 235 frame_writer_ =
225 new webrtc::test::FrameWriterImpl(config_.output_filename, 236 new webrtc::test::FrameWriterImpl(config_.output_filename,
226 config_.frame_length_in_bytes); 237 config_.frame_length_in_bytes);
227 ASSERT_TRUE(frame_reader_->Init()); 238 ASSERT_TRUE(frame_reader_->Init());
228 ASSERT_TRUE(frame_writer_->Init()); 239 ASSERT_TRUE(frame_writer_->Init());
229 240
230 packet_manipulator_ = new webrtc::test::PacketManipulatorImpl( 241 packet_manipulator_ = new webrtc::test::PacketManipulatorImpl(
(...skipping 351 matching lines...) Expand 10 before | Expand all | Expand 10 after
582 max_key_frame_size_mismatch; 593 max_key_frame_size_mismatch;
583 rc_metrics[update_index].max_delta_frame_size_mismatch = 594 rc_metrics[update_index].max_delta_frame_size_mismatch =
584 max_delta_frame_size_mismatch; 595 max_delta_frame_size_mismatch;
585 rc_metrics[update_index].max_encoding_rate_mismatch = 596 rc_metrics[update_index].max_encoding_rate_mismatch =
586 max_encoding_rate_mismatch; 597 max_encoding_rate_mismatch;
587 rc_metrics[update_index].max_time_hit_target = max_time_hit_target; 598 rc_metrics[update_index].max_time_hit_target = max_time_hit_target;
588 rc_metrics[update_index].num_spatial_resizes = num_spatial_resizes; 599 rc_metrics[update_index].num_spatial_resizes = num_spatial_resizes;
589 rc_metrics[update_index].num_key_frames = num_key_frames; 600 rc_metrics[update_index].num_key_frames = num_key_frames;
590 } 601 }
591 602
603 #if defined(WEBRTC_OPENH264)
604
605 // H264: Run with no packet loss and fixed bitrate. Quality should be very high.
606 // Note(hbos): The PacketManipulatorImpl code used to simulate packet loss in
607 // these unittests appears to drop "packets" in a way that is not compatible
608 // with H264. Therefore ProcessXPercentPacketLossH264, X != 0, unittests have
609 // not been added.
610 TEST_F(VideoProcessorIntegrationTest, Process0PercentPacketLossH264) {
611 // Bitrate and frame rate profile.
612 RateProfile rate_profile;
613 SetRateProfilePars(&rate_profile, 0, 500, 30, 0);
614 rate_profile.frame_index_rate_update[1] = kNbrFramesShort + 1;
615 rate_profile.num_frames = kNbrFramesShort;
616 // Codec/network settings.
617 CodecConfigPars process_settings;
618 SetCodecParameters(&process_settings, kVideoCodecH264, 0.0f, -1, 1, false,
619 false, true, false);
620 // Metrics for expected quality.
621 QualityMetrics quality_metrics;
622 SetQualityMetrics(&quality_metrics, 35.0, 25.0, 0.93, 0.70);
623 // Metrics for rate control.
624 RateControlMetrics rc_metrics[1];
625 SetRateControlMetrics(rc_metrics, 0, 2, 60, 20, 10, 20, 0, 1);
626 ProcessFramesAndVerify(quality_metrics,
627 rate_profile,
628 process_settings,
629 rc_metrics);
630 }
631
632 #endif // defined(WEBRTC_OPENH264)
633
592 // VP9: Run with no packet loss and fixed bitrate. Quality should be very high. 634 // VP9: Run with no packet loss and fixed bitrate. Quality should be very high.
593 // One key frame (first frame only) in sequence. Setting |key_frame_interval| 635 // One key frame (first frame only) in sequence. Setting |key_frame_interval|
594 // to -1 below means no periodic key frames in test. 636 // to -1 below means no periodic key frames in test.
595 TEST_F(VideoProcessorIntegrationTest, Process0PercentPacketLossVP9) { 637 TEST_F(VideoProcessorIntegrationTest, Process0PercentPacketLossVP9) {
596 // Bitrate and frame rate profile. 638 // Bitrate and frame rate profile.
597 RateProfile rate_profile; 639 RateProfile rate_profile;
598 SetRateProfilePars(&rate_profile, 0, 500, 30, 0); 640 SetRateProfilePars(&rate_profile, 0, 500, 30, 0);
599 rate_profile.frame_index_rate_update[1] = kNbrFramesShort + 1; 641 rate_profile.frame_index_rate_update[1] = kNbrFramesShort + 1;
600 rate_profile.num_frames = kNbrFramesShort; 642 rate_profile.num_frames = kNbrFramesShort;
601 // Codec/network settings. 643 // Codec/network settings.
(...skipping 352 matching lines...) Expand 10 before | Expand all | Expand 10 after
954 // Metrics for rate control. 996 // Metrics for rate control.
955 RateControlMetrics rc_metrics[2]; 997 RateControlMetrics rc_metrics[2];
956 SetRateControlMetrics(rc_metrics, 0, 0, 20, 30, 10, 10, 0, 1); 998 SetRateControlMetrics(rc_metrics, 0, 0, 20, 30, 10, 10, 0, 1);
957 SetRateControlMetrics(rc_metrics, 1, 0, 0, 30, 15, 10, 0, 0); 999 SetRateControlMetrics(rc_metrics, 1, 0, 0, 30, 15, 10, 0, 0);
958 ProcessFramesAndVerify(quality_metrics, 1000 ProcessFramesAndVerify(quality_metrics,
959 rate_profile, 1001 rate_profile,
960 process_settings, 1002 process_settings,
961 rc_metrics); 1003 rc_metrics);
962 } 1004 }
963 } // namespace webrtc 1005 } // namespace webrtc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698