]> granicus.if.org Git - libvpx/commitdiff
vp9: Reset params for cyclic refresh on slide change
authorMarco Paniconi <marpan@google.com>
Fri, 29 Jun 2018 22:34:54 +0000 (15:34 -0700)
committerJerome Jiang <jianj@google.com>
Fri, 29 Jun 2018 23:01:19 +0000 (16:01 -0700)
Reset the last_coded_q_map and the sb->index in the cyclic_refresh
on a re-encode for slide change, so the refresh can start again
right after slide change.

Change-Id: I10cbc8354de8f7c2863b4212e6793b58a048b330

vp9/encoder/vp9_aq_cyclicrefresh.c
vp9/encoder/vp9_encoder.c

index e11c9493266c371f54f69c5e705ca9e3307e5647..d89295bdff2424ec2b686ee2dcbf3a21a79d54e4 100644 (file)
@@ -593,7 +593,8 @@ void vp9_cyclic_refresh_reset_resize(VP9_COMP *const cpi) {
   const VP9_COMMON *const cm = &cpi->common;
   CYCLIC_REFRESH *const cr = cpi->cyclic_refresh;
   memset(cr->map, 0, cm->mi_rows * cm->mi_cols);
-  memset(cr->last_coded_q_map, MAXQ, cm->mi_rows * cm->mi_cols);
+  memset(cr->last_coded_q_map, MAXQ,
+         cm->mi_rows * cm->mi_cols * sizeof(*cr->last_coded_q_map));
   cr->sb_index = 0;
   cpi->refresh_golden_frame = 1;
   cpi->refresh_alt_ref_frame = 1;
index dc2a5a56c62cc01a138e0e5770e56e997bc1a2fc..9761997593727f0e9785714365b97e59bfb0b76d 100644 (file)
@@ -3880,8 +3880,12 @@ static int encode_without_recode_loop(VP9_COMP *cpi, size_t *size,
       suppress_active_map(cpi);
       // Turn-off cyclic refresh for re-encoded frame.
       if (cpi->oxcf.aq_mode == CYCLIC_REFRESH_AQ) {
+        CYCLIC_REFRESH *const cr = cpi->cyclic_refresh;
         unsigned char *const seg_map = cpi->segmentation_map;
         memset(seg_map, 0, cm->mi_rows * cm->mi_cols);
+        memset(cr->last_coded_q_map, MAXQ,
+               cm->mi_rows * cm->mi_cols * sizeof(*cr->last_coded_q_map));
+        cr->sb_index = 0;
         vp9_disable_segmentation(&cm->seg);
       }
       apply_active_map(cpi);