From 87386826a95fda953162050a27f2506d8c1f3db5 Mon Sep 17 00:00:00 2001 From: Jerome Jiang Date: Tue, 5 Jun 2018 15:21:29 -0700 Subject: [PATCH] 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 --- vp9/encoder/vp9_aq_cyclicrefresh.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/vp9/encoder/vp9_aq_cyclicrefresh.c b/vp9/encoder/vp9_aq_cyclicrefresh.c index 3b4fee7cf..95daadfe2 100644 --- a/vp9/encoder/vp9_aq_cyclicrefresh.c +++ b/vp9/encoder/vp9_aq_cyclicrefresh.c @@ -512,6 +512,8 @@ void vp9_cyclic_refresh_setup(VP9_COMP *const cpi) { 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; @@ -577,9 +579,6 @@ void vp9_cyclic_refresh_setup(VP9_COMP *const cpi) { 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); } -- 2.40.0