From: Marco Paniconi Date: Mon, 30 Jul 2018 21:32:54 +0000 (-0700) Subject: vp9: Add scene change detection flag to cyclic refresh setup X-Git-Tag: v1.8.0~472^2 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=2be0118dc9c7d9ae15b8c0c1a92fc2b8847cca05;p=libvpx vp9: Add scene change detection flag to cyclic refresh setup Disable cyclic refresh on slide/scene change frame. It was already disabled on the re-encode for the slide change, but this change makes sure its always disabled on a detected slide change (which may not be re-encoded at high Q). Change-Id: I1195c855bca25985d4d41e5b657adf124e901760 --- diff --git a/vp9/encoder/vp9_aq_cyclicrefresh.c b/vp9/encoder/vp9_aq_cyclicrefresh.c index 9f7be4f13..aecc565c1 100644 --- a/vp9/encoder/vp9_aq_cyclicrefresh.c +++ b/vp9/encoder/vp9_aq_cyclicrefresh.c @@ -523,15 +523,19 @@ void vp9_cyclic_refresh_setup(VP9_COMP *const cpi) { const RATE_CONTROL *const rc = &cpi->rc; CYCLIC_REFRESH *const cr = cpi->cyclic_refresh; struct segmentation *const seg = &cm->seg; + int scene_change_detected = + cpi->rc.high_source_sad || + (cpi->use_svc && cpi->svc.high_source_sad_superframe); 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)) { + if (!cr->apply_cyclic_refresh || (cpi->force_update_segmentation) || + scene_change_detected) { // Set segmentation map to 0 and disable. unsigned char *const seg_map = cpi->segmentation_map; memset(seg_map, 0, cm->mi_rows * cm->mi_cols); vp9_disable_segmentation(&cm->seg); - if (cm->frame_type == KEY_FRAME) { + if (cm->frame_type == KEY_FRAME || scene_change_detected) { memset(cr->last_coded_q_map, MAXQ, cm->mi_rows * cm->mi_cols * sizeof(*cr->last_coded_q_map)); cr->sb_index = 0;