From ffbe1cd07ef1b20a59415a0d440e8684505a2902 Mon Sep 17 00:00:00 2001 From: brandtr Date: Mon, 4 Sep 2017 03:03:40 -0700 Subject: [PATCH] Remove VideoProcessorIntegrationTest::SetTestConfig. BUG=webrtc:6634 Review-Url: https://codereview.webrtc.org/3004983002 Cr-Commit-Position: refs/heads/master@{#19648} --- .../plot_videoprocessor_integrationtest.cc | 15 ++-- .../test/videoprocessor_integrationtest.cc | 17 ---- .../test/videoprocessor_integrationtest.h | 7 -- .../videoprocessor_integrationtest_libvpx.cc | 80 ++++++++----------- ...videoprocessor_integrationtest_openh264.cc | 31 ++++--- 5 files changed, 64 insertions(+), 86 deletions(-) diff --git a/webrtc/modules/video_coding/codecs/test/plot_videoprocessor_integrationtest.cc b/webrtc/modules/video_coding/codecs/test/plot_videoprocessor_integrationtest.cc index b8f152d7ab..b715d2e074 100644 --- a/webrtc/modules/video_coding/codecs/test/plot_videoprocessor_integrationtest.cc +++ b/webrtc/modules/video_coding/codecs/test/plot_videoprocessor_integrationtest.cc @@ -10,6 +10,8 @@ #include "webrtc/modules/video_coding/codecs/test/videoprocessor_integrationtest.h" +#include "webrtc/test/testsupport/fileutils.h" + namespace webrtc { namespace test { @@ -21,7 +23,6 @@ const VideoCodecType kVideoCodecType[] = {kVideoCodecVP8}; const bool kHwCodec[] = {false}; // Codec settings. -const bool kUseSingleCore = false; const bool kResilienceOn = false; const int kNumTemporalLayers = 1; const bool kDenoisingOn = false; @@ -30,8 +31,7 @@ const bool kSpatialResizeOn = false; const bool kFrameDropperOn = false; // Test settings. -const bool kVerboseLogging = true; -const float kPacketLoss = 0.0f; +const bool kUseSingleCore = false; const VisualizationParams kVisualizationParams = { false, // save_encoded_ivf false, // save_decoded_y4m @@ -57,8 +57,13 @@ class PlotVideoProcessorIntegrationTest int height, int framerate, const std::string& filename) { - SetTestConfig(&config_, hw_codec_, kUseSingleCore, kPacketLoss, filename, - kVerboseLogging); + config_.filename = filename; + config_.input_filename = ResourcePath(filename, "yuv"); + config_.output_filename = + TempFilename(OutputPath(), "plot_videoprocessor_integrationtest"); + config_.use_single_core = kUseSingleCore; + config_.verbose = true; + config_.hw_codec = hw_codec_; SetCodecSettings(&config_, codec_type_, kNumTemporalLayers, kErrorConcealmentOn, kDenoisingOn, kFrameDropperOn, kSpatialResizeOn, kResilienceOn, width, height); diff --git a/webrtc/modules/video_coding/codecs/test/videoprocessor_integrationtest.cc b/webrtc/modules/video_coding/codecs/test/videoprocessor_integrationtest.cc index f90e5dd2f6..21ae84cdb4 100644 --- a/webrtc/modules/video_coding/codecs/test/videoprocessor_integrationtest.cc +++ b/webrtc/modules/video_coding/codecs/test/videoprocessor_integrationtest.cc @@ -78,23 +78,6 @@ VideoProcessorIntegrationTest::VideoProcessorIntegrationTest() { VideoProcessorIntegrationTest::~VideoProcessorIntegrationTest() = default; -void VideoProcessorIntegrationTest::SetTestConfig(TestConfig* config, - bool hw_codec, - bool use_single_core, - float packet_loss_probability, - std::string filename, - bool verbose_logging) { - config->filename = filename; - config->input_filename = ResourcePath(filename, "yuv"); - // Generate an output filename in a safe way. - config->output_filename = - TempFilename(OutputPath(), "videoprocessor_integrationtest"); - config->networking_config.packet_loss_probability = packet_loss_probability; - config->use_single_core = use_single_core; - config->verbose = verbose_logging; - config->hw_codec = hw_codec; -} - void VideoProcessorIntegrationTest::SetCodecSettings(TestConfig* config, VideoCodecType codec_type, int num_temporal_layers, diff --git a/webrtc/modules/video_coding/codecs/test/videoprocessor_integrationtest.h b/webrtc/modules/video_coding/codecs/test/videoprocessor_integrationtest.h index a3c512b140..6c9f3df416 100644 --- a/webrtc/modules/video_coding/codecs/test/videoprocessor_integrationtest.h +++ b/webrtc/modules/video_coding/codecs/test/videoprocessor_integrationtest.h @@ -93,13 +93,6 @@ class VideoProcessorIntegrationTest : public testing::Test { VideoProcessorIntegrationTest(); ~VideoProcessorIntegrationTest() override; - static void SetTestConfig(TestConfig* config, - bool hw_codec, - bool use_single_core, - float packet_loss_probability, - std::string filename, - bool verbose_logging); - static void SetCodecSettings(TestConfig* config, VideoCodecType codec_type, int num_temporal_layers, diff --git a/webrtc/modules/video_coding/codecs/test/videoprocessor_integrationtest_libvpx.cc b/webrtc/modules/video_coding/codecs/test/videoprocessor_integrationtest_libvpx.cc index 062f662c17..9162b92f9a 100644 --- a/webrtc/modules/video_coding/codecs/test/videoprocessor_integrationtest_libvpx.cc +++ b/webrtc/modules/video_coding/codecs/test/videoprocessor_integrationtest_libvpx.cc @@ -12,24 +12,17 @@ #include +#include "webrtc/test/testsupport/fileutils.h" + namespace webrtc { namespace test { namespace { -// Test settings. -// Only allow encoder/decoder to use single core, for predictability. -const bool kUseSingleCore = true; -const bool kVerboseLogging = false; -const bool kHwCodec = false; - // Codec settings. const bool kResilienceOn = true; - -// Default sequence is foreman (CIF): may be better to use VGA for resize test. const int kCifWidth = 352; const int kCifHeight = 288; -const char kForemanCif[] = "foreman_cif"; #if !defined(WEBRTC_IOS) const int kNumFramesShort = 100; #endif @@ -39,15 +32,29 @@ const std::nullptr_t kNoVisualizationParams = nullptr; } // namespace +class VideoProcessorIntegrationTestLibvpx + : public VideoProcessorIntegrationTest { + protected: + VideoProcessorIntegrationTestLibvpx() { + config_.filename = "foreman_cif"; + config_.input_filename = ResourcePath(config_.filename, "yuv"); + config_.output_filename = + TempFilename(OutputPath(), "videoprocessor_integrationtest_libvpx"); + config_.networking_config.packet_loss_probability = 0.0; + // Only allow encoder/decoder to use single core, for predictability. + config_.use_single_core = true; + config_.verbose = false; + config_.hw_codec = false; + } +}; + // Fails on iOS. See webrtc:4755. #if !defined(WEBRTC_IOS) #if !defined(RTC_DISABLE_VP9) // VP9: Run with no packet loss and fixed bitrate. Quality should be very high. // One key frame (first frame only) in sequence. -TEST_F(VideoProcessorIntegrationTest, Process0PercentPacketLossVP9) { - SetTestConfig(&config_, kHwCodec, kUseSingleCore, 0.0f, kForemanCif, - kVerboseLogging); +TEST_F(VideoProcessorIntegrationTestLibvpx, Process0PercentPacketLossVP9) { SetCodecSettings(&config_, kVideoCodecVP9, 1, false, false, true, false, kResilienceOn, kCifWidth, kCifHeight); @@ -67,9 +74,8 @@ TEST_F(VideoProcessorIntegrationTest, Process0PercentPacketLossVP9) { // VP9: Run with 5% packet loss and fixed bitrate. Quality should be a bit // lower. One key frame (first frame only) in sequence. -TEST_F(VideoProcessorIntegrationTest, Process5PercentPacketLossVP9) { - SetTestConfig(&config_, kHwCodec, kUseSingleCore, 0.05f, kForemanCif, - kVerboseLogging); +TEST_F(VideoProcessorIntegrationTestLibvpx, Process5PercentPacketLossVP9) { + config_.networking_config.packet_loss_probability = 0.05f; SetCodecSettings(&config_, kVideoCodecVP9, 1, false, false, true, false, kResilienceOn, kCifWidth, kCifHeight); @@ -91,9 +97,7 @@ TEST_F(VideoProcessorIntegrationTest, Process5PercentPacketLossVP9) { // low to high to medium. Check that quality and encoder response to the new // target rate/per-frame bandwidth (for each rate update) is within limits. // One key frame (first frame only) in sequence. -TEST_F(VideoProcessorIntegrationTest, ProcessNoLossChangeBitRateVP9) { - SetTestConfig(&config_, kHwCodec, kUseSingleCore, 0.0f, kForemanCif, - kVerboseLogging); +TEST_F(VideoProcessorIntegrationTestLibvpx, ProcessNoLossChangeBitRateVP9) { SetCodecSettings(&config_, kVideoCodecVP9, 1, false, false, true, false, kResilienceOn, kCifWidth, kCifHeight); @@ -122,10 +126,8 @@ TEST_F(VideoProcessorIntegrationTest, ProcessNoLossChangeBitRateVP9) { // for the rate control metrics can be lower. One key frame (first frame only). // Note: quality after update should be higher but we currently compute quality // metrics averaged over whole sequence run. -TEST_F(VideoProcessorIntegrationTest, +TEST_F(VideoProcessorIntegrationTestLibvpx, ProcessNoLossChangeFrameRateFrameDropVP9) { - SetTestConfig(&config_, kHwCodec, kUseSingleCore, 0.0f, kForemanCif, - kVerboseLogging); SetCodecSettings(&config_, kVideoCodecVP9, 1, false, false, true, false, kResilienceOn, kCifWidth, kCifHeight); @@ -148,9 +150,7 @@ TEST_F(VideoProcessorIntegrationTest, } // VP9: Run with no packet loss and denoiser on. One key frame (first frame). -TEST_F(VideoProcessorIntegrationTest, ProcessNoLossDenoiserOnVP9) { - SetTestConfig(&config_, kHwCodec, kUseSingleCore, 0.0f, kForemanCif, - kVerboseLogging); +TEST_F(VideoProcessorIntegrationTestLibvpx, ProcessNoLossDenoiserOnVP9) { SetCodecSettings(&config_, kVideoCodecVP9, 1, false, true, true, false, kResilienceOn, kCifWidth, kCifHeight); @@ -171,10 +171,8 @@ TEST_F(VideoProcessorIntegrationTest, ProcessNoLossDenoiserOnVP9) { // Run with no packet loss, at low bitrate. // spatial_resize is on, for this low bitrate expect one resize in sequence. // Resize happens on delta frame. Expect only one key frame (first frame). -TEST_F(VideoProcessorIntegrationTest, +TEST_F(VideoProcessorIntegrationTestLibvpx, DISABLED_ProcessNoLossSpatialResizeFrameDropVP9) { - SetTestConfig(&config_, kHwCodec, kUseSingleCore, 0.0f, kForemanCif, - kVerboseLogging); SetCodecSettings(&config_, kVideoCodecVP9, 1, false, false, true, true, kResilienceOn, kCifWidth, kCifHeight); @@ -200,9 +198,7 @@ TEST_F(VideoProcessorIntegrationTest, // VP8: Run with no packet loss and fixed bitrate. Quality should be very high. // One key frame (first frame only) in sequence. Setting |key_frame_interval| // to -1 below means no periodic key frames in test. -TEST_F(VideoProcessorIntegrationTest, ProcessZeroPacketLoss) { - SetTestConfig(&config_, kHwCodec, kUseSingleCore, 0.0f, kForemanCif, - kVerboseLogging); +TEST_F(VideoProcessorIntegrationTestLibvpx, ProcessZeroPacketLoss) { SetCodecSettings(&config_, kVideoCodecVP8, 1, false, true, true, false, kResilienceOn, kCifWidth, kCifHeight); @@ -222,9 +218,8 @@ TEST_F(VideoProcessorIntegrationTest, ProcessZeroPacketLoss) { // VP8: Run with 5% packet loss and fixed bitrate. Quality should be a bit // lower. One key frame (first frame only) in sequence. -TEST_F(VideoProcessorIntegrationTest, Process5PercentPacketLoss) { - SetTestConfig(&config_, kHwCodec, kUseSingleCore, 0.05f, kForemanCif, - kVerboseLogging); +TEST_F(VideoProcessorIntegrationTestLibvpx, Process5PercentPacketLoss) { + config_.networking_config.packet_loss_probability = 0.05f; SetCodecSettings(&config_, kVideoCodecVP8, 1, false, true, true, false, kResilienceOn, kCifWidth, kCifHeight); @@ -244,9 +239,8 @@ TEST_F(VideoProcessorIntegrationTest, Process5PercentPacketLoss) { // VP8: Run with 10% packet loss and fixed bitrate. Quality should be lower. // One key frame (first frame only) in sequence. -TEST_F(VideoProcessorIntegrationTest, Process10PercentPacketLoss) { - SetTestConfig(&config_, kHwCodec, kUseSingleCore, 0.1f, kForemanCif, - kVerboseLogging); +TEST_F(VideoProcessorIntegrationTestLibvpx, Process10PercentPacketLoss) { + config_.networking_config.packet_loss_probability = 0.1f; SetCodecSettings(&config_, kVideoCodecVP8, 1, false, true, true, false, kResilienceOn, kCifWidth, kCifHeight); @@ -286,9 +280,8 @@ TEST_F(VideoProcessorIntegrationTest, Process10PercentPacketLoss) { #else #define MAYBE_ProcessNoLossChangeBitRateVP8 ProcessNoLossChangeBitRateVP8 #endif -TEST_F(VideoProcessorIntegrationTest, MAYBE_ProcessNoLossChangeBitRateVP8) { - SetTestConfig(&config_, kHwCodec, kUseSingleCore, 0.0f, kForemanCif, - kVerboseLogging); +TEST_F(VideoProcessorIntegrationTestLibvpx, + MAYBE_ProcessNoLossChangeBitRateVP8) { SetCodecSettings(&config_, kVideoCodecVP8, 1, false, true, true, false, kResilienceOn, kCifWidth, kCifHeight); @@ -325,10 +318,8 @@ TEST_F(VideoProcessorIntegrationTest, MAYBE_ProcessNoLossChangeBitRateVP8) { #define MAYBE_ProcessNoLossChangeFrameRateFrameDropVP8 \ ProcessNoLossChangeFrameRateFrameDropVP8 #endif -TEST_F(VideoProcessorIntegrationTest, +TEST_F(VideoProcessorIntegrationTestLibvpx, MAYBE_ProcessNoLossChangeFrameRateFrameDropVP8) { - SetTestConfig(&config_, kHwCodec, kUseSingleCore, 0.0f, kForemanCif, - kVerboseLogging); SetCodecSettings(&config_, kVideoCodecVP8, 1, false, true, true, false, kResilienceOn, kCifWidth, kCifHeight); @@ -362,9 +353,8 @@ TEST_F(VideoProcessorIntegrationTest, #else #define MAYBE_ProcessNoLossTemporalLayersVP8 ProcessNoLossTemporalLayersVP8 #endif -TEST_F(VideoProcessorIntegrationTest, MAYBE_ProcessNoLossTemporalLayersVP8) { - SetTestConfig(&config_, kHwCodec, kUseSingleCore, 0.0f, kForemanCif, - kVerboseLogging); +TEST_F(VideoProcessorIntegrationTestLibvpx, + MAYBE_ProcessNoLossTemporalLayersVP8) { SetCodecSettings(&config_, kVideoCodecVP8, 3, false, true, true, false, kResilienceOn, kCifWidth, kCifHeight); diff --git a/webrtc/modules/video_coding/codecs/test/videoprocessor_integrationtest_openh264.cc b/webrtc/modules/video_coding/codecs/test/videoprocessor_integrationtest_openh264.cc index 41e42edee1..e4c60e737c 100644 --- a/webrtc/modules/video_coding/codecs/test/videoprocessor_integrationtest_openh264.cc +++ b/webrtc/modules/video_coding/codecs/test/videoprocessor_integrationtest_openh264.cc @@ -12,6 +12,8 @@ #include +#include "webrtc/test/testsupport/fileutils.h" + namespace webrtc { namespace test { @@ -19,33 +21,38 @@ namespace test { namespace { -// Test settings. -// Only allow encoder/decoder to use single core, for predictability. -const bool kUseSingleCore = true; -const bool kVerboseLogging = false; -const bool kHwCodec = false; - // Codec settings. const bool kResilienceOn = true; - -// Default sequence is foreman (CIF): may be better to use VGA for resize test. const int kCifWidth = 352; const int kCifHeight = 288; -const char kForemanCif[] = "foreman_cif"; const int kNumFrames = 100; const std::nullptr_t kNoVisualizationParams = nullptr; } // namespace +class VideoProcessorIntegrationTestOpenH264 + : public VideoProcessorIntegrationTest { + protected: + VideoProcessorIntegrationTestOpenH264() { + config_.filename = "foreman_cif"; + config_.input_filename = ResourcePath(config_.filename, "yuv"); + config_.output_filename = + TempFilename(OutputPath(), "videoprocessor_integrationtest_libvpx"); + config_.networking_config.packet_loss_probability = 0.0; + // Only allow encoder/decoder to use single core, for predictability. + config_.use_single_core = true; + config_.verbose = false; + config_.hw_codec = false; + } +}; + // H264: Run with no packet loss and fixed bitrate. Quality should be very high. // Note(hbos): The PacketManipulatorImpl code used to simulate packet loss in // these unittests appears to drop "packets" in a way that is not compatible // with H264. Therefore ProcessXPercentPacketLossH264, X != 0, unittests have // not been added. -TEST_F(VideoProcessorIntegrationTest, Process0PercentPacketLossH264) { - SetTestConfig(&config_, kHwCodec, kUseSingleCore, 0.0f, kForemanCif, - kVerboseLogging); +TEST_F(VideoProcessorIntegrationTestOpenH264, Process0PercentPacketLossH264) { SetCodecSettings(&config_, kVideoCodecH264, 1, false, false, true, false, kResilienceOn, kCifWidth, kCifHeight);