]> granicus.if.org Git - libvpx/commitdiff
vp9: Add scene change detection flag to cyclic refresh setup
authorMarco Paniconi <marpan@google.com>
Mon, 30 Jul 2018 21:32:54 +0000 (14:32 -0700)
committerMarco Paniconi <marpan@google.com>
Tue, 31 Jul 2018 02:08:37 +0000 (19:08 -0700)
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

vp9/encoder/vp9_aq_cyclicrefresh.c

index 9f7be4f13ab5d21349d47e2656e6f636e22e5828..aecc565c16e8bad053ed7a69116ae82c1d4d8d1a 100644 (file)
@@ -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;