intrabc: Add a frame level flag
For the combination of this and removing NEWDV from the tree: derflr: -0.101 screen_content: +0.053 The bulk of the decline in screen content effecincy is from the liquify clip. These should be recoverable by further entropy tweaks. Change-Id: I9d80152b8492e60a0367c31797fb6932fb09bba9
This commit is contained in:
parent
1f537e3818
commit
c3e884f5be
@ -20,7 +20,7 @@ extern "C" {
|
||||
#endif
|
||||
|
||||
#if CONFIG_INTRABC
|
||||
#define INTRABC_PROB 128
|
||||
#define INTRABC_PROB 192
|
||||
#endif // CONFIG_INTRABC
|
||||
|
||||
#define TX_SIZE_CONTEXTS 2
|
||||
|
@ -228,8 +228,13 @@ typedef struct VP9Common {
|
||||
int current_palette_count[PALETTE_BUF_SIZE];
|
||||
int allow_palette_mode;
|
||||
int palette_counter;
|
||||
int block_counter;
|
||||
int palette_blocks_signalled;
|
||||
#endif // CONFIG_PALETTE
|
||||
#if CONFIG_INTRABC
|
||||
int allow_intrabc_mode;
|
||||
int intrabc_counter;
|
||||
int intrabc_blocks_signalled;
|
||||
#endif // CONFIG_INTRABC
|
||||
#if CONFIG_GLOBAL_MOTION
|
||||
int num_global_motion[MAX_REF_FRAMES];
|
||||
Global_Motion_Params global_motion[MAX_REF_FRAMES][MAX_GLOBAL_MOTION_MODELS];
|
||||
|
@ -2825,10 +2825,14 @@ static int read_compressed_header(VP9Decoder *pbi, const uint8_t *data,
|
||||
read_global_motion(cm, &r);
|
||||
#endif // CONFIG_GLOBAL_MOTION
|
||||
}
|
||||
#if CONFIG_INTRABC
|
||||
if (frame_is_intra_only(cm))
|
||||
cm->allow_intrabc_mode = vp9_read_bit(&r);
|
||||
#endif // CONFIG_INTRABC
|
||||
#if CONFIG_PALETTE
|
||||
if (frame_is_intra_only(cm))
|
||||
cm->allow_palette_mode = vp9_read_bit(&r);
|
||||
#endif
|
||||
#endif // CONFIG_PALETTE
|
||||
|
||||
return vp9_reader_has_error(&r);
|
||||
}
|
||||
|
@ -276,7 +276,7 @@ static void read_intra_frame_mode_info(VP9_COMMON *const cm,
|
||||
|
||||
#if CONFIG_INTRABC
|
||||
vp9_find_ref_dv(&dv_ref, mi_row, mi_col);
|
||||
if (bsize >= BLOCK_8X8 /* && cm->allow_intrabc*/) {
|
||||
if (bsize >= BLOCK_8X8 && cm->allow_intrabc_mode) {
|
||||
use_intrabc = vp9_read(r, INTRABC_PROB);
|
||||
if (use_intrabc) {
|
||||
mbmi->mode = mbmi->uv_mode = NEWDV;
|
||||
|
@ -882,7 +882,7 @@ static void write_mb_modes_kf(const VP9_COMMON *cm,
|
||||
#endif
|
||||
|
||||
#if CONFIG_INTRABC
|
||||
if (bsize >= BLOCK_8X8 /*&& cm->allow_palette_mode*/) {
|
||||
if (bsize >= BLOCK_8X8 && cm->allow_intrabc_mode) {
|
||||
vp9_write(w, is_intrabc_mode(mbmi->mode), INTRABC_PROB);
|
||||
}
|
||||
#endif // CONFIG_INTRABC
|
||||
@ -2409,10 +2409,14 @@ static size_t write_compressed_header(VP9_COMP *cpi, uint8_t *data) {
|
||||
#endif // CONFIG_GLOBAL_MOTION
|
||||
}
|
||||
|
||||
#if CONFIG_INTRABC
|
||||
if (frame_is_intra_only(cm))
|
||||
vp9_write_bit(&header_bc, cm->allow_intrabc_mode);
|
||||
#endif // CONFIG_INTRABC
|
||||
#if CONFIG_PALETTE
|
||||
if (frame_is_intra_only(cm))
|
||||
vp9_write_bit(&header_bc, cm->allow_palette_mode);
|
||||
#endif
|
||||
#endif // CONFIG_PALETTE
|
||||
|
||||
vp9_stop_encode(&header_bc);
|
||||
assert(header_bc.pos <= 0xffff);
|
||||
|
@ -4844,9 +4844,15 @@ static void encode_frame_internal(VP9_COMP *cpi) {
|
||||
vpx_memset(cm->current_palette_count, 0,
|
||||
PALETTE_BUF_SIZE * sizeof(cm->current_palette_count[0]));
|
||||
cm->palette_counter = 0;
|
||||
cm->block_counter = 0;
|
||||
cm->palette_blocks_signalled = 0;
|
||||
}
|
||||
#endif
|
||||
#endif // CONFIG_PALETTE
|
||||
#if CONFIG_INTRABC
|
||||
if (frame_is_intra_only(cm)) {
|
||||
cm->intrabc_counter = 0;
|
||||
cm->intrabc_blocks_signalled = 0;
|
||||
}
|
||||
#endif // CONFIG_INTRABC
|
||||
|
||||
encode_tiles(cpi);
|
||||
|
||||
@ -5228,13 +5234,14 @@ static void encode_superblock(VP9_COMP *cpi, TOKENEXTRA **t, int output_enabled,
|
||||
rows * cols * sizeof(xd->plane[1].color_index_map[0]));
|
||||
}
|
||||
}
|
||||
|
||||
#endif // CONFIG_PALETTE
|
||||
#if CONFIG_PALETTE
|
||||
if (frame_is_intra_only(cm) && output_enabled && bsize >= BLOCK_8X8) {
|
||||
cm->block_counter++;
|
||||
cm->palette_blocks_signalled++;
|
||||
if (mbmi->palette_enabled[0])
|
||||
cm->palette_counter++;
|
||||
}
|
||||
#endif
|
||||
#endif // CONFIG_PALETTE
|
||||
} else {
|
||||
int ref;
|
||||
const int is_compound = has_second_ref(mbmi);
|
||||
@ -5251,6 +5258,13 @@ static void encode_superblock(VP9_COMP *cpi, TOKENEXTRA **t, int output_enabled,
|
||||
vp9_encode_sb(x, MAX(bsize, BLOCK_8X8));
|
||||
vp9_tokenize_sb(cpi, t, !output_enabled, MAX(bsize, BLOCK_8X8));
|
||||
}
|
||||
#if CONFIG_INTRABC
|
||||
if (frame_is_intra_only(cm) && output_enabled && bsize >= BLOCK_8X8) {
|
||||
cm->intrabc_blocks_signalled++;
|
||||
if (is_intrabc_mode(mbmi->mode))
|
||||
cm->intrabc_counter++;
|
||||
}
|
||||
#endif // CONFIG_INTRABC
|
||||
|
||||
if (output_enabled) {
|
||||
if (cm->tx_mode == TX_MODE_SELECT &&
|
||||
|
@ -2906,6 +2906,10 @@ static void encode_with_recode_loop(VP9_COMP *cpi,
|
||||
if (loop_count == 0 && frame_is_intra_only(cm))
|
||||
cm->allow_palette_mode = 1;
|
||||
#endif // CONFIG_PALETTE
|
||||
#if CONFIG_INTRABC
|
||||
if (loop_count == 0 && frame_is_intra_only(cm))
|
||||
cm->allow_intrabc_mode = 1;
|
||||
#endif // CONFIG_INTRABC
|
||||
|
||||
// Variance adaptive and in frame q adjustment experiments are mutually
|
||||
// exclusive.
|
||||
@ -3083,11 +3087,18 @@ static void encode_with_recode_loop(VP9_COMP *cpi,
|
||||
|
||||
#if CONFIG_PALETTE
|
||||
if (frame_is_intra_only(cm) && cm->allow_palette_mode &&
|
||||
cm->palette_counter * 100 < cm->block_counter) {
|
||||
cm->palette_counter * 100 < cm->palette_blocks_signalled) {
|
||||
cm->allow_palette_mode = 0;
|
||||
loop = 1;
|
||||
}
|
||||
#endif
|
||||
#endif // CONFIG_PALETTE
|
||||
#if CONFIG_INTRABC
|
||||
if (frame_is_intra_only(cm) && cm->allow_intrabc_mode &&
|
||||
cm->intrabc_counter * 100 < cm->intrabc_blocks_signalled) {
|
||||
cm->allow_intrabc_mode = 0;
|
||||
loop = 1;
|
||||
}
|
||||
#endif // CONFIG_INTRABC
|
||||
|
||||
if (loop) {
|
||||
loop_count++;
|
||||
|
@ -1841,7 +1841,8 @@ static int64_t rd_pick_intra_sby_mode(VP9_COMP *cpi, MACROBLOCK *x,
|
||||
this_rate += vp9_cost_bit(cpi->common.fc.y_tx_skip_prob[0], 0);
|
||||
#endif
|
||||
#if CONFIG_INTRABC
|
||||
this_rate += vp9_cost_bit(INTRABC_PROB, 0);
|
||||
if (cpi->common.allow_intrabc_mode)
|
||||
this_rate += vp9_cost_bit(INTRABC_PROB, 0);
|
||||
#endif // CONFIG_INTRABC
|
||||
#if CONFIG_FILTERINTRA
|
||||
if (is_filter_allowed(mode) && is_filter_enabled(mic->mbmi.tx_size))
|
||||
@ -1910,7 +1911,8 @@ static int64_t rd_pick_intra_sby_mode(VP9_COMP *cpi, MACROBLOCK *x,
|
||||
this_rate = this_rate_tokenonly + bmode_costs[mode];
|
||||
this_rate += vp9_cost_bit(cpi->common.fc.y_tx_skip_prob[0], 1);
|
||||
#if CONFIG_INTRABC
|
||||
this_rate += vp9_cost_bit(INTRABC_PROB, 0);
|
||||
if (cpi->common.allow_intrabc_mode)
|
||||
this_rate += vp9_cost_bit(INTRABC_PROB, 0);
|
||||
#endif // CONFIG_INTRABC
|
||||
#if CONFIG_FILTERINTRA
|
||||
if (is_filter_allowed(mode) && is_filter_enabled(mic->mbmi.tx_size))
|
||||
@ -2134,7 +2136,8 @@ static int64_t rd_pick_intra_sby_mode(VP9_COMP *cpi, MACROBLOCK *x,
|
||||
mic->mbmi.tx_skip[0]);
|
||||
#endif // CONFIG_TX_SKIP
|
||||
#if CONFIG_INTRABC
|
||||
this_rate += vp9_cost_bit(INTRABC_PROB, 0);
|
||||
if (cpi->common.allow_intrabc_mode)
|
||||
this_rate += vp9_cost_bit(INTRABC_PROB, 0);
|
||||
#endif // CONFIG_INTRABC
|
||||
this_rd = RDCOST(x->rdmult, x->rddiv, this_rate, this_distortion);
|
||||
if (this_rd < best_rd) {
|
||||
@ -5625,7 +5628,8 @@ static void rd_pick_palette_444(VP9_COMP *cpi, MACROBLOCK *x, RD_COST *rd_cost,
|
||||
}
|
||||
rate_uv = rate_uv_tokenonly + (1 + 8 * 2 * n) * vp9_cost_bit(128, 0);
|
||||
#if CONFIG_INTRABC
|
||||
rate_y += vp9_cost_bit(INTRABC_PROB, 0);
|
||||
if (cm->allow_intrabc_mode)
|
||||
rate_y += vp9_cost_bit(INTRABC_PROB, 0);
|
||||
#endif // CONFIG_INTRABC
|
||||
#if CONFIG_TX_SKIP
|
||||
rate_y +=
|
||||
@ -5777,7 +5781,7 @@ void vp9_rd_pick_intra_mode_sb(VP9_COMP *cpi, MACROBLOCK *x,
|
||||
#endif // CONFIG_PALETTE
|
||||
|
||||
#if CONFIG_INTRABC
|
||||
if (bsize >= BLOCK_8X8) {
|
||||
if (bsize >= BLOCK_8X8 && cm->allow_intrabc_mode) {
|
||||
best_rd = MIN(best_rd, rd_cost->rdcost);
|
||||
if (rd_pick_intrabc_sb_mode(cpi, x, mi_row, mi_col, &rate_y,
|
||||
&dist_y, &y_skip, bsize,
|
||||
|
Loading…
x
Reference in New Issue
Block a user