Revert "Updated the default VP9 per-spatial-temporal layer settings."

This reverts commit 99fb5945b9c278cf33ef434ebacd5dfb9bde865d.

Reason for revert: Speculative revert: breaks upstream project

Original change's description:
> Updated the default VP9 per-spatial-temporal layer settings.
>
> Bug: webrtc:11551
> Change-Id: If2029df444f576b41bfef302985d6e18d7cdc3b5
> Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/227782
> Commit-Queue: Michael Horowitz <mhoro@google.com>
> Reviewed-by: Erik Språng <sprang@webrtc.org>
> Cr-Commit-Position: refs/heads/master@{#34668}

# Not skipping CQ checks because original CL landed > 1 day ago.

Bug: webrtc:11551
Change-Id: Ief33f98d8a4e0ccf95d7004c2526c99829807d15
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/228162
Reviewed-by: Erik Språng <sprang@webrtc.org>
Commit-Queue: Andrey Logvin <landrey@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#34673}
This commit is contained in:
Andrey Logvin
2021-08-09 08:07:45 +00:00
committed by WebRTC LUCI CQ
parent 63ac8790c6
commit 3754e7c7ad
2 changed files with 39 additions and 13 deletions

View File

@ -1851,21 +1851,17 @@ LibvpxVp9Encoder::ParsePerformanceFlagsFromTrials(
LibvpxVp9Encoder::PerformanceFlags
LibvpxVp9Encoder::GetDefaultPerformanceFlags() {
PerformanceFlags flags;
flags.use_per_layer_speed = true;
flags.use_per_layer_speed = false;
#if defined(WEBRTC_ARCH_ARM) || defined(WEBRTC_ARCH_ARM64) || defined(ANDROID)
// Speed 8 on all layers for all resolutions.
flags.settings_by_resolution[0] = {8, 8, 0};
#else
// For smaller resolutions, use lower speed setting for the temporal base
// layer (get some coding gain at the cost of increased encoding complexity).
// Set encoder Speed 5 for TL0, encoder Speed 8 for upper temporal layers, and
// disable deblocking for upper-most temporal layers.
flags.settings_by_resolution[0] = {5, 8, 1};
// For smaller resolutions, use lower speed setting (get some coding gain at
// the cost of increased encoding complexity).
flags.settings_by_resolution[0] = {5, 5, 0};
// Use speed 7 for QCIF and above.
// Set encoder Speed 7 for TL0, encoder Speed 8 for upper temporal layers, and
// enable deblocking for all temporal layers.
flags.settings_by_resolution[352 * 288] = {7, 8, 0};
flags.settings_by_resolution[352 * 288] = {7, 7, 0};
#endif
return flags;
}

View File

@ -2205,6 +2205,36 @@ GetWrapImageFunction(vpx_image_t* img) {
};
}
TEST(Vp9SpeedSettingsTrialsTest, SvcExtraCfgNotPopulatedByDefault) {
test::ExplicitKeyValueConfig trials("");
// Keep a raw pointer for EXPECT calls and the like. Ownership is otherwise
// passed on to LibvpxVp9Encoder.
auto* const vpx = new NiceMock<MockLibvpxInterface>();
LibvpxVp9Encoder encoder(cricket::VideoCodec(),
absl::WrapUnique<LibvpxInterface>(vpx), trials);
VideoCodec settings = DefaultCodecSettings();
// Configure 3 spatial and three temporal ayers.
ConfigureSvc(settings, 3, 3);
vpx_image_t img;
ON_CALL(*vpx, img_wrap).WillByDefault(GetWrapImageFunction(&img));
ON_CALL(*vpx, codec_enc_config_default)
.WillByDefault(DoAll(WithArg<1>([](vpx_codec_enc_cfg_t* cfg) {
memset(cfg, 0, sizeof(vpx_codec_enc_cfg_t));
}),
Return(VPX_CODEC_OK)));
EXPECT_CALL(*vpx,
codec_control(
_, VP9E_SET_SVC_PARAMETERS,
SafeMatcherCast<vpx_svc_extra_cfg_t*>(AllOf(
Field(&vpx_svc_extra_cfg_t::speed_per_layer, Each(0)),
Field(&vpx_svc_extra_cfg_t::loopfilter_ctrl, Each(0))))));
EXPECT_EQ(WEBRTC_VIDEO_CODEC_OK, encoder.InitEncode(&settings, kSettings));
}
TEST(Vp9SpeedSettingsTrialsTest, NoSvcUsesGlobalSpeedFromTl0InLayerConfig) {
// TL0 speed 8 at >= 480x270, 5 if below that.
test::ExplicitKeyValueConfig trials(
@ -2303,10 +2333,10 @@ TEST(Vp9SpeedSettingsTrialsTest,
EXPECT_EQ(WEBRTC_VIDEO_CODEC_OK, encoder.InitEncode(&settings, kSettings));
}
TEST(Vp9SpeedSettingsTrialsTest, DefaultPerLayerFlagsWithSvc) {
TEST(Vp9SpeedSettingsTrialsTest, PerLayerFlagsWithSvc) {
// Per-temporal and spatial layer speed settings:
// SL0: TL0 = speed 5, TL1/TL2 = speed 8.
// SL1/2: TL0 = speed 7, TL1/TL2 = speed 8.
// SL1/2: TL0 = speed 7, TL1/TL2 = speed 9.
// Deblocking-mode per spatial layer:
// SL0: mode 1, SL1/2: mode 0.
test::ExplicitKeyValueConfig trials(
@ -2314,7 +2344,7 @@ TEST(Vp9SpeedSettingsTrialsTest, DefaultPerLayerFlagsWithSvc) {
"use_per_layer_speed,"
"min_pixel_count:0|129600,"
"base_layer_speed:5|7,"
"high_layer_speed:8|8,"
"high_layer_speed:8|9,"
"deblock_mode:1|0/");
// Keep a raw pointer for EXPECT calls and the like. Ownership is otherwise
@ -2331,7 +2361,7 @@ TEST(Vp9SpeedSettingsTrialsTest, DefaultPerLayerFlagsWithSvc) {
// Speed settings per spatial layer, for TL0.
const int kBaseTlSpeed[VPX_MAX_LAYERS] = {5, 7, 7};
// Speed settings per spatial layer, for TL1, TL2.
const int kHighTlSpeed[VPX_MAX_LAYERS] = {8, 8, 8};
const int kHighTlSpeed[VPX_MAX_LAYERS] = {8, 9, 9};
// Loopfilter settings are handled within libvpx, so this array is valid for
// both TL0 and higher.
const int kLoopFilter[VPX_MAX_LAYERS] = {1, 0, 0};