Fix dependency templates for VP8 3 temporal layers

Bug: None
Change-Id: I3c34fb949ba73c32cd36375aa5b96eeb1c11fc42
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/169730
Commit-Queue: Danil Chapovalov <danilchap@webrtc.org>
Reviewed-by: Philip Eliasson <philipel@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#30692}
diff --git a/modules/video_coding/codecs/vp8/default_temporal_layers.cc b/modules/video_coding/codecs/vp8/default_temporal_layers.cc
index 8322e8d..83ea450 100644
--- a/modules/video_coding/codecs/vp8/default_temporal_layers.cc
+++ b/modules/video_coding/codecs/vp8/default_temporal_layers.cc
@@ -164,6 +164,12 @@
         // TL1  references 'last' and references and updates 'golden'.
         // TL2 references both 'last' & 'golden' and references and updates
         // 'arf'.
+        //     2-------2       2-------2       2
+        //    /     __/       /     __/       /
+        //   /   __1         /   __1         /
+        //  /___/           /___/           /
+        // 0---------------0---------------0-----
+        // 0   1   2   3   4   5   6   7   8   9 ...
         return {{"SSS", {kReferenceAndUpdate, kNone, kNone}},
                 {"--S", {kReference, kNone, kUpdate}},
                 {"-DR", {kReference, kUpdate, kNone}},
@@ -174,6 +180,12 @@
         // TL0 also references and updates the 'last' buffer.
         // TL1 also references 'last' and references and updates 'golden'.
         // TL2 references both 'last' and 'golden' but updates no buffer.
+        //     2     __2  _____2     __2       2
+        //    /     /____/    /     /         /
+        //   /     1---------/-----1         /
+        //  /_____/         /_____/         /
+        // 0---------------0---------------0-----
+        // 0   1   2   3   4   5   6   7   8   9 ...
         return {{"SSS", {kReferenceAndUpdate, kNone, kNone}},
                 {"--D", {kReference, kNone, kNone, kFreezeEntropy}},
                 {"-SS", {kReference, kUpdate, kNone}},
@@ -616,15 +628,25 @@
       return template_structure;
     }
     case 3: {
-      template_structure.templates = {
-          Builder().T(0).Dtis("SSS").Build(),
-          Builder().T(0).Dtis("SSS").Fdiffs({4}).Build(),
-          Builder().T(0).Dtis("SRR").Fdiffs({4}).Build(),
-          Builder().T(1).Dtis("-SR").Fdiffs({2}).Build(),
-          Builder().T(1).Dtis("-DR").Fdiffs({2, 4}).Build(),
-          Builder().T(2).Dtis("--D").Fdiffs({1}).Build(),
-          Builder().T(2).Dtis("--D").Fdiffs({1, 3}).Build(),
-      };
+      if (field_trial::IsEnabled("WebRTC-UseShortVP8TL3Pattern")) {
+        template_structure.templates = {
+            Builder().T(0).Dtis("SSS").Build(),
+            Builder().T(0).Dtis("SSS").Fdiffs({4}).Build(),
+            Builder().T(1).Dtis("-DR").Fdiffs({2}).Build(),
+            Builder().T(2).Dtis("--S").Fdiffs({1}).Build(),
+            Builder().T(2).Dtis("--D").Fdiffs({1, 2}).Build(),
+        };
+      } else {
+        template_structure.templates = {
+            Builder().T(0).Dtis("SSS").Build(),
+            Builder().T(0).Dtis("SSS").Fdiffs({4}).Build(),
+            Builder().T(0).Dtis("SRR").Fdiffs({4}).Build(),
+            Builder().T(1).Dtis("-SS").Fdiffs({2}).Build(),
+            Builder().T(1).Dtis("-DS").Fdiffs({2, 4}).Build(),
+            Builder().T(2).Dtis("--D").Fdiffs({1}).Build(),
+            Builder().T(2).Dtis("--D").Fdiffs({1, 3}).Build(),
+        };
+      }
       return template_structure;
     }
     case 4: {