shithub: libvpx

Download patch

ref: 8a05413b0be0243acb13e0263d964434019e07b8
parent: b8794de05bc91a9e27425f5d5564347f06c686af
author: Jerome Jiang <jianj@google.com>
date: Wed Mar 13 05:13:35 EDT 2019

vp9 simulcast: update buffer slot flag used in API.

Also add #spatial_layers > 1 to simulcast_mode

Change-Id: I6234da81801176ac8678f9f5e1323f8b289cb663

--- a/vp9/encoder/vp9_svc_layercontext.c
+++ b/vp9/encoder/vp9_svc_layercontext.c
@@ -732,6 +732,27 @@
         svc->update_buffer_slot[sl] |= (1 << ref);
     }
   }
+
+  if (svc->simulcast_mode && cpi->common.frame_type == KEY_FRAME) {
+    const int index = svc->number_spatial_layers == 3 ? sl - 1 : sl;
+    const int ltf = svc->buffer_gf_temporal_ref[index].idx;
+    if (svc->number_spatial_layers == 2) {
+      if (sl == 0)
+        svc->update_buffer_slot[sl] = 1 + 4;  // 0, 2
+      else if (sl == 1)
+        svc->update_buffer_slot[sl] = 2 + 8;  // 1, 3
+    } else if (svc->number_spatial_layers == 3) {
+      if (sl == 0)
+        svc->update_buffer_slot[sl] = 1 + 8;  // 0, 3
+      else if (sl == 1)
+        svc->update_buffer_slot[sl] = 2 + 16;  // 1, 4
+      else if (sl == 2)
+        svc->update_buffer_slot[sl] = 4 + 32;  // 2, 5
+    }
+    if (svc->use_gf_temporal_ref_current_layer)
+      svc->update_buffer_slot[sl] += (1 << ltf);
+  }
+
   // TODO(jianj): Remove these 3, deprecated.
   svc->update_last[sl] = (uint8_t)cpi->refresh_last_frame;
   svc->update_golden[sl] = (uint8_t)cpi->refresh_golden_frame;
@@ -752,7 +773,8 @@
   svc->skip_enhancement_layer = 0;
 
   if (svc->disable_inter_layer_pred == INTER_LAYER_PRED_OFF &&
-      svc->number_spatial_layers <= 3 && svc->number_temporal_layers <= 3 &&
+      svc->number_spatial_layers > 1 && svc->number_spatial_layers <= 3 &&
+      svc->number_temporal_layers <= 3 &&
       !(svc->temporal_layering_mode == VP9E_TEMPORAL_LAYERING_MODE_BYPASS &&
         svc->use_set_ref_frame_config))
     svc->simulcast_mode = 1;