Commit 6b3d1e34 authored by Hui Su's avatar Hui Su
Browse files

Remove probability model for comp_ref_type

Change-Id: Ib4b83335ba9c61435f774136bc57638d8b88e963
parent c16fbbc0
...@@ -1405,9 +1405,6 @@ static const aom_cdf_prob default_comp_inter_cdf[COMP_INTER_CONTEXTS][CDF_SIZE( ...@@ -1405,9 +1405,6 @@ static const aom_cdf_prob default_comp_inter_cdf[COMP_INTER_CONTEXTS][CDF_SIZE(
{ AOM_CDF2(2842) } }; { AOM_CDF2(2842) } };
#if CONFIG_EXT_COMP_REFS #if CONFIG_EXT_COMP_REFS
static const aom_prob default_comp_ref_type_p[COMP_REF_TYPE_CONTEXTS] = {
8, 20, 78, 91, 194
};
static const aom_prob static const aom_prob
default_uni_comp_ref_p[UNI_COMP_REF_CONTEXTS][UNIDIR_COMP_REFS - 1] = { default_uni_comp_ref_p[UNI_COMP_REF_CONTEXTS][UNIDIR_COMP_REFS - 1] = {
{ 88, 30, 28 }, { 218, 97, 105 }, { 254, 180, 196 } { 88, 30, 28 }, { 218, 97, 105 }, { 254, 180, 196 }
...@@ -3300,7 +3297,6 @@ static void init_mode_probs(FRAME_CONTEXT *fc) { ...@@ -3300,7 +3297,6 @@ static void init_mode_probs(FRAME_CONTEXT *fc) {
#endif // CONFIG_EXT_INTRA_MOD #endif // CONFIG_EXT_INTRA_MOD
av1_copy(fc->comp_inter_cdf, default_comp_inter_cdf); av1_copy(fc->comp_inter_cdf, default_comp_inter_cdf);
#if CONFIG_EXT_COMP_REFS #if CONFIG_EXT_COMP_REFS
av1_copy(fc->comp_ref_type_prob, default_comp_ref_type_p);
av1_copy(fc->uni_comp_ref_prob, default_uni_comp_ref_p); av1_copy(fc->uni_comp_ref_prob, default_uni_comp_ref_p);
av1_copy(fc->comp_ref_type_cdf, default_comp_ref_type_cdf); av1_copy(fc->comp_ref_type_cdf, default_comp_ref_type_cdf);
av1_copy(fc->uni_comp_ref_cdf, default_uni_comp_ref_cdf); av1_copy(fc->uni_comp_ref_cdf, default_uni_comp_ref_cdf);
...@@ -3404,10 +3400,6 @@ void av1_adapt_inter_frame_probs(AV1_COMMON *cm) { ...@@ -3404,10 +3400,6 @@ void av1_adapt_inter_frame_probs(AV1_COMMON *cm) {
const FRAME_COUNTS *counts = &cm->counts; const FRAME_COUNTS *counts = &cm->counts;
#if CONFIG_EXT_COMP_REFS #if CONFIG_EXT_COMP_REFS
for (i = 0; i < COMP_REF_TYPE_CONTEXTS; i++)
fc->comp_ref_type_prob[i] = av1_mode_mv_merge_probs(
pre_fc->comp_ref_type_prob[i], counts->comp_ref_type[i]);
for (i = 0; i < UNI_COMP_REF_CONTEXTS; i++) for (i = 0; i < UNI_COMP_REF_CONTEXTS; i++)
for (j = 0; j < (UNIDIR_COMP_REFS - 1); j++) for (j = 0; j < (UNIDIR_COMP_REFS - 1); j++)
fc->uni_comp_ref_prob[i][j] = av1_mode_mv_merge_probs( fc->uni_comp_ref_prob[i][j] = av1_mode_mv_merge_probs(
......
...@@ -161,7 +161,6 @@ typedef struct frame_contexts { ...@@ -161,7 +161,6 @@ typedef struct frame_contexts {
aom_cdf_prob comp_inter_cdf[COMP_INTER_CONTEXTS][CDF_SIZE(2)]; aom_cdf_prob comp_inter_cdf[COMP_INTER_CONTEXTS][CDF_SIZE(2)];
aom_cdf_prob single_ref_cdf[REF_CONTEXTS][SINGLE_REFS - 1][CDF_SIZE(2)]; aom_cdf_prob single_ref_cdf[REF_CONTEXTS][SINGLE_REFS - 1][CDF_SIZE(2)];
#if CONFIG_EXT_COMP_REFS #if CONFIG_EXT_COMP_REFS
aom_prob comp_ref_type_prob[COMP_REF_TYPE_CONTEXTS];
aom_prob uni_comp_ref_prob[UNI_COMP_REF_CONTEXTS][UNIDIR_COMP_REFS - 1]; aom_prob uni_comp_ref_prob[UNI_COMP_REF_CONTEXTS][UNIDIR_COMP_REFS - 1];
aom_cdf_prob comp_ref_type_cdf[COMP_REF_TYPE_CONTEXTS][CDF_SIZE(2)]; aom_cdf_prob comp_ref_type_cdf[COMP_REF_TYPE_CONTEXTS][CDF_SIZE(2)];
aom_cdf_prob uni_comp_ref_cdf[UNI_COMP_REF_CONTEXTS][UNIDIR_COMP_REFS - 1] aom_cdf_prob uni_comp_ref_cdf[UNI_COMP_REF_CONTEXTS][UNIDIR_COMP_REFS - 1]
...@@ -322,7 +321,9 @@ typedef struct FRAME_COUNTS { ...@@ -322,7 +321,9 @@ typedef struct FRAME_COUNTS {
unsigned int comp_inter[COMP_INTER_CONTEXTS][2]; unsigned int comp_inter[COMP_INTER_CONTEXTS][2];
#endif // CONFIG_ENTROPY_STATS #endif // CONFIG_ENTROPY_STATS
#if CONFIG_EXT_COMP_REFS #if CONFIG_EXT_COMP_REFS
#if CONFIG_ENTROPY_STATS
unsigned int comp_ref_type[COMP_REF_TYPE_CONTEXTS][2]; unsigned int comp_ref_type[COMP_REF_TYPE_CONTEXTS][2];
#endif // CONFIG_ENTROPY_STATS
unsigned int uni_comp_ref[UNI_COMP_REF_CONTEXTS][UNIDIR_COMP_REFS - 1][2]; unsigned int uni_comp_ref[UNI_COMP_REF_CONTEXTS][UNIDIR_COMP_REFS - 1][2];
#endif // CONFIG_EXT_COMP_REFS #endif // CONFIG_EXT_COMP_REFS
#if CONFIG_ENTROPY_STATS #if CONFIG_ENTROPY_STATS
......
...@@ -200,11 +200,6 @@ static INLINE aom_cdf_prob *av1_get_reference_mode_cdf(const AV1_COMMON *cm, ...@@ -200,11 +200,6 @@ static INLINE aom_cdf_prob *av1_get_reference_mode_cdf(const AV1_COMMON *cm,
#if CONFIG_EXT_COMP_REFS #if CONFIG_EXT_COMP_REFS
int av1_get_comp_reference_type_context(const MACROBLOCKD *xd); int av1_get_comp_reference_type_context(const MACROBLOCKD *xd);
static INLINE aom_prob av1_get_comp_reference_type_prob(const AV1_COMMON *cm,
const MACROBLOCKD *xd) {
return cm->fc->comp_ref_type_prob[av1_get_comp_reference_type_context(xd)];
}
int av1_get_pred_context_uni_comp_ref_p(const MACROBLOCKD *xd); int av1_get_pred_context_uni_comp_ref_p(const MACROBLOCKD *xd);
static INLINE aom_prob av1_get_pred_prob_uni_comp_ref_p(const AV1_COMMON *cm, static INLINE aom_prob av1_get_pred_prob_uni_comp_ref_p(const AV1_COMMON *cm,
......
...@@ -3133,8 +3133,6 @@ static void debug_check_frame_counts(const AV1_COMMON *const cm) { ...@@ -3133,8 +3133,6 @@ static void debug_check_frame_counts(const AV1_COMMON *const cm) {
assert(!memcmp(cm->counts.intra_inter, zero_counts.intra_inter, assert(!memcmp(cm->counts.intra_inter, zero_counts.intra_inter,
sizeof(cm->counts.intra_inter))); sizeof(cm->counts.intra_inter)));
#if CONFIG_EXT_COMP_REFS #if CONFIG_EXT_COMP_REFS
assert(!memcmp(cm->counts.comp_ref_type, zero_counts.comp_ref_type,
sizeof(cm->counts.comp_ref_type)));
assert(!memcmp(cm->counts.uni_comp_ref, zero_counts.uni_comp_ref, assert(!memcmp(cm->counts.uni_comp_ref, zero_counts.uni_comp_ref,
sizeof(cm->counts.uni_comp_ref))); sizeof(cm->counts.uni_comp_ref)));
#endif // CONFIG_EXT_COMP_REFS #endif // CONFIG_EXT_COMP_REFS
......
...@@ -1289,8 +1289,6 @@ static COMP_REFERENCE_TYPE read_comp_reference_type(const MACROBLOCKD *xd, ...@@ -1289,8 +1289,6 @@ static COMP_REFERENCE_TYPE read_comp_reference_type(const MACROBLOCKD *xd,
const COMP_REFERENCE_TYPE comp_ref_type = const COMP_REFERENCE_TYPE comp_ref_type =
(COMP_REFERENCE_TYPE)aom_read_symbol( (COMP_REFERENCE_TYPE)aom_read_symbol(
r, xd->tile_ctx->comp_ref_type_cdf[ctx], 2, ACCT_STR); r, xd->tile_ctx->comp_ref_type_cdf[ctx], 2, ACCT_STR);
FRAME_COUNTS *counts = xd->counts;
if (counts) ++counts->comp_ref_type[ctx][comp_ref_type];
return comp_ref_type; // UNIDIR_COMP_REFERENCE or BIDIR_COMP_REFERENCE return comp_ref_type; // UNIDIR_COMP_REFERENCE or BIDIR_COMP_REFERENCE
} }
#endif // CONFIG_EXT_COMP_REFS #endif // CONFIG_EXT_COMP_REFS
......
...@@ -285,6 +285,10 @@ struct macroblock { ...@@ -285,6 +285,10 @@ struct macroblock {
int comp_inter_cost[COMP_INTER_CONTEXTS][2]; int comp_inter_cost[COMP_INTER_CONTEXTS][2];
int single_ref_cost[REF_CONTEXTS][SINGLE_REFS - 1][2]; int single_ref_cost[REF_CONTEXTS][SINGLE_REFS - 1][2];
#if CONFIG_EXT_COMP_REFS
int comp_ref_type_cost[COMP_REF_TYPE_CONTEXTS]
[CDF_SIZE(COMP_REFERENCE_TYPES)];
#endif // CONFIG_EXT_COMP_REFS
int inter_compound_mode_cost[INTER_MODE_CONTEXTS][INTER_COMPOUND_MODES]; int inter_compound_mode_cost[INTER_MODE_CONTEXTS][INTER_COMPOUND_MODES];
#if CONFIG_JNT_COMP #if CONFIG_JNT_COMP
int compound_type_cost[BLOCK_SIZES_ALL][COMPOUND_TYPES - 1]; int compound_type_cost[BLOCK_SIZES_ALL][COMPOUND_TYPES - 1];
......
...@@ -901,8 +901,14 @@ static void update_stats(const AV1_COMMON *const cm, TileDataEnc *tile_data, ...@@ -901,8 +901,14 @@ static void update_stats(const AV1_COMMON *const cm, TileDataEnc *tile_data,
const COMP_REFERENCE_TYPE comp_ref_type = has_uni_comp_refs(mbmi) const COMP_REFERENCE_TYPE comp_ref_type = has_uni_comp_refs(mbmi)
? UNIDIR_COMP_REFERENCE ? UNIDIR_COMP_REFERENCE
: BIDIR_COMP_REFERENCE; : BIDIR_COMP_REFERENCE;
if (allow_update_cdf) {
update_cdf(av1_get_comp_reference_type_cdf(xd), comp_ref_type,
COMP_REFERENCE_TYPES);
}
#if CONFIG_ENTROPY_STATS
counts->comp_ref_type[av1_get_comp_reference_type_context(xd)] counts->comp_ref_type[av1_get_comp_reference_type_context(xd)]
[comp_ref_type]++; [comp_ref_type]++;
#endif // CONFIG_ENTROPY_STATS
if (comp_ref_type == UNIDIR_COMP_REFERENCE) { if (comp_ref_type == UNIDIR_COMP_REFERENCE) {
const int bit = (ref0 == BWDREF_FRAME); const int bit = (ref0 == BWDREF_FRAME);
......
...@@ -238,6 +238,13 @@ void av1_fill_mode_rates(AV1_COMMON *const cm, MACROBLOCK *x, ...@@ -238,6 +238,13 @@ void av1_fill_mode_rates(AV1_COMMON *const cm, MACROBLOCK *x,
} }
} }
#if CONFIG_EXT_COMP_REFS
for (i = 0; i < REF_CONTEXTS; ++i) {
av1_cost_tokens_from_cdf(x->comp_ref_type_cost[i],
fc->comp_ref_type_cdf[i], NULL);
}
#endif // CONFIG_EXT_COMP_REFS
for (i = 0; i < INTRA_INTER_CONTEXTS; ++i) { for (i = 0; i < INTRA_INTER_CONTEXTS; ++i) {
av1_cost_tokens_from_cdf(x->intra_inter_cost[i], fc->intra_inter_cdf[i], av1_cost_tokens_from_cdf(x->intra_inter_cost[i], fc->intra_inter_cdf[i],
NULL); NULL);
......
...@@ -5892,12 +5892,12 @@ static void estimate_ref_frame_costs( ...@@ -5892,12 +5892,12 @@ static void estimate_ref_frame_costs(
aom_prob bwdref_comp_p1 = av1_get_pred_prob_comp_bwdref_p1(cm, xd); aom_prob bwdref_comp_p1 = av1_get_pred_prob_comp_bwdref_p1(cm, xd);
#if CONFIG_EXT_COMP_REFS #if CONFIG_EXT_COMP_REFS
aom_prob comp_ref_type_p = av1_get_comp_reference_type_prob(cm, xd); const int comp_ref_type_ctx = av1_get_comp_reference_type_context(xd);
unsigned int ref_bicomp_costs[TOTAL_REFS_PER_FRAME] = { 0 }; unsigned int ref_bicomp_costs[TOTAL_REFS_PER_FRAME] = { 0 };
ref_bicomp_costs[LAST_FRAME] = ref_bicomp_costs[LAST2_FRAME] = ref_bicomp_costs[LAST_FRAME] = ref_bicomp_costs[LAST2_FRAME] =
ref_bicomp_costs[LAST3_FRAME] = ref_bicomp_costs[GOLDEN_FRAME] = ref_bicomp_costs[LAST3_FRAME] = ref_bicomp_costs[GOLDEN_FRAME] =
base_cost + av1_cost_bit(comp_ref_type_p, 1); base_cost + x->comp_ref_type_cost[comp_ref_type_ctx][1];
ref_bicomp_costs[BWDREF_FRAME] = ref_bicomp_costs[ALTREF2_FRAME] = 0; ref_bicomp_costs[BWDREF_FRAME] = ref_bicomp_costs[ALTREF2_FRAME] = 0;
ref_bicomp_costs[ALTREF_FRAME] = 0; ref_bicomp_costs[ALTREF_FRAME] = 0;
...@@ -5932,19 +5932,18 @@ static void estimate_ref_frame_costs( ...@@ -5932,19 +5932,18 @@ static void estimate_ref_frame_costs(
aom_prob uni_comp_ref_p2 = av1_get_pred_prob_uni_comp_ref_p2(cm, xd); aom_prob uni_comp_ref_p2 = av1_get_pred_prob_uni_comp_ref_p2(cm, xd);
ref_costs_comp[LAST_FRAME][LAST2_FRAME] = ref_costs_comp[LAST_FRAME][LAST2_FRAME] =
base_cost + av1_cost_bit(comp_ref_type_p, 0) + base_cost + x->comp_ref_type_cost[comp_ref_type_ctx][0] +
av1_cost_bit(uni_comp_ref_p, 0) + av1_cost_bit(uni_comp_ref_p1, 0); av1_cost_bit(uni_comp_ref_p, 0) + av1_cost_bit(uni_comp_ref_p1, 0);
ref_costs_comp[LAST_FRAME][LAST3_FRAME] = ref_costs_comp[LAST_FRAME][LAST3_FRAME] =
base_cost + av1_cost_bit(comp_ref_type_p, 0) + base_cost + x->comp_ref_type_cost[comp_ref_type_ctx][0] +
av1_cost_bit(uni_comp_ref_p, 0) + av1_cost_bit(uni_comp_ref_p1, 1) + av1_cost_bit(uni_comp_ref_p, 0) + av1_cost_bit(uni_comp_ref_p1, 1) +
av1_cost_bit(uni_comp_ref_p2, 0); av1_cost_bit(uni_comp_ref_p2, 0);
ref_costs_comp[LAST_FRAME][GOLDEN_FRAME] = ref_costs_comp[LAST_FRAME][GOLDEN_FRAME] =
base_cost + av1_cost_bit(comp_ref_type_p, 0) + base_cost + x->comp_ref_type_cost[comp_ref_type_ctx][0] +
av1_cost_bit(uni_comp_ref_p, 0) + av1_cost_bit(uni_comp_ref_p1, 1) + av1_cost_bit(uni_comp_ref_p, 0) + av1_cost_bit(uni_comp_ref_p1, 1) +
av1_cost_bit(uni_comp_ref_p2, 1); av1_cost_bit(uni_comp_ref_p2, 1);
ref_costs_comp[BWDREF_FRAME][ALTREF_FRAME] = ref_costs_comp[BWDREF_FRAME][ALTREF_FRAME] =
base_cost + av1_cost_bit(comp_ref_type_p, 0) + base_cost + x->comp_ref_type_cost[comp_ref_type_ctx][0] +
av1_cost_bit(uni_comp_ref_p, 1); av1_cost_bit(uni_comp_ref_p, 1);
#else // !CONFIG_EXT_COMP_REFS #else // !CONFIG_EXT_COMP_REFS
......
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