shithub: libvpx

Download patch

ref: bc0a97431072afdad009930c186a71c129bdea2c
parent: 6201a256f48c7fccbe2c1f7778ad75b0693ac6d9
author: Marco <marpan@chromium.org>
date: Mon Aug 24 09:00:50 EDT 2015

Fix to golden update in cyclic_refresh.

For one pass CBR: only check for updating refresh_golden
if ext_refresh_frame_flags_pending is not set (i.e., == 0).
And move the resetting of ext_refresh_frame_flags_pending = 0
down to after the encode_loop (and account for dropped frames).

This is to prevent changing refresh_golden flga when the user
supplies the reference/update flags.

Change-Id: I4d87b3e705ba43f243667e367503b585c61e2a54

--- a/vp9/encoder/vp9_encoder.c
+++ b/vp9/encoder/vp9_encoder.c
@@ -3270,6 +3270,7 @@
   if (cpi->oxcf.aq_mode == CYCLIC_REFRESH_AQ &&
       cm->frame_type != KEY_FRAME &&
       !cpi->use_svc &&
+      cpi->ext_refresh_frame_flags_pending == 0 &&
       (cpi->oxcf.pass == 0 && cpi->oxcf.rc_mode == VPX_CBR))
     vp9_cyclic_refresh_check_golden_update(cpi);
 
@@ -3578,7 +3579,6 @@
     cpi->refresh_last_frame = cpi->ext_refresh_last_frame;
     cpi->refresh_golden_frame = cpi->ext_refresh_golden_frame;
     cpi->refresh_alt_ref_frame = cpi->ext_refresh_alt_ref_frame;
-    cpi->ext_refresh_frame_flags_pending = 0;
   }
 }
 
@@ -3747,6 +3747,7 @@
     if (vp9_rc_drop_frame(cpi)) {
       vp9_rc_postencode_update_drop_frame(cpi);
       ++cm->current_video_frame;
+      cpi->ext_refresh_frame_flags_pending = 0;
       return;
     }
   }
@@ -3827,6 +3828,8 @@
       vp9_adapt_mv_probs(cm, cm->allow_high_precision_mv);
     }
   }
+
+  cpi->ext_refresh_frame_flags_pending = 0;
 
   if (cpi->refresh_golden_frame == 1)
     cpi->frame_flags |= FRAMEFLAGS_GOLDEN;