Commit 7c412ea4 authored by Alex Converse's avatar Alex Converse

intrabc: adapt use_intrabc prob

First keyframe BD-RATE objective-1-fast:
   PSNR | PSNR Cb | PSNR Cr | PSNR HVS |    SSIM | MS SSIM | CIEDE 2000
-0.3705 | -0.3232 | -0.3812 |  -0.3782 |     N/A | -0.3412 |        N/A

First keyframe BD-RATE twitch-1:
   PSNR | PSNR Cb | PSNR Cr | PSNR HVS |    SSIM | MS SSIM | CIEDE 2000
-0.2479 | -0.2477 | -0.2467 |  -0.2567 | -0.2486 | -0.2508 |    -0.2487



Change-Id: Iea6c895c6fe9e9764887a8968f6e5330903969d3
parent 47e07077
......@@ -4535,6 +4535,9 @@ static void init_mode_probs(FRAME_CONTEXT *fc) {
#if CONFIG_CFL
av1_copy(fc->cfl_alpha_cdf, default_cfl_alpha_cdf);
#endif
#if CONFIG_INTRABC
fc->intrabc_prob = INTRABC_PROB_DEFAULT;
#endif
}
int av1_switchable_interp_ind[SWITCHABLE_FILTERS];
......
......@@ -73,7 +73,7 @@ extern "C" {
#endif // CONFIG_PALETTE
#if CONFIG_INTRABC
#define INTRABC_PROB 192
#define INTRABC_PROB_DEFAULT 192
#endif // CONFIG_INTRABC
struct AV1Common;
......@@ -230,6 +230,7 @@ typedef struct frame_contexts {
nmv_context nmvc[NMV_CONTEXTS];
#if CONFIG_INTRABC
nmv_context ndvc;
aom_prob intrabc_prob;
#endif
int initialized;
#if CONFIG_EXT_TX
......@@ -405,6 +406,7 @@ typedef struct FRAME_COUNTS {
unsigned int skip[SKIP_CONTEXTS][2];
nmv_context_counts mv[NMV_CONTEXTS];
#if CONFIG_INTRABC
unsigned int intrabc[2];
nmv_context_counts dv;
#endif
#if CONFIG_DELTA_Q
......
......@@ -4794,6 +4794,11 @@ static int read_compressed_header(AV1Decoder *pbi, const uint8_t *data,
for (j = 0; j < INTRA_MODES; j++)
for (i = 0; i < INTRA_MODES - 1; ++i)
av1_diff_update_prob(&r, &cm->kf_y_prob[k][j][i], ACCT_STR);
#endif
#if CONFIG_INTRABC
if (cm->allow_screen_content_tools) {
av1_diff_update_prob(&r, &fc->intrabc_prob, ACCT_STR);
}
#endif
} else {
read_inter_mode_probs(fc, &r);
......
......@@ -1017,7 +1017,7 @@ static void read_intra_frame_mode_info(AV1_COMMON *const cm,
#if CONFIG_INTRABC
if (bsize >= BLOCK_8X8 && cm->allow_screen_content_tools) {
mbmi->use_intrabc = aom_read(r, INTRABC_PROB, ACCT_STR);
mbmi->use_intrabc = aom_read(r, ec_ctx->intrabc_prob, ACCT_STR);
if (mbmi->use_intrabc) {
mbmi->mode = mbmi->uv_mode = DC_PRED;
#if CONFIG_DUAL_FILTER
......
......@@ -2126,7 +2126,7 @@ static void write_mb_modes_kf(AV1_COMMON *cm,
#if CONFIG_INTRABC
if (bsize >= BLOCK_8X8 && cm->allow_screen_content_tools) {
int use_intrabc = is_intrabc_block(mbmi);
aom_write(w, use_intrabc, INTRABC_PROB);
aom_write(w, use_intrabc, ec_ctx->intrabc_prob);
if (use_intrabc) {
assert(mbmi->mode == DC_PRED);
assert(mbmi->uv_mode == DC_PRED);
......@@ -4718,6 +4718,12 @@ static uint32_t write_compressed_header(AV1_COMP *cpi, uint8_t *data) {
counts->kf_y_mode[i][j], INTRA_MODES, probwt,
header_bc);
#endif // CONFIG_EC_ADAPT
#if CONFIG_INTRABC
if (cm->allow_screen_content_tools) {
av1_cond_prob_diff_update(header_bc, &fc->intrabc_prob,
cm->counts.intrabc, probwt);
}
#endif
} else {
update_inter_mode_probs(cm, header_bc, counts);
#if CONFIG_EXT_INTER
......
......@@ -1730,6 +1730,15 @@ static void update_stats(const AV1_COMMON *const cm, ThreadData *td, int mi_row,
}
}
}
#if CONFIG_INTRABC
} else {
if (cm->allow_screen_content_tools && bsize >= BLOCK_8X8) {
FRAME_COUNTS *const counts = td->counts;
++counts->intrabc[mbmi->use_intrabc];
} else {
assert(!mbmi->use_intrabc);
}
#endif
}
}
......
......@@ -8109,6 +8109,11 @@ static int64_t rd_pick_intrabc_mode_sb(const AV1_COMP *cpi, MACROBLOCK *x,
MACROBLOCKD *const xd = &x->e_mbd;
const TileInfo *tile = &xd->tile;
#if CONFIG_EC_ADAPT
FRAME_CONTEXT *const ec_ctx = xd->tile_ctx;
#else
FRAME_CONTEXT *const ec_ctx = cm->fc;
#endif // CONFIG_EC_ADAPT
MODE_INFO *const mi = xd->mi[0];
const int mi_row = -xd->mb_to_top_edge / (8 * MI_SIZE);
const int mi_col = -xd->mb_to_left_edge / (8 * MI_SIZE);
......@@ -8223,8 +8228,8 @@ static int64_t rd_pick_intrabc_mode_sb(const AV1_COMP *cpi, MACROBLOCK *x,
x->mvcost, MV_COST_WEIGHT);
const PREDICTION_MODE A = av1_above_block_mode(mi, xd->above_mi, 0);
const PREDICTION_MODE L = av1_left_block_mode(mi, xd->left_mi, 0);
const int rate_mode =
cpi->y_mode_costs[A][L][DC_PRED] + av1_cost_bit(INTRABC_PROB, 1);
const int rate_mode = cpi->y_mode_costs[A][L][DC_PRED] +
av1_cost_bit(ec_ctx->intrabc_prob, 1);
RD_STATS rd_stats, rd_stats_uv;
av1_subtract_plane(x, bsize, 0);
......
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