Commit 163710c0 authored by Sebastien Alaiwan's avatar Sebastien Alaiwan
Browse files

Accept all warped motion model settings

When needed, fallback regular interp filter at reconstruction stage.

Such bitstreams are valid.
However, as we don't expect aomenc to generate them,
print a helper warning.

Change-Id: If30c8d8e478688d142abd857f4c35f3e8c68edb4
parent c002bdf6
......@@ -111,6 +111,7 @@ typedef struct {
TransformationType wmtype;
int32_t wmmat[8];
int16_t alpha, beta, gamma, delta;
int8_t invalid;
} WarpedMotionParams;
/* clang-format off */
......@@ -118,7 +119,8 @@ static const WarpedMotionParams default_warp_params = {
IDENTITY,
{ 0, 0, (1 << WARPEDMODEL_PREC_BITS), 0, 0, (1 << WARPEDMODEL_PREC_BITS), 0,
0 },
0, 0, 0, 0
0, 0, 0, 0,
0,
};
/* clang-format on */
#endif // CONFIG_GLOBAL_MOTION || CONFIG_WARPED_MOTION
......
......@@ -45,6 +45,10 @@ static INLINE int allow_warp(const MODE_INFO *const mi,
const MB_MODE_INFO *const mbmi = &mi->mbmi;
*final_warp_params = default_warp_params;
#if CONFIG_WARPED_MOTION
if (mbmi->wm_params[0].invalid) return 0;
#endif
// Only global motion configured
#if CONFIG_GLOBAL_MOTION && !CONFIG_WARPED_MOTION && !CONFIG_MOTION_VAR
(void)mbmi;
......
......@@ -2591,23 +2591,6 @@ static void read_inter_block_mode_info(AV1Decoder *const pbi,
#if CONFIG_COMPOUND_SINGLEREF
if (is_singleref_comp_mode) assert(mbmi->motion_mode == SIMPLE_TRANSLATION);
#endif // CONFIG_COMPOUND_SINGLEREF
#if CONFIG_WARPED_MOTION
if (mbmi->motion_mode == WARPED_CAUSAL) {
mbmi->wm_params[0].wmtype = DEFAULT_WMTYPE;
#if CONFIG_EXT_WARPED_MOTION
if (mbmi->num_proj_ref[0] > 1)
mbmi->num_proj_ref[0] = sortSamples(pts_mv, &mbmi->mv[0].as_mv, pts,
pts_inref, mbmi->num_proj_ref[0]);
#endif // CONFIG_EXT_WARPED_MOTION
if (find_projection(mbmi->num_proj_ref[0], pts, pts_inref, bsize,
mbmi->mv[0].as_mv.row, mbmi->mv[0].as_mv.col,
&mbmi->wm_params[0], mi_row, mi_col)) {
aom_internal_error(&cm->error, AOM_CODEC_ERROR, "Invalid Warped Model");
}
}
#endif // CONFIG_WARPED_MOTION
#endif // CONFIG_MOTION_VAR || CONFIG_WARPED_MOTION
mbmi->interinter_compound_type = COMPOUND_AVERAGE;
......@@ -2659,6 +2642,27 @@ static void read_inter_block_mode_info(AV1Decoder *const pbi,
read_mb_interp_filter(cm, xd, mbmi, r);
#endif // CONFIG_DUAL_FILTER || CONFIG_WARPED_MOTION
#if CONFIG_WARPED_MOTION
if (mbmi->motion_mode == WARPED_CAUSAL) {
mbmi->wm_params[0].wmtype = DEFAULT_WMTYPE;
#if CONFIG_EXT_WARPED_MOTION
if (mbmi->num_proj_ref[0] > 1)
mbmi->num_proj_ref[0] = sortSamples(pts_mv, &mbmi->mv[0].as_mv, pts,
pts_inref, mbmi->num_proj_ref[0]);
#endif // CONFIG_EXT_WARPED_MOTION
if (find_projection(mbmi->num_proj_ref[0], pts, pts_inref, bsize,
mbmi->mv[0].as_mv.row, mbmi->mv[0].as_mv.col,
&mbmi->wm_params[0], mi_row, mi_col)) {
#if DEC_MISMATCH_DEBUG
printf("Warning: unexpected warped model from aomenc\n");
#endif
mbmi->wm_params[0].invalid = 1;
}
}
#endif // CONFIG_WARPED_MOTION
#if DEC_MISMATCH_DEBUG
dec_dump_logs(cm, mi, mi_row, mi_col, inter_mode_ctx, mode_ctx);
#endif // DEC_MISMATCH_DEBUG
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment