Added number of simulcast/spatial layers to TestConfig.
These parameters allow to configure number of simulcast/spatial layers in video codec tests. Bug: webrtc:8524 Change-Id: Iad1332732758a8297abcf740c24c483e5fccec9a Reviewed-on: https://webrtc-review.googlesource.com/43020 Commit-Queue: Sergey Silkin <ssilkin@webrtc.org> Reviewed-by: Rasmus Brandt <brandtr@webrtc.org> Cr-Commit-Position: refs/heads/master@{#21741}
This commit is contained in:

committed by
Commit Bot

parent
2880ea300e
commit
b7d7301d7e
@ -508,6 +508,7 @@ if (rtc_include_tests) {
|
||||
"../../api:video_frame_api_i420",
|
||||
"../../api/video_codecs:video_codecs_api",
|
||||
"../../common_video:common_video",
|
||||
"../../media:rtc_internal_video_codecs",
|
||||
"../../rtc_base:checks",
|
||||
"../../rtc_base:rtc_base_approved",
|
||||
"../../rtc_base:rtc_task_queue",
|
||||
|
@ -13,7 +13,7 @@ specific_include_rules = {
|
||||
"+base/android",
|
||||
"+sdk",
|
||||
],
|
||||
"(.*test\.cc|.*test\.h|.*test\.mm)": [
|
||||
"(.*test\.cc|.*test\.h|.*test\.mm|test_config.cc)": [
|
||||
"+media/base",
|
||||
"+media/engine",
|
||||
"+sdk",
|
||||
|
@ -12,6 +12,7 @@
|
||||
|
||||
#include <sstream>
|
||||
|
||||
#include "media/engine/simulcast.h"
|
||||
#include "modules/video_coding/include/video_codec_interface.h"
|
||||
#include "rtc_base/checks.h"
|
||||
#include "system_wrappers/include/cpu_info.h"
|
||||
@ -22,6 +23,9 @@ namespace test {
|
||||
|
||||
namespace {
|
||||
const int kBaseKeyFrameInterval = 3000;
|
||||
const int kMaxBitrateBps = 5000 * 1000; // From kSimulcastFormats.
|
||||
const int kMaxFramerateFps = 30;
|
||||
const int kMaxQp = 56;
|
||||
|
||||
std::string CodecSpecificToString(const webrtc::VideoCodec& codec) {
|
||||
std::stringstream ss;
|
||||
@ -67,6 +71,8 @@ std::string CodecSpecificToString(const webrtc::VideoCodec& codec) {
|
||||
} // namespace
|
||||
|
||||
void TestConfig::SetCodecSettings(VideoCodecType codec_type,
|
||||
size_t num_simulcast_streams,
|
||||
size_t num_spatial_layers,
|
||||
size_t num_temporal_layers,
|
||||
bool error_concealment_on,
|
||||
bool denoising_on,
|
||||
@ -82,6 +88,22 @@ void TestConfig::SetCodecSettings(VideoCodecType codec_type,
|
||||
codec_settings.width = static_cast<uint16_t>(width);
|
||||
codec_settings.height = static_cast<uint16_t>(height);
|
||||
|
||||
RTC_CHECK(num_simulcast_streams >= 1 &&
|
||||
num_simulcast_streams <= kMaxSimulcastStreams);
|
||||
RTC_CHECK(num_spatial_layers >= 1 && num_spatial_layers <= kMaxSpatialLayers);
|
||||
|
||||
// Simulcast is only available with VP8.
|
||||
RTC_CHECK(num_simulcast_streams < 2 || codec_type == kVideoCodecVP8);
|
||||
|
||||
// Spatial scalability is only available with VP9.
|
||||
RTC_CHECK(num_spatial_layers < 2 || codec_type == kVideoCodecVP9);
|
||||
|
||||
// Some base code requires numberOfSimulcastStreams to be set to zero
|
||||
// when simulcast is not used.
|
||||
codec_settings.numberOfSimulcastStreams =
|
||||
num_simulcast_streams <= 1 ? 0
|
||||
: static_cast<uint8_t>(num_simulcast_streams);
|
||||
|
||||
switch (codec_settings.codecType) {
|
||||
case kVideoCodecVP8:
|
||||
codec_settings.VP8()->resilience =
|
||||
@ -102,6 +124,8 @@ void TestConfig::SetCodecSettings(VideoCodecType codec_type,
|
||||
codec_settings.VP9()->frameDroppingOn = frame_dropper_on;
|
||||
codec_settings.VP9()->keyFrameInterval = kBaseKeyFrameInterval;
|
||||
codec_settings.VP9()->automaticResizeOn = spatial_resize_on;
|
||||
codec_settings.VP9()->numberOfSpatialLayers =
|
||||
static_cast<uint8_t>(num_spatial_layers);
|
||||
break;
|
||||
case kVideoCodecH264:
|
||||
codec_settings.H264()->frameDroppingOn = frame_dropper_on;
|
||||
@ -111,6 +135,29 @@ void TestConfig::SetCodecSettings(VideoCodecType codec_type,
|
||||
RTC_NOTREACHED();
|
||||
break;
|
||||
}
|
||||
|
||||
if (codec_settings.numberOfSimulcastStreams > 1) {
|
||||
ConfigureSimulcast();
|
||||
}
|
||||
}
|
||||
|
||||
void TestConfig::ConfigureSimulcast() {
|
||||
std::vector<webrtc::VideoStream> stream = cricket::GetSimulcastConfig(
|
||||
codec_settings.numberOfSimulcastStreams, codec_settings.width,
|
||||
codec_settings.height, kMaxBitrateBps, kMaxQp, kMaxFramerateFps, false);
|
||||
|
||||
for (size_t i = 0; i < stream.size(); ++i) {
|
||||
SimulcastStream* ss = &codec_settings.simulcastStream[i];
|
||||
ss->width = static_cast<uint16_t>(stream[i].width);
|
||||
ss->height = static_cast<uint16_t>(stream[i].height);
|
||||
ss->numberOfTemporalLayers = static_cast<unsigned char>(
|
||||
stream[i].temporal_layer_thresholds_bps.size() + 1);
|
||||
ss->maxBitrate = stream[i].max_bitrate_bps / 1000;
|
||||
ss->targetBitrate = stream[i].target_bitrate_bps / 1000;
|
||||
ss->minBitrate = stream[i].min_bitrate_bps / 1000;
|
||||
ss->qpMax = stream[i].max_qp;
|
||||
ss->active = true;
|
||||
}
|
||||
}
|
||||
|
||||
size_t TestConfig::NumberOfCores() const {
|
||||
@ -135,6 +182,10 @@ size_t TestConfig::NumberOfSpatialLayers() const {
|
||||
}
|
||||
}
|
||||
|
||||
size_t TestConfig::NumberOfSimulcastStreams() const {
|
||||
return codec_settings.numberOfSimulcastStreams;
|
||||
}
|
||||
|
||||
size_t TestConfig::TemporalLayerForFrame(size_t frame_idx) const {
|
||||
size_t tl = 0;
|
||||
switch (NumberOfTemporalLayers()) {
|
||||
|
@ -32,6 +32,8 @@ struct TestConfig {
|
||||
};
|
||||
|
||||
void SetCodecSettings(VideoCodecType codec_type,
|
||||
size_t num_simulcast_streams,
|
||||
size_t num_spatial_layers,
|
||||
size_t num_temporal_layers,
|
||||
bool error_concealment_on,
|
||||
bool denoising_on,
|
||||
@ -41,13 +43,24 @@ struct TestConfig {
|
||||
size_t width,
|
||||
size_t height);
|
||||
|
||||
void ConfigureSimulcast();
|
||||
|
||||
size_t NumberOfCores() const;
|
||||
|
||||
size_t NumberOfTemporalLayers() const;
|
||||
|
||||
size_t NumberOfSpatialLayers() const;
|
||||
|
||||
size_t NumberOfSimulcastStreams() const;
|
||||
|
||||
size_t TemporalLayerForFrame(size_t frame_idx) const;
|
||||
|
||||
std::vector<FrameType> FrameTypeForFrame(size_t frame_idx) const;
|
||||
|
||||
std::string ToString() const;
|
||||
|
||||
std::string CodecName() const;
|
||||
|
||||
std::string FilenameWithParams() const;
|
||||
|
||||
// Plain name of YUV file to process without file extension.
|
||||
|
@ -106,50 +106,6 @@ TEST(TestConfig, ForcedKeyFrameIntervalOn) {
|
||||
EXPECT_THAT(config.FrameTypeForFrame(5), ElementsAre(kVideoFrameDelta));
|
||||
}
|
||||
|
||||
TEST(TestConfig, ToString_Vp8) {
|
||||
TestConfig config;
|
||||
config.filename = "yuvfile";
|
||||
config.use_single_core = true;
|
||||
|
||||
config.SetCodecSettings(kVideoCodecVP8, 2, true, // error_concealment_on,
|
||||
false, // denoising_on,
|
||||
false, // frame_dropper_on,
|
||||
true, // spatial_resize_on,
|
||||
false, // resilience_on,
|
||||
320, 180);
|
||||
config.codec_settings.startBitrate = 400;
|
||||
config.codec_settings.maxBitrate = 500;
|
||||
config.codec_settings.minBitrate = 70;
|
||||
config.codec_settings.maxFramerate = 35;
|
||||
config.codec_settings.qpMax = 66;
|
||||
config.codec_settings.VP8()->complexity = kComplexityNormal;
|
||||
config.codec_settings.VP8()->keyFrameInterval = 999;
|
||||
|
||||
EXPECT_EQ(
|
||||
"\n Filename : yuvfile"
|
||||
"\n # CPU cores used : 1"
|
||||
"\n General:"
|
||||
"\n Codec type : VP8"
|
||||
"\n Start bitrate : 400 kbps"
|
||||
"\n Max bitrate : 500 kbps"
|
||||
"\n Min bitrate : 70 kbps"
|
||||
"\n Width : 320"
|
||||
"\n Height : 180"
|
||||
"\n Max frame rate : 35"
|
||||
"\n QPmax : 66"
|
||||
"\n # simulcast streams : 0"
|
||||
"\n VP8 specific: "
|
||||
"\n Complexity : 0"
|
||||
"\n Resilience : 0"
|
||||
"\n # temporal layers : 2"
|
||||
"\n Denoising : 0"
|
||||
"\n Error concealment : 1"
|
||||
"\n Automatic resize : 1"
|
||||
"\n Frame dropping : 0"
|
||||
"\n Key frame interval : 999\n",
|
||||
config.ToString());
|
||||
}
|
||||
|
||||
TEST(TestConfig, FilenameWithParams) {
|
||||
TestConfig config;
|
||||
config.filename = "filename";
|
||||
|
@ -76,7 +76,7 @@ class VideoProcessorIntegrationTestLibvpx
|
||||
|
||||
#if !defined(RTC_DISABLE_VP9)
|
||||
TEST_F(VideoProcessorIntegrationTestLibvpx, HighBitrateVP9) {
|
||||
config_.SetCodecSettings(kVideoCodecVP9, 1, false, false, true, false,
|
||||
config_.SetCodecSettings(kVideoCodecVP9, 1, 1, 1, false, false, true, false,
|
||||
kResilienceOn, kCifWidth, kCifHeight);
|
||||
config_.num_frames = kNumFramesShort;
|
||||
|
||||
@ -93,7 +93,7 @@ TEST_F(VideoProcessorIntegrationTestLibvpx, HighBitrateVP9) {
|
||||
}
|
||||
|
||||
TEST_F(VideoProcessorIntegrationTestLibvpx, ChangeBitrateVP9) {
|
||||
config_.SetCodecSettings(kVideoCodecVP9, 1, false, false, true, false,
|
||||
config_.SetCodecSettings(kVideoCodecVP9, 1, 1, 1, false, false, true, false,
|
||||
kResilienceOn, kCifWidth, kCifHeight);
|
||||
|
||||
std::vector<RateProfile> rate_profiles = {
|
||||
@ -115,7 +115,7 @@ TEST_F(VideoProcessorIntegrationTestLibvpx, ChangeBitrateVP9) {
|
||||
}
|
||||
|
||||
TEST_F(VideoProcessorIntegrationTestLibvpx, ChangeFramerateVP9) {
|
||||
config_.SetCodecSettings(kVideoCodecVP9, 1, false, false, true, false,
|
||||
config_.SetCodecSettings(kVideoCodecVP9, 1, 1, 1, false, false, true, false,
|
||||
kResilienceOn, kCifWidth, kCifHeight);
|
||||
|
||||
std::vector<RateProfile> rate_profiles = {
|
||||
@ -139,7 +139,7 @@ TEST_F(VideoProcessorIntegrationTestLibvpx, ChangeFramerateVP9) {
|
||||
}
|
||||
|
||||
TEST_F(VideoProcessorIntegrationTestLibvpx, DenoiserOnVP9) {
|
||||
config_.SetCodecSettings(kVideoCodecVP9, 1, false, true, true, false,
|
||||
config_.SetCodecSettings(kVideoCodecVP9, 1, 1, 1, false, true, true, false,
|
||||
kResilienceOn, kCifWidth, kCifHeight);
|
||||
config_.num_frames = kNumFramesShort;
|
||||
|
||||
@ -156,7 +156,7 @@ TEST_F(VideoProcessorIntegrationTestLibvpx, DenoiserOnVP9) {
|
||||
}
|
||||
|
||||
TEST_F(VideoProcessorIntegrationTestLibvpx, VeryLowBitrateVP9) {
|
||||
config_.SetCodecSettings(kVideoCodecVP9, 1, false, false, true, true,
|
||||
config_.SetCodecSettings(kVideoCodecVP9, 1, 1, 1, false, false, true, true,
|
||||
kResilienceOn, kCifWidth, kCifHeight);
|
||||
|
||||
std::vector<RateProfile> rate_profiles = {{50, 30, kNumFramesLong}};
|
||||
@ -177,7 +177,7 @@ TEST_F(VideoProcessorIntegrationTestLibvpx, VeryLowBitrateVP9) {
|
||||
#endif // !defined(RTC_DISABLE_VP9)
|
||||
|
||||
TEST_F(VideoProcessorIntegrationTestLibvpx, HighBitrateVP8) {
|
||||
config_.SetCodecSettings(kVideoCodecVP8, 1, false, true, true, false,
|
||||
config_.SetCodecSettings(kVideoCodecVP8, 1, 1, 1, false, true, true, false,
|
||||
kResilienceOn, kCifWidth, kCifHeight);
|
||||
config_.num_frames = kNumFramesShort;
|
||||
|
||||
@ -215,7 +215,7 @@ TEST_F(VideoProcessorIntegrationTestLibvpx, HighBitrateVP8) {
|
||||
#define MAYBE_ProcessNoLossChangeBitRateVP8 ProcessNoLossChangeBitRateVP8
|
||||
#endif
|
||||
TEST_F(VideoProcessorIntegrationTestLibvpx, MAYBE_ChangeBitrateVP8) {
|
||||
config_.SetCodecSettings(kVideoCodecVP8, 1, false, true, true, false,
|
||||
config_.SetCodecSettings(kVideoCodecVP8, 1, 1, 1, false, true, true, false,
|
||||
kResilienceOn, kCifWidth, kCifHeight);
|
||||
|
||||
std::vector<RateProfile> rate_profiles = {
|
||||
@ -249,7 +249,7 @@ TEST_F(VideoProcessorIntegrationTestLibvpx, MAYBE_ChangeBitrateVP8) {
|
||||
ProcessNoLossChangeFrameRateFrameDropVP8
|
||||
#endif
|
||||
TEST_F(VideoProcessorIntegrationTestLibvpx, MAYBE_ChangeFramerateVP8) {
|
||||
config_.SetCodecSettings(kVideoCodecVP8, 1, false, true, true, false,
|
||||
config_.SetCodecSettings(kVideoCodecVP8, 1, 1, 1, false, true, true, false,
|
||||
kResilienceOn, kCifWidth, kCifHeight);
|
||||
|
||||
std::vector<RateProfile> rate_profiles = {
|
||||
@ -288,7 +288,7 @@ TEST_F(VideoProcessorIntegrationTestLibvpx, MAYBE_ChangeFramerateVP8) {
|
||||
#define MAYBE_ProcessNoLossTemporalLayersVP8 ProcessNoLossTemporalLayersVP8
|
||||
#endif
|
||||
TEST_F(VideoProcessorIntegrationTestLibvpx, MAYBE_TemporalLayersVP8) {
|
||||
config_.SetCodecSettings(kVideoCodecVP8, 3, false, true, true, false,
|
||||
config_.SetCodecSettings(kVideoCodecVP8, 1, 1, 3, false, true, true, false,
|
||||
kResilienceOn, kCifWidth, kCifHeight);
|
||||
|
||||
std::vector<RateProfile> rate_profiles = {{200, 30, 150},
|
||||
|
@ -41,8 +41,8 @@ class VideoProcessorIntegrationTestMediaCodec
|
||||
};
|
||||
|
||||
TEST_F(VideoProcessorIntegrationTestMediaCodec, ForemanCif500kbpsVp8) {
|
||||
config_.SetCodecSettings(kVideoCodecVP8, 1, false, false, false, false, false,
|
||||
352, 288);
|
||||
config_.SetCodecSettings(kVideoCodecVP8, 1, 1, 1, false, false, false, false,
|
||||
false, 352, 288);
|
||||
|
||||
std::vector<RateProfile> rate_profiles = {{500, 30, kForemanNumFrames}};
|
||||
|
||||
@ -61,7 +61,7 @@ TEST_F(VideoProcessorIntegrationTestMediaCodec, ForemanCif500kbpsVp8) {
|
||||
|
||||
TEST_F(VideoProcessorIntegrationTestMediaCodec, ForemanCif500kbpsH264CBP) {
|
||||
config_.encoded_frame_checker = &h264_keyframe_checker_;
|
||||
config_.SetCodecSettings(kVideoCodecH264, 1, false, false, false, false,
|
||||
config_.SetCodecSettings(kVideoCodecH264, 1, 1, 1, false, false, false, false,
|
||||
false, 352, 288);
|
||||
|
||||
std::vector<RateProfile> rate_profiles = {{500, 30, kForemanNumFrames}};
|
||||
@ -87,7 +87,7 @@ TEST_F(VideoProcessorIntegrationTestMediaCodec,
|
||||
|
||||
config_.h264_codec_settings.profile = H264::kProfileConstrainedHigh;
|
||||
config_.encoded_frame_checker = &h264_keyframe_checker_;
|
||||
config_.SetCodecSettings(kVideoCodecH264, 1, false, false, false, false,
|
||||
config_.SetCodecSettings(kVideoCodecH264, 1, 1, 1, false, false, false, false,
|
||||
false, 352, 288);
|
||||
|
||||
std::vector<RateProfile> rate_profiles = {{500, 30, kForemanNumFrames}};
|
||||
|
@ -49,7 +49,7 @@ class VideoProcessorIntegrationTestOpenH264
|
||||
};
|
||||
|
||||
TEST_F(VideoProcessorIntegrationTestOpenH264, ConstantHighBitrate) {
|
||||
config_.SetCodecSettings(kVideoCodecH264, 1, false, false, true, false,
|
||||
config_.SetCodecSettings(kVideoCodecH264, 1, 1, 1, false, false, true, false,
|
||||
kResilienceOn, kCifWidth, kCifHeight);
|
||||
|
||||
std::vector<RateProfile> rate_profiles = {{500, 30, kNumFrames}};
|
||||
@ -70,7 +70,7 @@ TEST_F(VideoProcessorIntegrationTestOpenH264, SingleNalUnit) {
|
||||
config_.h264_codec_settings.packetization_mode =
|
||||
H264PacketizationMode::SingleNalUnit;
|
||||
config_.max_payload_size_bytes = 500;
|
||||
config_.SetCodecSettings(kVideoCodecH264, 1, false, false, true, false,
|
||||
config_.SetCodecSettings(kVideoCodecH264, 1, 1, 1, false, false, true, false,
|
||||
kResilienceOn, kCifWidth, kCifHeight);
|
||||
|
||||
std::vector<RateProfile> rate_profiles = {{500, 30, kNumFrames}};
|
||||
|
@ -67,7 +67,7 @@ class VideoProcessorIntegrationTestParameterized
|
||||
config_.hw_encoder = hw_codec_;
|
||||
config_.hw_decoder = hw_codec_;
|
||||
config_.num_frames = kNumFrames;
|
||||
config_.SetCodecSettings(codec_type_, kNumTemporalLayers,
|
||||
config_.SetCodecSettings(codec_type_, 1, 1, kNumTemporalLayers,
|
||||
kErrorConcealmentOn, kDenoisingOn, kFrameDropperOn,
|
||||
kSpatialResizeOn, kResilienceOn, width, height);
|
||||
|
||||
|
@ -45,7 +45,7 @@ class VideoProcessorIntegrationTestVideoToolbox
|
||||
|
||||
TEST_F(VideoProcessorIntegrationTestVideoToolbox,
|
||||
DISABLED_ForemanCif500kbpsH264CBP) {
|
||||
config_.SetCodecSettings(kVideoCodecH264, 1, false, false, false, false,
|
||||
config_.SetCodecSettings(kVideoCodecH264, 1, 1, 1, false, false, false, false,
|
||||
false, 352, 288);
|
||||
|
||||
std::vector<RateProfile> rate_profiles = {{500, 30, kForemanNumFrames}};
|
||||
@ -65,7 +65,7 @@ TEST_F(VideoProcessorIntegrationTestVideoToolbox,
|
||||
ScopedFieldTrials override_field_trials("WebRTC-H264HighProfile/Enabled/");
|
||||
|
||||
config_.h264_codec_settings.profile = H264::kProfileConstrainedHigh;
|
||||
config_.SetCodecSettings(kVideoCodecH264, 1, false, false, false, false,
|
||||
config_.SetCodecSettings(kVideoCodecH264, 1, 1, 1, false, false, false, false,
|
||||
false, 352, 288);
|
||||
|
||||
std::vector<RateProfile> rate_profiles = {{500, 30, kForemanNumFrames}};
|
||||
|
Reference in New Issue
Block a user