Commit 2d0e9b75 authored by Sarah Parker's avatar Sarah Parker Committed by James Zern
Browse files

Move compound segment mask buffer from mbmi to xd

This resolves crashes on awcy due to excessive memory
use. No change in BDRATE.

Change-Id: I1d92d0b53718cfc66f2842cfca68059bafafc64a
parent 187a02e8
...@@ -322,14 +322,18 @@ typedef struct RD_STATS { ...@@ -322,14 +322,18 @@ typedef struct RD_STATS {
} RD_STATS; } RD_STATS;
#if CONFIG_EXT_INTER #if CONFIG_EXT_INTER
// This struct is used to group function args that are commonly
// sent together in functions related to interinter compound modes
typedef struct { typedef struct {
COMPOUND_TYPE type; #if CONFIG_WEDGE
int wedge_index; int wedge_index;
int wedge_sign; int wedge_sign;
#endif // CONFIG_WEDGE
#if CONFIG_COMPOUND_SEGMENT #if CONFIG_COMPOUND_SEGMENT
SEG_MASK_TYPE mask_type; SEG_MASK_TYPE mask_type;
DECLARE_ALIGNED(16, uint8_t, seg_mask[2 * MAX_SB_SQUARE]); uint8_t *seg_mask;
#endif // CONFIG_COMPOUND_SEGMENT #endif // CONFIG_COMPOUND_SEGMENT
COMPOUND_TYPE interinter_compound_type;
} INTERINTER_COMPOUND_DATA; } INTERINTER_COMPOUND_DATA;
#endif // CONFIG_EXT_INTER #endif // CONFIG_EXT_INTER
...@@ -387,12 +391,21 @@ typedef struct { ...@@ -387,12 +391,21 @@ typedef struct {
#endif // CONFIG_EXT_INTRA #endif // CONFIG_EXT_INTRA
#if CONFIG_EXT_INTER #if CONFIG_EXT_INTER
// interintra members
INTERINTRA_MODE interintra_mode; INTERINTRA_MODE interintra_mode;
// TODO(debargha): Consolidate these flags // TODO(debargha): Consolidate these flags
int use_wedge_interintra; int use_wedge_interintra;
int interintra_wedge_index; int interintra_wedge_index;
int interintra_wedge_sign; int interintra_wedge_sign;
INTERINTER_COMPOUND_DATA interinter_compound_data; // interinter members
COMPOUND_TYPE interinter_compound_type;
#if CONFIG_WEDGE
int wedge_index;
int wedge_sign;
#endif // CONFIG_WEDGE
#if CONFIG_COMPOUND_SEGMENT
SEG_MASK_TYPE mask_type;
#endif // CONFIG_COMPOUND_SEGMENT
#endif // CONFIG_EXT_INTER #endif // CONFIG_EXT_INTER
MOTION_MODE motion_mode; MOTION_MODE motion_mode;
#if CONFIG_MOTION_VAR #if CONFIG_MOTION_VAR
...@@ -662,6 +675,10 @@ typedef struct macroblockd { ...@@ -662,6 +675,10 @@ typedef struct macroblockd {
const EobThresholdMD *eob_threshold_md; const EobThresholdMD *eob_threshold_md;
#endif #endif
#if CONFIG_EXT_INTER && CONFIG_COMPOUND_SEGMENT
DECLARE_ALIGNED(16, uint8_t, seg_mask[2 * MAX_SB_SQUARE]);
#endif // CONFIG_EXT_INTER && CONFIG_COMPOUND_SEGMENT
#if CONFIG_CFL #if CONFIG_CFL
CFL_CTX *cfl; CFL_CTX *cfl;
#endif #endif
......
...@@ -268,9 +268,9 @@ const uint8_t *av1_get_compound_type_mask_inverse( ...@@ -268,9 +268,9 @@ const uint8_t *av1_get_compound_type_mask_inverse(
uint8_t *mask_buffer, int h, int w, int stride, uint8_t *mask_buffer, int h, int w, int stride,
#endif #endif
BLOCK_SIZE sb_type) { BLOCK_SIZE sb_type) {
assert(is_masked_compound_type(comp_data->type)); assert(is_masked_compound_type(comp_data->interinter_compound_type));
(void)sb_type; (void)sb_type;
switch (comp_data->type) { switch (comp_data->interinter_compound_type) {
#if CONFIG_WEDGE #if CONFIG_WEDGE
case COMPOUND_WEDGE: case COMPOUND_WEDGE:
return av1_get_contiguous_soft_mask(comp_data->wedge_index, return av1_get_contiguous_soft_mask(comp_data->wedge_index,
...@@ -286,9 +286,9 @@ const uint8_t *av1_get_compound_type_mask_inverse( ...@@ -286,9 +286,9 @@ const uint8_t *av1_get_compound_type_mask_inverse(
const uint8_t *av1_get_compound_type_mask( const uint8_t *av1_get_compound_type_mask(
const INTERINTER_COMPOUND_DATA *const comp_data, BLOCK_SIZE sb_type) { const INTERINTER_COMPOUND_DATA *const comp_data, BLOCK_SIZE sb_type) {
assert(is_masked_compound_type(comp_data->type)); assert(is_masked_compound_type(comp_data->interinter_compound_type));
(void)sb_type; (void)sb_type;
switch (comp_data->type) { switch (comp_data->interinter_compound_type) {
#if CONFIG_WEDGE #if CONFIG_WEDGE
case COMPOUND_WEDGE: case COMPOUND_WEDGE:
return av1_get_contiguous_soft_mask(comp_data->wedge_index, return av1_get_contiguous_soft_mask(comp_data->wedge_index,
...@@ -596,7 +596,7 @@ static void build_masked_compound_wedge_extend( ...@@ -596,7 +596,7 @@ static void build_masked_compound_wedge_extend(
const int subw = (2 << b_width_log2_lookup[sb_type]) == w; const int subw = (2 << b_width_log2_lookup[sb_type]) == w;
const uint8_t *mask; const uint8_t *mask;
size_t mask_stride; size_t mask_stride;
switch (comp_data->type) { switch (comp_data->interinter_compound_type) {
case COMPOUND_WEDGE: case COMPOUND_WEDGE:
mask = av1_get_soft_mask(comp_data->wedge_index, comp_data->wedge_sign, mask = av1_get_soft_mask(comp_data->wedge_index, comp_data->wedge_sign,
sb_type, wedge_offset_x, wedge_offset_y); sb_type, wedge_offset_x, wedge_offset_y);
...@@ -624,7 +624,7 @@ static void build_masked_compound_wedge_extend_highbd( ...@@ -624,7 +624,7 @@ static void build_masked_compound_wedge_extend_highbd(
const int subw = (2 << b_width_log2_lookup[sb_type]) == w; const int subw = (2 << b_width_log2_lookup[sb_type]) == w;
const uint8_t *mask; const uint8_t *mask;
size_t mask_stride; size_t mask_stride;
switch (comp_data->type) { switch (comp_data->interinter_compound_type) {
case COMPOUND_WEDGE: case COMPOUND_WEDGE:
mask = av1_get_soft_mask(comp_data->wedge_index, comp_data->wedge_sign, mask = av1_get_soft_mask(comp_data->wedge_index, comp_data->wedge_sign,
sb_type, wedge_offset_x, wedge_offset_y); sb_type, wedge_offset_x, wedge_offset_y);
...@@ -699,7 +699,17 @@ void av1_make_masked_inter_predictor(const uint8_t *pre, int pre_stride, ...@@ -699,7 +699,17 @@ void av1_make_masked_inter_predictor(const uint8_t *pre, int pre_stride,
#endif // CONFIG_GLOBAL_MOTION || CONFIG_WARPED_MOTION #endif // CONFIG_GLOBAL_MOTION || CONFIG_WARPED_MOTION
MACROBLOCKD *xd) { MACROBLOCKD *xd) {
MODE_INFO *mi = xd->mi[0]; MODE_INFO *mi = xd->mi[0];
INTERINTER_COMPOUND_DATA *comp_data = &mi->mbmi.interinter_compound_data; const INTERINTER_COMPOUND_DATA comp_data = {
#if CONFIG_WEDGE
mi->mbmi.wedge_index,
mi->mbmi.wedge_sign,
#endif // CONFIG_WEDGE
#if CONFIG_COMPOUND_SEGMENT
mi->mbmi.mask_type,
xd->seg_mask,
#endif // CONFIG_COMPOUND_SEGMENT
mi->mbmi.interinter_compound_type
};
// The prediction filter types used here should be those for // The prediction filter types used here should be those for
// the second reference block. // the second reference block.
#if CONFIG_DUAL_FILTER #if CONFIG_DUAL_FILTER
...@@ -726,13 +736,13 @@ void av1_make_masked_inter_predictor(const uint8_t *pre, int pre_stride, ...@@ -726,13 +736,13 @@ void av1_make_masked_inter_predictor(const uint8_t *pre, int pre_stride,
#endif #endif
xs, ys, xd); xs, ys, xd);
#if CONFIG_COMPOUND_SEGMENT #if CONFIG_COMPOUND_SEGMENT
if (!plane && comp_data->type == COMPOUND_SEG) { if (!plane && comp_data.interinter_compound_type == COMPOUND_SEG) {
if (xd->cur_buf->flags & YV12_FLAG_HIGHBITDEPTH) if (xd->cur_buf->flags & YV12_FLAG_HIGHBITDEPTH)
build_compound_seg_mask_highbd(comp_data->seg_mask, comp_data->mask_type, build_compound_seg_mask_highbd(comp_data.seg_mask, comp_data.mask_type,
dst, dst_stride, tmp_dst, MAX_SB_SIZE, dst, dst_stride, tmp_dst, MAX_SB_SIZE,
mi->mbmi.sb_type, h, w, xd->bd); mi->mbmi.sb_type, h, w, xd->bd);
else else
build_compound_seg_mask(comp_data->seg_mask, comp_data->mask_type, dst, build_compound_seg_mask(comp_data.seg_mask, comp_data.mask_type, dst,
dst_stride, tmp_dst, MAX_SB_SIZE, dst_stride, tmp_dst, MAX_SB_SIZE,
mi->mbmi.sb_type, h, w); mi->mbmi.sb_type, h, w);
} }
...@@ -741,20 +751,20 @@ void av1_make_masked_inter_predictor(const uint8_t *pre, int pre_stride, ...@@ -741,20 +751,20 @@ void av1_make_masked_inter_predictor(const uint8_t *pre, int pre_stride,
#if CONFIG_SUPERTX #if CONFIG_SUPERTX
if (xd->cur_buf->flags & YV12_FLAG_HIGHBITDEPTH) if (xd->cur_buf->flags & YV12_FLAG_HIGHBITDEPTH)
build_masked_compound_wedge_extend_highbd( build_masked_compound_wedge_extend_highbd(
dst, dst_stride, dst, dst_stride, tmp_dst, MAX_SB_SIZE, comp_data, dst, dst_stride, dst, dst_stride, tmp_dst, MAX_SB_SIZE, &comp_data,
mi->mbmi.sb_type, wedge_offset_x, wedge_offset_y, h, w, xd->bd); mi->mbmi.sb_type, wedge_offset_x, wedge_offset_y, h, w, xd->bd);
else else
build_masked_compound_wedge_extend( build_masked_compound_wedge_extend(
dst, dst_stride, dst, dst_stride, tmp_dst, MAX_SB_SIZE, comp_data, dst, dst_stride, dst, dst_stride, tmp_dst, MAX_SB_SIZE, &comp_data,
mi->mbmi.sb_type, wedge_offset_x, wedge_offset_y, h, w); mi->mbmi.sb_type, wedge_offset_x, wedge_offset_y, h, w);
#else #else
if (xd->cur_buf->flags & YV12_FLAG_HIGHBITDEPTH) if (xd->cur_buf->flags & YV12_FLAG_HIGHBITDEPTH)
build_masked_compound_highbd(dst, dst_stride, dst, dst_stride, tmp_dst, build_masked_compound_highbd(dst, dst_stride, dst, dst_stride, tmp_dst,
MAX_SB_SIZE, comp_data, mi->mbmi.sb_type, h, w, MAX_SB_SIZE, &comp_data, mi->mbmi.sb_type, h,
xd->bd); w, xd->bd);
else else
build_masked_compound(dst, dst_stride, dst, dst_stride, tmp_dst, build_masked_compound(dst, dst_stride, dst, dst_stride, tmp_dst,
MAX_SB_SIZE, comp_data, mi->mbmi.sb_type, h, w); MAX_SB_SIZE, &comp_data, mi->mbmi.sb_type, h, w);
#endif // CONFIG_SUPERTX #endif // CONFIG_SUPERTX
#else // CONFIG_HIGHBITDEPTH #else // CONFIG_HIGHBITDEPTH
...@@ -769,18 +779,18 @@ void av1_make_masked_inter_predictor(const uint8_t *pre, int pre_stride, ...@@ -769,18 +779,18 @@ void av1_make_masked_inter_predictor(const uint8_t *pre, int pre_stride,
#endif #endif
xs, ys, xd); xs, ys, xd);
#if CONFIG_COMPOUND_SEGMENT #if CONFIG_COMPOUND_SEGMENT
if (!plane && comp_data->type == COMPOUND_SEG) if (!plane && comp_data.interinter_compound_type == COMPOUND_SEG)
build_compound_seg_mask(comp_data->seg_mask, comp_data->mask_type, dst, build_compound_seg_mask(comp_data.seg_mask, comp_data.mask_type, dst,
dst_stride, tmp_dst, MAX_SB_SIZE, mi->mbmi.sb_type, dst_stride, tmp_dst, MAX_SB_SIZE, mi->mbmi.sb_type,
h, w); h, w);
#endif // CONFIG_COMPOUND_SEGMENT #endif // CONFIG_COMPOUND_SEGMENT
#if CONFIG_SUPERTX #if CONFIG_SUPERTX
build_masked_compound_wedge_extend(dst, dst_stride, dst, dst_stride, tmp_dst, build_masked_compound_wedge_extend(dst, dst_stride, dst, dst_stride, tmp_dst,
MAX_SB_SIZE, comp_data, mi->mbmi.sb_type, MAX_SB_SIZE, &comp_data, mi->mbmi.sb_type,
wedge_offset_x, wedge_offset_y, h, w); wedge_offset_x, wedge_offset_y, h, w);
#else #else
build_masked_compound(dst, dst_stride, dst, dst_stride, tmp_dst, MAX_SB_SIZE, build_masked_compound(dst, dst_stride, dst, dst_stride, tmp_dst, MAX_SB_SIZE,
comp_data, mi->mbmi.sb_type, h, w); &comp_data, mi->mbmi.sb_type, h, w);
#endif // CONFIG_SUPERTX #endif // CONFIG_SUPERTX
#endif // CONFIG_HIGHBITDEPTH #endif // CONFIG_HIGHBITDEPTH
#if CONFIG_COMPOUND_SEGMENT #if CONFIG_COMPOUND_SEGMENT
...@@ -987,8 +997,7 @@ void build_inter_predictors(MACROBLOCKD *xd, int plane, ...@@ -987,8 +997,7 @@ void build_inter_predictors(MACROBLOCKD *xd, int plane,
(scaled_mv.col >> SUBPEL_BITS); (scaled_mv.col >> SUBPEL_BITS);
#if CONFIG_EXT_INTER #if CONFIG_EXT_INTER
if (ref && if (ref && is_masked_compound_type(mi->mbmi.interinter_compound_type))
is_masked_compound_type(mi->mbmi.interinter_compound_data.type))
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,
...@@ -1110,8 +1119,7 @@ void build_inter_predictors(MACROBLOCKD *xd, int plane, ...@@ -1110,8 +1119,7 @@ void build_inter_predictors(MACROBLOCKD *xd, int plane,
#endif // CONFIG_GLOBAL_MOTION || CONFIG_WARPED_MOTION #endif // CONFIG_GLOBAL_MOTION || CONFIG_WARPED_MOTION
conv_params.ref = ref; conv_params.ref = ref;
#if CONFIG_EXT_INTER #if CONFIG_EXT_INTER
if (ref && if (ref && is_masked_compound_type(mi->mbmi.interinter_compound_type))
is_masked_compound_type(mi->mbmi.interinter_compound_data.type))
av1_make_masked_inter_predictor( av1_make_masked_inter_predictor(
pre[ref], pre_buf->stride, dst, dst_buf->stride, pre[ref], pre_buf->stride, dst, dst_buf->stride,
subpel_params[ref].subpel_x, subpel_params[ref].subpel_y, sf, w, h, subpel_params[ref].subpel_x, subpel_params[ref].subpel_y, sf, w, h,
...@@ -1868,8 +1876,8 @@ void modify_neighbor_predictor_for_obmc(MB_MODE_INFO *mbmi) { ...@@ -1868,8 +1876,8 @@ 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_FRAME; mbmi->ref_frame[1] = NONE_FRAME;
} else if (has_second_ref(mbmi) && } else if (has_second_ref(mbmi) &&
is_masked_compound_type(mbmi->interinter_compound_data.type)) { is_masked_compound_type(mbmi->interinter_compound_type)) {
mbmi->interinter_compound_data.type = COMPOUND_AVERAGE; mbmi->interinter_compound_type = COMPOUND_AVERAGE;
mbmi->ref_frame[1] = NONE_FRAME; mbmi->ref_frame[1] = NONE_FRAME;
} }
#endif // CONFIG_EXT_INTER #endif // CONFIG_EXT_INTER
...@@ -2956,16 +2964,25 @@ static void build_wedge_inter_predictor_from_buf( ...@@ -2956,16 +2964,25 @@ static void build_wedge_inter_predictor_from_buf(
MACROBLOCKD_PLANE *const pd = &xd->plane[plane]; MACROBLOCKD_PLANE *const pd = &xd->plane[plane];
struct buf_2d *const dst_buf = &pd->dst; struct buf_2d *const dst_buf = &pd->dst;
uint8_t *const dst = dst_buf->buf + dst_buf->stride * y + x; uint8_t *const dst = dst_buf->buf + dst_buf->stride * y + x;
INTERINTER_COMPOUND_DATA *comp_data = &mbmi->interinter_compound_data; const INTERINTER_COMPOUND_DATA comp_data = {
#if CONFIG_WEDGE
mbmi->wedge_index,
mbmi->wedge_sign,
#endif // CONFIG_WEDGE
#if CONFIG_COMPOUND_SEGMENT
mbmi->mask_type,
xd->seg_mask,
#endif // CONFIG_COMPOUND_SEGMENT
mbmi->interinter_compound_type
};
if (is_compound && if (is_compound && is_masked_compound_type(mbmi->interinter_compound_type)) {
is_masked_compound_type(mbmi->interinter_compound_data.type)) {
#if CONFIG_COMPOUND_SEGMENT #if CONFIG_COMPOUND_SEGMENT
if (!plane && comp_data.interinter_compound_type == COMPOUND_SEG) { if (!plane && comp_data.interinter_compound_type == COMPOUND_SEG) {
#if CONFIG_HIGHBITDEPTH #if CONFIG_HIGHBITDEPTH
if (xd->cur_buf->flags & YV12_FLAG_HIGHBITDEPTH) if (xd->cur_buf->flags & YV12_FLAG_HIGHBITDEPTH)
build_compound_seg_mask_highbd( build_compound_seg_mask_highbd(
comp_data->seg_mask, comp_data->mask_type, comp_data.seg_mask, comp_data.mask_type,
CONVERT_TO_BYTEPTR(ext_dst0), ext_dst_stride0, CONVERT_TO_BYTEPTR(ext_dst0), ext_dst_stride0,
CONVERT_TO_BYTEPTR(ext_dst1), ext_dst_stride1, mbmi->sb_type, h, w, CONVERT_TO_BYTEPTR(ext_dst1), ext_dst_stride1, mbmi->sb_type, h, w,
xd->bd); xd->bd);
...@@ -2982,26 +2999,26 @@ static void build_wedge_inter_predictor_from_buf( ...@@ -2982,26 +2999,26 @@ static void build_wedge_inter_predictor_from_buf(
if (xd->cur_buf->flags & YV12_FLAG_HIGHBITDEPTH) if (xd->cur_buf->flags & YV12_FLAG_HIGHBITDEPTH)
build_masked_compound_wedge_extend_highbd( build_masked_compound_wedge_extend_highbd(
dst, dst_buf->stride, CONVERT_TO_BYTEPTR(ext_dst0), ext_dst_stride0, dst, dst_buf->stride, CONVERT_TO_BYTEPTR(ext_dst0), ext_dst_stride0,
CONVERT_TO_BYTEPTR(ext_dst1), ext_dst_stride1, comp_data, CONVERT_TO_BYTEPTR(ext_dst1), ext_dst_stride1, &comp_data,
mbmi->sb_type, wedge_offset_x, wedge_offset_y, h, w, xd->bd); mbmi->sb_type, wedge_offset_x, wedge_offset_y, h, w, xd->bd);
else else
#endif // CONFIG_HIGHBITDEPTH #endif // CONFIG_HIGHBITDEPTH
build_masked_compound_wedge_extend( build_masked_compound_wedge_extend(
dst, dst_buf->stride, ext_dst0, ext_dst_stride0, ext_dst1, dst, dst_buf->stride, ext_dst0, ext_dst_stride0, ext_dst1,
ext_dst_stride1, comp_data, mbmi->sb_type, wedge_offset_x, ext_dst_stride1, &comp_data, mbmi->sb_type, wedge_offset_x,
wedge_offset_y, h, w); wedge_offset_y, h, w);
#else #else
#if CONFIG_HIGHBITDEPTH #if CONFIG_HIGHBITDEPTH
if (xd->cur_buf->flags & YV12_FLAG_HIGHBITDEPTH) if (xd->cur_buf->flags & YV12_FLAG_HIGHBITDEPTH)
build_masked_compound_highbd( build_masked_compound_highbd(
dst, dst_buf->stride, CONVERT_TO_BYTEPTR(ext_dst0), ext_dst_stride0, dst, dst_buf->stride, CONVERT_TO_BYTEPTR(ext_dst0), ext_dst_stride0,
CONVERT_TO_BYTEPTR(ext_dst1), ext_dst_stride1, comp_data, CONVERT_TO_BYTEPTR(ext_dst1), ext_dst_stride1, &comp_data,
mbmi->sb_type, h, w, xd->bd); mbmi->sb_type, h, w, xd->bd);
else else
#endif // CONFIG_HIGHBITDEPTH #endif // CONFIG_HIGHBITDEPTH
build_masked_compound(dst, dst_buf->stride, ext_dst0, ext_dst_stride0, build_masked_compound(dst, dst_buf->stride, ext_dst0, ext_dst_stride0,
ext_dst1, ext_dst_stride1, comp_data, mbmi->sb_type, ext_dst1, ext_dst_stride1, &comp_data,
h, w); mbmi->sb_type, h, w);
#endif // CONFIG_SUPERTX #endif // CONFIG_SUPERTX
} else { } else {
#if CONFIG_HIGHBITDEPTH #if CONFIG_HIGHBITDEPTH
......
...@@ -2192,7 +2192,7 @@ static void read_inter_block_mode_info(AV1Decoder *const pbi, ...@@ -2192,7 +2192,7 @@ static void read_inter_block_mode_info(AV1Decoder *const pbi,
#endif // CONFIG_MOTION_VAR || CONFIG_WARPED_MOTION #endif // CONFIG_MOTION_VAR || CONFIG_WARPED_MOTION
#if CONFIG_EXT_INTER #if CONFIG_EXT_INTER
mbmi->interinter_compound_data.type = COMPOUND_AVERAGE; mbmi->interinter_compound_type = COMPOUND_AVERAGE;
if (cm->reference_mode != SINGLE_REFERENCE && if (cm->reference_mode != SINGLE_REFERENCE &&
is_inter_compound_mode(mbmi->mode) is_inter_compound_mode(mbmi->mode)
#if CONFIG_MOTION_VAR || CONFIG_WARPED_MOTION #if CONFIG_MOTION_VAR || CONFIG_WARPED_MOTION
...@@ -2201,29 +2201,27 @@ static void read_inter_block_mode_info(AV1Decoder *const pbi, ...@@ -2201,29 +2201,27 @@ static void read_inter_block_mode_info(AV1Decoder *const pbi,
) { ) {
if (is_any_masked_compound_used(bsize)) { if (is_any_masked_compound_used(bsize)) {
#if CONFIG_COMPOUND_SEGMENT || CONFIG_WEDGE #if CONFIG_COMPOUND_SEGMENT || CONFIG_WEDGE
mbmi->interinter_compound_data.type = mbmi->interinter_compound_type =
aom_read_tree(r, av1_compound_type_tree, aom_read_tree(r, av1_compound_type_tree,
cm->fc->compound_type_prob[bsize], ACCT_STR); cm->fc->compound_type_prob[bsize], ACCT_STR);
#endif // CONFIG_COMPOUND_SEGMENT || CONFIG_WEDGE #endif // CONFIG_COMPOUND_SEGMENT || CONFIG_WEDGE
#if CONFIG_WEDGE #if CONFIG_WEDGE
if (mbmi->interinter_compound_data.type == COMPOUND_WEDGE) { if (mbmi->interinter_compound_type == COMPOUND_WEDGE) {
mbmi->interinter_compound_data.wedge_index = mbmi->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_compound_data.wedge_sign = aom_read_bit(r, ACCT_STR); mbmi->wedge_sign = aom_read_bit(r, ACCT_STR);
} }
#endif // CONFIG_WEDGE #endif // CONFIG_WEDGE
#if CONFIG_COMPOUND_SEGMENT #if CONFIG_COMPOUND_SEGMENT
if (mbmi->interinter_compound_data.type == COMPOUND_SEG) { if (mbmi->interinter_compound_type == COMPOUND_SEG) {
mbmi->interinter_compound_data.mask_type = mbmi->mask_type = aom_read_literal(r, MAX_SEG_MASK_BITS, ACCT_STR);
aom_read_literal(r, MAX_SEG_MASK_BITS, ACCT_STR);
} }
#endif // CONFIG_COMPOUND_SEGMENT #endif // CONFIG_COMPOUND_SEGMENT
} else { } else {
mbmi->interinter_compound_data.type = COMPOUND_AVERAGE; mbmi->interinter_compound_type = COMPOUND_AVERAGE;
} }
if (xd->counts) if (xd->counts)
xd->counts xd->counts->compound_interinter[bsize][mbmi->interinter_compound_type]++;
->compound_interinter[bsize][mbmi->interinter_compound_data.type]++;
} }
#endif // CONFIG_EXT_INTER #endif // CONFIG_EXT_INTER
......
...@@ -2082,21 +2082,19 @@ static void pack_inter_mode_mvs(AV1_COMP *cpi, const int mi_row, ...@@ -2082,21 +2082,19 @@ static void pack_inter_mode_mvs(AV1_COMP *cpi, const int mi_row,
#endif // CONFIG_MOTION_VAR #endif // CONFIG_MOTION_VAR
&& is_any_masked_compound_used(bsize)) { && is_any_masked_compound_used(bsize)) {
#if CONFIG_COMPOUND_SEGMENT || CONFIG_WEDGE #if CONFIG_COMPOUND_SEGMENT || CONFIG_WEDGE
av1_write_token( av1_write_token(w, av1_compound_type_tree,
w, av1_compound_type_tree, cm->fc->compound_type_prob[bsize], cm->fc->compound_type_prob[bsize],
&compound_type_encodings[mbmi->interinter_compound_data.type]); &compound_type_encodings[mbmi->interinter_compound_type]);
#endif // CONFIG_COMPOUND_SEGMENT || CONFIG_WEDGE #endif // CONFIG_COMPOUND_SEGMENT || CONFIG_WEDGE
#if CONFIG_WEDGE #if CONFIG_WEDGE
if (mbmi->interinter_compound_data.type == COMPOUND_WEDGE) { if (mbmi->interinter_compound_type == COMPOUND_WEDGE) {
aom_write_literal(w, mbmi->interinter_compound_data.wedge_index, aom_write_literal(w, mbmi->wedge_index, get_wedge_bits_lookup(bsize));
get_wedge_bits_lookup(bsize)); aom_write_bit(w, mbmi->wedge_sign);
aom_write_bit(w, mbmi->interinter_compound_data.wedge_sign);
} }
#endif // CONFIG_WEDGE #endif // CONFIG_WEDGE
#if CONFIG_COMPOUND_SEGMENT #if CONFIG_COMPOUND_SEGMENT
if (mbmi->interinter_compound_data.type == COMPOUND_SEG) { if (mbmi->interinter_compound_type == COMPOUND_SEG) {
aom_write_literal(w, mbmi->interinter_compound_data.mask_type, aom_write_literal(w, mbmi->mask_type, MAX_SEG_MASK_BITS);
MAX_SEG_MASK_BITS);
} }
#endif // CONFIG_COMPOUND_SEGMENT #endif // CONFIG_COMPOUND_SEGMENT
} }
......
...@@ -2233,8 +2233,7 @@ static void update_stats(const AV1_COMMON *const cm, ThreadData *td, int mi_row, ...@@ -2233,8 +2233,7 @@ static void update_stats(const AV1_COMMON *const cm, ThreadData *td, int mi_row,
&& mbmi->motion_mode == SIMPLE_TRANSLATION && mbmi->motion_mode == SIMPLE_TRANSLATION
#endif // CONFIG_MOTION_VAR || CONFIG_WARPED_MOTION #endif // CONFIG_MOTION_VAR || CONFIG_WARPED_MOTION
) { ) {
counts->compound_interinter[bsize] counts->compound_interinter[bsize][mbmi->interinter_compound_type]++;
[mbmi->interinter_compound_data.type]++;
} }
#endif // CONFIG_EXT_INTER #endif // CONFIG_EXT_INTER
} }
......
...@@ -7562,11 +7562,11 @@ static int64_t pick_wedge_fixed_sign( ...@@ -7562,11 +7562,11 @@ static int64_t pick_wedge_fixed_sign(
} }
static int64_t pick_interinter_wedge(const AV1_COMP *const cpi, static int64_t pick_interinter_wedge(const AV1_COMP *const cpi,
const MACROBLOCK *const x, MACROBLOCK *const x,
const BLOCK_SIZE bsize, const BLOCK_SIZE bsize,
const uint8_t *const p0, const uint8_t *const p0,
const uint8_t *const p1) { const uint8_t *const p1) {
const MACROBLOCKD *const xd = &x->e_mbd; MACROBLOCKD *const xd = &x->e_mbd;
MB_MODE_INFO *const mbmi = &xd->mi[0]->mbmi; MB_MODE_INFO *const mbmi = &xd->mi[0]->mbmi;
const int bw = block_size_wide[bsize]; const int bw = block_size_wide[bsize];
...@@ -7583,19 +7583,18 @@ static int64_t pick_interinter_wedge(const AV1_COMP *const cpi, ...@@ -7583,19 +7583,18 @@ static int64_t pick_interinter_wedge(const AV1_COMP *const cpi,
rd = pick_wedge(cpi, x, bsize, p0, p1, &wedge_sign, &wedge_index); rd = pick_wedge(cpi, x, bsize, p0, p1, &wedge_sign, &wedge_index);
} }
mbmi->interinter_compound_data.wedge_sign = wedge_sign; mbmi->wedge_sign = wedge_sign;
mbmi->interinter_compound_data.wedge_index = wedge_index; mbmi->wedge_index = wedge_index;
return rd; return rd;
} }
#endif // CONFIG_WEDGE #endif // CONFIG_WEDGE
#if CONFIG_COMPOUND_SEGMENT #if CONFIG_COMPOUND_SEGMENT
static int64_t pick_interinter_seg(const AV1_COMP *const cpi, static int64_t pick_interinter_seg(const AV1_COMP *const cpi,
const MACROBLOCK *const x, MACROBLOCK *const x, const BLOCK_SIZE bsize,
const BLOCK_SIZE bsize,
const uint8_t *const p0, const uint8_t *const p0,
const uint8_t *const p1) { const uint8_t *const p1) {
const MACROBLOCKD *const xd = &x->e_mbd; MACROBLOCKD *const xd = &x->e_mbd;
MB_MODE_INFO *const mbmi = &xd->mi[0]->mbmi; MB_MODE_INFO *const mbmi = &xd->mi[0]->mbmi;
const struct buf_2d *const src = &x->plane[0].src; const struct buf_2d *const src = &x->plane[0].src;
const int bw = block_size_wide[bsize]; const int bw = block_size_wide[bsize];
...@@ -7614,7 +7613,6 @@ static int64_t pick_interinter_seg(const AV1_COMP *const cpi, ...@@ -7614,7 +7613,6 @@ static int64_t pick_interinter_seg(const AV1_COMP *const cpi,
#else #else
const int bd_round = 0; const int bd_round = 0;
#endif // CONFIG_HIGHBITDEPTH #endif // CONFIG_HIGHBITDEPTH
INTERINTER_COMPOUND_DATA *comp_data = &mbmi->interinter_compound_data;
DECLARE_ALIGNED(32, int16_t, r0[MAX_SB_SQUARE]); DECLARE_ALIGNED(32, int16_t, r0[MAX_SB_SQUARE]);
DECLARE_ALIGNED(32, int16_t, r1[MAX_SB_SQUARE]); DECLARE_ALIGNED(32, int16_t, r1[MAX_SB_SQUARE]);
DECLARE_ALIGNED(32, int16_t, d10[MAX_SB_SQUARE]); DECLARE_ALIGNED(32, int16_t, d10[MAX_SB_SQUARE]);
...@@ -7641,15 +7639,15 @@ static int64_t pick_interinter_seg(const AV1_COMP *const cpi, ...@@ -7641,15 +7639,15 @@ static int64_t pick_interinter_seg(const AV1_COMP *const cpi,
#if CONFIG_HIGHBITDEPTH #if CONFIG_HIGHBITDEPTH
if (hbd) if (hbd)
build_compound_seg_mask_highbd( build_compound_seg_mask_highbd(
comp_data->seg_mask, cur_mask_type, CONVERT_TO_BYTEPTR(p0), bw, xd->seg_mask, cur_mask_type, CONVERT_TO_BYTEPTR(p0), bw,
CONVERT_TO_BYTEPTR(p1), bw, bsize, bh, bw, xd->bd); CONVERT_TO_BYTEPTR(p1), bw, bsize, bh, bw, xd->bd);
else else
#endif // CONFIG_HIGHBITDEPTH #endif // CONFIG_HIGHBITDEPTH
build_compound_seg_mask(comp_data->seg_mask, cur_mask_type, p0, bw, p1, build_compound_seg_mask(xd->seg_mask, cur_mask_type, p0, bw, p1, bw,
bw, bsize, bh, bw); bsize, bh, bw);
// compute rd for mask // compute rd for mask
sse = av1_wedge_sse_from_residuals(r1, d10, comp_data->seg_mask, N); sse = av1_wedge_sse_from_residuals(r1, d10, xd->seg_mask, N);
sse = ROUND_POWER_OF_TWO(sse, bd_round); sse = ROUND_POWER_OF_TWO(sse, bd_round);
model_rd_from_sse(cpi, xd, bsize, 0, sse, &rate, &dist); model_rd_from_sse(cpi, xd, bsize, 0, sse, &rate, &dist);
...@@ -7662,16 +7660,16 @@ static int64_t pick_interinter_seg(const AV1_COMP *const cpi, ...@@ -7662,16 +7660,16 @@ static int64_t pick_interinter_seg(const AV1_COMP *const cpi,
} }
// make final mask // make final mask
comp_data->mask_type = best_mask_type; mbmi->mask_type = best_mask_type;
#if CONFIG_HIGHBITDEPTH #if CONFIG_HIGHBITDEPTH
if (hbd) if (hbd)