Commit e38ca542 authored by Jingning Han's avatar Jingning Han Committed by Gerrit Code Review
Browse files

Merge "Enable background detection for adaptive quantizer control"

parents a7ecad59 80a4f559
...@@ -136,7 +136,8 @@ void vp9_cyclic_refresh_update_segment(VP9_COMP *const cpi, ...@@ -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 xmis = MIN(cm->mi_cols - mi_col, bw);
const int ymis = MIN(cm->mi_rows - mi_row, bh); const int ymis = MIN(cm->mi_rows - mi_row, bh);
const int block_index = mi_row * cm->mi_cols + mi_col; 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. // Default is to not update the refresh map.
int new_map_value = cr->map[block_index]; int new_map_value = cr->map[block_index];
int x = 0; int y = 0; int x = 0; int y = 0;
......
...@@ -162,6 +162,8 @@ struct macroblock { ...@@ -162,6 +162,8 @@ struct macroblock {
// note that token_costs is the cost when eob node is skipped // note that token_costs is the cost when eob node is skipped
vp9_coeff_cost token_costs[TX_SIZES]; vp9_coeff_cost token_costs[TX_SIZES];
int in_static_area;
int optimize; int optimize;
// indicate if it is in the rd search loop or encoding process // indicate if it is in the rd search loop or encoding process
......
...@@ -1273,6 +1273,7 @@ static void set_source_var_based_partition(VP9_COMP *cpi, ...@@ -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, static int is_background(VP9_COMP *cpi, const TileInfo *const tile,
int mi_row, int mi_col) { int mi_row, int mi_col) {
MACROBLOCK *x = &cpi->mb;
uint8_t *src, *pre; uint8_t *src, *pre;
int src_stride, pre_stride; int src_stride, pre_stride;
...@@ -1304,7 +1305,8 @@ static int is_background(VP9_COMP *cpi, const TileInfo *const tile, ...@@ -1304,7 +1305,8 @@ static int is_background(VP9_COMP *cpi, const TileInfo *const tile,
threshold = (row8x8_remaining * col8x8_remaining) << 6; 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) { 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, ...@@ -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); set_offsets(cpi, tile, mi_row, mi_col, bsize);
xd->mi[0]->mbmi.sb_type = 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)) { if (!frame_is_intra_only(cm)) {
vp9_pick_inter_mode(cpi, x, tile, mi_row, mi_col, vp9_pick_inter_mode(cpi, x, tile, mi_row, mi_col,
rate, dist, bsize); rate, dist, bsize);
...@@ -2856,7 +2863,8 @@ static void nonrd_use_partition(VP9_COMP *cpi, ...@@ -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, static void encode_nonrd_sb_row(VP9_COMP *cpi, const TileInfo *const tile,
int mi_row, TOKENEXTRA **tp) { int mi_row, TOKENEXTRA **tp) {
VP9_COMMON *cm = &cpi->common; VP9_COMMON *cm = &cpi->common;
MACROBLOCKD *xd = &cpi->mb.e_mbd; MACROBLOCK *x = &cpi->mb;
MACROBLOCKD *xd = &x->e_mbd;
int mi_col; int mi_col;
// Initialize the left context for the new SB row // 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, ...@@ -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; MODE_INFO **prev_mi_8x8 = cm->prev_mi_grid_visible + idx_str;
BLOCK_SIZE bsize; BLOCK_SIZE bsize;
cpi->mb.source_variance = UINT_MAX; x->in_static_area = 0;
vp9_zero(cpi->mb.pred_mv); x->source_variance = UINT_MAX;
vp9_zero(x->pred_mv);
// Set the partition type of the 64X64 block // Set the partition type of the 64X64 block
switch (cpi->sf.partition_search_type) { switch (cpi->sf.partition_search_type) {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment