Commit f34deab2 authored by Debargha Mukherjee's avatar Debargha Mukherjee

Adds compound wedge prediction modes

Incorporates wedge compound prediction modes.

Change-Id: Ie73b54b629105b9dcc5f3763be87f35b09ad2ec7
parent cf9c95c3
......@@ -45,6 +45,7 @@ typedef enum {
#endif // CONFIG_EXT_INTERP && SUPPORT_NONINTERPOLATING_FILTERS
#define MAXTXLEN 32
#define CU_SIZE 64
static INLINE int is_inter_mode(PREDICTION_MODE mode) {
#if CONFIG_EXT_INTER
......@@ -55,6 +56,23 @@ static INLINE int is_inter_mode(PREDICTION_MODE mode) {
}
#if CONFIG_EXT_INTER
#define WEDGE_BITS_SML 3
#define WEDGE_BITS_MED 4
#define WEDGE_BITS_BIG 5
#define WEDGE_NONE -1
#define WEDGE_WEIGHT_BITS 6
static INLINE int get_wedge_bits(BLOCK_SIZE sb_type) {
if (sb_type < BLOCK_8X8)
return 0;
if (sb_type <= BLOCK_8X8)
return WEDGE_BITS_SML;
else if (sb_type <= BLOCK_32X32)
return WEDGE_BITS_MED;
else
return WEDGE_BITS_BIG;
}
static INLINE int is_inter_singleref_mode(PREDICTION_MODE mode) {
return mode >= NEARESTMV && mode <= NEWFROMNEARMV;
}
......@@ -69,6 +87,11 @@ static INLINE int have_newmv_in_inter_mode(PREDICTION_MODE mode) {
mode == NEAREST_NEWMV || mode == NEW_NEARESTMV ||
mode == NEAR_NEWMV || mode == NEW_NEARMV);
}
#else
static INLINE int have_newmv_in_inter_mode(PREDICTION_MODE mode) {
return (mode == NEWMV);
}
#endif // CONFIG_EXT_INTER
/* For keyframes, intra block modes are predicted by the (already decoded)
......@@ -172,6 +195,12 @@ typedef struct {
#if CONFIG_EXT_INTER
PREDICTION_MODE interintra_mode;
PREDICTION_MODE interintra_uv_mode;
// TODO(debargha): Consolidate these flags
int use_wedge_interintra;
int interintra_wedge_index;
int interintra_uv_wedge_index;
int use_wedge_interinter;
int interinter_wedge_index;
#endif // CONFIG_EXT_INTER
#if CONFIG_OBMC
......@@ -203,12 +232,6 @@ static INLINE int has_second_ref(const MB_MODE_INFO *mbmi) {
return mbmi->ref_frame[1] > INTRA_FRAME;
}
#if CONFIG_OBMC
static INLINE int is_obmc_allowed(const MB_MODE_INFO *mbmi) {
return (mbmi->sb_type >= BLOCK_8X8);
}
#endif // CONFIG_OBMC
PREDICTION_MODE vp10_left_block_mode(const MODE_INFO *cur_mi,
const MODE_INFO *left_mi, int b);
......@@ -647,6 +670,23 @@ static INLINE int is_interintra_pred(const MB_MODE_INFO *mbmi) {
}
#endif // CONFIG_EXT_INTER
#if CONFIG_OBMC
static INLINE int is_obmc_allowed(const MB_MODE_INFO *mbmi) {
return (mbmi->sb_type >= BLOCK_8X8);
}
static INLINE int is_neighbor_overlappable(const MB_MODE_INFO *mbmi) {
#if CONFIG_EXT_INTER
return (is_inter_block(mbmi) &&
!(has_second_ref(mbmi) && get_wedge_bits(mbmi->sb_type) &&
mbmi->use_wedge_interinter) &&
!(is_interintra_pred(mbmi)));
#else
return (is_inter_block(mbmi));
#endif // CONFIG_EXT_INTER
}
#endif // CONFIG_OBMC
#ifdef __cplusplus
} // extern "C"
#endif
......
......@@ -10,6 +10,7 @@
#include "vpx_mem/vpx_mem.h"
#include "vp10/common/reconinter.h"
#include "vp10/common/onyxc_int.h"
#include "vp10/common/seg_common.h"
......@@ -190,8 +191,8 @@ static const vpx_prob default_drl_prob[DRL_MODE_CONTEXTS] = {
#if CONFIG_EXT_INTER
static const vpx_prob default_new2mv_prob = 180;
#endif
#endif
#endif // CONFIG_EXT_INTER
#endif // CONFIG_REF_MV
static const vpx_prob default_inter_mode_probs[INTER_MODE_CONTEXTS]
[INTER_MODES - 1] = {
......@@ -230,6 +231,14 @@ static const vpx_prob default_inter_compound_mode_probs
static const vpx_prob default_interintra_prob[BLOCK_SIZES] = {
192, 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, 192,
};
static const vpx_prob default_wedge_interintra_prob[BLOCK_SIZES] = {
192, 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, 192,
};
static const vpx_prob default_wedge_interinter_prob[BLOCK_SIZES] = {
192, 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, 192,
};
#endif // CONFIG_EXT_INTER
#if CONFIG_OBMC
......@@ -1337,6 +1346,8 @@ static void init_mode_probs(FRAME_CONTEXT *fc) {
#if CONFIG_EXT_INTER
vp10_copy(fc->inter_compound_mode_probs, default_inter_compound_mode_probs);
vp10_copy(fc->interintra_prob, default_interintra_prob);
vp10_copy(fc->wedge_interintra_prob, default_wedge_interintra_prob);
vp10_copy(fc->wedge_interinter_prob, default_wedge_interinter_prob);
#endif // CONFIG_EXT_INTER
#if CONFIG_SUPERTX
vp10_copy(fc->supertx_prob, default_supertx_prob);
......@@ -1445,12 +1456,21 @@ void vp10_adapt_inter_frame_probs(VP10_COMMON *cm) {
pre_fc->inter_compound_mode_probs[i],
counts->inter_compound_mode[i],
fc->inter_compound_mode_probs[i]);
for (i = 0; i < BLOCK_SIZES; ++i) {
if (is_interintra_allowed_bsize(i))
fc->interintra_prob[i] = mode_mv_merge_probs(pre_fc->interintra_prob[i],
counts->interintra[i]);
}
for (i = 0; i < BLOCK_SIZES; ++i) {
if (is_interintra_allowed_bsize(i) && get_wedge_bits(i))
fc->wedge_interintra_prob[i] = mode_mv_merge_probs(
pre_fc->wedge_interintra_prob[i], counts->wedge_interintra[i]);
}
for (i = 0; i < BLOCK_SIZES; ++i) {
if (get_wedge_bits(i))
fc->wedge_interinter_prob[i] = mode_mv_merge_probs(
pre_fc->wedge_interinter_prob[i], counts->wedge_interinter[i]);
}
#endif // CONFIG_EXT_INTER
for (i = 0; i < BLOCK_SIZE_GROUPS; i++)
......
......@@ -74,13 +74,15 @@ typedef struct frame_contexts {
#if CONFIG_EXT_INTER
vpx_prob new2mv_prob;
#endif // CONFIG_EXT_INTER
#endif
#endif // CONFIG_REF_MV
vpx_prob inter_mode_probs[INTER_MODE_CONTEXTS][INTER_MODES - 1];
#if CONFIG_EXT_INTER
vpx_prob inter_compound_mode_probs[INTER_MODE_CONTEXTS]
[INTER_COMPOUND_MODES - 1];
vpx_prob interintra_prob[BLOCK_SIZES];
vpx_prob wedge_interintra_prob[BLOCK_SIZES];
vpx_prob wedge_interinter_prob[BLOCK_SIZES];
#endif // CONFIG_EXT_INTER
#if CONFIG_OBMC
vpx_prob obmc_prob[BLOCK_SIZES];
......@@ -143,6 +145,8 @@ typedef struct FRAME_COUNTS {
#if CONFIG_EXT_INTER
unsigned int inter_compound_mode[INTER_MODE_CONTEXTS][INTER_COMPOUND_MODES];
unsigned int interintra[BLOCK_SIZES][2];
unsigned int wedge_interintra[BLOCK_SIZES][2];
unsigned int wedge_interinter[BLOCK_SIZES][2];
#endif // CONFIG_EXT_INTER
#if CONFIG_OBMC
unsigned int obmc[BLOCK_SIZES][2];
......
......@@ -41,21 +41,32 @@ typedef enum BITSTREAM_PROFILE {
MAX_PROFILES
} BITSTREAM_PROFILE;
#define BLOCK_4X4 0
#define BLOCK_4X8 1
#define BLOCK_8X4 2
#define BLOCK_8X8 3
#define BLOCK_8X16 4
#define BLOCK_16X8 5
#define BLOCK_16X16 6
#define BLOCK_16X32 7
#define BLOCK_32X16 8
#define BLOCK_32X32 9
#define BLOCK_32X64 10
#define BLOCK_64X32 11
#define BLOCK_64X64 12
#define BLOCK_SIZES 13
#define BLOCK_INVALID BLOCK_SIZES
#define BLOCK_4X4 0
#define BLOCK_4X8 1
#define BLOCK_8X4 2
#define BLOCK_8X8 3
#define BLOCK_8X16 4
#define BLOCK_16X8 5
#define BLOCK_16X16 6
#define BLOCK_16X32 7
#define BLOCK_32X16 8
#define BLOCK_32X32 9
#define BLOCK_32X64 10
#define BLOCK_64X32 11
#define BLOCK_64X64 12
#if CONFIG_EXT_PARTITION
#define BLOCK_64X128 13
#define BLOCK_128X64 14
#define BLOCK_128X128 15
#define BLOCK_SIZES 16
#else
#define BLOCK_SIZES 13
#endif // CONFIG_EXT_PARTITION
#define BLOCK_INVALID (BLOCK_SIZES)
#define BLOCK_LARGEST (BLOCK_SIZES - 1)
typedef uint8_t BLOCK_SIZE;
typedef enum PARTITION_TYPE {
......
This diff is collapsed.
......@@ -62,14 +62,14 @@ static INLINE void inter_predictor(const uint8_t *src, int src_stride,
}
#if CONFIG_VP9_HIGHBITDEPTH
static INLINE void high_inter_predictor(const uint8_t *src, int src_stride,
uint8_t *dst, int dst_stride,
const int subpel_x,
const int subpel_y,
const struct scale_factors *sf,
int w, int h, int ref,
const INTERP_FILTER interp_filter,
int xs, int ys, int bd) {
static INLINE void highbd_inter_predictor(const uint8_t *src, int src_stride,
uint8_t *dst, int dst_stride,
const int subpel_x,
const int subpel_y,
const struct scale_factors *sf,
int w, int h, int ref,
const INTERP_FILTER interp_filter,
int xs, int ys, int bd) {
InterpFilterParams interp_filter_params =
vp10_get_interp_filter_params(interp_filter);
if (interp_filter_params.taps == SUBPEL_TAPS) {
......@@ -105,6 +105,61 @@ static INLINE void high_inter_predictor(const uint8_t *src, int src_stride,
}
#endif // CONFIG_VP9_HIGHBITDEPTH
void build_inter_predictors(MACROBLOCKD *xd, int plane,
#if CONFIG_OBMC
int mi_col_offset, int mi_row_offset,
#endif // CONFIG_OBMC
int block,
int bw, int bh,
int x, int y, int w, int h,
#if CONFIG_SUPERTX && CONFIG_EXT_INTER
int wedge_offset_x, int wedge_offset_y,
#endif // CONFIG_SUPERTX && CONFIG_EXT_INTER
int mi_x, int mi_y);
static INLINE void vp10_make_inter_predictor(
const uint8_t *src,
int src_stride,
uint8_t *dst,
int dst_stride,
const int subpel_x,
const int subpel_y,
const struct scale_factors *sf,
int w, int h, int ref,
const INTERP_FILTER interp_filter,
int xs, int ys,
const MACROBLOCKD *xd) {
(void) xd;
#if CONFIG_VP9_HIGHBITDEPTH
if (xd->cur_buf->flags & YV12_FLAG_HIGHBITDEPTH)
highbd_inter_predictor(src, src_stride, dst, dst_stride,
subpel_x, subpel_y, sf, w, h, ref,
interp_filter, xs, ys, xd->bd);
else
#endif // CONFIG_VP9_HIGHBITDEPTH
inter_predictor(src, src_stride, dst, dst_stride,
subpel_x, subpel_y, sf, w, h, ref,
interp_filter, xs, ys);
}
#if CONFIG_EXT_INTER
void vp10_make_masked_inter_predictor(
const uint8_t *pre,
int pre_stride,
uint8_t *dst,
int dst_stride,
const int subpel_x,
const int subpel_y,
const struct scale_factors *sf,
int w, int h,
const INTERP_FILTER interp_filter,
int xs, int ys,
#if CONFIG_SUPERTX
int plane, int wedge_offset_x, int wedge_offset_y,
#endif // CONFIG_SUPERTX
const MACROBLOCKD *xd);
#endif // CONFIG_EXT_INTER
static INLINE int round_mv_comp_q4(int value) {
return (value < 0 ? value - 2 : value + 2) / 4;
}
......@@ -114,10 +169,10 @@ static MV mi_mv_pred_q4(const MODE_INFO *mi, int idx) {
mi->bmi[1].as_mv[idx].as_mv.row +
mi->bmi[2].as_mv[idx].as_mv.row +
mi->bmi[3].as_mv[idx].as_mv.row),
round_mv_comp_q4(mi->bmi[0].as_mv[idx].as_mv.col +
mi->bmi[1].as_mv[idx].as_mv.col +
mi->bmi[2].as_mv[idx].as_mv.col +
mi->bmi[3].as_mv[idx].as_mv.col) };
round_mv_comp_q4(mi->bmi[0].as_mv[idx].as_mv.col +
mi->bmi[1].as_mv[idx].as_mv.col +
mi->bmi[2].as_mv[idx].as_mv.col +
mi->bmi[3].as_mv[idx].as_mv.col) };
return res;
}
......@@ -183,15 +238,6 @@ static INLINE MV average_split_mvs(const struct macroblockd_plane *pd,
return res;
}
void build_inter_predictors(MACROBLOCKD *xd, int plane,
#if CONFIG_OBMC
int mi_col_offset, int mi_row_offset,
#endif // CONFIG_OBMC
int block,
int bw, int bh,
int x, int y, int w, int h,
int mi_x, int mi_y);
void vp10_build_inter_predictor_sub8x8(MACROBLOCKD *xd, int plane,
int i, int ir, int ic,
int mi_row, int mi_col);
......@@ -209,9 +255,21 @@ void vp10_build_inter_predictors_sb(MACROBLOCKD *xd, int mi_row, int mi_col,
BLOCK_SIZE bsize);
#if CONFIG_SUPERTX
void vp10_build_inter_predictors_sb_sub8x8(MACROBLOCKD *xd,
int mi_row, int mi_col,
BLOCK_SIZE bsize, int block);
void vp10_build_inter_predictors_sb_sub8x8_extend(
MACROBLOCKD *xd,
#if CONFIG_EXT_INTER
int mi_row_ori, int mi_col_ori,
#endif // CONFIG_EXT_INTER
int mi_row, int mi_col,
BLOCK_SIZE bsize, int block);
void vp10_build_inter_predictors_sb_extend(
MACROBLOCKD *xd,
#if CONFIG_EXT_INTER
int mi_row_ori, int mi_col_ori,
#endif // CONFIG_EXT_INTER
int mi_row, int mi_col,
BLOCK_SIZE bsize);
struct macroblockd_plane;
void vp10_build_masked_inter_predictor_complex(
MACROBLOCKD *xd,
......@@ -219,7 +277,6 @@ void vp10_build_masked_inter_predictor_complex(
const struct macroblockd_plane *pd, int mi_row, int mi_col,
int mi_row_ori, int mi_col_ori, BLOCK_SIZE bsize, BLOCK_SIZE top_bsize,
PARTITION_TYPE partition, int plane);
#endif // CONFIG_SUPERTX
void vp10_build_inter_predictor(const uint8_t *src, int src_stride,
......@@ -376,6 +433,15 @@ void vp10_build_obmc_inter_prediction(VP10_COMMON *cm,
#endif // CONFIG_OBMC
#if CONFIG_EXT_INTER
#define MASK_MASTER_SIZE (2 * CU_SIZE)
#define MASK_MASTER_STRIDE (2 * CU_SIZE)
void vp10_init_wedge_masks();
const uint8_t *vp10_get_soft_mask(int wedge_index,
BLOCK_SIZE sb_type,
int h, int w);
void vp10_build_interintra_predictors(MACROBLOCKD *xd,
uint8_t *ypred,
uint8_t *upred,
......@@ -398,6 +464,17 @@ void vp10_build_interintra_predictors_sbuv(MACROBLOCKD *xd,
uint8_t *vpred,
int ustride, int vstride,
BLOCK_SIZE bsize);
// Encoder only
void vp10_build_inter_predictors_for_planes_single_buf(
MACROBLOCKD *xd, BLOCK_SIZE bsize,
int mi_row, int mi_col, int ref,
uint8_t *ext_dst[3], int ext_dst_stride[3]);
void vp10_build_wedge_inter_predictor_from_buf(
MACROBLOCKD *xd, BLOCK_SIZE bsize,
int mi_row, int mi_col,
uint8_t *ext_dst0[3], int ext_dst_stride0[3],
uint8_t *ext_dst1[3], int ext_dst_stride1[3]);
#endif // CONFIG_EXT_INTER
#ifdef __cplusplus
......
......@@ -412,6 +412,13 @@ void vp10_accumulate_frame_counts(VP10_COMMON *cm, FRAME_COUNTS *counts,
for (i = 0; i < BLOCK_SIZES; i++)
for (j = 0; j < 2; j++)
cm->counts.interintra[i][j] += counts->interintra[i][j];
for (i = 0; i < BLOCK_SIZES; i++)
for (j = 0; j < 2; j++)
cm->counts.wedge_interintra[i][j] += counts->wedge_interintra[i][j];
for (i = 0; i < BLOCK_SIZES; i++)
for (j = 0; j < 2; j++)
cm->counts.wedge_interinter[i][j] += counts->wedge_interinter[i][j];
#endif // CONFIG_EXT_INTER
for (i = 0; i < INTRA_INTER_CONTEXTS; i++)
......
......@@ -12,7 +12,7 @@ struct macroblockd;
/* Encoder forward decls */
struct macroblock;
struct vp9_variance_vtable;
struct vp10_variance_vtable;
struct search_site_config;
struct mv;
union int_mv;
......@@ -614,15 +614,15 @@ if (vpx_config("CONFIG_VP9_HIGHBITDEPTH") eq "yes") {
#
# Motion search
#
add_proto qw/int vp10_full_search_sad/, "const struct macroblock *x, const struct mv *ref_mv, int sad_per_bit, int distance, const struct vp9_variance_vtable *fn_ptr, const struct mv *center_mv, struct mv *best_mv";
add_proto qw/int vp10_full_search_sad/, "const struct macroblock *x, const struct mv *ref_mv, int sad_per_bit, int distance, const struct vp10_variance_vtable *fn_ptr, const struct mv *center_mv, struct mv *best_mv";
specialize qw/vp10_full_search_sad sse3 sse4_1/;
$vp10_full_search_sad_sse3=vp10_full_search_sadx3;
$vp10_full_search_sad_sse4_1=vp10_full_search_sadx8;
add_proto qw/int vp10_diamond_search_sad/, "const struct macroblock *x, const struct search_site_config *cfg, struct mv *ref_mv, struct mv *best_mv, int search_param, int sad_per_bit, int *num00, const struct vp9_variance_vtable *fn_ptr, const struct mv *center_mv";
add_proto qw/int vp10_diamond_search_sad/, "const struct macroblock *x, const struct search_site_config *cfg, struct mv *ref_mv, struct mv *best_mv, int search_param, int sad_per_bit, int *num00, const struct vp10_variance_vtable *fn_ptr, const struct mv *center_mv";
specialize qw/vp10_diamond_search_sad/;
add_proto qw/int vp10_full_range_search/, "const struct macroblock *x, const struct search_site_config *cfg, struct mv *ref_mv, struct mv *best_mv, int search_param, int sad_per_bit, int *num00, const struct vp9_variance_vtable *fn_ptr, const struct mv *center_mv";
add_proto qw/int vp10_full_range_search/, "const struct macroblock *x, const struct search_site_config *cfg, struct mv *ref_mv, struct mv *best_mv, int search_param, int sad_per_bit, int *num00, const struct vp10_variance_vtable *fn_ptr, const struct mv *center_mv";
specialize qw/vp10_full_range_search/;
add_proto qw/void vp10_temporal_filter_apply/, "uint8_t *frame1, unsigned int stride, uint8_t *frame2, unsigned int block_width, unsigned int block_height, int strength, int filter_weight, unsigned int *accumulator, uint16_t *count";
......
This diff is collapsed.
......@@ -1185,10 +1185,11 @@ static void read_inter_block_mode_info(VP10Decoder *const pbi,
}
#if CONFIG_OBMC
mbmi->obmc = 0;
#if CONFIG_SUPERTX
if (!supertx_enabled)
#endif // CONFIG_SUPERTX
mbmi->obmc = read_is_obmc_block(cm, xd, r);
mbmi->obmc = read_is_obmc_block(cm, xd, r);
#endif // CONFIG_OBMC
#if CONFIG_REF_MV
......@@ -1432,7 +1433,12 @@ static void read_inter_block_mode_info(VP10Decoder *const pbi,
}
#if CONFIG_EXT_INTER
mbmi->use_wedge_interintra = 0;
mbmi->use_wedge_interinter = 0;
if (cm->reference_mode != COMPOUND_REFERENCE &&
#if CONFIG_OBMC
!(is_obmc_allowed(mbmi) && mbmi->obmc) &&
#endif // CONFIG_OBMC
#if CONFIG_SUPERTX
!supertx_enabled &&
#endif
......@@ -1444,19 +1450,42 @@ static void read_inter_block_mode_info(VP10Decoder *const pbi,
if (interintra) {
const PREDICTION_MODE interintra_mode =
read_intra_mode_y(cm, xd, r, size_group_lookup[bsize]);
mbmi->ref_frame[1] = INTRA_FRAME;
mbmi->interintra_mode = interintra_mode;
mbmi->interintra_uv_mode = interintra_mode;
#if CONFIG_EXT_INTRA
// TODO(debargha|geza.lore):
// Should we use ext_intra modes for interintra?
mbmi->ext_intra_mode_info.use_ext_intra_mode[0] = 0;
mbmi->ext_intra_mode_info.use_ext_intra_mode[1] = 0;
mbmi->angle_delta[0] = 0;
mbmi->angle_delta[1] = 0;
mbmi->intra_filter = INTRA_FILTER_LINEAR;
#endif // CONFIG_EXT_INTRA
if (get_wedge_bits(bsize)) {
mbmi->use_wedge_interintra =
vpx_read(r, cm->fc->wedge_interintra_prob[bsize]);
if (xd->counts)
xd->counts->wedge_interintra[bsize][mbmi->use_wedge_interintra]++;
if (mbmi->use_wedge_interintra) {
mbmi->interintra_wedge_index =
mbmi->interintra_uv_wedge_index =
vpx_read_literal(r, get_wedge_bits(bsize));
}
}
}
}
if (cm->reference_mode != SINGLE_REFERENCE &&
is_inter_compound_mode(mbmi->mode) &&
#if CONFIG_OBMC
!(is_obmc_allowed(mbmi) && mbmi->obmc) &&
#endif // CONFIG_OBMC
get_wedge_bits(bsize)) {
mbmi->use_wedge_interinter =
vpx_read(r, cm->fc->wedge_interinter_prob[bsize]);
if (xd->counts)
xd->counts->wedge_interinter[bsize][mbmi->use_wedge_interinter]++;
if (mbmi->use_wedge_interinter) {
mbmi->interinter_wedge_index =
vpx_read_literal(r, get_wedge_bits(bsize));
}
}
#endif // CONFIG_EXT_INTER
......
......@@ -30,6 +30,7 @@
#include "vp10/common/postproc.h"
#endif
#include "vp10/common/quant_common.h"
#include "vp10/common/reconinter.h"
#include "vp10/common/reconintra.h"
#include "vp10/decoder/decodeframe.h"
......@@ -44,6 +45,9 @@ static void initialize_dec(void) {
vpx_dsp_rtcd();
vpx_scale_rtcd();
vp10_init_intra_predictors();
#if CONFIG_EXT_INTER
vp10_init_wedge_masks();
#endif // CONFIG_EXT_INTER
init_done = 1;
}
}
......
......@@ -997,12 +997,13 @@ static void pack_inter_mode_mvs(VP10_COMP *cpi, const MODE_INFO *mi,
} else {
int16_t mode_ctx = mbmi_ext->mode_context[mbmi->ref_frame[0]];
write_ref_frames(cm, xd, w);
#if CONFIG_OBMC
#if CONFIG_SUPERTX
if (!supertx_enabled)
#endif // CONFIG_SUPERTX
if (is_obmc_allowed(mbmi))
vpx_write(w, mbmi->obmc, cm->fc->obmc_prob[bsize]);
if (is_obmc_allowed(mbmi))
vpx_write(w, mbmi->obmc, cm->fc->obmc_prob[bsize]);
#endif // CONFIG_OBMC
#if CONFIG_REF_MV
......@@ -1052,8 +1053,8 @@ static void pack_inter_mode_mvs(VP10_COMP *cpi, const MODE_INFO *mi,
#if CONFIG_EXT_INTER
if (!is_compound)
#endif // CONFIG_EXT_INTER
mode_ctx = vp10_mode_context_analyzer(mbmi_ext->mode_context,
mbmi->ref_frame, bsize, j);
mode_ctx = vp10_mode_context_analyzer(mbmi_ext->mode_context,
mbmi->ref_frame, bsize, j);
#endif
#if CONFIG_EXT_INTER
if (is_inter_compound_mode(b_mode))
......@@ -1162,6 +1163,9 @@ static void pack_inter_mode_mvs(VP10_COMP *cpi, const MODE_INFO *mi,
#if CONFIG_EXT_INTER
if (cpi->common.reference_mode != COMPOUND_REFERENCE &&
#if CONFIG_OBMC
!(is_obmc_allowed(mbmi) && mbmi->obmc) &&
#endif // CONFIG_OBMC
#if CONFIG_SUPERTX
!supertx_enabled &&
#endif // CONFIG_SUPERTX
......@@ -1172,8 +1176,28 @@ static void pack_inter_mode_mvs(VP10_COMP *cpi, const MODE_INFO *mi,
write_intra_mode(w, mbmi->interintra_mode,
cm->fc->y_mode_prob[size_group_lookup[bsize]]);
assert(mbmi->interintra_mode == mbmi->interintra_uv_mode);
if (get_wedge_bits(bsize)) {
vpx_write(w, mbmi->use_wedge_interintra,
cm->fc->wedge_interintra_prob[bsize]);
if (mbmi->use_wedge_interintra) {
vpx_write_literal(w, mbmi->interintra_wedge_index,
get_wedge_bits(bsize));
}
}
}
}
if (cpi->common.reference_mode != SINGLE_REFERENCE &&
is_inter_compound_mode(mbmi->mode) &&
#if CONFIG_OBMC
!(is_obmc_allowed(mbmi) && mbmi->obmc) &&
#endif // CONFIG_OBMC
get_wedge_bits(bsize)) {
vpx_write(w, mbmi->use_wedge_interinter,
cm->fc->wedge_interinter_prob[bsize]);
if (mbmi->use_wedge_interinter)
vpx_write_literal(w, mbmi->interinter_wedge_index,
get_wedge_bits(bsize));
}
#endif // CONFIG_EXT_INTER
#if CONFIG_EXT_INTERP
......@@ -2467,6 +2491,19 @@ static size_t write_compressed_header(VP10_COMP *cpi, uint8_t *data) {
cm->counts.interintra[i]);
}
}
for (i = 0; i < BLOCK_SIZES; i++) {
if (is_interintra_allowed_bsize(i) && get_wedge_bits(i))
vp10_cond_prob_diff_update(&header_bc,
&fc->wedge_interintra_prob[i],
cm->counts.wedge_interintra[i]);
}
}
if (cm->reference_mode != SINGLE_REFERENCE) {
for (i = 0; i < BLOCK_SIZES; i++)
if (get_wedge_bits(i))
vp10_cond_prob_diff_update(&header_bc,
&fc->wedge_interinter_prob[i],
cm->counts.wedge_interinter[i]);
}
#endif // CONFIG_EXT_INTER
......
......@@ -61,6 +61,9 @@ static int check_intra_sb(VP10_COMP *cpi, const TileInfo *const tile,
int mi_row, int mi_col, BLOCK_SIZE bsize,
PC_TREE *pc_tree);
static void predict_superblock(VP10_COMP *cpi, ThreadData *td,
#if CONFIG_EXT_INTER
int mi_row_ori, int mi_col_ori,
#endif // CONFIG_EXT_INTER
int mi_row_pred, int mi_col_pred,
BLOCK_SIZE bsize_pred, int b_sub8x8, int block);
static int check_supertx_sb(BLOCK_SIZE bsize, TX_SIZE supertx_size,
......@@ -1290,6 +1293,10 @@ static void update_state_supertx(VP10_COMP *cpi, ThreadData *td,
mbmi->inter_tx_size[(idy << 3) + idx] = mbmi->tx_size;
}
#endif // CONFIG_VAR_TX
#if CONFIG_OBMC
// Turn OBMC off for supertx
mbmi->obmc = 0;
#endif // CONFIG_OBMC
if (!output_enabled)
return;
......@@ -1801,29 +1808,43 @@ static void update_stats(VP10_COMMON *cm, ThreadData *td
[ref0 != GOLDEN_FRAME]++;
#endif // CONFIG_EXT_REFS
}
#if CONFIG_OBMC
#if CONFIG_SUPERTX
if (!supertx_enabled)
#endif // CONFIG_SUPERTX
if (is_obmc_allowed(mbmi))
counts->obmc[mbmi->sb_type][mbmi->obmc]++;
if (is_obmc_allowed(mbmi))
counts->obmc[mbmi->sb_type][mbmi->obmc]++;
#endif // CONFIG_OBMC
}
}
#if CONFIG_EXT_INTER
if (cm->reference_mode != COMPOUND_REFERENCE &&
#if CONFIG_OBMC
!(is_obmc_allowed(mbmi) && mbmi->obmc) &&
#endif
#if CONFIG_SUPERTX
!supertx_enabled &&
!supertx_enabled &&
#endif
is_interintra_allowed(mbmi)) {
is_interintra_allowed(mbmi)) {
if (mbmi->ref_frame[1] == INTRA_FRAME) {
counts->y_mode[size_group_lookup[bsize]][mbmi->interintra_mode]++;
counts->interintra[bsize][1]++;
if (get_wedge_bits(bsize))
counts->wedge_interintra[bsize][mbmi->use_wedge_interintra]++;
} else {
counts->interintra[bsize][0]++;
}
}
if (cm->reference_mode != SINGLE_REFERENCE &&
is_inter_compound_mode(mbmi->mode) &&
#if CONFIG_OBMC
!(is_obmc_allowed(mbmi) && mbmi->obmc) &&
#endif // CONFIG_OBMC
get_wedge_bits(bsize)) {
counts->wedge_interinter[bsize][mbmi->use_wedge_interinter]++;
}
#endif // CONFIG_EXT_INTER
if (inter_block &&
......@@ -4458,15 +4479,19 @@ static void encode_superblock(VP10_COMP *cpi, ThreadData *td,
#if CONFIG_OBMC
if (mbmi->obmc) {
#if CONFIG_VP9_HIGHBITDEPTH
DECLARE_ALIGNED(16, uint8_t, tmp_buf1[2 * MAX_MB_PLANE * 64 * 64]);
DECLARE_ALIGNED(16, uint8_t, tmp_buf2[2 * MAX_MB_PLANE * 64 * 64]);
DECLARE_ALIGNED(16, uint8_t,
tmp_buf1[2 * MAX_MB_PLANE * CU_SIZE * CU_SIZE]);
DECLARE_ALIGNED(16, uint8_t,
tmp_buf2[2 * MAX_MB_PLANE * CU_SIZE * CU_SIZE]);
#else
DECLARE_ALIGNED(16, uint8_t, tmp_buf1[MAX_MB_PLANE * 64 * 64]);
DECLARE_ALIGNED(16, uint8_t, tmp_buf2[MAX_MB_PLANE * 64 * 64]);
DECLARE_ALIGNED(16, uint8_t,