| Index: webrtc/modules/video_coding/codecs/test/videoprocessor_integrationtest.h
|
| diff --git a/webrtc/modules/video_coding/codecs/test/videoprocessor_integrationtest.cc b/webrtc/modules/video_coding/codecs/test/videoprocessor_integrationtest.h
|
| similarity index 50%
|
| copy from webrtc/modules/video_coding/codecs/test/videoprocessor_integrationtest.cc
|
| copy to webrtc/modules/video_coding/codecs/test/videoprocessor_integrationtest.h
|
| index e4b20e2c96f6a7642ab1f3cfb40377233d0bab75..f244bea183b29ce2fdcd736cfca35e81ae0eed10 100644
|
| --- a/webrtc/modules/video_coding/codecs/test/videoprocessor_integrationtest.cc
|
| +++ b/webrtc/modules/video_coding/codecs/test/videoprocessor_integrationtest.h
|
| @@ -8,9 +8,13 @@
|
| * be found in the AUTHORS file in the root of the source tree.
|
| */
|
|
|
| +#ifndef WEBRTC_MODULES_VIDEO_CODING_CODECS_TEST_VIDEOPROCESSOR_INTEGRATIONTEST_H_
|
| +#define WEBRTC_MODULES_VIDEO_CODING_CODECS_TEST_VIDEOPROCESSOR_INTEGRATIONTEST_H_
|
| +
|
| #include <math.h>
|
|
|
| #include <memory>
|
| +#include <string>
|
|
|
| #include "webrtc/modules/video_coding/codecs/h264/include/h264.h"
|
| #include "webrtc/modules/video_coding/codecs/test/packet_manipulator.h"
|
| @@ -30,7 +34,7 @@
|
| #include "webrtc/typedefs.h"
|
|
|
| namespace webrtc {
|
| -namespace {
|
| +namespace test {
|
| // Maximum number of rate updates (i.e., calls to encoder to change bitrate
|
| // and/or frame rate) for the current tests.
|
| const int kMaxNumRateUpdates = 3;
|
| @@ -38,6 +42,11 @@ const int kMaxNumRateUpdates = 3;
|
| const int kPercTargetvsActualMismatch = 20;
|
| const int kBaseKeyFrameInterval = 3000;
|
|
|
| +// Default sequence is foreman (CIF): may be better to use VGA for resize test.
|
| +const int kCifWidth = 352;
|
| +const int kCifHeight = 288;
|
| +const char kFilenameForemanCif[] = "foreman_cif";
|
| +
|
| // Codec and network settings.
|
| struct CodecConfigPars {
|
| VideoCodecType codec_type;
|
| @@ -48,6 +57,10 @@ struct CodecConfigPars {
|
| bool denoising_on;
|
| bool frame_dropper_on;
|
| bool spatial_resize_on;
|
| + int width;
|
| + int height;
|
| + std::string filename;
|
| + bool verbose_logging;
|
| };
|
|
|
| // Quality metrics.
|
| @@ -83,9 +96,6 @@ struct RateControlMetrics {
|
| int num_key_frames;
|
| };
|
|
|
| -// Sequence used is foreman (CIF): may be better to use VGA for resize test.
|
| -const int kCIFWidth = 352;
|
| -const int kCIFHeight = 288;
|
| #if !defined(WEBRTC_IOS)
|
| const int kNbrFramesShort = 100; // Some tests are run for shorter sequence.
|
| #endif
|
| @@ -96,68 +106,6 @@ const float kInitialBufferSize = 0.5f;
|
| const float kOptimalBufferSize = 0.6f;
|
| const float kScaleKeyFrameSize = 0.5f;
|
|
|
| -void SetRateProfilePars(RateProfile* rate_profile,
|
| - int update_index,
|
| - int bit_rate,
|
| - int frame_rate,
|
| - int frame_index_rate_update) {
|
| - rate_profile->target_bit_rate[update_index] = bit_rate;
|
| - rate_profile->input_frame_rate[update_index] = frame_rate;
|
| - rate_profile->frame_index_rate_update[update_index] = frame_index_rate_update;
|
| -}
|
| -
|
| -void SetCodecParameters(CodecConfigPars* process_settings,
|
| - VideoCodecType codec_type,
|
| - float packet_loss,
|
| - int key_frame_interval,
|
| - int num_temporal_layers,
|
| - bool error_concealment_on,
|
| - bool denoising_on,
|
| - bool frame_dropper_on,
|
| - bool spatial_resize_on) {
|
| - process_settings->codec_type = codec_type;
|
| - process_settings->packet_loss = packet_loss;
|
| - process_settings->key_frame_interval = key_frame_interval;
|
| - process_settings->num_temporal_layers = num_temporal_layers,
|
| - process_settings->error_concealment_on = error_concealment_on;
|
| - process_settings->denoising_on = denoising_on;
|
| - process_settings->frame_dropper_on = frame_dropper_on;
|
| - process_settings->spatial_resize_on = spatial_resize_on;
|
| -}
|
| -
|
| -void SetQualityMetrics(QualityMetrics* quality_metrics,
|
| - double minimum_avg_psnr,
|
| - double minimum_min_psnr,
|
| - double minimum_avg_ssim,
|
| - double minimum_min_ssim) {
|
| - quality_metrics->minimum_avg_psnr = minimum_avg_psnr;
|
| - quality_metrics->minimum_min_psnr = minimum_min_psnr;
|
| - quality_metrics->minimum_avg_ssim = minimum_avg_ssim;
|
| - quality_metrics->minimum_min_ssim = minimum_min_ssim;
|
| -}
|
| -
|
| -void SetRateControlMetrics(RateControlMetrics* rc_metrics,
|
| - int update_index,
|
| - int max_num_dropped_frames,
|
| - int max_key_frame_size_mismatch,
|
| - int max_delta_frame_size_mismatch,
|
| - int max_encoding_rate_mismatch,
|
| - int max_time_hit_target,
|
| - int num_spatial_resizes,
|
| - int num_key_frames) {
|
| - rc_metrics[update_index].max_num_dropped_frames = max_num_dropped_frames;
|
| - rc_metrics[update_index].max_key_frame_size_mismatch =
|
| - max_key_frame_size_mismatch;
|
| - rc_metrics[update_index].max_delta_frame_size_mismatch =
|
| - max_delta_frame_size_mismatch;
|
| - rc_metrics[update_index].max_encoding_rate_mismatch =
|
| - max_encoding_rate_mismatch;
|
| - rc_metrics[update_index].max_time_hit_target = max_time_hit_target;
|
| - rc_metrics[update_index].num_spatial_resizes = num_spatial_resizes;
|
| - rc_metrics[update_index].num_key_frames = num_key_frames;
|
| -}
|
| -} // namespace
|
| -
|
| // Integration test for video processor. Encodes+decodes a clip and
|
| // writes it to the output directory. After completion, quality metrics
|
| // (PSNR and SSIM) and rate control metrics are computed to verify that the
|
| @@ -217,7 +165,10 @@ class VideoProcessorIntegrationTest : public testing::Test {
|
| VideoProcessorIntegrationTest() {}
|
| virtual ~VideoProcessorIntegrationTest() {}
|
|
|
| - void SetUpCodecConfig() {
|
| + void SetUpCodecConfig(const std::string& filename,
|
| + int width,
|
| + int height,
|
| + bool verbose_logging) {
|
| if (codec_type_ == kVideoCodecH264) {
|
| encoder_.reset(H264Encoder::Create(cricket::VideoCodec("H264")));
|
| decoder_.reset(H264Decoder::Create());
|
| @@ -232,16 +183,15 @@ class VideoProcessorIntegrationTest : public testing::Test {
|
| VideoCodingModule::Codec(kVideoCodecVP9, &codec_settings_);
|
| }
|
|
|
| - // CIF is currently used for all tests below.
|
| - // Setup the TestConfig struct for processing of a clip in CIF resolution.
|
| - config_.input_filename = webrtc::test::ResourcePath("foreman_cif", "yuv");
|
| -
|
| + // Configure input filename.
|
| + config_.input_filename = test::ResourcePath(filename, "yuv");
|
| + if (verbose_logging)
|
| + printf("Filename: %s\n", filename.c_str());
|
| // Generate an output filename in a safe way.
|
| - config_.output_filename = webrtc::test::TempFilename(
|
| - webrtc::test::OutputPath(), "videoprocessor_integrationtest");
|
| - config_.frame_length_in_bytes =
|
| - CalcBufferSize(kI420, kCIFWidth, kCIFHeight);
|
| - config_.verbose = false;
|
| + config_.output_filename = test::TempFilename(
|
| + test::OutputPath(), "videoprocessor_integrationtest");
|
| + config_.frame_length_in_bytes = CalcBufferSize(kI420, width, height);
|
| + config_.verbose = verbose_logging;
|
| // Only allow encoder/decoder to use single core, for predictability.
|
| config_.use_single_core = true;
|
| // Key frame interval and packet loss are set for each test.
|
| @@ -251,8 +201,8 @@ class VideoProcessorIntegrationTest : public testing::Test {
|
| // Configure codec settings.
|
| config_.codec_settings = &codec_settings_;
|
| config_.codec_settings->startBitrate = start_bitrate_;
|
| - config_.codec_settings->width = kCIFWidth;
|
| - config_.codec_settings->height = kCIFHeight;
|
| + config_.codec_settings->width = width;
|
| + config_.codec_settings->height = height;
|
|
|
| // These features may be set depending on the test.
|
| switch (config_.codec_settings->codecType) {
|
| @@ -377,7 +327,7 @@ class VideoProcessorIntegrationTest : public testing::Test {
|
| int num_dropped_frames = processor_->NumberDroppedFrames();
|
| int num_resize_actions = processor_->NumberSpatialResizes();
|
| printf(
|
| - "For update #: %d,\n "
|
| + "For update #: %d,\n"
|
| " Target Bitrate: %d,\n"
|
| " Encoding bitrate: %f,\n"
|
| " Frame rate: %d \n",
|
| @@ -492,7 +442,8 @@ class VideoProcessorIntegrationTest : public testing::Test {
|
| denoising_on_ = process.denoising_on;
|
| frame_dropper_on_ = process.frame_dropper_on;
|
| spatial_resize_on_ = process.spatial_resize_on;
|
| - SetUpCodecConfig();
|
| + SetUpCodecConfig(process.filename, process.width, process.height,
|
| + process.verbose_logging);
|
| // Update the layers and the codec with the initial rates.
|
| bit_rate_ = rate_profile.target_bit_rate[0];
|
| frame_rate_ = rate_profile.input_frame_rate[0];
|
| @@ -579,386 +530,95 @@ class VideoProcessorIntegrationTest : public testing::Test {
|
| fprintf(stderr, "Failed to remove temporary file!\n");
|
| }
|
| }
|
| -};
|
|
|
| -#if defined(WEBRTC_VIDEOPROCESSOR_H264_TESTS)
|
| -
|
| -// 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) {
|
| - // Bitrate and frame rate profile.
|
| - RateProfile rate_profile;
|
| - SetRateProfilePars(&rate_profile, 0, 500, 30, 0);
|
| - rate_profile.frame_index_rate_update[1] = kNbrFramesShort + 1;
|
| - rate_profile.num_frames = kNbrFramesShort;
|
| - // Codec/network settings.
|
| - CodecConfigPars process_settings;
|
| - SetCodecParameters(&process_settings, kVideoCodecH264, 0.0f, -1, 1, false,
|
| - false, true, false);
|
| - // Metrics for expected quality.
|
| - QualityMetrics quality_metrics;
|
| - SetQualityMetrics(&quality_metrics, 35.0, 25.0, 0.93, 0.70);
|
| - // Metrics for rate control.
|
| - RateControlMetrics rc_metrics[1];
|
| - SetRateControlMetrics(rc_metrics, 0, 2, 60, 20, 10, 20, 0, 1);
|
| - ProcessFramesAndVerify(quality_metrics,
|
| - rate_profile,
|
| - process_settings,
|
| - rc_metrics);
|
| -}
|
| -
|
| -#endif // defined(WEBRTC_VIDEOPROCESSOR_H264_TESTS)
|
| -
|
| -// Fails on iOS. See webrtc:4755.
|
| -#if !defined(WEBRTC_IOS)
|
| + static void SetRateProfilePars(RateProfile* rate_profile,
|
| + int update_index,
|
| + int bit_rate,
|
| + int frame_rate,
|
| + int frame_index_rate_update) {
|
| + rate_profile->target_bit_rate[update_index] = bit_rate;
|
| + rate_profile->input_frame_rate[update_index] = frame_rate;
|
| + rate_profile->frame_index_rate_update[update_index] =
|
| + frame_index_rate_update;
|
| + }
|
|
|
| -#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. Setting |key_frame_interval|
|
| -// to -1 below means no periodic key frames in test.
|
| -TEST_F(VideoProcessorIntegrationTest, Process0PercentPacketLossVP9) {
|
| - // Bitrate and frame rate profile.
|
| - RateProfile rate_profile;
|
| - SetRateProfilePars(&rate_profile, 0, 500, 30, 0);
|
| - rate_profile.frame_index_rate_update[1] = kNbrFramesShort + 1;
|
| - rate_profile.num_frames = kNbrFramesShort;
|
| - // Codec/network settings.
|
| - CodecConfigPars process_settings;
|
| - SetCodecParameters(&process_settings, kVideoCodecVP9, 0.0f, -1, 1, false,
|
| - false, true, false);
|
| - // Metrics for expected quality.
|
| - QualityMetrics quality_metrics;
|
| - SetQualityMetrics(&quality_metrics, 37.0, 36.0, 0.93, 0.92);
|
| - // Metrics for rate control.
|
| - RateControlMetrics rc_metrics[1];
|
| - SetRateControlMetrics(rc_metrics, 0, 0, 40, 20, 10, 20, 0, 1);
|
| - ProcessFramesAndVerify(quality_metrics, rate_profile, process_settings,
|
| - rc_metrics);
|
| -}
|
| -
|
| -// 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) {
|
| - // Bitrate and frame rate profile.
|
| - RateProfile rate_profile;
|
| - SetRateProfilePars(&rate_profile, 0, 500, 30, 0);
|
| - rate_profile.frame_index_rate_update[1] = kNbrFramesShort + 1;
|
| - rate_profile.num_frames = kNbrFramesShort;
|
| - // Codec/network settings.
|
| - CodecConfigPars process_settings;
|
| - SetCodecParameters(&process_settings, kVideoCodecVP9, 0.05f, -1, 1, false,
|
| - false, true, false);
|
| - // Metrics for expected quality.
|
| - QualityMetrics quality_metrics;
|
| - SetQualityMetrics(&quality_metrics, 17.0, 14.0, 0.45, 0.36);
|
| - // Metrics for rate control.
|
| - RateControlMetrics rc_metrics[1];
|
| - SetRateControlMetrics(rc_metrics, 0, 0, 40, 20, 10, 20, 0, 1);
|
| - ProcessFramesAndVerify(quality_metrics, rate_profile, process_settings,
|
| - rc_metrics);
|
| -}
|
| -
|
| -// VP9: Run with no packet loss, with varying bitrate (3 rate updates):
|
| -// 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) {
|
| - // Bitrate and frame rate profile.
|
| - RateProfile rate_profile;
|
| - SetRateProfilePars(&rate_profile, 0, 200, 30, 0);
|
| - SetRateProfilePars(&rate_profile, 1, 700, 30, 100);
|
| - SetRateProfilePars(&rate_profile, 2, 500, 30, 200);
|
| - rate_profile.frame_index_rate_update[3] = kNbrFramesLong + 1;
|
| - rate_profile.num_frames = kNbrFramesLong;
|
| - // Codec/network settings.
|
| - CodecConfigPars process_settings;
|
| - SetCodecParameters(&process_settings, kVideoCodecVP9, 0.0f, -1, 1, false,
|
| - false, true, false);
|
| - // Metrics for expected quality.
|
| - QualityMetrics quality_metrics;
|
| - SetQualityMetrics(&quality_metrics, 35.5, 30.0, 0.90, 0.85);
|
| - // Metrics for rate control.
|
| - RateControlMetrics rc_metrics[3];
|
| - SetRateControlMetrics(rc_metrics, 0, 0, 30, 20, 20, 30, 0, 1);
|
| - SetRateControlMetrics(rc_metrics, 1, 2, 0, 20, 20, 60, 0, 0);
|
| - SetRateControlMetrics(rc_metrics, 2, 0, 0, 25, 20, 40, 0, 0);
|
| - ProcessFramesAndVerify(quality_metrics, rate_profile, process_settings,
|
| - rc_metrics);
|
| -}
|
| -
|
| -// VP9: Run with no packet loss, with an update (decrease) in frame rate.
|
| -// Lower frame rate means higher per-frame-bandwidth, so easier to encode.
|
| -// At the low bitrate in this test, this means better rate control after the
|
| -// update(s) to lower frame rate. So expect less frame drops, and max values
|
| -// 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,
|
| - ProcessNoLossChangeFrameRateFrameDropVP9) {
|
| - config_.networking_config.packet_loss_probability = 0;
|
| - // Bitrate and frame rate profile.
|
| - RateProfile rate_profile;
|
| - SetRateProfilePars(&rate_profile, 0, 100, 24, 0);
|
| - SetRateProfilePars(&rate_profile, 1, 100, 15, 100);
|
| - SetRateProfilePars(&rate_profile, 2, 100, 10, 200);
|
| - rate_profile.frame_index_rate_update[3] = kNbrFramesLong + 1;
|
| - rate_profile.num_frames = kNbrFramesLong;
|
| - // Codec/network settings.
|
| - CodecConfigPars process_settings;
|
| - SetCodecParameters(&process_settings, kVideoCodecVP9, 0.0f, -1, 1, false,
|
| - false, true, false);
|
| - // Metrics for expected quality.
|
| - QualityMetrics quality_metrics;
|
| - SetQualityMetrics(&quality_metrics, 31.5, 18.0, 0.80, 0.43);
|
| - // Metrics for rate control.
|
| - RateControlMetrics rc_metrics[3];
|
| - SetRateControlMetrics(rc_metrics, 0, 38, 50, 75, 15, 45, 0, 1);
|
| - SetRateControlMetrics(rc_metrics, 1, 10, 0, 40, 10, 30, 0, 0);
|
| - SetRateControlMetrics(rc_metrics, 2, 5, 0, 30, 5, 20, 0, 0);
|
| - ProcessFramesAndVerify(quality_metrics, rate_profile, process_settings,
|
| - rc_metrics);
|
| -}
|
| -
|
| -// VP9: Run with no packet loss and denoiser on. One key frame (first frame).
|
| -TEST_F(VideoProcessorIntegrationTest, ProcessNoLossDenoiserOnVP9) {
|
| - // Bitrate and frame rate profile.
|
| - RateProfile rate_profile;
|
| - SetRateProfilePars(&rate_profile, 0, 500, 30, 0);
|
| - rate_profile.frame_index_rate_update[1] = kNbrFramesShort + 1;
|
| - rate_profile.num_frames = kNbrFramesShort;
|
| - // Codec/network settings.
|
| - CodecConfigPars process_settings;
|
| - SetCodecParameters(&process_settings, kVideoCodecVP9, 0.0f, -1, 1, false,
|
| - true, true, false);
|
| - // Metrics for expected quality.
|
| - QualityMetrics quality_metrics;
|
| - SetQualityMetrics(&quality_metrics, 36.8, 35.8, 0.92, 0.91);
|
| - // Metrics for rate control.
|
| - RateControlMetrics rc_metrics[1];
|
| - SetRateControlMetrics(rc_metrics, 0, 0, 40, 20, 10, 20, 0, 1);
|
| - ProcessFramesAndVerify(quality_metrics, rate_profile, process_settings,
|
| - rc_metrics);
|
| -}
|
| -
|
| -// 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,
|
| - DISABLED_ProcessNoLossSpatialResizeFrameDropVP9) {
|
| - config_.networking_config.packet_loss_probability = 0;
|
| - // Bitrate and frame rate profile.
|
| - RateProfile rate_profile;
|
| - SetRateProfilePars(&rate_profile, 0, 50, 30, 0);
|
| - rate_profile.frame_index_rate_update[1] = kNbrFramesLong + 1;
|
| - rate_profile.num_frames = kNbrFramesLong;
|
| - // Codec/network settings.
|
| - CodecConfigPars process_settings;
|
| - SetCodecParameters(&process_settings, kVideoCodecVP9, 0.0f, -1, 1, false,
|
| - false, true, true);
|
| - // Metrics for expected quality.
|
| - QualityMetrics quality_metrics;
|
| - SetQualityMetrics(&quality_metrics, 24.0, 13.0, 0.65, 0.37);
|
| - // Metrics for rate control.
|
| - RateControlMetrics rc_metrics[1];
|
| - SetRateControlMetrics(rc_metrics, 0, 228, 70, 160, 15, 80, 1, 1);
|
| - ProcessFramesAndVerify(quality_metrics, rate_profile, process_settings,
|
| - rc_metrics);
|
| -}
|
| -
|
| -// TODO(marpan): Add temporal layer test for VP9, once changes are in
|
| -// vp9 wrapper for this.
|
| -
|
| -#endif // !defined(RTC_DISABLE_VP9)
|
| -
|
| -// 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) {
|
| - // Bitrate and frame rate profile.
|
| - RateProfile rate_profile;
|
| - SetRateProfilePars(&rate_profile, 0, 500, 30, 0);
|
| - rate_profile.frame_index_rate_update[1] = kNbrFramesShort + 1;
|
| - rate_profile.num_frames = kNbrFramesShort;
|
| - // Codec/network settings.
|
| - CodecConfigPars process_settings;
|
| - SetCodecParameters(&process_settings, kVideoCodecVP8, 0.0f, -1, 1, false,
|
| - true, true, false);
|
| - // Metrics for expected quality.
|
| - QualityMetrics quality_metrics;
|
| - SetQualityMetrics(&quality_metrics, 34.95, 33.0, 0.90, 0.89);
|
| - // Metrics for rate control.
|
| - RateControlMetrics rc_metrics[1];
|
| - SetRateControlMetrics(rc_metrics, 0, 0, 40, 20, 10, 15, 0, 1);
|
| - ProcessFramesAndVerify(quality_metrics, rate_profile, process_settings,
|
| - rc_metrics);
|
| -}
|
| -
|
| -// 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) {
|
| - // Bitrate and frame rate profile.
|
| - RateProfile rate_profile;
|
| - SetRateProfilePars(&rate_profile, 0, 500, 30, 0);
|
| - rate_profile.frame_index_rate_update[1] = kNbrFramesShort + 1;
|
| - rate_profile.num_frames = kNbrFramesShort;
|
| - // Codec/network settings.
|
| - CodecConfigPars process_settings;
|
| - SetCodecParameters(&process_settings, kVideoCodecVP8, 0.05f, -1, 1, false,
|
| - true, true, false);
|
| - // Metrics for expected quality.
|
| - QualityMetrics quality_metrics;
|
| - SetQualityMetrics(&quality_metrics, 20.0, 16.0, 0.60, 0.40);
|
| - // Metrics for rate control.
|
| - RateControlMetrics rc_metrics[1];
|
| - SetRateControlMetrics(rc_metrics, 0, 0, 40, 20, 10, 15, 0, 1);
|
| - ProcessFramesAndVerify(quality_metrics, rate_profile, process_settings,
|
| - rc_metrics);
|
| -}
|
| -
|
| -// 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) {
|
| - // Bitrate and frame rate profile.
|
| - RateProfile rate_profile;
|
| - SetRateProfilePars(&rate_profile, 0, 500, 30, 0);
|
| - rate_profile.frame_index_rate_update[1] = kNbrFramesShort + 1;
|
| - rate_profile.num_frames = kNbrFramesShort;
|
| - // Codec/network settings.
|
| - CodecConfigPars process_settings;
|
| - SetCodecParameters(&process_settings, kVideoCodecVP8, 0.1f, -1, 1, false,
|
| - true, true, false);
|
| - // Metrics for expected quality.
|
| - QualityMetrics quality_metrics;
|
| - SetQualityMetrics(&quality_metrics, 19.0, 16.0, 0.50, 0.35);
|
| - // Metrics for rate control.
|
| - RateControlMetrics rc_metrics[1];
|
| - SetRateControlMetrics(rc_metrics, 0, 0, 40, 20, 10, 15, 0, 1);
|
| - ProcessFramesAndVerify(quality_metrics, rate_profile, process_settings,
|
| - rc_metrics);
|
| -}
|
| -
|
| -#endif // !defined(WEBRTC_IOS)
|
| -
|
| -// The tests below are currently disabled for Android. For ARM, the encoder
|
| -// uses |cpu_speed| = 12, as opposed to default |cpu_speed| <= 6 for x86,
|
| -// which leads to significantly different quality. The quality and rate control
|
| -// settings in the tests below are defined for encoder speed setting
|
| -// |cpu_speed| <= ~6. A number of settings would need to be significantly
|
| -// modified for the |cpu_speed| = 12 case. For now, keep the tests below
|
| -// disabled on Android. Some quality parameter in the above test has been
|
| -// adjusted to also pass for |cpu_speed| <= 12.
|
| -
|
| -// VP8: Run with no packet loss, with varying bitrate (3 rate updates):
|
| -// 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.
|
| -// Too slow to finish before timeout on iOS. See webrtc:4755.
|
| -#if defined(WEBRTC_ANDROID) || defined(WEBRTC_IOS)
|
| -#define MAYBE_ProcessNoLossChangeBitRateVP8 \
|
| - DISABLED_ProcessNoLossChangeBitRateVP8
|
| -#else
|
| -#define MAYBE_ProcessNoLossChangeBitRateVP8 ProcessNoLossChangeBitRateVP8
|
| -#endif
|
| -TEST_F(VideoProcessorIntegrationTest, MAYBE_ProcessNoLossChangeBitRateVP8) {
|
| - // Bitrate and frame rate profile.
|
| - RateProfile rate_profile;
|
| - SetRateProfilePars(&rate_profile, 0, 200, 30, 0);
|
| - SetRateProfilePars(&rate_profile, 1, 800, 30, 100);
|
| - SetRateProfilePars(&rate_profile, 2, 500, 30, 200);
|
| - rate_profile.frame_index_rate_update[3] = kNbrFramesLong + 1;
|
| - rate_profile.num_frames = kNbrFramesLong;
|
| - // Codec/network settings.
|
| - CodecConfigPars process_settings;
|
| - SetCodecParameters(&process_settings, kVideoCodecVP8, 0.0f, -1, 1, false,
|
| - true, true, false);
|
| - // Metrics for expected quality.
|
| - QualityMetrics quality_metrics;
|
| - SetQualityMetrics(&quality_metrics, 34.0, 32.0, 0.85, 0.80);
|
| - // Metrics for rate control.
|
| - RateControlMetrics rc_metrics[3];
|
| - SetRateControlMetrics(rc_metrics, 0, 0, 45, 20, 10, 15, 0, 1);
|
| - SetRateControlMetrics(rc_metrics, 1, 0, 0, 25, 20, 10, 0, 0);
|
| - SetRateControlMetrics(rc_metrics, 2, 0, 0, 25, 15, 10, 0, 0);
|
| - ProcessFramesAndVerify(quality_metrics, rate_profile, process_settings,
|
| - rc_metrics);
|
| -}
|
| -
|
| -// VP8: Run with no packet loss, with an update (decrease) in frame rate.
|
| -// Lower frame rate means higher per-frame-bandwidth, so easier to encode.
|
| -// At the bitrate in this test, this means better rate control after the
|
| -// update(s) to lower frame rate. So expect less frame drops, and max values
|
| -// 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.
|
| -// Too slow to finish before timeout on iOS. See webrtc:4755.
|
| -#if defined(WEBRTC_ANDROID) || defined(WEBRTC_IOS)
|
| -#define MAYBE_ProcessNoLossChangeFrameRateFrameDropVP8 \
|
| - DISABLED_ProcessNoLossChangeFrameRateFrameDropVP8
|
| -#else
|
| -#define MAYBE_ProcessNoLossChangeFrameRateFrameDropVP8 \
|
| - ProcessNoLossChangeFrameRateFrameDropVP8
|
| -#endif
|
| -TEST_F(VideoProcessorIntegrationTest,
|
| - MAYBE_ProcessNoLossChangeFrameRateFrameDropVP8) {
|
| - config_.networking_config.packet_loss_probability = 0;
|
| - // Bitrate and frame rate profile.
|
| - RateProfile rate_profile;
|
| - SetRateProfilePars(&rate_profile, 0, 80, 24, 0);
|
| - SetRateProfilePars(&rate_profile, 1, 80, 15, 100);
|
| - SetRateProfilePars(&rate_profile, 2, 80, 10, 200);
|
| - rate_profile.frame_index_rate_update[3] = kNbrFramesLong + 1;
|
| - rate_profile.num_frames = kNbrFramesLong;
|
| - // Codec/network settings.
|
| - CodecConfigPars process_settings;
|
| - SetCodecParameters(&process_settings, kVideoCodecVP8, 0.0f, -1, 1, false,
|
| - true, true, false);
|
| - // Metrics for expected quality.
|
| - QualityMetrics quality_metrics;
|
| - SetQualityMetrics(&quality_metrics, 31.0, 22.0, 0.80, 0.65);
|
| - // Metrics for rate control.
|
| - RateControlMetrics rc_metrics[3];
|
| - SetRateControlMetrics(rc_metrics, 0, 40, 20, 75, 15, 60, 0, 1);
|
| - SetRateControlMetrics(rc_metrics, 1, 10, 0, 25, 10, 35, 0, 0);
|
| - SetRateControlMetrics(rc_metrics, 2, 0, 0, 20, 10, 15, 0, 0);
|
| - ProcessFramesAndVerify(quality_metrics, rate_profile, process_settings,
|
| - rc_metrics);
|
| -}
|
| -
|
| -// VP8: Run with no packet loss, with 3 temporal layers, with a rate update in
|
| -// the middle of the sequence. The max values for the frame size mismatch and
|
| -// encoding rate mismatch are applied to each layer.
|
| -// No dropped frames in this test, and internal spatial resizer is off.
|
| -// One key frame (first frame only) in sequence, so no spatial resizing.
|
| -// Too slow to finish before timeout on iOS. See webrtc:4755.
|
| -#if defined(WEBRTC_ANDROID) || defined(WEBRTC_IOS)
|
| -#define MAYBE_ProcessNoLossTemporalLayersVP8 \
|
| - DISABLED_ProcessNoLossTemporalLayersVP8
|
| -#else
|
| -#define MAYBE_ProcessNoLossTemporalLayersVP8 ProcessNoLossTemporalLayersVP8
|
| -#endif
|
| -TEST_F(VideoProcessorIntegrationTest, MAYBE_ProcessNoLossTemporalLayersVP8) {
|
| - config_.networking_config.packet_loss_probability = 0;
|
| - // Bitrate and frame rate profile.
|
| - RateProfile rate_profile;
|
| - SetRateProfilePars(&rate_profile, 0, 200, 30, 0);
|
| - SetRateProfilePars(&rate_profile, 1, 400, 30, 150);
|
| - rate_profile.frame_index_rate_update[2] = kNbrFramesLong + 1;
|
| - rate_profile.num_frames = kNbrFramesLong;
|
| - // Codec/network settings.
|
| - CodecConfigPars process_settings;
|
| - SetCodecParameters(&process_settings, kVideoCodecVP8, 0.0f, -1, 3, false,
|
| - true, true, false);
|
| - // Metrics for expected quality.
|
| - QualityMetrics quality_metrics;
|
| - SetQualityMetrics(&quality_metrics, 32.5, 30.0, 0.85, 0.80);
|
| - // Metrics for rate control.
|
| - RateControlMetrics rc_metrics[2];
|
| - SetRateControlMetrics(rc_metrics, 0, 0, 20, 30, 10, 10, 0, 1);
|
| - SetRateControlMetrics(rc_metrics, 1, 0, 0, 30, 15, 10, 0, 0);
|
| - ProcessFramesAndVerify(quality_metrics, rate_profile, process_settings,
|
| - rc_metrics);
|
| -}
|
| + static void SetCodecParameters(CodecConfigPars* process_settings,
|
| + VideoCodecType codec_type,
|
| + float packet_loss,
|
| + int key_frame_interval,
|
| + int num_temporal_layers,
|
| + bool error_concealment_on,
|
| + bool denoising_on,
|
| + bool frame_dropper_on,
|
| + bool spatial_resize_on,
|
| + int width,
|
| + int height,
|
| + const std::string& filename,
|
| + bool verbose_logging) {
|
| + process_settings->codec_type = codec_type;
|
| + process_settings->packet_loss = packet_loss;
|
| + process_settings->key_frame_interval = key_frame_interval;
|
| + process_settings->num_temporal_layers = num_temporal_layers,
|
| + process_settings->error_concealment_on = error_concealment_on;
|
| + process_settings->denoising_on = denoising_on;
|
| + process_settings->frame_dropper_on = frame_dropper_on;
|
| + process_settings->spatial_resize_on = spatial_resize_on;
|
| + process_settings->width = width;
|
| + process_settings->height = height;
|
| + process_settings->filename = filename;
|
| + process_settings->verbose_logging = verbose_logging;
|
| + }
|
| +
|
| + static void SetCodecParameters(CodecConfigPars* process_settings,
|
| + VideoCodecType codec_type,
|
| + float packet_loss,
|
| + int key_frame_interval,
|
| + int num_temporal_layers,
|
| + bool error_concealment_on,
|
| + bool denoising_on,
|
| + bool frame_dropper_on,
|
| + bool spatial_resize_on) {
|
| + SetCodecParameters(process_settings, codec_type, packet_loss,
|
| + key_frame_interval, num_temporal_layers,
|
| + error_concealment_on, denoising_on, frame_dropper_on,
|
| + spatial_resize_on, kCifWidth, kCifHeight,
|
| + kFilenameForemanCif, false /* verbose_logging */);
|
| + }
|
| +
|
| + static void SetQualityMetrics(QualityMetrics* quality_metrics,
|
| + double minimum_avg_psnr,
|
| + double minimum_min_psnr,
|
| + double minimum_avg_ssim,
|
| + double minimum_min_ssim) {
|
| + quality_metrics->minimum_avg_psnr = minimum_avg_psnr;
|
| + quality_metrics->minimum_min_psnr = minimum_min_psnr;
|
| + quality_metrics->minimum_avg_ssim = minimum_avg_ssim;
|
| + quality_metrics->minimum_min_ssim = minimum_min_ssim;
|
| + }
|
| +
|
| + static void SetRateControlMetrics(RateControlMetrics* rc_metrics,
|
| + int update_index,
|
| + int max_num_dropped_frames,
|
| + int max_key_frame_size_mismatch,
|
| + int max_delta_frame_size_mismatch,
|
| + int max_encoding_rate_mismatch,
|
| + int max_time_hit_target,
|
| + int num_spatial_resizes,
|
| + int num_key_frames) {
|
| + rc_metrics[update_index].max_num_dropped_frames = max_num_dropped_frames;
|
| + rc_metrics[update_index].max_key_frame_size_mismatch =
|
| + max_key_frame_size_mismatch;
|
| + rc_metrics[update_index].max_delta_frame_size_mismatch =
|
| + max_delta_frame_size_mismatch;
|
| + rc_metrics[update_index].max_encoding_rate_mismatch =
|
| + max_encoding_rate_mismatch;
|
| + rc_metrics[update_index].max_time_hit_target = max_time_hit_target;
|
| + rc_metrics[update_index].num_spatial_resizes = num_spatial_resizes;
|
| + rc_metrics[update_index].num_key_frames = num_key_frames;
|
| + }
|
| +};
|
| +
|
| +} // namespace test
|
| } // namespace webrtc
|
| +
|
| +#endif // WEBRTC_MODULES_VIDEO_CODING_CODECS_TEST_VIDEOPROCESSOR_INTEGRATIONTEST_H_
|
|
|