shithub: libvpx

Download patch

ref: 87386826a95fda953162050a27f2506d8c1f3db5
parent: d5bd2809f1eaf93203f8bad385f2b02fd03b01e7
author: Jerome Jiang <jianj@google.com>
date: Tue Jun 5 11:21:29 EDT 2018

vp9: Move up reset of cyclic refresh under dynamic resize.

When resize happens and cyclic refresh is not applied on the
current (resized) frame, the sb_index is not reset and then
might be out of boundary on future frames when the
cyclic refresh is applied.

Change-Id: I05282fc4bc2323522d60e019ed0790d69221a2f7

--- a/vp9/encoder/vp9_aq_cyclicrefresh.c
+++ b/vp9/encoder/vp9_aq_cyclicrefresh.c
@@ -512,6 +512,8 @@
   CYCLIC_REFRESH *const cr = cpi->cyclic_refresh;
   struct segmentation *const seg = &cm->seg;
   if (cm->current_video_frame == 0) cr->low_content_avg = 0.0;
+  // Reset if resoluton change has occurred.
+  if (cpi->resize_pending != 0) vp9_cyclic_refresh_reset_resize(cpi);
   if (!cr->apply_cyclic_refresh || (cpi->force_update_segmentation)) {
     // Set segmentation map to 0 and disable.
     unsigned char *const seg_map = cpi->segmentation_map;
@@ -576,9 +578,6 @@
                0.1 * cr->rate_boost_fac * cr->rate_ratio_qdelta));
     cr->qindex_delta[2] = qindex_delta;
     vp9_set_segdata(seg, CR_SEGMENT_ID_BOOST2, SEG_LVL_ALT_Q, qindex_delta);
-
-    // Reset if resoluton change has occurred.
-    if (cpi->resize_pending != 0) vp9_cyclic_refresh_reset_resize(cpi);
 
     // Update the segmentation and refresh map.
     cyclic_refresh_update_map(cpi);