shithub: libvpx

Download patch

ref: b8642738c9851232c9bb1e1a22474953d3d367cf
parent: 7c326d7ad06622ad825ced39f78ba3fedca30cbb
author: Marco Paniconi <marpan@google.com>
date: Sat Aug 11 08:59:40 EDT 2018

vp9-svc: Fix to updated SET_SVC_REF_FRAME_CONFIG control

Add flag to separate two cases of bypass (flexible) SVC mode:
usage of using the SET_SVC_REF_FRAME_CONFIG vs passing in the
frame_flags in the vpx_encode (only used for temporal layers).

This fixes failures in Datarate Temporal layer test,
introduced in commit: a66da31

Change-Id: Ie62f933987c20792d1f963d645e98c1903bdd423

--- a/vp9/encoder/vp9_bitstream.c
+++ b/vp9/encoder/vp9_bitstream.c
@@ -913,7 +913,7 @@
       const GF_GROUP *const gf_group = &cpi->twopass.gf_group;
       arf_idx = gf_group->arf_update_idx[gf_group->index];
     }
-    if (cpi->use_svc &&
+    if (cpi->use_svc && cpi->svc.use_set_ref_frame_config &&
         cpi->svc.temporal_layering_mode == VP9E_TEMPORAL_LAYERING_MODE_BYPASS)
       return cpi->svc.update_buffer_slot[cpi->svc.spatial_layer_id];
     return (cpi->refresh_last_frame << cpi->lst_fb_idx) |
--- a/vp9/encoder/vp9_svc_layercontext.c
+++ b/vp9/encoder/vp9_svc_layercontext.c
@@ -44,6 +44,7 @@
   svc->set_intra_only_frame = 0;
   svc->previous_frame_is_intra_only = 0;
   svc->superframe_has_layer_sync = 0;
+  svc->use_set_ref_frame_config = 0;
 
   for (i = 0; i < REF_FRAMES; ++i) {
     svc->fb_idx_spatial_layer_id[i] = -1;
@@ -730,9 +731,9 @@
   } else if (svc->temporal_layering_mode == VP9E_TEMPORAL_LAYERING_MODE_0101) {
     set_flags_and_fb_idx_for_temporal_mode2(cpi);
   } else if (svc->temporal_layering_mode ==
-             VP9E_TEMPORAL_LAYERING_MODE_BYPASS) {
-    if (cpi->ext_refresh_frame_flags_pending == 0)
-      set_flags_and_fb_idx_bypass_via_set_ref_frame_config(cpi);
+                 VP9E_TEMPORAL_LAYERING_MODE_BYPASS &&
+             svc->use_set_ref_frame_config) {
+    set_flags_and_fb_idx_bypass_via_set_ref_frame_config(cpi);
   }
 
   if (cpi->lst_fb_idx == svc->buffer_gf_temporal_ref[0].idx ||
@@ -1148,7 +1149,8 @@
   SVC *const svc = &cpi->svc;
   BufferPool *const pool = cm->buffer_pool;
 
-  if (svc->temporal_layering_mode == VP9E_TEMPORAL_LAYERING_MODE_BYPASS) {
+  if (svc->temporal_layering_mode == VP9E_TEMPORAL_LAYERING_MODE_BYPASS &&
+      svc->use_set_ref_frame_config) {
     vp9_svc_update_ref_frame_bypass_mode(cpi);
   } else if (cm->frame_type == KEY_FRAME) {
     // Keep track of frame index for each reference frame.
--- a/vp9/encoder/vp9_svc_layercontext.h
+++ b/vp9/encoder/vp9_svc_layercontext.h
@@ -167,6 +167,8 @@
   uint8_t superframe_has_layer_sync;
 
   uint8_t fb_idx_base[REF_FRAMES];
+
+  int use_set_ref_frame_config;
 } SVC;
 
 struct VP9_COMP;
--- a/vp9/vp9_cx_iface.c
+++ b/vp9/vp9_cx_iface.c
@@ -1509,6 +1509,7 @@
   VP9_COMP *const cpi = ctx->cpi;
   vpx_svc_ref_frame_config_t *data = va_arg(args, vpx_svc_ref_frame_config_t *);
   int sl;
+  cpi->svc.use_set_ref_frame_config = 1;
   for (sl = 0; sl < cpi->svc.number_spatial_layers; ++sl) {
     cpi->svc.update_buffer_slot[sl] = data->update_buffer_slot[sl];
     cpi->svc.reference_last[sl] = data->reference_last[sl];