diff --git a/vp9/encoder/vp9_aq_cyclicrefresh.c b/vp9/encoder/vp9_aq_cyclicrefresh.c index 323c103506e491acbe781fccddec0b0b2fc96581..d1437d3770fef027eb498dbde6bf7b2bcea5eb40 100644 --- a/vp9/encoder/vp9_aq_cyclicrefresh.c +++ b/vp9/encoder/vp9_aq_cyclicrefresh.c @@ -136,7 +136,8 @@ void vp9_cyclic_refresh_update_segment(VP9_COMP *const cpi, const int xmis = MIN(cm->mi_cols - mi_col, bw); const int ymis = MIN(cm->mi_rows - mi_row, bh); const int block_index = mi_row * cm->mi_cols + mi_col; - const int refresh_this_block = candidate_refresh_aq(cr, mbmi, bsize, use_rd); + const int refresh_this_block = cpi->mb.in_static_area || + candidate_refresh_aq(cr, mbmi, bsize, use_rd); // Default is to not update the refresh map. int new_map_value = cr->map[block_index]; int x = 0; int y = 0; diff --git a/vp9/encoder/vp9_block.h b/vp9/encoder/vp9_block.h index cad1241259bf9fd22053da6652c1df423baf7c3a..fcf2a04204717c2619577783ce480f8a36a81926 100644 --- a/vp9/encoder/vp9_block.h +++ b/vp9/encoder/vp9_block.h @@ -162,6 +162,8 @@ struct macroblock { // note that token_costs is the cost when eob node is skipped vp9_coeff_cost token_costs[TX_SIZES]; + int in_static_area; + int optimize; // indicate if it is in the rd search loop or encoding process diff --git a/vp9/encoder/vp9_encodeframe.c b/vp9/encoder/vp9_encodeframe.c index f88ce2d1a572d15977d58c5a6b95c79de4047197..9956acc0bdccb2a3823f5d56e3ab8eadd134c2b4 100644 --- a/vp9/encoder/vp9_encodeframe.c +++ b/vp9/encoder/vp9_encodeframe.c @@ -1273,6 +1273,7 @@ static void set_source_var_based_partition(VP9_COMP *cpi, static int is_background(VP9_COMP *cpi, const TileInfo *const tile, int mi_row, int mi_col) { + MACROBLOCK *x = &cpi->mb; uint8_t *src, *pre; int src_stride, pre_stride; @@ -1304,7 +1305,8 @@ static int is_background(VP9_COMP *cpi, const TileInfo *const tile, threshold = (row8x8_remaining * col8x8_remaining) << 6; } - return (this_sad < 2 * threshold); + x->in_static_area = (this_sad < 2 * threshold); + return x->in_static_area; } static int sb_has_motion(const VP9_COMMON *cm, MODE_INFO **prev_mi_8x8) { @@ -2433,6 +2435,11 @@ static void nonrd_pick_sb_modes(VP9_COMP *cpi, const TileInfo *const tile, set_offsets(cpi, tile, mi_row, mi_col, bsize); xd->mi[0]->mbmi.sb_type = bsize; + if (cpi->oxcf.aq_mode == CYCLIC_REFRESH_AQ && cm->seg.enabled) { + if (xd->mi[0]->mbmi.segment_id && x->in_static_area) + x->rdmult = vp9_cyclic_refresh_get_rdmult(cpi->cyclic_refresh); + } + if (!frame_is_intra_only(cm)) { vp9_pick_inter_mode(cpi, x, tile, mi_row, mi_col, rate, dist, bsize); @@ -2856,7 +2863,8 @@ static void nonrd_use_partition(VP9_COMP *cpi, static void encode_nonrd_sb_row(VP9_COMP *cpi, const TileInfo *const tile, int mi_row, TOKENEXTRA **tp) { VP9_COMMON *cm = &cpi->common; - MACROBLOCKD *xd = &cpi->mb.e_mbd; + MACROBLOCK *x = &cpi->mb; + MACROBLOCKD *xd = &x->e_mbd; int mi_col; // Initialize the left context for the new SB row @@ -2874,8 +2882,9 @@ static void encode_nonrd_sb_row(VP9_COMP *cpi, const TileInfo *const tile, MODE_INFO **prev_mi_8x8 = cm->prev_mi_grid_visible + idx_str; BLOCK_SIZE bsize; - cpi->mb.source_variance = UINT_MAX; - vp9_zero(cpi->mb.pred_mv); + x->in_static_area = 0; + x->source_variance = UINT_MAX; + vp9_zero(x->pred_mv); // Set the partition type of the 64X64 block switch (cpi->sf.partition_search_type) {