2014-03-14 22:35:47 +01:00
|
|
|
/*
|
|
|
|
* Copyright (c) 2014 The WebM project authors. All Rights Reserved.
|
|
|
|
*
|
|
|
|
* Use of this source code is governed by a BSD-style license
|
|
|
|
* that can be found in the LICENSE file in the root of the source
|
|
|
|
* tree. An additional intellectual property rights grant can be found
|
|
|
|
* in the file PATENTS. All contributing project authors may
|
|
|
|
* be found in the AUTHORS file in the root of the source tree.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <limits.h>
|
|
|
|
#include <math.h>
|
|
|
|
|
2015-08-31 23:36:35 +02:00
|
|
|
#include "vpx_dsp/vpx_dsp_common.h"
|
2015-08-10 20:28:04 +02:00
|
|
|
#include "vpx_ports/system_state.h"
|
|
|
|
|
2014-03-21 22:31:53 +01:00
|
|
|
#include "vp9/encoder/vp9_aq_cyclicrefresh.h"
|
2014-03-14 22:35:47 +01:00
|
|
|
|
|
|
|
#include "vp9/common/vp9_seg_common.h"
|
|
|
|
|
|
|
|
#include "vp9/encoder/vp9_ratectrl.h"
|
|
|
|
#include "vp9/encoder/vp9_segmentation.h"
|
|
|
|
|
2014-03-26 19:00:35 +01:00
|
|
|
CYCLIC_REFRESH *vp9_cyclic_refresh_alloc(int mi_rows, int mi_cols) {
|
2015-06-19 01:05:56 +02:00
|
|
|
size_t last_coded_q_map_size;
|
2014-03-26 19:00:35 +01:00
|
|
|
CYCLIC_REFRESH *const cr = vpx_calloc(1, sizeof(*cr));
|
2016-07-27 05:43:23 +02:00
|
|
|
if (cr == NULL) return NULL;
|
2014-03-26 19:00:35 +01:00
|
|
|
|
|
|
|
cr->map = vpx_calloc(mi_rows * mi_cols, sizeof(*cr->map));
|
|
|
|
if (cr->map == NULL) {
|
2016-02-17 21:36:49 +01:00
|
|
|
vp9_cyclic_refresh_free(cr);
|
2014-03-26 19:00:35 +01:00
|
|
|
return NULL;
|
|
|
|
}
|
2015-06-19 01:05:56 +02:00
|
|
|
last_coded_q_map_size = mi_rows * mi_cols * sizeof(*cr->last_coded_q_map);
|
|
|
|
cr->last_coded_q_map = vpx_malloc(last_coded_q_map_size);
|
|
|
|
if (cr->last_coded_q_map == NULL) {
|
2016-02-17 21:36:49 +01:00
|
|
|
vp9_cyclic_refresh_free(cr);
|
2015-06-19 01:05:56 +02:00
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
assert(MAXQ <= 255);
|
|
|
|
memset(cr->last_coded_q_map, MAXQ, last_coded_q_map_size);
|
2014-03-26 19:00:35 +01:00
|
|
|
return cr;
|
|
|
|
}
|
|
|
|
|
|
|
|
void vp9_cyclic_refresh_free(CYCLIC_REFRESH *cr) {
|
|
|
|
vpx_free(cr->map);
|
2015-06-19 01:05:56 +02:00
|
|
|
vpx_free(cr->last_coded_q_map);
|
2014-03-26 19:00:35 +01:00
|
|
|
vpx_free(cr);
|
|
|
|
}
|
2014-03-14 22:35:47 +01:00
|
|
|
|
|
|
|
// Check if this coding block, of size bsize, should be considered for refresh
|
|
|
|
// (lower-qp coding). Decision can be based on various factors, such as
|
|
|
|
// size of the coding block (i.e., below min_block size rejected), coding
|
|
|
|
// mode, and rate/distortion.
|
2016-07-27 05:43:23 +02:00
|
|
|
static int candidate_refresh_aq(const CYCLIC_REFRESH *cr, const MODE_INFO *mi,
|
|
|
|
int64_t rate, int64_t dist, int bsize) {
|
2016-01-20 01:40:20 +01:00
|
|
|
MV mv = mi->mv[0].as_mv;
|
2015-01-28 20:34:24 +01:00
|
|
|
// Reject the block for lower-qp coding if projected distortion
|
2015-01-22 01:09:13 +01:00
|
|
|
// is above the threshold, and any of the following is true:
|
|
|
|
// 1) mode uses large mv
|
|
|
|
// 2) mode is an intra-mode
|
2015-01-28 20:34:24 +01:00
|
|
|
// Otherwise accept for refresh.
|
|
|
|
if (dist > cr->thresh_dist_sb &&
|
|
|
|
(mv.row > cr->motion_thresh || mv.row < -cr->motion_thresh ||
|
|
|
|
mv.col > cr->motion_thresh || mv.col < -cr->motion_thresh ||
|
2016-01-20 01:40:20 +01:00
|
|
|
!is_inter_block(mi)))
|
2015-01-28 20:34:24 +01:00
|
|
|
return CR_SEGMENT_ID_BASE;
|
2016-07-27 05:43:23 +02:00
|
|
|
else if (bsize >= BLOCK_16X16 && rate < cr->thresh_rate_sb &&
|
|
|
|
is_inter_block(mi) && mi->mv[0].as_int == 0 &&
|
|
|
|
cr->rate_boost_fac > 10)
|
2015-01-28 20:34:24 +01:00
|
|
|
// More aggressive delta-q for bigger blocks with zero motion.
|
|
|
|
return CR_SEGMENT_ID_BOOST2;
|
2015-01-22 01:09:13 +01:00
|
|
|
else
|
2015-01-28 20:34:24 +01:00
|
|
|
return CR_SEGMENT_ID_BOOST1;
|
2014-03-14 22:35:47 +01:00
|
|
|
}
|
|
|
|
|
2014-04-03 03:37:04 +02:00
|
|
|
// Compute delta-q for the segment.
|
2015-01-28 20:34:24 +01:00
|
|
|
static int compute_deltaq(const VP9_COMP *cpi, int q, double rate_factor) {
|
2014-04-03 03:37:04 +02:00
|
|
|
const CYCLIC_REFRESH *const cr = cpi->cyclic_refresh;
|
|
|
|
const RATE_CONTROL *const rc = &cpi->rc;
|
2016-07-27 05:43:23 +02:00
|
|
|
int deltaq = vp9_compute_qdelta_by_rate(rc, cpi->common.frame_type, q,
|
|
|
|
rate_factor, cpi->common.bit_depth);
|
2014-04-03 03:37:04 +02:00
|
|
|
if ((-deltaq) > cr->max_qdelta_perc * q / 100) {
|
|
|
|
deltaq = -cr->max_qdelta_perc * q / 100;
|
|
|
|
}
|
|
|
|
return deltaq;
|
|
|
|
}
|
|
|
|
|
|
|
|
// For the just encoded frame, estimate the bits, incorporating the delta-q
|
2015-01-28 20:34:24 +01:00
|
|
|
// from non-base segment. For now ignore effect of multiple segments
|
|
|
|
// (with different delta-q). Note this function is called in the postencode
|
|
|
|
// (called from rc_update_rate_correction_factors()).
|
2014-04-03 03:37:04 +02:00
|
|
|
int vp9_cyclic_refresh_estimate_bits_at_q(const VP9_COMP *cpi,
|
|
|
|
double correction_factor) {
|
|
|
|
const VP9_COMMON *const cm = &cpi->common;
|
|
|
|
const CYCLIC_REFRESH *const cr = cpi->cyclic_refresh;
|
|
|
|
int estimated_bits;
|
|
|
|
int mbs = cm->MBs;
|
|
|
|
int num8x8bl = mbs << 2;
|
2015-01-28 20:34:24 +01:00
|
|
|
// Weight for non-base segments: use actual number of blocks refreshed in
|
2014-04-03 03:37:04 +02:00
|
|
|
// previous/just encoded frame. Note number of blocks here is in 8x8 units.
|
2015-03-10 23:16:10 +01:00
|
|
|
double weight_segment1 = (double)cr->actual_num_seg1_blocks / num8x8bl;
|
|
|
|
double weight_segment2 = (double)cr->actual_num_seg2_blocks / num8x8bl;
|
2014-04-03 03:37:04 +02:00
|
|
|
// Take segment weighted average for estimated bits.
|
2016-07-27 05:43:23 +02:00
|
|
|
estimated_bits =
|
|
|
|
(int)((1.0 - weight_segment1 - weight_segment2) *
|
|
|
|
vp9_estimate_bits_at_q(cm->frame_type, cm->base_qindex, mbs,
|
|
|
|
correction_factor, cm->bit_depth) +
|
|
|
|
weight_segment1 *
|
|
|
|
vp9_estimate_bits_at_q(cm->frame_type,
|
|
|
|
cm->base_qindex + cr->qindex_delta[1],
|
|
|
|
mbs, correction_factor, cm->bit_depth) +
|
|
|
|
weight_segment2 *
|
|
|
|
vp9_estimate_bits_at_q(cm->frame_type,
|
|
|
|
cm->base_qindex + cr->qindex_delta[2],
|
|
|
|
mbs, correction_factor, cm->bit_depth));
|
2014-04-03 03:37:04 +02:00
|
|
|
return estimated_bits;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Prior to encoding the frame, estimate the bits per mb, for a given q = i and
|
|
|
|
// a corresponding delta-q (for segment 1). This function is called in the
|
|
|
|
// rc_regulate_q() to set the base qp index.
|
2015-01-28 20:34:24 +01:00
|
|
|
// Note: the segment map is set to either 0/CR_SEGMENT_ID_BASE (no refresh) or
|
|
|
|
// to 1/CR_SEGMENT_ID_BOOST1 (refresh) for each superblock, prior to encoding.
|
2014-04-03 03:37:04 +02:00
|
|
|
int vp9_cyclic_refresh_rc_bits_per_mb(const VP9_COMP *cpi, int i,
|
|
|
|
double correction_factor) {
|
|
|
|
const VP9_COMMON *const cm = &cpi->common;
|
|
|
|
CYCLIC_REFRESH *const cr = cpi->cyclic_refresh;
|
|
|
|
int bits_per_mb;
|
2017-02-15 18:18:34 +01:00
|
|
|
int deltaq = 0;
|
|
|
|
if (cpi->oxcf.speed < 8)
|
|
|
|
deltaq = compute_deltaq(cpi, i, cr->rate_ratio_qdelta);
|
|
|
|
else
|
|
|
|
deltaq = -(cr->max_qdelta_perc * i) / 200;
|
2014-04-03 03:37:04 +02:00
|
|
|
// Take segment weighted average for bits per mb.
|
2017-02-15 22:51:14 +01:00
|
|
|
bits_per_mb = (int)((1.0 - cr->weight_segment) *
|
2016-07-27 05:43:23 +02:00
|
|
|
vp9_rc_bits_per_mb(cm->frame_type, i,
|
|
|
|
correction_factor, cm->bit_depth) +
|
2017-02-15 22:51:14 +01:00
|
|
|
cr->weight_segment *
|
2016-07-27 05:43:23 +02:00
|
|
|
vp9_rc_bits_per_mb(cm->frame_type, i + deltaq,
|
|
|
|
correction_factor, cm->bit_depth));
|
2014-04-03 03:37:04 +02:00
|
|
|
return bits_per_mb;
|
|
|
|
}
|
|
|
|
|
2014-03-14 22:35:47 +01:00
|
|
|
// Prior to coding a given prediction block, of size bsize at (mi_row, mi_col),
|
|
|
|
// check if we should reset the segment_id, and update the cyclic_refresh map
|
|
|
|
// and segmentation map.
|
2016-07-27 05:43:23 +02:00
|
|
|
void vp9_cyclic_refresh_update_segment(VP9_COMP *const cpi, MODE_INFO *const mi,
|
|
|
|
int mi_row, int mi_col, BLOCK_SIZE bsize,
|
|
|
|
int64_t rate, int64_t dist, int skip,
|
2015-12-21 19:35:05 +01:00
|
|
|
struct macroblock_plane *const p) {
|
2014-03-24 18:48:14 +01:00
|
|
|
const VP9_COMMON *const cm = &cpi->common;
|
2014-03-26 19:00:35 +01:00
|
|
|
CYCLIC_REFRESH *const cr = cpi->cyclic_refresh;
|
2014-03-14 22:35:47 +01:00
|
|
|
const int bw = num_8x8_blocks_wide_lookup[bsize];
|
|
|
|
const int bh = num_8x8_blocks_high_lookup[bsize];
|
2015-08-18 03:19:22 +02:00
|
|
|
const int xmis = VPXMIN(cm->mi_cols - mi_col, bw);
|
|
|
|
const int ymis = VPXMIN(cm->mi_rows - mi_row, bh);
|
2014-03-14 22:35:47 +01:00
|
|
|
const int block_index = mi_row * cm->mi_cols + mi_col;
|
2016-01-20 01:40:20 +01:00
|
|
|
int refresh_this_block = candidate_refresh_aq(cr, mi, rate, dist, bsize);
|
2014-03-14 22:35:47 +01:00
|
|
|
// Default is to not update the refresh map.
|
|
|
|
int new_map_value = cr->map[block_index];
|
2016-07-27 05:43:23 +02:00
|
|
|
int x = 0;
|
|
|
|
int y = 0;
|
2014-03-24 18:48:14 +01:00
|
|
|
|
2015-12-21 19:35:05 +01:00
|
|
|
int is_skin = 0;
|
2016-07-27 05:43:23 +02:00
|
|
|
if (refresh_this_block == 0 && bsize <= BLOCK_16X16 &&
|
2016-02-01 20:52:49 +01:00
|
|
|
cpi->use_skin_detection) {
|
2016-07-27 05:43:23 +02:00
|
|
|
is_skin =
|
|
|
|
vp9_compute_skin_block(p[0].src.buf, p[1].src.buf, p[2].src.buf,
|
|
|
|
p[0].src.stride, p[1].src.stride, bsize, 0, 0);
|
|
|
|
if (is_skin) refresh_this_block = 1;
|
2015-12-21 19:35:05 +01:00
|
|
|
}
|
|
|
|
|
2016-02-12 19:29:26 +01:00
|
|
|
if (cpi->oxcf.rc_mode == VPX_VBR && mi->ref_frame[0] == GOLDEN_FRAME)
|
|
|
|
refresh_this_block = 0;
|
|
|
|
|
2015-01-28 20:34:24 +01:00
|
|
|
// If this block is labeled for refresh, check if we should reset the
|
|
|
|
// segment_id.
|
2016-01-20 01:40:20 +01:00
|
|
|
if (cyclic_refresh_segment_id_boosted(mi->segment_id)) {
|
|
|
|
mi->segment_id = refresh_this_block;
|
2015-09-30 00:38:49 +02:00
|
|
|
// Reset segment_id if it will be skipped.
|
2016-07-27 05:43:23 +02:00
|
|
|
if (skip) mi->segment_id = CR_SEGMENT_ID_BASE;
|
2015-03-10 23:16:10 +01:00
|
|
|
}
|
2014-03-14 22:35:47 +01:00
|
|
|
|
|
|
|
// Update the cyclic refresh map, to be used for setting segmentation map
|
|
|
|
// for the next frame. If the block will be refreshed this frame, mark it
|
|
|
|
// as clean. The magnitude of the -ve influences how long before we consider
|
|
|
|
// it for refresh again.
|
2016-01-20 01:40:20 +01:00
|
|
|
if (cyclic_refresh_segment_id_boosted(mi->segment_id)) {
|
2014-03-14 22:35:47 +01:00
|
|
|
new_map_value = -cr->time_for_refresh;
|
|
|
|
} else if (refresh_this_block) {
|
|
|
|
// Else if it is accepted as candidate for refresh, and has not already
|
|
|
|
// been refreshed (marked as 1) then mark it as a candidate for cleanup
|
|
|
|
// for future time (marked as 0), otherwise don't update it.
|
2016-07-27 05:43:23 +02:00
|
|
|
if (cr->map[block_index] == 1) new_map_value = 0;
|
2014-03-14 22:35:47 +01:00
|
|
|
} else {
|
|
|
|
// Leave it marked as block that is not candidate for refresh.
|
|
|
|
new_map_value = 1;
|
|
|
|
}
|
2014-11-04 23:32:04 +01:00
|
|
|
|
2014-03-14 22:35:47 +01:00
|
|
|
// Update entries in the cyclic refresh map with new_map_value, and
|
|
|
|
// copy mbmi->segment_id into global segmentation map.
|
|
|
|
for (y = 0; y < ymis; y++)
|
|
|
|
for (x = 0; x < xmis; x++) {
|
2015-06-19 01:05:56 +02:00
|
|
|
int map_offset = block_index + y * cm->mi_cols + x;
|
|
|
|
cr->map[map_offset] = new_map_value;
|
2016-01-20 01:40:20 +01:00
|
|
|
cpi->segmentation_map[map_offset] = mi->segment_id;
|
2015-06-23 17:34:06 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void vp9_cyclic_refresh_update_sb_postencode(VP9_COMP *const cpi,
|
2016-01-20 01:40:20 +01:00
|
|
|
const MODE_INFO *const mi,
|
2015-06-23 17:34:06 +02:00
|
|
|
int mi_row, int mi_col,
|
|
|
|
BLOCK_SIZE bsize) {
|
|
|
|
const VP9_COMMON *const cm = &cpi->common;
|
|
|
|
CYCLIC_REFRESH *const cr = cpi->cyclic_refresh;
|
|
|
|
const int bw = num_8x8_blocks_wide_lookup[bsize];
|
|
|
|
const int bh = num_8x8_blocks_high_lookup[bsize];
|
|
|
|
const int xmis = VPXMIN(cm->mi_cols - mi_col, bw);
|
|
|
|
const int ymis = VPXMIN(cm->mi_rows - mi_row, bh);
|
|
|
|
const int block_index = mi_row * cm->mi_cols + mi_col;
|
|
|
|
int x, y;
|
|
|
|
for (y = 0; y < ymis; y++)
|
|
|
|
for (x = 0; x < xmis; x++) {
|
|
|
|
int map_offset = block_index + y * cm->mi_cols + x;
|
2015-06-19 01:05:56 +02:00
|
|
|
// Inter skip blocks were clearly not coded at the current qindex, so
|
|
|
|
// don't update the map for them. For cases where motion is non-zero or
|
|
|
|
// the reference frame isn't the previous frame, the previous value in
|
|
|
|
// the map for this spatial location is not entirely correct.
|
2016-01-20 01:40:20 +01:00
|
|
|
if ((!is_inter_block(mi) || !mi->skip) &&
|
|
|
|
mi->segment_id <= CR_SEGMENT_ID_BOOST2) {
|
2016-07-27 05:43:23 +02:00
|
|
|
cr->last_coded_q_map[map_offset] =
|
|
|
|
clamp(cm->base_qindex + cr->qindex_delta[mi->segment_id], 0, MAXQ);
|
2016-01-20 01:40:20 +01:00
|
|
|
} else if (is_inter_block(mi) && mi->skip &&
|
|
|
|
mi->segment_id <= CR_SEGMENT_ID_BOOST2) {
|
2015-09-03 23:53:40 +02:00
|
|
|
cr->last_coded_q_map[map_offset] = VPXMIN(
|
2016-07-27 05:43:23 +02:00
|
|
|
clamp(cm->base_qindex + cr->qindex_delta[mi->segment_id], 0, MAXQ),
|
2015-09-03 23:53:40 +02:00
|
|
|
cr->last_coded_q_map[map_offset]);
|
|
|
|
}
|
2014-03-14 22:35:47 +01:00
|
|
|
}
|
2014-04-03 03:37:04 +02:00
|
|
|
}
|
|
|
|
|
2017-03-30 01:57:53 +02:00
|
|
|
// From the just encoded frame: update the actual number of blocks that were
|
|
|
|
// applied the segment delta q, and the amount of low motion in the frame.
|
|
|
|
// Also check conditions for forcing golden update, or preventing golden
|
|
|
|
// update if the period is up.
|
2015-03-06 02:26:52 +01:00
|
|
|
void vp9_cyclic_refresh_postencode(VP9_COMP *const cpi) {
|
2014-04-03 03:37:04 +02:00
|
|
|
VP9_COMMON *const cm = &cpi->common;
|
2017-03-30 01:57:53 +02:00
|
|
|
MODE_INFO **mi = cm->mi_grid_visible;
|
2014-04-03 03:37:04 +02:00
|
|
|
CYCLIC_REFRESH *const cr = cpi->cyclic_refresh;
|
2017-03-30 01:57:53 +02:00
|
|
|
RATE_CONTROL *const rc = &cpi->rc;
|
2014-04-03 03:37:04 +02:00
|
|
|
unsigned char *const seg_map = cpi->segmentation_map;
|
2017-03-30 01:57:53 +02:00
|
|
|
double fraction_low = 0.0;
|
|
|
|
int force_gf_refresh = 0;
|
|
|
|
int low_content_frame = 0;
|
2014-04-03 03:37:04 +02:00
|
|
|
int mi_row, mi_col;
|
2015-03-10 23:16:10 +01:00
|
|
|
cr->actual_num_seg1_blocks = 0;
|
|
|
|
cr->actual_num_seg2_blocks = 0;
|
2017-03-30 01:57:53 +02:00
|
|
|
for (mi_row = 0; mi_row < cm->mi_rows; mi_row++) {
|
2015-03-11 00:08:17 +01:00
|
|
|
for (mi_col = 0; mi_col < cm->mi_cols; mi_col++) {
|
2017-04-04 18:53:13 +02:00
|
|
|
MV mv = mi[0]->mv[0].as_mv;
|
2017-03-30 01:57:53 +02:00
|
|
|
int map_index = mi_row * cm->mi_cols + mi_col;
|
|
|
|
if (cyclic_refresh_segment_id(seg_map[map_index]) == CR_SEGMENT_ID_BOOST1)
|
2015-03-10 23:16:10 +01:00
|
|
|
cr->actual_num_seg1_blocks++;
|
2017-03-30 01:57:53 +02:00
|
|
|
else if (cyclic_refresh_segment_id(seg_map[map_index]) ==
|
2016-07-27 05:43:23 +02:00
|
|
|
CR_SEGMENT_ID_BOOST2)
|
2015-03-10 23:16:10 +01:00
|
|
|
cr->actual_num_seg2_blocks++;
|
2017-03-30 01:57:53 +02:00
|
|
|
// Accumulate low_content_frame.
|
2017-04-04 18:53:13 +02:00
|
|
|
if (is_inter_block(mi[0]) && abs(mv.row) < 16 && abs(mv.col) < 16)
|
|
|
|
low_content_frame++;
|
2017-03-30 01:57:53 +02:00
|
|
|
mi++;
|
|
|
|
}
|
|
|
|
mi += 8;
|
|
|
|
}
|
|
|
|
// Check for golden frame update: only for non-SVC and non-golden boost.
|
|
|
|
if (!cpi->use_svc && cpi->ext_refresh_frame_flags_pending == 0 &&
|
|
|
|
!cpi->oxcf.gf_cbr_boost_pct) {
|
|
|
|
// Force this frame as a golden update frame if this frame changes the
|
|
|
|
// resolution (resize_pending != 0).
|
|
|
|
if (cpi->resize_pending != 0) {
|
|
|
|
vp9_cyclic_refresh_set_golden_update(cpi);
|
|
|
|
rc->frames_till_gf_update_due = rc->baseline_gf_interval;
|
|
|
|
if (rc->frames_till_gf_update_due > rc->frames_to_key)
|
|
|
|
rc->frames_till_gf_update_due = rc->frames_to_key;
|
|
|
|
cpi->refresh_golden_frame = 1;
|
|
|
|
force_gf_refresh = 1;
|
2015-03-11 00:08:17 +01:00
|
|
|
}
|
2017-03-30 01:57:53 +02:00
|
|
|
// Update average of low content/motion in the frame.
|
|
|
|
fraction_low = (double)low_content_frame / (cm->mi_rows * cm->mi_cols);
|
|
|
|
cr->low_content_avg = (fraction_low + 3 * cr->low_content_avg) / 4;
|
2017-04-04 18:53:13 +02:00
|
|
|
if (!force_gf_refresh && cpi->refresh_golden_frame == 1 &&
|
|
|
|
rc->frames_since_key > rc->frames_since_golden + 1) {
|
2017-03-30 01:57:53 +02:00
|
|
|
// Don't update golden reference if the amount of low_content for the
|
|
|
|
// current encoded frame is small, or if the recursive average of the
|
|
|
|
// low_content over the update interval window falls below threshold.
|
2017-04-04 18:53:13 +02:00
|
|
|
if (fraction_low < 0.65 || cr->low_content_avg < 0.6) {
|
2017-03-30 01:57:53 +02:00
|
|
|
cpi->refresh_golden_frame = 0;
|
2017-04-04 18:53:13 +02:00
|
|
|
}
|
2017-03-30 01:57:53 +02:00
|
|
|
// Reset for next internal.
|
|
|
|
cr->low_content_avg = fraction_low;
|
|
|
|
}
|
|
|
|
}
|
2014-04-03 03:37:04 +02:00
|
|
|
}
|
|
|
|
|
2015-03-06 02:26:52 +01:00
|
|
|
// Set golden frame update interval, for non-svc 1 pass CBR mode.
|
|
|
|
void vp9_cyclic_refresh_set_golden_update(VP9_COMP *const cpi) {
|
|
|
|
RATE_CONTROL *const rc = &cpi->rc;
|
|
|
|
CYCLIC_REFRESH *const cr = cpi->cyclic_refresh;
|
2016-01-27 21:01:58 +01:00
|
|
|
// Set minimum gf_interval for GF update to a multiple of the refresh period,
|
|
|
|
// with some max limit. Depending on past encoding stats, GF flag may be
|
|
|
|
// reset and update may not occur until next baseline_gf_interval.
|
2015-03-06 02:26:52 +01:00
|
|
|
if (cr->percent_refresh > 0)
|
2016-01-27 21:01:58 +01:00
|
|
|
rc->baseline_gf_interval = VPXMIN(4 * (100 / cr->percent_refresh), 40);
|
2015-03-06 02:26:52 +01:00
|
|
|
else
|
2015-04-24 21:12:17 +02:00
|
|
|
rc->baseline_gf_interval = 40;
|
2016-07-27 05:43:23 +02:00
|
|
|
if (cpi->oxcf.rc_mode == VPX_VBR) rc->baseline_gf_interval = 20;
|
2017-05-22 07:15:28 +02:00
|
|
|
if (rc->avg_frame_low_motion < 50 && rc->frames_since_key > 40)
|
|
|
|
rc->baseline_gf_interval = 10;
|
2015-03-06 02:26:52 +01:00
|
|
|
}
|
|
|
|
|
2014-04-03 03:37:04 +02:00
|
|
|
// Update the segmentation map, and related quantities: cyclic refresh map,
|
|
|
|
// refresh sb_index, and target number of blocks to be refreshed.
|
2015-01-28 20:34:24 +01:00
|
|
|
// The map is set to either 0/CR_SEGMENT_ID_BASE (no refresh) or to
|
|
|
|
// 1/CR_SEGMENT_ID_BOOST1 (refresh) for each superblock.
|
|
|
|
// Blocks labeled as BOOST1 may later get set to BOOST2 (during the
|
|
|
|
// encoding of the superblock).
|
2015-05-15 05:22:50 +02:00
|
|
|
static void cyclic_refresh_update_map(VP9_COMP *const cpi) {
|
2014-04-03 03:37:04 +02:00
|
|
|
VP9_COMMON *const cm = &cpi->common;
|
|
|
|
CYCLIC_REFRESH *const cr = cpi->cyclic_refresh;
|
|
|
|
unsigned char *const seg_map = cpi->segmentation_map;
|
|
|
|
int i, block_count, bl_index, sb_rows, sb_cols, sbs_in_frame;
|
|
|
|
int xmis, ymis, x, y;
|
2015-10-07 02:47:08 +02:00
|
|
|
int consec_zero_mv_thresh = 0;
|
2015-09-30 00:38:49 +02:00
|
|
|
int qindex_thresh = 0;
|
|
|
|
int count_sel = 0;
|
|
|
|
int count_tot = 0;
|
2015-04-24 05:47:40 +02:00
|
|
|
memset(seg_map, CR_SEGMENT_ID_BASE, cm->mi_rows * cm->mi_cols);
|
2014-04-03 03:37:04 +02:00
|
|
|
sb_cols = (cm->mi_cols + MI_BLOCK_SIZE - 1) / MI_BLOCK_SIZE;
|
|
|
|
sb_rows = (cm->mi_rows + MI_BLOCK_SIZE - 1) / MI_BLOCK_SIZE;
|
|
|
|
sbs_in_frame = sb_cols * sb_rows;
|
|
|
|
// Number of target blocks to get the q delta (segment 1).
|
|
|
|
block_count = cr->percent_refresh * cm->mi_rows * cm->mi_cols / 100;
|
|
|
|
// Set the segmentation map: cycle through the superblocks, starting at
|
|
|
|
// cr->mb_index, and stopping when either block_count blocks have been found
|
|
|
|
// to be refreshed, or we have passed through whole frame.
|
|
|
|
assert(cr->sb_index < sbs_in_frame);
|
|
|
|
i = cr->sb_index;
|
|
|
|
cr->target_num_seg_blocks = 0;
|
2015-11-12 03:21:20 +01:00
|
|
|
if (cpi->oxcf.content != VP9E_CONTENT_SCREEN) {
|
2015-09-30 00:38:49 +02:00
|
|
|
consec_zero_mv_thresh = 100;
|
2015-11-12 03:21:20 +01:00
|
|
|
}
|
2015-09-30 00:38:49 +02:00
|
|
|
qindex_thresh =
|
|
|
|
cpi->oxcf.content == VP9E_CONTENT_SCREEN
|
2016-07-27 05:43:23 +02:00
|
|
|
? vp9_get_qindex(&cm->seg, CR_SEGMENT_ID_BOOST2, cm->base_qindex)
|
|
|
|
: vp9_get_qindex(&cm->seg, CR_SEGMENT_ID_BOOST1, cm->base_qindex);
|
2016-04-30 00:52:45 +02:00
|
|
|
// More aggressive settings for noisy content.
|
|
|
|
if (cpi->noise_estimate.enabled && cpi->noise_estimate.level >= kMedium) {
|
2016-11-09 00:46:50 +01:00
|
|
|
consec_zero_mv_thresh = 60;
|
2016-04-30 00:52:45 +02:00
|
|
|
qindex_thresh =
|
|
|
|
VPXMAX(vp9_get_qindex(&cm->seg, CR_SEGMENT_ID_BOOST1, cm->base_qindex),
|
2016-11-09 00:46:50 +01:00
|
|
|
cm->base_qindex);
|
2016-04-30 00:52:45 +02:00
|
|
|
}
|
2014-04-03 03:37:04 +02:00
|
|
|
do {
|
|
|
|
int sum_map = 0;
|
2016-11-09 00:46:50 +01:00
|
|
|
int consec_zero_mv_thresh_block = consec_zero_mv_thresh;
|
2014-04-03 03:37:04 +02:00
|
|
|
// Get the mi_row/mi_col corresponding to superblock index i.
|
|
|
|
int sb_row_index = (i / sb_cols);
|
|
|
|
int sb_col_index = i - sb_row_index * sb_cols;
|
|
|
|
int mi_row = sb_row_index * MI_BLOCK_SIZE;
|
|
|
|
int mi_col = sb_col_index * MI_BLOCK_SIZE;
|
|
|
|
assert(mi_row >= 0 && mi_row < cm->mi_rows);
|
|
|
|
assert(mi_col >= 0 && mi_col < cm->mi_cols);
|
|
|
|
bl_index = mi_row * cm->mi_cols + mi_col;
|
|
|
|
// Loop through all 8x8 blocks in superblock and update map.
|
2015-08-18 03:19:22 +02:00
|
|
|
xmis =
|
|
|
|
VPXMIN(cm->mi_cols - mi_col, num_8x8_blocks_wide_lookup[BLOCK_64X64]);
|
|
|
|
ymis =
|
|
|
|
VPXMIN(cm->mi_rows - mi_row, num_8x8_blocks_high_lookup[BLOCK_64X64]);
|
2016-11-09 00:46:50 +01:00
|
|
|
if (cpi->noise_estimate.enabled && cpi->noise_estimate.level >= kMedium &&
|
|
|
|
(xmis <= 2 || ymis <= 2))
|
2017-04-07 17:52:54 +02:00
|
|
|
consec_zero_mv_thresh_block = 4;
|
2014-04-03 03:37:04 +02:00
|
|
|
for (y = 0; y < ymis; y++) {
|
|
|
|
for (x = 0; x < xmis; x++) {
|
|
|
|
const int bl_index2 = bl_index + y * cm->mi_cols + x;
|
|
|
|
// If the block is as a candidate for clean up then mark it
|
|
|
|
// for possible boost/refresh (segment 1). The segment id may get
|
2017-03-30 01:57:53 +02:00
|
|
|
// reset to 0 later depending on the coding mode.
|
2014-04-03 03:37:04 +02:00
|
|
|
if (cr->map[bl_index2] == 0) {
|
2015-09-30 00:38:49 +02:00
|
|
|
count_tot++;
|
2015-06-23 17:34:06 +02:00
|
|
|
if (cr->last_coded_q_map[bl_index2] > qindex_thresh ||
|
2016-11-09 00:46:50 +01:00
|
|
|
cpi->consec_zero_mv[bl_index2] < consec_zero_mv_thresh_block) {
|
2015-06-19 01:05:56 +02:00
|
|
|
sum_map++;
|
2015-09-30 00:38:49 +02:00
|
|
|
count_sel++;
|
|
|
|
}
|
2014-04-03 03:37:04 +02:00
|
|
|
} else if (cr->map[bl_index2] < 0) {
|
|
|
|
cr->map[bl_index2]++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
// Enforce constant segment over superblock.
|
|
|
|
// If segment is at least half of superblock, set to 1.
|
|
|
|
if (sum_map >= xmis * ymis / 2) {
|
|
|
|
for (y = 0; y < ymis; y++)
|
|
|
|
for (x = 0; x < xmis; x++) {
|
2015-01-28 20:34:24 +01:00
|
|
|
seg_map[bl_index + y * cm->mi_cols + x] = CR_SEGMENT_ID_BOOST1;
|
2014-04-03 03:37:04 +02:00
|
|
|
}
|
|
|
|
cr->target_num_seg_blocks += xmis * ymis;
|
|
|
|
}
|
|
|
|
i++;
|
|
|
|
if (i == sbs_in_frame) {
|
|
|
|
i = 0;
|
|
|
|
}
|
|
|
|
} while (cr->target_num_seg_blocks < block_count && i != cr->sb_index);
|
|
|
|
cr->sb_index = i;
|
2015-09-30 00:38:49 +02:00
|
|
|
cr->reduce_refresh = 0;
|
2016-07-27 05:43:23 +02:00
|
|
|
if (count_sel<(3 * count_tot)>> 2) cr->reduce_refresh = 1;
|
2014-03-14 22:35:47 +01:00
|
|
|
}
|
|
|
|
|
2015-06-11 01:25:22 +02:00
|
|
|
// Set cyclic refresh parameters.
|
2014-12-03 19:19:54 +01:00
|
|
|
void vp9_cyclic_refresh_update_parameters(VP9_COMP *const cpi) {
|
|
|
|
const RATE_CONTROL *const rc = &cpi->rc;
|
2015-06-11 01:25:22 +02:00
|
|
|
const VP9_COMMON *const cm = &cpi->common;
|
2014-12-03 19:19:54 +01:00
|
|
|
CYCLIC_REFRESH *const cr = cpi->cyclic_refresh;
|
2017-02-15 22:51:14 +01:00
|
|
|
int num8x8bl = cm->MBs << 2;
|
|
|
|
int target_refresh = 0;
|
|
|
|
double weight_segment_target = 0;
|
|
|
|
double weight_segment = 0;
|
2017-06-22 00:24:56 +02:00
|
|
|
int thresh_low_motion = (cm->width < 720) ? 55 : 20;
|
2017-05-22 07:15:28 +02:00
|
|
|
cr->apply_cyclic_refresh = 1;
|
|
|
|
if (cm->frame_type == KEY_FRAME || cpi->svc.temporal_layer_id > 0 ||
|
2017-06-22 00:24:56 +02:00
|
|
|
(!cpi->use_svc && rc->avg_frame_low_motion < thresh_low_motion &&
|
2017-05-22 07:15:28 +02:00
|
|
|
rc->frames_since_key > 40)) {
|
|
|
|
cr->apply_cyclic_refresh = 0;
|
|
|
|
return;
|
|
|
|
}
|
2014-12-03 19:19:54 +01:00
|
|
|
cr->percent_refresh = 10;
|
2016-07-27 05:43:23 +02:00
|
|
|
if (cr->reduce_refresh) cr->percent_refresh = 5;
|
2017-01-24 18:58:05 +01:00
|
|
|
cr->max_qdelta_perc = 60;
|
2015-06-11 01:25:22 +02:00
|
|
|
cr->time_for_refresh = 0;
|
2016-04-30 00:52:45 +02:00
|
|
|
cr->motion_thresh = 32;
|
|
|
|
cr->rate_boost_fac = 15;
|
2014-12-03 19:19:54 +01:00
|
|
|
// Use larger delta-qp (increase rate_ratio_qdelta) for first few (~4)
|
2015-06-11 01:25:22 +02:00
|
|
|
// periods of the refresh cycle, after a key frame.
|
2015-08-07 19:14:01 +02:00
|
|
|
// Account for larger interval on base layer for temporal layers.
|
|
|
|
if (cr->percent_refresh > 0 &&
|
2016-07-27 05:43:23 +02:00
|
|
|
rc->frames_since_key <
|
|
|
|
(4 * cpi->svc.number_temporal_layers) * (100 / cr->percent_refresh)) {
|
2014-12-03 19:19:54 +01:00
|
|
|
cr->rate_ratio_qdelta = 3.0;
|
2015-10-26 22:56:46 +01:00
|
|
|
} else {
|
2014-12-03 19:19:54 +01:00
|
|
|
cr->rate_ratio_qdelta = 2.0;
|
2016-04-30 00:52:45 +02:00
|
|
|
if (cpi->noise_estimate.enabled && cpi->noise_estimate.level >= kMedium) {
|
|
|
|
// Reduce the delta-qp if the estimated source noise is above threshold.
|
|
|
|
cr->rate_ratio_qdelta = 1.7;
|
|
|
|
cr->rate_boost_fac = 13;
|
|
|
|
}
|
2015-10-26 22:56:46 +01:00
|
|
|
}
|
2017-01-24 18:58:05 +01:00
|
|
|
// Adjust some parameters for low resolutions.
|
|
|
|
if (cm->width <= 352 && cm->height <= 288) {
|
|
|
|
if (rc->avg_frame_bandwidth < 3000) {
|
|
|
|
cr->motion_thresh = 16;
|
|
|
|
cr->rate_boost_fac = 13;
|
|
|
|
} else {
|
|
|
|
cr->max_qdelta_perc = 70;
|
|
|
|
cr->rate_ratio_qdelta = VPXMAX(cr->rate_ratio_qdelta, 2.5);
|
|
|
|
}
|
2015-06-11 01:25:22 +02:00
|
|
|
}
|
2016-02-12 19:29:26 +01:00
|
|
|
if (cpi->oxcf.rc_mode == VPX_VBR) {
|
|
|
|
// To be adjusted for VBR mode, e.g., based on gf period and boost.
|
|
|
|
// For now use smaller qp-delta (than CBR), no second boosted seg, and
|
|
|
|
// turn-off (no refresh) on golden refresh (since it's already boosted).
|
|
|
|
cr->percent_refresh = 10;
|
|
|
|
cr->rate_ratio_qdelta = 1.5;
|
|
|
|
cr->rate_boost_fac = 10;
|
|
|
|
if (cpi->refresh_golden_frame == 1) {
|
|
|
|
cr->percent_refresh = 0;
|
|
|
|
cr->rate_ratio_qdelta = 1.0;
|
|
|
|
}
|
|
|
|
}
|
2017-02-15 22:51:14 +01:00
|
|
|
// Weight for segment prior to encoding: take the average of the target
|
|
|
|
// number for the frame to be encoded and the actual from the previous frame.
|
|
|
|
// Use the target if its less. To be used for setting the base qp for the
|
|
|
|
// frame in vp9_rc_regulate_q.
|
|
|
|
target_refresh = cr->percent_refresh * cm->mi_rows * cm->mi_cols / 100;
|
|
|
|
weight_segment_target = (double)(target_refresh) / num8x8bl;
|
|
|
|
weight_segment = (double)((target_refresh + cr->actual_num_seg1_blocks +
|
|
|
|
cr->actual_num_seg2_blocks) >>
|
|
|
|
1) /
|
|
|
|
num8x8bl;
|
|
|
|
if (weight_segment_target < 7 * weight_segment / 8)
|
|
|
|
weight_segment = weight_segment_target;
|
|
|
|
cr->weight_segment = weight_segment;
|
2014-12-03 19:19:54 +01:00
|
|
|
}
|
|
|
|
|
2014-03-14 22:35:47 +01:00
|
|
|
// Setup cyclic background refresh: set delta q and segmentation map.
|
2014-03-26 19:00:35 +01:00
|
|
|
void vp9_cyclic_refresh_setup(VP9_COMP *const cpi) {
|
2014-03-14 22:35:47 +01:00
|
|
|
VP9_COMMON *const cm = &cpi->common;
|
2014-03-24 18:48:14 +01:00
|
|
|
const RATE_CONTROL *const rc = &cpi->rc;
|
2014-03-26 19:00:35 +01:00
|
|
|
CYCLIC_REFRESH *const cr = cpi->cyclic_refresh;
|
2014-03-14 22:35:47 +01:00
|
|
|
struct segmentation *const seg = &cm->seg;
|
2016-07-27 05:43:23 +02:00
|
|
|
if (cm->current_video_frame == 0) cr->low_content_avg = 0.0;
|
2017-05-22 07:15:28 +02:00
|
|
|
if (!cr->apply_cyclic_refresh || (cpi->force_update_segmentation)) {
|
2014-03-14 22:35:47 +01:00
|
|
|
// Set segmentation map to 0 and disable.
|
2014-04-03 03:37:04 +02:00
|
|
|
unsigned char *const seg_map = cpi->segmentation_map;
|
2015-04-24 05:47:40 +02:00
|
|
|
memset(seg_map, 0, cm->mi_rows * cm->mi_cols);
|
2014-03-14 22:35:47 +01:00
|
|
|
vp9_disable_segmentation(&cm->seg);
|
2015-06-19 01:05:56 +02:00
|
|
|
if (cm->frame_type == KEY_FRAME) {
|
|
|
|
memset(cr->last_coded_q_map, MAXQ,
|
|
|
|
cm->mi_rows * cm->mi_cols * sizeof(*cr->last_coded_q_map));
|
2014-03-27 02:09:20 +01:00
|
|
|
cr->sb_index = 0;
|
2017-02-22 19:45:21 +01:00
|
|
|
cr->reduce_refresh = 0;
|
2015-06-19 01:05:56 +02:00
|
|
|
}
|
2014-03-14 22:35:47 +01:00
|
|
|
return;
|
|
|
|
} else {
|
|
|
|
int qindex_delta = 0;
|
2014-04-03 03:37:04 +02:00
|
|
|
int qindex2;
|
2014-09-03 01:34:09 +02:00
|
|
|
const double q = vp9_convert_qindex_to_q(cm->base_qindex, cm->bit_depth);
|
2015-08-10 20:28:04 +02:00
|
|
|
vpx_clear_system_state();
|
2015-01-28 20:34:24 +01:00
|
|
|
// Set rate threshold to some multiple (set to 2 for now) of the target
|
2015-01-22 01:09:13 +01:00
|
|
|
// rate (target is given by sb64_target_rate and scaled by 256).
|
2015-03-10 23:16:10 +01:00
|
|
|
cr->thresh_rate_sb = ((int64_t)(rc->sb64_target_rate) << 8) << 2;
|
2014-03-14 22:35:47 +01:00
|
|
|
// Distortion threshold, quadratic in Q, scale factor to be adjusted.
|
2015-02-26 23:27:16 +01:00
|
|
|
// q will not exceed 457, so (q * q) is within 32bit; see:
|
|
|
|
// vp9_convert_qindex_to_q(), vp9_ac_quant(), ac_qlookup*[].
|
|
|
|
cr->thresh_dist_sb = ((int64_t)(q * q)) << 2;
|
2015-06-09 23:58:32 +02:00
|
|
|
|
2014-03-14 22:35:47 +01:00
|
|
|
// Set up segmentation.
|
|
|
|
// Clear down the segment map.
|
|
|
|
vp9_enable_segmentation(&cm->seg);
|
|
|
|
vp9_clearall_segfeatures(seg);
|
|
|
|
// Select delta coding method.
|
|
|
|
seg->abs_delta = SEGMENT_DELTADATA;
|
|
|
|
|
|
|
|
// Note: setting temporal_update has no effect, as the seg-map coding method
|
|
|
|
// (temporal or spatial) is determined in vp9_choose_segmap_coding_method(),
|
|
|
|
// based on the coding cost of each method. For error_resilient mode on the
|
|
|
|
// last_frame_seg_map is set to 0, so if temporal coding is used, it is
|
|
|
|
// relative to 0 previous map.
|
|
|
|
// seg->temporal_update = 0;
|
|
|
|
|
2015-01-28 20:34:24 +01:00
|
|
|
// Segment BASE "Q" feature is disabled so it defaults to the baseline Q.
|
|
|
|
vp9_disable_segfeature(seg, CR_SEGMENT_ID_BASE, SEG_LVL_ALT_Q);
|
|
|
|
// Use segment BOOST1 for in-frame Q adjustment.
|
|
|
|
vp9_enable_segfeature(seg, CR_SEGMENT_ID_BOOST1, SEG_LVL_ALT_Q);
|
|
|
|
// Use segment BOOST2 for more aggressive in-frame Q adjustment.
|
|
|
|
vp9_enable_segfeature(seg, CR_SEGMENT_ID_BOOST2, SEG_LVL_ALT_Q);
|
2014-03-14 22:35:47 +01:00
|
|
|
|
2015-01-28 20:34:24 +01:00
|
|
|
// Set the q delta for segment BOOST1.
|
|
|
|
qindex_delta = compute_deltaq(cpi, cm->base_qindex, cr->rate_ratio_qdelta);
|
2015-06-19 01:05:56 +02:00
|
|
|
cr->qindex_delta[1] = qindex_delta;
|
2014-03-14 22:35:47 +01:00
|
|
|
|
2015-01-28 20:34:24 +01:00
|
|
|
// Compute rd-mult for segment BOOST1.
|
2014-03-14 22:35:47 +01:00
|
|
|
qindex2 = clamp(cm->base_qindex + cm->y_dc_delta_q + qindex_delta, 0, MAXQ);
|
2015-03-10 23:16:10 +01:00
|
|
|
|
2014-03-14 22:35:47 +01:00
|
|
|
cr->rdmult = vp9_compute_rd_mult(cpi, qindex2);
|
|
|
|
|
2015-01-28 20:34:24 +01:00
|
|
|
vp9_set_segdata(seg, CR_SEGMENT_ID_BOOST1, SEG_LVL_ALT_Q, qindex_delta);
|
|
|
|
|
|
|
|
// Set a more aggressive (higher) q delta for segment BOOST2.
|
2015-06-25 01:12:12 +02:00
|
|
|
qindex_delta = compute_deltaq(
|
2015-08-18 03:19:22 +02:00
|
|
|
cpi, cm->base_qindex,
|
|
|
|
VPXMIN(CR_MAX_RATE_TARGET_RATIO,
|
|
|
|
0.1 * cr->rate_boost_fac * cr->rate_ratio_qdelta));
|
2015-06-19 01:05:56 +02:00
|
|
|
cr->qindex_delta[2] = qindex_delta;
|
2015-01-28 20:34:24 +01:00
|
|
|
vp9_set_segdata(seg, CR_SEGMENT_ID_BOOST2, SEG_LVL_ALT_Q, qindex_delta);
|
2014-03-27 02:09:20 +01:00
|
|
|
|
2015-10-15 18:01:47 +02:00
|
|
|
// Reset if resoluton change has occurred.
|
2016-07-27 05:43:23 +02:00
|
|
|
if (cpi->resize_pending != 0) vp9_cyclic_refresh_reset_resize(cpi);
|
2015-10-15 18:01:47 +02:00
|
|
|
|
2014-04-03 03:37:04 +02:00
|
|
|
// Update the segmentation and refresh map.
|
2015-05-15 05:22:50 +02:00
|
|
|
cyclic_refresh_update_map(cpi);
|
2014-03-14 22:35:47 +01:00
|
|
|
}
|
|
|
|
}
|
2014-03-26 19:00:35 +01:00
|
|
|
|
|
|
|
int vp9_cyclic_refresh_get_rdmult(const CYCLIC_REFRESH *cr) {
|
|
|
|
return cr->rdmult;
|
|
|
|
}
|
2015-06-08 19:03:51 +02:00
|
|
|
|
|
|
|
void vp9_cyclic_refresh_reset_resize(VP9_COMP *const cpi) {
|
|
|
|
const VP9_COMMON *const cm = &cpi->common;
|
|
|
|
CYCLIC_REFRESH *const cr = cpi->cyclic_refresh;
|
|
|
|
memset(cr->map, 0, cm->mi_rows * cm->mi_cols);
|
2015-06-23 17:34:06 +02:00
|
|
|
memset(cr->last_coded_q_map, MAXQ, cm->mi_rows * cm->mi_cols);
|
2015-06-08 19:03:51 +02:00
|
|
|
cr->sb_index = 0;
|
2015-07-16 03:00:03 +02:00
|
|
|
cpi->refresh_golden_frame = 1;
|
2016-02-06 00:43:42 +01:00
|
|
|
cpi->refresh_alt_ref_frame = 1;
|
2015-06-08 19:03:51 +02:00
|
|
|
}
|