[spatial svc]Fix reference issues
authorMinghai Shang <minghai@google.com>
Wed, 23 Jul 2014 20:52:34 +0000 (13:52 -0700)
committerMinghai Shang <minghai@google.com>
Wed, 23 Jul 2014 23:54:14 +0000 (16:54 -0700)
1. Remove last reference flag for first frame upper layers in one pass mode.
2. Disable refresh golden frame flag for key frames.

Change-Id: I44ac1bd2c795169e4fbfdd078ea79a1d33a204d6

vp9/encoder/vp9_encoder.c
vp9/encoder/vp9_ratectrl.c

index b1a5e08..a4226c6 100644 (file)
@@ -131,7 +131,8 @@ static void setup_frame(VP9_COMP *cpi) {
   }
 
   if (cm->frame_type == KEY_FRAME) {
-    cpi->refresh_golden_frame = 1;
+    if (!(cpi->use_svc && cpi->svc.number_temporal_layers == 1))
+      cpi->refresh_golden_frame = 1;
     cpi->refresh_alt_ref_frame = 1;
   } else {
     cm->fc = cm->frame_contexts[cm->frame_context_idx];
@@ -2001,7 +2002,8 @@ static void get_ref_frame_flags(VP9_COMP *cpi) {
   if (cpi->gold_is_last)
     cpi->ref_frame_flags &= ~VP9_GOLD_FLAG;
 
-  if (cpi->rc.frames_till_gf_update_due == INT_MAX)
+  if (cpi->rc.frames_till_gf_update_due == INT_MAX &&
+      !(cpi->use_svc && cpi->svc.number_temporal_layers == 1))
     cpi->ref_frame_flags &= ~VP9_GOLD_FLAG;
 
   if (cpi->alt_is_last)
index f0f9afc..1adbad9 100644 (file)
@@ -1238,6 +1238,7 @@ void vp9_rc_get_svc_params(VP9_COMP *cpi) {
 
     if (cpi->use_svc && cpi->svc.number_temporal_layers == 1) {
       cpi->svc.layer_context[cpi->svc.spatial_layer_id].is_key_frame = 1;
+      cpi->ref_frame_flags &= (~VP9_ALT_FLAG);
     }
 
     if (cpi->pass == 0 && cpi->oxcf.rc_mode == VPX_CBR) {
@@ -1252,7 +1253,10 @@ void vp9_rc_get_svc_params(VP9_COMP *cpi) {
         lc->is_key_frame = 0;
       } else {
         lc->is_key_frame = cpi->svc.layer_context[0].is_key_frame;
+        if (lc->is_key_frame)
+          cpi->ref_frame_flags &= (~VP9_LAST_FLAG);
       }
+      cpi->ref_frame_flags &= (~VP9_ALT_FLAG);
     }
 
     if (cpi->pass == 0 && cpi->oxcf.rc_mode == VPX_CBR) {