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

This is a reland of 99fb5945b9c278cf33ef434ebacd5dfb9bde865d

Downstream project has been fixed.

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}

Bug: webrtc:11551
Change-Id: I23a87408f1a9df3a9ccb874698ff97f59cfbe791
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/228280
Commit-Queue: Michael Horowitz <mhoro@google.com>
Reviewed-by: Erik Språng <sprang@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#34688}
diff --git a/modules/video_coding/codecs/vp9/libvpx_vp9_encoder.cc b/modules/video_coding/codecs/vp9/libvpx_vp9_encoder.cc
index 2c1aa22..525fbe8 100644
--- a/modules/video_coding/codecs/vp9/libvpx_vp9_encoder.cc
+++ b/modules/video_coding/codecs/vp9/libvpx_vp9_encoder.cc
@@ -1851,17 +1851,21 @@
 LibvpxVp9Encoder::PerformanceFlags
 LibvpxVp9Encoder::GetDefaultPerformanceFlags() {
   PerformanceFlags flags;
-  flags.use_per_layer_speed = false;
+  flags.use_per_layer_speed = true;
 #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 (get some coding gain at
-  // the cost of increased encoding complexity).
-  flags.settings_by_resolution[0] = {5, 5, 0};
+  // 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};
 
   // Use speed 7 for QCIF and above.
-  flags.settings_by_resolution[352 * 288] = {7, 7, 0};
+  // 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};
 #endif
   return flags;
 }
diff --git a/modules/video_coding/codecs/vp9/test/vp9_impl_unittest.cc b/modules/video_coding/codecs/vp9/test/vp9_impl_unittest.cc
index ca669dcb..9de76a3 100644
--- a/modules/video_coding/codecs/vp9/test/vp9_impl_unittest.cc
+++ b/modules/video_coding/codecs/vp9/test/vp9_impl_unittest.cc
@@ -2205,36 +2205,6 @@
   };
 }
 
-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(
@@ -2333,10 +2303,10 @@
   EXPECT_EQ(WEBRTC_VIDEO_CODEC_OK, encoder.InitEncode(&settings, kSettings));
 }
 
-TEST(Vp9SpeedSettingsTrialsTest, PerLayerFlagsWithSvc) {
+TEST(Vp9SpeedSettingsTrialsTest, DefaultPerLayerFlagsWithSvc) {
   // Per-temporal and spatial layer speed settings:
   // SL0:   TL0 = speed 5, TL1/TL2 = speed 8.
-  // SL1/2: TL0 = speed 7, TL1/TL2 = speed 9.
+  // SL1/2: TL0 = speed 7, TL1/TL2 = speed 8.
   // Deblocking-mode per spatial layer:
   // SL0: mode 1, SL1/2: mode 0.
   test::ExplicitKeyValueConfig trials(
@@ -2344,7 +2314,7 @@
       "use_per_layer_speed,"
       "min_pixel_count:0|129600,"
       "base_layer_speed:5|7,"
-      "high_layer_speed:8|9,"
+      "high_layer_speed:8|8,"
       "deblock_mode:1|0/");
 
   // Keep a raw pointer for EXPECT calls and the like. Ownership is otherwise
@@ -2361,7 +2331,7 @@
   // 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, 9, 9};
+  const int kHighTlSpeed[VPX_MAX_LAYERS] = {8, 8, 8};
   // 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};