Commit 03be30ba authored by Debargha Mukherjee's avatar Debargha Mukherjee

Some refactoring to support warped motion mode

Change-Id: I15d54a3ae48b2b33082668116792c6595bdb3ddb
parent f59bf76e
......@@ -202,11 +202,7 @@ typedef struct {
int interinter_wedge_index;
int interinter_wedge_sign;
#endif // CONFIG_EXT_INTER
#if CONFIG_OBMC
int8_t obmc;
#endif // CONFIG_OBMC
MOTION_VARIATION motion_variation;
int_mv mv[2];
int_mv pred_mv[2];
#if CONFIG_REF_MV
......@@ -710,8 +706,8 @@ 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) {
#if CONFIG_OBMC || CONFIG_WARPED_MOTION
static INLINE int is_motvar_allowed(const MB_MODE_INFO *mbmi) {
#if CONFIG_EXT_INTER
return (mbmi->sb_type >= BLOCK_8X8 && mbmi->ref_frame[1] != INTRA_FRAME);
#else
......@@ -719,10 +715,12 @@ static INLINE int is_obmc_allowed(const MB_MODE_INFO *mbmi) {
#endif // CONFIG_EXT_INTER
}
#if CONFIG_OBMC
static INLINE int is_neighbor_overlappable(const MB_MODE_INFO *mbmi) {
return (is_inter_block(mbmi));
}
#endif // CONFIG_OBMC
#endif // CONFIG_OBMC || CONFIG_WARPED_MOTION
#ifdef __cplusplus
} // extern "C"
......
......@@ -295,15 +295,58 @@ static const vpx_prob default_wedge_interinter_prob[BLOCK_SIZES] = {
};
#endif // CONFIG_EXT_INTER
#if CONFIG_OBMC
static const vpx_prob default_obmc_prob[BLOCK_SIZES] = {
255, 255, 255, 151, 153, 144, 178, 165, 160, 207, 195, 168, 244,
// Change this section appropriately once warped motion is supported
#if CONFIG_OBMC && !CONFIG_WARPED_MOTION
const vpx_tree_index vp10_motvar_tree[TREE_SIZE(MOTION_VARIATIONS)] = {
-SIMPLE_TRANSLATION, -OBMC_CAUSAL
};
static
const vpx_prob default_motvar_prob[BLOCK_SIZES][MOTION_VARIATIONS - 1] = {
{255},
{255}, {255}, {151},
{153}, {144}, {178},
{165}, {160}, {207},
{195}, {168}, {244},
#if CONFIG_EXT_PARTITION
{252}, {252}, {252},
#endif // CONFIG_EXT_PARTITION
};
#elif !CONFIG_OBMC && CONFIG_WARPED_MOTION
const vpx_tree_index vp10_motvar_tree[TREE_SIZE(MOTION_VARIATIONS)] = {
-SIMPLE_TRANSLATION, -WARPED_CAUSAL
};
static
const vpx_prob default_motvar_prob[BLOCK_SIZES][MOTION_VARIATIONS - 1] = {
{255},
{255}, {255}, {151},
{153}, {144}, {178},
{165}, {160}, {207},
{195}, {168}, {244},
#if CONFIG_EXT_PARTITION
{252}, {252}, {252},
#endif // CONFIG_EXT_PARTITION
};
#elif CONFIG_OBMC && CONFIG_WARPED_MOTION
const vpx_tree_index vp10_motvar_tree[TREE_SIZE(MOTION_VARIATIONS)] = {
-SIMPLE_TRANSLATION, 2,
-OBMC_CAUSAL, -WARPED_CAUSAL,
};
static
const vpx_prob default_motvar_prob[BLOCK_SIZES][MOTION_VARIATIONS - 1] = {
{255, 200},
{255, 200}, {255, 200}, {151, 200},
{153, 200}, {144, 200}, {178, 200},
{165, 200}, {160, 200}, {207, 200},
{195, 200}, {168, 200}, {244, 200},
#if CONFIG_EXT_PARTITION
// TODO(debargha) What are the correct values for these?
192, 192, 192
{252, 200}, {252, 200}, {252, 200},
#endif // CONFIG_EXT_PARTITION
};
#endif // CONFIG_OBMC
#endif // CONFIG_OBMC || !CONFIG_WARPED_MOTION
/* Array indices are identical to previously-existing INTRAMODECONTEXTNODES. */
const vpx_tree_index vp10_intra_mode_tree[TREE_SIZE(INTRA_MODES)] = {
......@@ -1287,9 +1330,9 @@ static void init_mode_probs(FRAME_CONTEXT *fc) {
#endif // CONFIG_EXT_INTER
#endif // CONFIG_REF_MV
vp10_copy(fc->inter_mode_probs, default_inter_mode_probs);
#if CONFIG_OBMC
vp10_copy(fc->obmc_prob, default_obmc_prob);
#endif // CONFIG_OBMC
#if CONFIG_OBMC || CONFIG_WARPED_MOTION
vp10_copy(fc->motvar_prob, default_motvar_prob);
#endif // CONFIG_OBMC || CONFIG_WARPED_MOTION
#if CONFIG_EXT_INTER
vp10_copy(fc->inter_compound_mode_probs, default_inter_compound_mode_probs);
vp10_copy(fc->interintra_prob, default_interintra_prob);
......@@ -1381,14 +1424,14 @@ void vp10_adapt_inter_frame_probs(VP10_COMMON *cm) {
#else
for (i = 0; i < INTER_MODE_CONTEXTS; i++)
vpx_tree_merge_probs(vp10_inter_mode_tree, pre_fc->inter_mode_probs[i],
counts->inter_mode[i], fc->inter_mode_probs[i]);
counts->inter_mode[i], fc->inter_mode_probs[i]);
#endif
#if CONFIG_OBMC
#if CONFIG_OBMC || CONFIG_WARPED_MOTION
for (i = BLOCK_8X8; i < BLOCK_SIZES; ++i)
fc->obmc_prob[i] = vp10_mode_mv_merge_probs(pre_fc->obmc_prob[i],
counts->obmc[i]);
#endif // CONFIG_OBMC
vpx_tree_merge_probs(vp10_motvar_tree, pre_fc->motvar_prob[i],
counts->motvar[i], fc->motvar_prob[i]);
#endif // CONFIG_OBMC || CONFIG_WARPED_MOTION
#if CONFIG_SUPERTX
for (i = 0; i < PARTITION_SUPERTX_CONTEXTS; ++i) {
......
......@@ -79,9 +79,9 @@ typedef struct frame_contexts {
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];
#endif // CONFIG_OBMC
#if CONFIG_OBMC || CONFIG_WARPED_MOTION
vpx_prob motvar_prob[BLOCK_SIZES][MOTION_VARIATIONS - 1];
#endif // CONFIG_OBMC || CONFIG_WARPED_MOTION
vpx_prob intra_inter_prob[INTRA_INTER_CONTEXTS];
vpx_prob comp_inter_prob[COMP_INTER_CONTEXTS];
vpx_prob single_ref_prob[REF_CONTEXTS][SINGLE_REFS-1];
......@@ -154,9 +154,9 @@ typedef struct FRAME_COUNTS {
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];
#endif // CONFIG_OBMC
#if CONFIG_OBMC || CONFIG_WARPED_MOTION
unsigned int motvar[BLOCK_SIZES][MOTION_VARIATIONS];
#endif // CONFIG_OBMC || CONFIG_WARPED_MOTION
unsigned int intra_inter[INTRA_INTER_CONTEXTS][2];
unsigned int comp_inter[COMP_INTER_CONTEXTS][2];
unsigned int single_ref[REF_CONTEXTS][SINGLE_REFS-1][2];
......@@ -242,6 +242,9 @@ extern const vpx_tree_index
extern const vpx_tree_index
vp10_ext_tx_tree[TREE_SIZE(TX_TYPES)];
#endif // CONFIG_EXT_TX
#if CONFIG_OBMC || CONFIG_WARPED_MOTION
extern const vpx_tree_index vp10_motvar_tree[TREE_SIZE(MOTION_VARIATIONS)];
#endif // CONFIG_OBMC || CONFIG_WARPED_MOTION
void vp10_setup_past_independence(struct VP10Common *cm);
......
......@@ -281,6 +281,17 @@ typedef uint8_t PREDICTION_MODE;
#define INTRA_MODES (TM_PRED + 1)
typedef enum {
SIMPLE_TRANSLATION = 0,
#if CONFIG_OBMC
OBMC_CAUSAL, // 2-sided OBMC
#endif // CONFIG_OBMC
#if CONFIG_WARPED_MOTION
WARPED_CAUSAL, // 2-sided WARPED
#endif // CONFIG_WARPED_MOTION
MOTION_VARIATIONS
} MOTION_VARIATION;
#if CONFIG_EXT_INTER
typedef enum {
II_DC_PRED = 0,
......
......@@ -339,7 +339,6 @@ static const uint8_t *get_wedge_mask(int wedge_index,
return wedge_params_lookup[bsize].masks[neg][wedge_index];
}
const uint8_t *vp10_get_soft_mask(int wedge_index,
int wedge_sign,
BLOCK_SIZE sb_type,
......
......@@ -1319,7 +1319,7 @@ static void decode_block(VP10Decoder *const pbi, MACROBLOCKD *const xd,
vp10_build_inter_predictors_sb(xd, mi_row, mi_col,
VPXMAX(bsize, BLOCK_8X8));
#if CONFIG_OBMC
if (mbmi->obmc) {
if (mbmi->motion_variation == OBMC_CAUSAL) {
#if CONFIG_VP9_HIGHBITDEPTH
DECLARE_ALIGNED(16, uint8_t,
tmp_buf1[2 * MAX_MB_PLANE * MAX_SB_SQUARE]);
......@@ -3544,10 +3544,12 @@ static int read_compressed_header(VP10Decoder *pbi, const uint8_t *data,
}
#endif // CONFIG_EXT_INTER
#if CONFIG_OBMC
for (i = BLOCK_8X8; i < BLOCK_SIZES; ++i)
vp10_diff_update_prob(&r, &fc->obmc_prob[i]);
#endif // CONFIG_OBMC
#if CONFIG_OBMC || CONFIG_WARPED_MOTION
for (i = BLOCK_8X8; i < BLOCK_SIZES; ++i) {
for (j = 0; j < MOTION_VARIATIONS - 1; ++j)
vp10_diff_update_prob(&r, &fc->motvar_prob[i][j]);
}
#endif // CONFIG_OBMC || CONFIG_WARPED_MOTION
if (cm->interp_filter == SWITCHABLE)
read_switchable_interp_probs(fc, &r);
......@@ -3615,10 +3617,10 @@ static void debug_check_frame_counts(const VP10_COMMON *const cm) {
assert(!memcmp(cm->counts.wedge_interinter, zero_counts.wedge_interinter,
sizeof(cm->counts.wedge_interinter)));
#endif // CONFIG_EXT_INTER
#if CONFIG_OBMC
assert(!memcmp(cm->counts.obmc, zero_counts.obmc,
sizeof(cm->counts.obmc)));
#endif // CONFIG_OBMC
#if CONFIG_OBMC || CONFIG_WARPED_MOTION
assert(!memcmp(cm->counts.motvar, zero_counts.motvar,
sizeof(cm->counts.motvar)));
#endif // CONFIG_OBMC || CONFIG_WARPED_MOTION
assert(!memcmp(cm->counts.intra_inter, zero_counts.intra_inter,
sizeof(cm->counts.intra_inter)));
assert(!memcmp(cm->counts.comp_inter, zero_counts.comp_inter,
......
......@@ -883,23 +883,24 @@ static void read_ref_frames(VP10_COMMON *const cm, MACROBLOCKD *const xd,
}
#if CONFIG_OBMC
static int read_is_obmc_block(VP10_COMMON *const cm, MACROBLOCKD *const xd,
vp10_reader *r) {
#if CONFIG_OBMC || CONFIG_WARPED_MOTION
static MOTION_VARIATION read_motvar_block(
VP10_COMMON *const cm, MACROBLOCKD *const xd, vp10_reader *r) {
BLOCK_SIZE bsize = xd->mi[0]->mbmi.sb_type;
FRAME_COUNTS *counts = xd->counts;
int is_obmc;
MOTION_VARIATION motvar;
if (is_obmc_allowed(&xd->mi[0]->mbmi)) {
is_obmc = vp10_read(r, cm->fc->obmc_prob[bsize]);
if (is_motvar_allowed(&xd->mi[0]->mbmi)) {
motvar = (MOTION_VARIATION)
vp10_read_tree(r, vp10_motvar_tree, cm->fc->motvar_prob[bsize]);
if (counts)
++counts->obmc[bsize][is_obmc];
return is_obmc;
++counts->motvar[bsize][motvar];
return motvar;
} else {
return 0;
return SIMPLE_TRANSLATION;
}
}
#endif // CONFIG_OBMC
#endif // CONFIG_OBMC || CONFIG_WARPED_MOTION
static INLINE INTERP_FILTER read_interp_filter(
VP10_COMMON *const cm, MACROBLOCKD *const xd,
......@@ -1599,24 +1600,25 @@ static void read_inter_block_mode_info(VP10Decoder *const pbi,
}
#endif // CONFIG_EXT_INTER
#if CONFIG_OBMC
mbmi->obmc = 0;
#if CONFIG_OBMC || CONFIG_WARPED_MOTION
mbmi->motion_variation = SIMPLE_TRANSLATION;
#if CONFIG_SUPERTX
if (!supertx_enabled)
#endif // CONFIG_SUPERTX
#if CONFIG_EXT_INTER
if (mbmi->ref_frame[1] != INTRA_FRAME)
#endif // CONFIG_EXT_INTER
mbmi->obmc = read_is_obmc_block(cm, xd, r);
#endif // CONFIG_OBMC
mbmi->motion_variation = read_motvar_block(cm, xd, r);
#endif // CONFIG_OBMC || CONFIG_WARPED_MOTION
#if CONFIG_EXT_INTER
mbmi->use_wedge_interinter = 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
#if CONFIG_OBMC || CONFIG_WARPED_MOTION
!(is_motvar_allowed(mbmi) &&
mbmi->motion_variation != SIMPLE_TRANSLATION) &&
#endif // CONFIG_OBMC || CONFIG_WARPED_MOTION
is_interinter_wedge_used(bsize)) {
mbmi->use_wedge_interinter =
vp10_read(r, cm->fc->wedge_interinter_prob[bsize]);
......
......@@ -117,6 +117,9 @@ static struct vp10_token intra_filter_encodings[INTRA_FILTERS];
#if CONFIG_EXT_INTER
static struct vp10_token interintra_mode_encodings[INTERINTRA_MODES];
#endif // CONFIG_EXT_INTER
#if CONFIG_OBMC || CONFIG_WARPED_MOTION
static struct vp10_token motvar_encodings[MOTION_VARIATIONS];
#endif // CONFIG_OBMC || CONFIG_WARPED_MOTION
void vp10_encode_token_init() {
#if CONFIG_EXT_TX
......@@ -136,6 +139,9 @@ void vp10_encode_token_init() {
#if CONFIG_EXT_INTER
vp10_tokens_from_tree(interintra_mode_encodings, vp10_interintra_mode_tree);
#endif // CONFIG_EXT_INTER
#if CONFIG_OBMC || CONFIG_WARPED_MOTION
vp10_tokens_from_tree(motvar_encodings, vp10_motvar_tree);
#endif // CONFIG_OBMC || CONFIG_WARPED_MOTION
}
static void write_intra_mode(vp10_writer *w, PREDICTION_MODE mode,
......@@ -1370,22 +1376,24 @@ static void pack_inter_mode_mvs(VP10_COMP *cpi, const MODE_INFO *mi,
}
#endif // CONFIG_EXT_INTER
#if CONFIG_OBMC
#if CONFIG_OBMC || CONFIG_WARPED_MOTION
#if CONFIG_SUPERTX
if (!supertx_enabled)
#endif // CONFIG_SUPERTX
#if CONFIG_EXT_INTER
if (mbmi->ref_frame[1] != INTRA_FRAME)
#endif // CONFIG_EXT_INTER
if (is_obmc_allowed(mbmi))
vp10_write(w, mbmi->obmc, cm->fc->obmc_prob[bsize]);
#endif // CONFIG_OBMC
if (is_motvar_allowed(mbmi))
vp10_write_token(w, vp10_motvar_tree, cm->fc->motvar_prob[bsize],
&motvar_encodings[mbmi->motion_variation]);
#endif // CONFIG_OBMC || CONFIG_WARPED_MOTION
#if CONFIG_EXT_INTER
if (cpi->common.reference_mode != SINGLE_REFERENCE &&
is_inter_compound_mode(mbmi->mode) &&
#if CONFIG_OBMC
!(is_obmc_allowed(mbmi) && mbmi->obmc) &&
!(is_motvar_allowed(mbmi) &&
mbmi->motion_variation != SIMPLE_TRANSLATION) &&
#endif // CONFIG_OBMC
is_interinter_wedge_used(bsize)) {
vp10_write(w, mbmi->use_wedge_interinter,
......@@ -3283,11 +3291,11 @@ static uint32_t write_compressed_header(VP10_COMP *cpi, uint8_t *data) {
}
#endif // CONFIG_EXT_INTER
#if CONFIG_OBMC
#if CONFIG_OBMC || CONFIG_WARPED_MOTION
for (i = BLOCK_8X8; i < BLOCK_SIZES; ++i)
vp10_cond_prob_diff_update(header_bc, &fc->obmc_prob[i],
counts->obmc[i]);
#endif // CONFIG_OBMC
prob_diff_update(vp10_motvar_tree, fc->motvar_prob[i],
counts->motvar[i], MOTION_VARIATIONS, header_bc);
#endif // CONFIG_OBMC || CONFIG_WARPED_MOTION
if (cm->interp_filter == SWITCHABLE)
update_switchable_interp_probs(cm, header_bc, counts);
......
......@@ -1337,10 +1337,8 @@ static void update_state_supertx(VP10_COMP *cpi, ThreadData *td,
mbmi->inter_tx_size[idy][idx] = mbmi->tx_size;
}
#endif // CONFIG_VAR_TX
#if CONFIG_OBMC
// Turn OBMC off for supertx
mbmi->obmc = 0;
#endif // CONFIG_OBMC
// Turn motion variation off for supertx
mbmi->motion_variation = SIMPLE_TRANSLATION;
if (!output_enabled)
return;
......@@ -1966,23 +1964,24 @@ static void update_stats(VP10_COMMON *cm, ThreadData *td
}
#endif // CONFIG_EXT_INTER
#if CONFIG_OBMC
#if CONFIG_OBMC || CONFIG_WARPED_MOTION
#if CONFIG_SUPERTX
if (!supertx_enabled)
#endif // CONFIG_SUPERTX
#if CONFIG_EXT_INTER
if (mbmi->ref_frame[1] != INTRA_FRAME)
#endif // CONFIG_EXT_INTER
if (is_obmc_allowed(mbmi))
counts->obmc[mbmi->sb_type][mbmi->obmc]++;
#endif // CONFIG_OBMC
if (is_motvar_allowed(mbmi))
counts->motvar[mbmi->sb_type][mbmi->motion_variation]++;
#endif // CONFIG_OBMC || CONFIG_WARPED_MOTION
#if CONFIG_EXT_INTER
if (cm->reference_mode != SINGLE_REFERENCE &&
is_inter_compound_mode(mbmi->mode) &&
#if CONFIG_OBMC
!(is_obmc_allowed(mbmi) && mbmi->obmc) &&
#endif // CONFIG_OBMC
#if CONFIG_OBMC || CONFIG_WARPED_MOTION
!(is_motvar_allowed(mbmi) &&
mbmi->motion_variation != SIMPLE_TRANSLATION) &&
#endif // CONFIG_OBMC || CONFIG_WARPED_MOTION
is_interinter_wedge_used(bsize)) {
counts->wedge_interinter[bsize][mbmi->use_wedge_interinter]++;
}
......@@ -5034,7 +5033,7 @@ static void encode_superblock(VP10_COMP *cpi, ThreadData *td,
VPXMAX(bsize, BLOCK_8X8));
#if CONFIG_OBMC
if (mbmi->obmc) {
if (mbmi->motion_variation == OBMC_CAUSAL) {
#if CONFIG_VP9_HIGHBITDEPTH
DECLARE_ALIGNED(16, uint8_t, tmp_buf1[2 * MAX_MB_PLANE * MAX_SB_SQUARE]);
DECLARE_ALIGNED(16, uint8_t, tmp_buf2[2 * MAX_MB_PLANE * MAX_SB_SQUARE]);
......
......@@ -527,9 +527,9 @@ typedef struct VP10_COMP {
[INTER_COMPOUND_MODES];
unsigned int interintra_mode_cost[BLOCK_SIZE_GROUPS][INTERINTRA_MODES];
#endif // CONFIG_EXT_INTER
#if CONFIG_OBMC
int obmc_cost[BLOCK_SIZES][2];
#endif // CONFIG_OBMC
#if CONFIG_OBMC || CONFIG_WARPED_MOTION
int motvar_cost[BLOCK_SIZES][MOTION_VARIATIONS];
#endif // CONFIG_OBMC || CONFIG_WARPED_MOTION
int intra_uv_mode_cost[INTRA_MODES][INTRA_MODES];
int y_mode_costs[INTRA_MODES][INTRA_MODES][INTRA_MODES];
int switchable_interp_costs[SWITCHABLE_FILTER_CONTEXTS][SWITCHABLE_FILTERS];
......
......@@ -472,12 +472,12 @@ void vp10_initialize_rd_consts(VP10_COMP *cpi) {
cm->fc->interintra_mode_prob[i],
vp10_interintra_mode_tree);
#endif // CONFIG_EXT_INTER
#if CONFIG_OBMC
#if CONFIG_OBMC || CONFIG_WARPED_MOTION
for (i = BLOCK_8X8; i < BLOCK_SIZES; i++) {
cpi->obmc_cost[i][0] = vp10_cost_bit(cm->fc->obmc_prob[i], 0);
cpi->obmc_cost[i][1] = vp10_cost_bit(cm->fc->obmc_prob[i], 1);
vp10_cost_tokens((int *)cpi->motvar_cost[i],
cm->fc->motvar_prob[i], vp10_motvar_tree);
}
#endif // CONFIG_OBMC
#endif // CONFIG_OBMC || CONFIG_WARPED_MOTION
}
}
}
......
......@@ -6947,12 +6947,12 @@ static int64_t handle_inter_mode(VP10_COMP *cpi, MACROBLOCK *x,
#endif // CONFIG_VP9_HIGHBITDEPTH
uint8_t *tmp_buf;
#if CONFIG_OBMC
int allow_obmc =
#if CONFIG_OBMC || CONFIG_WARPED_MOTION
int allow_motvar =
#if CONFIG_EXT_INTER
!is_comp_interintra_pred &&
#endif // CONFIG_EXT_INTER
is_obmc_allowed(mbmi);
is_motvar_allowed(mbmi);
int rate2_nocoeff, best_rate2 = INT_MAX,
best_skippable, best_xskip, best_disable_skip = 0;
#if CONFIG_SUPERTX
......@@ -6969,7 +6969,7 @@ static int64_t handle_inter_mode(VP10_COMP *cpi, MACROBLOCK *x,
int rate_mv_bmc;
MB_MODE_INFO best_bmc_mbmi;
#endif // CONFIG_EXT_INTER
#endif // CONFIG_OBMC
#endif // CONFIG_OBMC || CONFIG_WARPED_MOTION
int pred_exists = 0;
int intpel_mv;
......@@ -7864,13 +7864,17 @@ static int64_t handle_inter_mode(VP10_COMP *cpi, MACROBLOCK *x,
memcpy(x->skip_txfm, skip_txfm, sizeof(skip_txfm));
memcpy(x->bsse, bsse, sizeof(bsse));
#if CONFIG_OBMC
#if CONFIG_OBMC || CONFIG_WARPED_MOTION
best_rd = INT64_MAX;
for (mbmi->obmc = 0; mbmi->obmc <= allow_obmc; mbmi->obmc++) {
for (mbmi->motion_variation = SIMPLE_TRANSLATION;
mbmi->motion_variation < (allow_motvar ? MOTION_VARIATIONS : 1);
mbmi->motion_variation++) {
int64_t tmp_rd, tmp_dist;
int tmp_rate;
#if CONFIG_EXT_INTER
int tmp_rate2 = mbmi->obmc ? rate2_bmc_nocoeff : rate2_nocoeff;
int tmp_rate2 =
mbmi->motion_variation != SIMPLE_TRANSLATION ?
rate2_bmc_nocoeff : rate2_nocoeff;
#else
int tmp_rate2 = rate2_nocoeff;
#endif // CONFIG_EXT_INTER
......@@ -7888,10 +7892,11 @@ static int64_t handle_inter_mode(VP10_COMP *cpi, MACROBLOCK *x,
#endif // CONFIG_DUAL_FILTER
#endif // CONFIG_EXT_INTERP
if (mbmi->obmc) {
#if CONFIG_OBMC
if (mbmi->motion_variation == OBMC_CAUSAL) {
#if CONFIG_EXT_INTER
*mbmi = best_bmc_mbmi;
mbmi->obmc = 1;
mbmi->motion_variation = OBMC_CAUSAL;
#endif // CONFIG_EXT_INTER
if (!is_comp_pred && have_newmv_in_inter_mode(this_mode)) {
int_mv tmp_mv;
......@@ -7943,13 +7948,22 @@ static int64_t handle_inter_mode(VP10_COMP *cpi, MACROBLOCK *x,
model_rd_for_sb(cpi, bsize, x, xd, 0, MAX_MB_PLANE - 1,
&tmp_rate, &tmp_dist, &skip_txfm_sb, &skip_sse_sb);
}
#endif // CONFIG_OBMC
#if CONFIG_WARPED_MOTION
if (mbmi->motion_variation == WARPED_CAUSAL) {
// TODO(yuec): Add code
}
#endif // CONFIG_WARPED_MOTION
#if CONFIG_VP9_HIGHBITDEPTH
if (xd->cur_buf->flags & YV12_FLAG_HIGHBITDEPTH) {
x->pred_variance = vp10_high_get_sby_perpixel_variance(cpi,
&xd->plane[0].dst, bsize, xd->bd);
x->pred_variance =
vp10_high_get_sby_perpixel_variance(
cpi, &xd->plane[0].dst, bsize, xd->bd);
} else {
x->pred_variance =
vp10_get_sby_perpixel_variance(cpi, &xd->plane[0].dst, bsize);
vp10_get_sby_perpixel_variance(cpi, &xd->plane[0].dst, bsize);
}
#else
x->pred_variance =
......@@ -7958,124 +7972,128 @@ static int64_t handle_inter_mode(VP10_COMP *cpi, MACROBLOCK *x,
x->skip = 0;
*rate2 = tmp_rate2;
if (allow_obmc)
*rate2 += cpi->obmc_cost[bsize][mbmi->obmc];
if (allow_motvar)
*rate2 += cpi->motvar_cost[bsize][mbmi->motion_variation];
*distortion = 0;
#endif // CONFIG_OBMC
if (!skip_txfm_sb) {
int skippable_y, skippable_uv;
int64_t sseuv = INT64_MAX;
int64_t rdcosty = INT64_MAX;
#endif // CONFIG_OBMC || CONFIG_WARPED_MOTION
if (!skip_txfm_sb) {
int skippable_y, skippable_uv;
int64_t sseuv = INT64_MAX;
int64_t rdcosty = INT64_MAX;
// Y cost and distortion
vp10_subtract_plane(x, bsize, 0);
// Y cost and distortion
vp10_subtract_plane(x, bsize, 0);
#if CONFIG_VAR_TX
if (cm->tx_mode == TX_MODE_SELECT || xd->lossless[mbmi->segment_id]) {
select_tx_type_yrd(cpi, x, rate_y, &distortion_y, &skippable_y, psse,
bsize, ref_best_rd);
} else {
int idx, idy;
if (cm->tx_mode == TX_MODE_SELECT || xd->lossless[mbmi->segment_id]) {
select_tx_type_yrd(cpi, x, rate_y, &distortion_y, &skippable_y, psse,
bsize, ref_best_rd);
} else {
int idx, idy;
super_block_yrd(cpi, x, rate_y, &distortion_y, &skippable_y, psse,
bsize, ref_best_rd);
for (idy = 0; idy < xd->n8_h; ++idy)
for (idx = 0; idx < xd->n8_w; ++idx)
mbmi->inter_tx_size[idy][idx] = mbmi->tx_size;
memset(x->blk_skip[0], skippable_y,
sizeof(uint8_t) * xd->n8_h * xd->n8_w * 4);
}
#else
super_block_yrd(cpi, x, rate_y, &distortion_y, &skippable_y, psse,
bsize, ref_best_rd);
for (idy = 0; idy < xd->n8_h; ++idy)
for (idx = 0; idx < xd->n8_w; ++idx)
mbmi->inter_tx_size[idy][idx] = mbmi->tx_size;
memset(x->blk_skip[0], skippable_y,
sizeof(uint8_t) * xd->n8_h * xd->n8_w * 4);
}
#else
super_block_yrd(cpi, x, rate_y, &distortion_y, &skippable_y, psse,
bsize, ref_best_rd);
#endif // CONFIG_VAR_TX
if (*rate_y == INT_MAX) {
*rate2 = INT_MAX;
*distortion = INT64_MAX;
#if CONFIG_OBMC
if (mbmi->obmc) {
continue;
} else {
#endif // CONFIG_OBMC
restore_dst_buf(xd, orig_dst, orig_dst_stride);
return INT64_MAX;
#if CONFIG_OBMC
if (*rate_y == INT_MAX) {
*rate2 = INT_MAX;
*distortion = INT64_MAX;
#if CONFIG_OBMC || CONFIG_WARPED_MOTION
if (mbmi->motion_variation != SIMPLE_TRANSLATION) {
continue;
} else {
#endif // CONFIG_OBMC || CONFIG_WARPED_MOTION
restore_dst_buf(xd, orig_dst, orig_dst_stride);
return INT64_MAX;
#if CONFIG_OBMC || CONFIG_WARPED_MOTION