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
}
#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
#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"
};
#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)] = {
#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);
#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) {
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];
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];
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);
#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,
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,
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]);
}
#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);
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,
}
-#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,
}
#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]);
#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
#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,
}
#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,
}
#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);
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;
}
#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]++;
}
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]);
[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];
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
}
}
}
#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
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;
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
#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;
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 =
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
+ }
+#endif // CONFIG_OBMC || CONFIG_WARPED_MOTION
}
-#endif // CONFIG_OBMC
- }
- *rate2 += *rate_y;
- *distortion += distortion_y;
+ *rate2 += *rate_y;
+ *distortion += distortion_y;
- rdcosty = RDCOST(x->rdmult, x->rddiv, *rate2, *distortion);
- rdcosty = VPXMIN(rdcosty, RDCOST(x->rdmult, x->rddiv, 0, *psse));
+ rdcosty = RDCOST(x->rdmult, x->rddiv, *rate2, *distortion);
+ rdcosty = VPXMIN(rdcosty, RDCOST(x->rdmult, x->rddiv, 0, *psse));
#if CONFIG_VAR_TX
- if (!inter_block_uvrd(cpi, x, rate_uv, &distortion_uv, &skippable_uv,
- &sseuv, bsize, ref_best_rd - rdcosty)) {
+ if (!inter_block_uvrd(cpi, x, rate_uv, &distortion_uv, &skippable_uv,
+ &sseuv, bsize, ref_best_rd - rdcosty))
#else
- if (!super_block_uvrd(cpi, x, rate_uv, &distortion_uv, &skippable_uv,
- &sseuv, bsize, ref_best_rd - rdcosty)) {
+ if (!super_block_uvrd(cpi, x, rate_uv, &distortion_uv, &skippable_uv,
+ &sseuv, bsize, ref_best_rd - rdcosty))
#endif // CONFIG_VAR_TX
- *rate2 = INT_MAX;
- *distortion = INT64_MAX;
-#if CONFIG_OBMC
- continue;
+ {
+ *rate2 = INT_MAX;
+ *distortion = INT64_MAX;
+#if CONFIG_OBMC || CONFIG_WARPED_MOTION
+ continue;
#else
- restore_dst_buf(xd, orig_dst, orig_dst_stride);
- return INT64_MAX;
-#endif // CONFIG_OBMC
- }
+ restore_dst_buf(xd, orig_dst, orig_dst_stride);
+ return INT64_MAX;
+#endif // CONFIG_OBMC || CONFIG_WARPED_MOTION
+ }
- *psse += sseuv;
- *rate2 += *rate_uv;
- *distortion += distortion_uv;
- *skippable = skippable_y && skippable_uv;
-#if CONFIG_OBMC
- if (*skippable) {
- *rate2 -= *rate_uv + *rate_y;
- *rate_y = 0;
- *rate_uv = 0;
- *rate2 += vp10_cost_bit(vp10_get_skip_prob(cm, xd), 1);
- mbmi->skip = 0;
- // here mbmi->skip temporarily plays a role as what this_skip2 does
- } else if (!xd->lossless[mbmi->segment_id] &&
- (RDCOST(x->rdmult, x->rddiv, *rate_y + *rate_uv +
- vp10_cost_bit(vp10_get_skip_prob(cm, xd), 0), *distortion) >=
- RDCOST(x->rdmult, x->rddiv,
- vp10_cost_bit(vp10_get_skip_prob(cm, xd), 1), *psse))) {
- *rate2 -= *rate_uv + *rate_y;
- *rate2 += vp10_cost_bit(vp10_get_skip_prob(cm, xd), 1);
- *distortion = *psse;
- *rate_y = 0;
- *rate_uv = 0;
- mbmi->skip = 1;
+ *psse += sseuv;
+ *rate2 += *rate_uv;
+ *distortion += distortion_uv;
+ *skippable = skippable_y && skippable_uv;
+#if CONFIG_OBMC || CONFIG_WARPED_MOTION
+ if (*skippable) {
+ *rate2 -= *rate_uv + *rate_y;
+ *rate_y = 0;
+ *rate_uv = 0;
+ *rate2 += vp10_cost_bit(vp10_get_skip_prob(cm, xd), 1);
+ mbmi->skip = 0;
+ // here mbmi->skip temporarily plays a role as what this_skip2 does
+ } else if (!xd->lossless[mbmi->segment_id] &&
+ (RDCOST(x->rdmult, x->rddiv, *rate_y + *rate_uv +
+ vp10_cost_bit(vp10_get_skip_prob(cm, xd), 0),
+ *distortion) >=
+ RDCOST(x->rdmult, x->rddiv,
+ vp10_cost_bit(vp10_get_skip_prob(cm, xd), 1),
+ *psse))) {
+ *rate2 -= *rate_uv + *rate_y;
+ *rate2 += vp10_cost_bit(vp10_get_skip_prob(cm, xd), 1);
+ *distortion = *psse;
+ *rate_y = 0;
+ *rate_uv = 0;
+ mbmi->skip = 1;
+ } else {
+ *rate2 += vp10_cost_bit(vp10_get_skip_prob(cm, xd), 0);
+ mbmi->skip = 0;
+ }
+ *disable_skip = 0;
+#endif // CONFIG_OBMC || CONFIG_WARPED_MOTION
} else {
- *rate2 += vp10_cost_bit(vp10_get_skip_prob(cm, xd), 0);
+ x->skip = 1;
+ *disable_skip = 1;
+
+ // The cost of skip bit needs to be added.
+#if CONFIG_OBMC || CONFIG_WARPED_MOTION
mbmi->skip = 0;
- }
- *disable_skip = 0;
-#endif // CONFIG_OBMC
- } else {
- x->skip = 1;
- *disable_skip = 1;
+#endif // CONFIG_OBMC || CONFIG_WARPED_MOTION
+ *rate2 += vp10_cost_bit(vp10_get_skip_prob(cm, xd), 1);
- // The cost of skip bit needs to be added.
-#if CONFIG_OBMC
- mbmi->skip = 0;
-#endif // CONFIG_OBMC
- *rate2 += vp10_cost_bit(vp10_get_skip_prob(cm, xd), 1);
+ *distortion = skip_sse_sb;
+ }
- *distortion = skip_sse_sb;
- }
-#if CONFIG_OBMC
+#if CONFIG_OBMC || CONFIG_WARPED_MOTION
tmp_rd = RDCOST(x->rdmult, x->rddiv, *rate2, *distortion);
- if (mbmi->obmc == 0 || (tmp_rd < best_rd)) {
+ if (mbmi->motion_variation == SIMPLE_TRANSLATION || (tmp_rd < best_rd)) {
#if CONFIG_EXT_INTERP
#if CONFIG_DUAL_FILTER
- mbmi->interp_filter[0] = obmc_interp_filter[mbmi->obmc][0];
- mbmi->interp_filter[1] = obmc_interp_filter[mbmi->obmc][1];
+ mbmi->interp_filter[0] = obmc_interp_filter[mbmi->motion_variation][0];
+ mbmi->interp_filter[1] = obmc_interp_filter[mbmi->motion_variation][1];
#else
- mbmi->interp_filter = obmc_interp_filter[mbmi->obmc];
+ mbmi->interp_filter = obmc_interp_filter[mbmi->motion_variation];
#endif // CONFIG_DUAL_FILTER
#endif // CONFIG_EXT_INTERP
best_mbmi = *mbmi;
x->skip = best_xskip;
*disable_skip = best_disable_skip;
x->pred_variance = best_pred_var;
-#endif // CONFIG_OBMC
+#endif // CONFIG_OBMC || CONFIG_WARPED_MOTION
if (!is_comp_pred)
single_skippable[this_mode][refs[0]] = *skippable;
: cm->interp_filter;
#endif
mbmi->mv[0].as_int = mbmi->mv[1].as_int = 0;
-#if CONFIG_OBMC
- mbmi->obmc = 0;
-#endif // CONFIG_OBMC
+ mbmi->motion_variation = SIMPLE_TRANSLATION;
x->skip = 0;
set_ref_ptrs(cm, xd, ref_frame, second_ref_frame);
#if CONFIG_EXT_INTER
rate2 += compmode_interintra_cost;
if (cm->reference_mode != SINGLE_REFERENCE && comp_pred)
-#if CONFIG_OBMC
- if (mbmi->obmc == 0)
-#endif // CONFIG_OBMC
- rate2 += compmode_wedge_cost;
+#if CONFIG_OBMC || CONFIG_WARPED_MOTION
+ if (mbmi->motion_variation == SIMPLE_TRANSLATION)
+#endif // CONFIG_OBMC || CONFIG_WARPED_MOTION
+ rate2 += compmode_wedge_cost;
#endif // CONFIG_EXT_INTER
// Estimate the reference frame signaling cost and add it
disable_skip || skippable || this_skip2);
*returnrate_nocoef -= vp10_cost_bit(vp10_get_intra_inter_prob(cm, xd),
mbmi->ref_frame[0] != INTRA_FRAME);
-#if CONFIG_OBMC
- if (is_inter_block(mbmi) && is_obmc_allowed(mbmi))
- *returnrate_nocoef -= cpi->obmc_cost[bsize][mbmi->obmc];
-#endif // CONFIG_OBMC
+#if CONFIG_OBMC || CONFIG_WARPED_MOTION
+ if (is_inter_block(mbmi) && is_motvar_allowed(mbmi))
+ *returnrate_nocoef -= cpi->motvar_cost[bsize][mbmi->motion_variation];
+#endif // CONFIG_OBMC || CONFIG_WARPED_MOTION
#endif // CONFIG_SUPERTX
rd_cost->dist = distortion2;
rd_cost->rdcost = this_rd;
mbmi->ext_intra_mode_info.use_ext_intra_mode[0] = 0;
mbmi->ext_intra_mode_info.use_ext_intra_mode[1] = 0;
#endif // CONFIG_EXT_INTRA
-#if CONFIG_OBMC
- mbmi->obmc = 0;
-#endif // CONFIG_OBMC
+ mbmi->motion_variation = SIMPLE_TRANSLATION;
#if CONFIG_EXT_INTER
mbmi->use_wedge_interinter = 0;
mbmi->use_wedge_interintra = 0;