Commit 0fbd2b79 authored by Thomas Davies's avatar Thomas Davies

NEW_MULTISYMBOL: support EXT_COMP_REFS signaling.

Change-Id: Ic29bac4cd00a009e4a5a607ecc5596fa53bb1c1f
parent 77f792f0
......@@ -2323,6 +2323,10 @@ void av1_average_tile_inter_cdfs(AV1_COMMON *cm, FRAME_CONTEXT *fc,
AVERAGE_TILE_CDFS(zeromv_cdf)
AVERAGE_TILE_CDFS(refmv_cdf)
AVERAGE_TILE_CDFS(drl_cdf)
#if CONFIG_EXT_COMP_REFS
AVERAGE_TILE_CDFS(uni_comp_ref_cdf)
AVERAGE_TILE_CDFS(comp_ref_type_cdf)
#endif
#endif
// FIXME: cdfs not defined for super_tx
......
......@@ -1356,9 +1356,13 @@ static REFERENCE_MODE read_block_reference_mode(AV1_COMMON *cm,
#if CONFIG_NEW_MULTISYMBOL
#define READ_REF_BIT(pname) \
aom_read_symbol(r, av1_get_pred_cdf_##pname(cm, xd), 2, ACCT_STR)
#define READ_REF_BIT2(pname) \
aom_read_symbol(r, av1_get_pred_cdf_##pname(xd), 2, ACCT_STR)
#else
#define READ_REF_BIT(pname) \
aom_read(r, av1_get_pred_prob_##pname(cm, xd), ACCT_STR)
#define READ_REF_BIT2(pname) \
aom_read(r, av1_get_pred_prob_##pname(cm, xd), ACCT_STR)
#endif
#if CONFIG_EXT_COMP_REFS
......@@ -1369,16 +1373,24 @@ static COMP_REFERENCE_TYPE read_comp_reference_type(AV1_COMMON *cm,
#if USE_UNI_COMP_REFS
COMP_REFERENCE_TYPE comp_ref_type;
#if CONFIG_VAR_REFS
if ((L_OR_L2(cm) || L3_OR_G(cm)) && BWD_OR_ALT(cm))
if (L_AND_L2(cm) || L_AND_L3(cm) || L_AND_G(cm) || BWD_AND_ALT(cm))
if ((L_OR_L2(cm) || L3_OR_G(cm)) && BWD_OR_ALT(cm)) {
if (L_AND_L2(cm) || L_AND_L3(cm) || L_AND_G(cm) || BWD_AND_ALT(cm)) {
#endif // CONFIG_VAR_REFS
comp_ref_type = (COMP_REFERENCE_TYPE)aom_read(
r, cm->fc->comp_ref_type_prob[ctx], ACCT_STR);
#if CONFIG_NEW_MULTISYMBOL
(void)cm;
comp_ref_type = (COMP_REFERENCE_TYPE)aom_read_symbol(
r, xd->tile_ctx->comp_ref_type_cdf[ctx], 2, ACCT_STR);
#else
comp_ref_type = (COMP_REFERENCE_TYPE)aom_read(
r, cm->fc->comp_ref_type_prob[ctx], ACCT_STR);
#endif
#if CONFIG_VAR_REFS
else
} else {
comp_ref_type = BIDIR_COMP_REFERENCE;
else
}
} else {
comp_ref_type = UNIDIR_COMP_REFERENCE;
}
#endif // CONFIG_VAR_REFS
#else // !USE_UNI_COMP_REFS
// TODO(zoeliu): Temporarily turn off uni-directional comp refs
......@@ -1394,9 +1406,6 @@ static COMP_REFERENCE_TYPE read_comp_reference_type(AV1_COMMON *cm,
static void read_ref_frames(AV1_COMMON *const cm, MACROBLOCKD *const xd,
aom_reader *r, int segment_id,
MV_REFERENCE_FRAME ref_frame[2]) {
#if CONFIG_EXT_COMP_REFS
FRAME_CONTEXT *const fc = cm->fc;
#endif
FRAME_COUNTS *counts = xd->counts;
if (segfeature_active(&cm->seg, segment_id, SEG_LVL_REF_FRAME)) {
......@@ -1422,7 +1431,7 @@ static void read_ref_frames(AV1_COMMON *const cm, MACROBLOCKD *const xd,
#if CONFIG_VAR_REFS
if ((L_AND_L2(cm) || L_AND_L3(cm) || L_AND_G(cm)) && BWD_AND_ALT(cm))
#endif // CONFIG_VAR_REFS
bit = aom_read(r, fc->uni_comp_ref_prob[ctx][0], ACCT_STR);
bit = READ_REF_BIT2(uni_comp_ref_p);
#if CONFIG_VAR_REFS
else
bit = BWD_AND_ALT(cm);
......@@ -1438,7 +1447,7 @@ static void read_ref_frames(AV1_COMMON *const cm, MACROBLOCKD *const xd,
#if CONFIG_VAR_REFS
if (L_AND_L2(cm) && (L_AND_L3(cm) || L_AND_G(cm)))
#endif // CONFIG_VAR_REFS
bit1 = aom_read(r, fc->uni_comp_ref_prob[ctx1][1], ACCT_STR);
bit1 = READ_REF_BIT2(uni_comp_ref_p1);
#if CONFIG_VAR_REFS
else
bit1 = L_AND_L3(cm) || L_AND_G(cm);
......@@ -1451,7 +1460,7 @@ static void read_ref_frames(AV1_COMMON *const cm, MACROBLOCKD *const xd,
#if CONFIG_VAR_REFS
if (L_AND_L3(cm) && L_AND_G(cm))
#endif // CONFIG_VAR_REFS
bit2 = aom_read(r, fc->uni_comp_ref_prob[ctx2][2], ACCT_STR);
bit2 = READ_REF_BIT2(uni_comp_ref_p2);
#if CONFIG_VAR_REFS
else
bit2 = L_AND_G(cm);
......
......@@ -1007,9 +1007,13 @@ static void write_segment_id(aom_writer *w, const struct segmentation *seg,
#if CONFIG_NEW_MULTISYMBOL
#define WRITE_REF_BIT(bname, pname) \
aom_write_symbol(w, bname, av1_get_pred_cdf_##pname(cm, xd), 2)
#define WRITE_REF_BIT2(bname, pname) \
aom_write_symbol(w, bname, av1_get_pred_cdf_##pname(xd), 2)
#else
#define WRITE_REF_BIT(bname, pname) \
aom_write(w, bname, av1_get_pred_prob_##pname(cm, xd))
#define WRITE_REF_BIT2(bname, pname) \
aom_write(w, bname, av1_get_pred_prob_##pname(cm, xd))
#endif
// This function encodes the reference frame
......@@ -1049,7 +1053,12 @@ static void write_ref_frames(const AV1_COMMON *cm, const MACROBLOCKD *xd,
if ((L_OR_L2(cm) || L3_OR_G(cm)) && BWD_OR_ALT(cm))
if (L_AND_L2(cm) || L_AND_L3(cm) || L_AND_G(cm) || BWD_AND_ALT(cm))
#endif // CONFIG_VAR_REFS
aom_write(w, comp_ref_type, av1_get_comp_reference_type_prob(cm, xd));
#if CONFIG_NEW_MULTISYMBOL
aom_write_symbol(w, comp_ref_type,
av1_get_comp_reference_type_cdf(xd), 2);
#else
aom_write(w, comp_ref_type, av1_get_comp_reference_type_prob(cm, xd));
#endif
#if CONFIG_VAR_REFS
else
assert(comp_ref_type == BIDIR_COMP_REFERENCE);
......@@ -1066,7 +1075,7 @@ static void write_ref_frames(const AV1_COMMON *cm, const MACROBLOCKD *xd,
#if CONFIG_VAR_REFS
if ((L_AND_L2(cm) || L_AND_L3(cm) || L_AND_G(cm)) && BWD_AND_ALT(cm))
#endif // CONFIG_VAR_REFS
aom_write(w, bit, av1_get_pred_prob_uni_comp_ref_p(cm, xd));
WRITE_REF_BIT2(bit, uni_comp_ref_p);
if (!bit) {
assert(mbmi->ref_frame[0] == LAST_FRAME);
......@@ -1075,14 +1084,13 @@ static void write_ref_frames(const AV1_COMMON *cm, const MACROBLOCKD *xd,
#endif // CONFIG_VAR_REFS
const int bit1 = mbmi->ref_frame[1] == LAST3_FRAME ||
mbmi->ref_frame[1] == GOLDEN_FRAME;
aom_write(w, bit1, av1_get_pred_prob_uni_comp_ref_p1(cm, xd));
WRITE_REF_BIT2(bit1, uni_comp_ref_p1);
if (bit1) {
#if CONFIG_VAR_REFS
if (L_AND_L3(cm) && L_AND_G(cm)) {
#endif // CONFIG_VAR_REFS
const int bit2 = mbmi->ref_frame[1] == GOLDEN_FRAME;
aom_write(w, bit2, av1_get_pred_prob_uni_comp_ref_p2(cm, xd));
WRITE_REF_BIT2(bit2, uni_comp_ref_p2);
#if CONFIG_VAR_REFS
}
#endif // CONFIG_VAR_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