ref: 2be0118dc9c7d9ae15b8c0c1a92fc2b8847cca05
parent: 2eba086685d3ccd8959d22b0959c698774769513
author: Marco Paniconi <marpan@google.com>
date: Mon Jul 30 10:32:54 EDT 2018
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
--- a/vp9/encoder/vp9_aq_cyclicrefresh.c
+++ b/vp9/encoder/vp9_aq_cyclicrefresh.c
@@ -523,15 +523,19 @@
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;