Commit eaf128a9 authored by Yue Chen's avatar Yue Chen
Browse files

new_multisymbol: use cdf-based costs of interintra

Calculate rate costs of interintra and wedge interintar symbols
based on cdfs that are per-sb updated.

Change-Id: I4fa73953cb0bccbf078d2e2dd4e90370972fcce1
parent dab2ca9d
...@@ -241,6 +241,8 @@ struct macroblock { ...@@ -241,6 +241,8 @@ struct macroblock {
[INTER_SINGLEREF_COMP_MODES]; [INTER_SINGLEREF_COMP_MODES];
#endif // CONFIG_COMPOUND_SINGLEREF #endif // CONFIG_COMPOUND_SINGLEREF
#if CONFIG_INTERINTRA #if CONFIG_INTERINTRA
int interintra_cost[BLOCK_SIZE_GROUPS][2];
int wedge_interintra_cost[BLOCK_SIZES_ALL][2];
int interintra_mode_cost[BLOCK_SIZE_GROUPS][INTERINTRA_MODES]; int interintra_mode_cost[BLOCK_SIZE_GROUPS][INTERINTRA_MODES];
#endif // CONFIG_INTERINTRA #endif // CONFIG_INTERINTRA
#if CONFIG_MOTION_VAR || CONFIG_WARPED_MOTION #if CONFIG_MOTION_VAR || CONFIG_WARPED_MOTION
......
...@@ -338,9 +338,28 @@ void av1_fill_mode_rates(AV1_COMMON *const cm, MACROBLOCK *x, ...@@ -338,9 +338,28 @@ void av1_fill_mode_rates(AV1_COMMON *const cm, MACROBLOCK *x,
fc->inter_singleref_comp_mode_cdf[i], NULL); fc->inter_singleref_comp_mode_cdf[i], NULL);
#endif // CONFIG_COMPOUND_SINGLEREF #endif // CONFIG_COMPOUND_SINGLEREF
#if CONFIG_INTERINTRA #if CONFIG_INTERINTRA
for (i = 0; i < BLOCK_SIZE_GROUPS; ++i) for (i = 0; i < BLOCK_SIZE_GROUPS; ++i) {
#if CONFIG_NEW_MULTISYMBOL
av1_cost_tokens_from_cdf(x->interintra_cost[i], fc->interintra_cdf[i],
NULL);
#else
x->interintra_cost[i][0] = av1_cost_bit(fc->interintra_prob[i], 0);
x->interintra_cost[i][1] = av1_cost_bit(fc->interintra_prob[i], 1);
#endif
av1_cost_tokens_from_cdf(x->interintra_mode_cost[i], av1_cost_tokens_from_cdf(x->interintra_mode_cost[i],
fc->interintra_mode_cdf[i], NULL); fc->interintra_mode_cdf[i], NULL);
}
for (i = 0; i < BLOCK_SIZES_ALL; ++i) {
#if CONFIG_NEW_MULTISYMBOL
av1_cost_tokens_from_cdf(x->wedge_interintra_cost[i],
fc->wedge_interintra_cdf[i], NULL);
#else
x->wedge_interintra_cost[i][0] =
av1_cost_bit(fc->wedge_interintra_prob[i], 0);
x->wedge_interintra_cost[i][1] =
av1_cost_bit(fc->wedge_interintra_prob[i], 1);
#endif
}
#endif // CONFIG_INTERINTRA #endif // CONFIG_INTERINTRA
#if CONFIG_MOTION_VAR || CONFIG_WARPED_MOTION #if CONFIG_MOTION_VAR || CONFIG_WARPED_MOTION
for (i = BLOCK_8X8; i < BLOCK_SIZES_ALL; i++) { for (i = BLOCK_8X8; i < BLOCK_SIZES_ALL; i++) {
......
...@@ -9740,7 +9740,7 @@ static int64_t handle_inter_mode(const AV1_COMP *const cpi, MACROBLOCK *x, ...@@ -9740,7 +9740,7 @@ static int64_t handle_inter_mode(const AV1_COMP *const cpi, MACROBLOCK *x,
int64_t best_interintra_rd_nowedge = INT64_MAX; int64_t best_interintra_rd_nowedge = INT64_MAX;
int64_t best_interintra_rd_wedge = INT64_MAX; int64_t best_interintra_rd_wedge = INT64_MAX;
int_mv tmp_mv; int_mv tmp_mv;
int rwedge = av1_cost_bit(cm->fc->wedge_interintra_prob[bsize], 0); int rwedge = x->wedge_interintra_cost[bsize][0];
if (rd != INT64_MAX) if (rd != INT64_MAX)
rd = RDCOST(x->rdmult, rmode + rate_mv + rwedge + rate_sum, dist_sum); rd = RDCOST(x->rdmult, rmode + rate_mv + rwedge + rate_sum, dist_sum);
best_interintra_rd_nowedge = best_interintra_rd; best_interintra_rd_nowedge = best_interintra_rd;
...@@ -9750,7 +9750,7 @@ static int64_t handle_inter_mode(const AV1_COMP *const cpi, MACROBLOCK *x, ...@@ -9750,7 +9750,7 @@ static int64_t handle_inter_mode(const AV1_COMP *const cpi, MACROBLOCK *x,
mbmi->use_wedge_interintra = 1; mbmi->use_wedge_interintra = 1;
rwedge = av1_cost_literal(get_interintra_wedge_bits(bsize)) + rwedge = av1_cost_literal(get_interintra_wedge_bits(bsize)) +
av1_cost_bit(cm->fc->wedge_interintra_prob[bsize], 1); x->wedge_interintra_cost[bsize][1];
best_interintra_rd_wedge = best_interintra_rd_wedge =
pick_interintra_wedge(cpi, x, bsize, intrapred_, tmp_buf_); pick_interintra_wedge(cpi, x, bsize, intrapred_, tmp_buf_);
...@@ -9807,20 +9807,18 @@ static int64_t handle_inter_mode(const AV1_COMP *const cpi, MACROBLOCK *x, ...@@ -9807,20 +9807,18 @@ static int64_t handle_inter_mode(const AV1_COMP *const cpi, MACROBLOCK *x,
#endif // CONFIG_WEDGE #endif // CONFIG_WEDGE
pred_exists = 0; pred_exists = 0;
compmode_interintra_cost = compmode_interintra_cost = x->interintra_cost[size_group_lookup[bsize]][1] +
av1_cost_bit(cm->fc->interintra_prob[size_group_lookup[bsize]], 1) + interintra_mode_cost[mbmi->interintra_mode];
interintra_mode_cost[mbmi->interintra_mode];
if (is_interintra_wedge_used(bsize)) { if (is_interintra_wedge_used(bsize)) {
compmode_interintra_cost += av1_cost_bit( compmode_interintra_cost +=
cm->fc->wedge_interintra_prob[bsize], mbmi->use_wedge_interintra); x->wedge_interintra_cost[bsize][mbmi->use_wedge_interintra];
if (mbmi->use_wedge_interintra) { if (mbmi->use_wedge_interintra) {
compmode_interintra_cost += compmode_interintra_cost +=
av1_cost_literal(get_interintra_wedge_bits(bsize)); av1_cost_literal(get_interintra_wedge_bits(bsize));
} }
} }
} else if (is_interintra_allowed(mbmi)) { } else if (is_interintra_allowed(mbmi)) {
compmode_interintra_cost = compmode_interintra_cost = x->interintra_cost[size_group_lookup[bsize]][0];
av1_cost_bit(cm->fc->interintra_prob[size_group_lookup[bsize]], 0);
} }
#endif // CONFIG_INTERINTRA #endif // CONFIG_INTERINTRA
......
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