Fix to golden update in cyclic_refresh.
authorMarco <marpan@chromium.org>
Mon, 24 Aug 2015 20:00:50 +0000 (13:00 -0700)
committerMarco <marpan@chromium.org>
Fri, 28 Aug 2015 17:22:09 +0000 (10:22 -0700)
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

vp9/encoder/vp9_encoder.c

index d9ecb9a..3cb935f 100644 (file)
@@ -3270,6 +3270,7 @@ static void encode_without_recode_loop(VP9_COMP *cpi,
   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 @@ static void set_ext_overrides(VP9_COMP *cpi) {
     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 @@ static void encode_frame_to_data_rate(VP9_COMP *cpi,
     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;
     }
   }
@@ -3828,6 +3829,8 @@ static void encode_frame_to_data_rate(VP9_COMP *cpi,
     }
   }
 
+  cpi->ext_refresh_frame_flags_pending = 0;
+
   if (cpi->refresh_golden_frame == 1)
     cpi->frame_flags |= FRAMEFLAGS_GOLDEN;
   else