Commit 00d5472a authored by Zoe Liu's avatar Zoe Liu

Fix the code to allow a 3rd compound mode

It is possible down the road new compound modes are added in addition to
COMPOUND_AVERAGE and COMPOUND_WEDGE.

Change-Id: I85985d4c104effd34df13845344aac2a08d28019
parent b2a0cfd2
...@@ -632,7 +632,7 @@ void build_inter_predictors(MACROBLOCKD *xd, int plane, ...@@ -632,7 +632,7 @@ void build_inter_predictors(MACROBLOCKD *xd, int plane,
#if CONFIG_EXT_INTER #if CONFIG_EXT_INTER
if (ref && is_interinter_wedge_used(mi->mbmi.sb_type) && if (ref && is_interinter_wedge_used(mi->mbmi.sb_type) &&
mi->mbmi.interinter_compound) mi->mbmi.interinter_compound == COMPOUND_WEDGE)
av1_make_masked_inter_predictor( av1_make_masked_inter_predictor(
pre, pre_buf->stride, dst, dst_buf->stride, subpel_x, subpel_y, pre, pre_buf->stride, dst, dst_buf->stride, subpel_x, subpel_y,
sf, w, h, mi->mbmi.interp_filter, xs, ys, sf, w, h, mi->mbmi.interp_filter, xs, ys,
...@@ -698,7 +698,7 @@ void build_inter_predictors(MACROBLOCKD *xd, int plane, ...@@ -698,7 +698,7 @@ void build_inter_predictors(MACROBLOCKD *xd, int plane,
#if CONFIG_EXT_INTER #if CONFIG_EXT_INTER
if (ref && is_interinter_wedge_used(mi->mbmi.sb_type) && if (ref && is_interinter_wedge_used(mi->mbmi.sb_type) &&
mi->mbmi.interinter_compound) mi->mbmi.interinter_compound == COMPOUND_WEDGE)
av1_make_masked_inter_predictor(pre, pre_buf->stride, dst, av1_make_masked_inter_predictor(pre, pre_buf->stride, dst,
dst_buf->stride, subpel_x, subpel_y, sf, dst_buf->stride, subpel_x, subpel_y, sf,
w, h, mi->mbmi.interp_filter, xs, ys, w, h, mi->mbmi.interp_filter, xs, ys,
...@@ -1283,7 +1283,7 @@ void modify_neighbor_predictor_for_obmc(MB_MODE_INFO *mbmi) { ...@@ -1283,7 +1283,7 @@ void modify_neighbor_predictor_for_obmc(MB_MODE_INFO *mbmi) {
if (is_interintra_pred(mbmi)) { if (is_interintra_pred(mbmi)) {
mbmi->ref_frame[1] = NONE; mbmi->ref_frame[1] = NONE;
} else if (has_second_ref(mbmi) && is_interinter_wedge_used(mbmi->sb_type) && } else if (has_second_ref(mbmi) && is_interinter_wedge_used(mbmi->sb_type) &&
mbmi->interinter_compound) { mbmi->interinter_compound == COMPOUND_WEDGE) {
mbmi->interinter_compound = COMPOUND_AVERAGE; mbmi->interinter_compound = COMPOUND_AVERAGE;
mbmi->ref_frame[1] = NONE; mbmi->ref_frame[1] = NONE;
} }
...@@ -2048,7 +2048,7 @@ static void build_wedge_inter_predictor_from_buf( ...@@ -2048,7 +2048,7 @@ static void build_wedge_inter_predictor_from_buf(
uint8_t *const dst = dst_buf->buf + dst_buf->stride * y + x; uint8_t *const dst = dst_buf->buf + dst_buf->stride * y + x;
if (is_compound && is_interinter_wedge_used(mbmi->sb_type) && if (is_compound && is_interinter_wedge_used(mbmi->sb_type) &&
mbmi->interinter_compound) { mbmi->interinter_compound == COMPOUND_WEDGE) {
#if CONFIG_AOM_HIGHBITDEPTH #if CONFIG_AOM_HIGHBITDEPTH
if (xd->cur_buf->flags & YV12_FLAG_HIGHBITDEPTH) if (xd->cur_buf->flags & YV12_FLAG_HIGHBITDEPTH)
build_masked_compound_wedge_highbd( build_masked_compound_wedge_highbd(
......
...@@ -1773,7 +1773,7 @@ static void read_inter_block_mode_info(AV1Decoder *const pbi, ...@@ -1773,7 +1773,7 @@ static void read_inter_block_mode_info(AV1Decoder *const pbi,
r, av1_compound_type_tree, cm->fc->compound_type_prob[bsize], ACCT_STR); r, av1_compound_type_tree, cm->fc->compound_type_prob[bsize], ACCT_STR);
if (xd->counts) if (xd->counts)
xd->counts->compound_interinter[bsize][mbmi->interinter_compound]++; xd->counts->compound_interinter[bsize][mbmi->interinter_compound]++;
if (mbmi->interinter_compound) { if (mbmi->interinter_compound == COMPOUND_WEDGE) {
mbmi->interinter_wedge_index = mbmi->interinter_wedge_index =
aom_read_literal(r, get_wedge_bits_lookup(bsize), ACCT_STR); aom_read_literal(r, get_wedge_bits_lookup(bsize), ACCT_STR);
mbmi->interinter_wedge_sign = aom_read_bit(r, ACCT_STR); mbmi->interinter_wedge_sign = aom_read_bit(r, ACCT_STR);
......
...@@ -1607,7 +1607,7 @@ static void pack_inter_mode_mvs(AV1_COMP *cpi, const MODE_INFO *mi, ...@@ -1607,7 +1607,7 @@ static void pack_inter_mode_mvs(AV1_COMP *cpi, const MODE_INFO *mi,
av1_write_token(w, av1_compound_type_tree, av1_write_token(w, av1_compound_type_tree,
cm->fc->compound_type_prob[bsize], cm->fc->compound_type_prob[bsize],
&compound_type_encodings[mbmi->interinter_compound]); &compound_type_encodings[mbmi->interinter_compound]);
if (mbmi->interinter_compound) { if (mbmi->interinter_compound == COMPOUND_WEDGE) {
aom_write_literal(w, mbmi->interinter_wedge_index, aom_write_literal(w, mbmi->interinter_wedge_index,
get_wedge_bits_lookup(bsize)); get_wedge_bits_lookup(bsize));
aom_write_bit(w, mbmi->interinter_wedge_sign); aom_write_bit(w, mbmi->interinter_wedge_sign);
......
...@@ -7513,7 +7513,7 @@ static int64_t handle_inter_mode( ...@@ -7513,7 +7513,7 @@ static int64_t handle_inter_mode(
*compmode_wedge_cost = compound_type_cost[mbmi->interinter_compound]; *compmode_wedge_cost = compound_type_cost[mbmi->interinter_compound];
if (mbmi->interinter_compound) if (mbmi->interinter_compound == COMPOUND_WEDGE)
*compmode_wedge_cost += *compmode_wedge_cost +=
av1_cost_literal(get_interinter_wedge_bits(bsize)); av1_cost_literal(get_interinter_wedge_bits(bsize));
} }
......
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