Commit 246d2737 authored by Debargha Mukherjee's avatar Debargha Mukherjee

Assign offsets correctly to compute warped motion

Offsets for the least-squares for affine motion computation
are now set at the top left corner of the current block.

Improves stability and performance a little.

Change-Id: I68ca7e74c6102502daa8ca3373af2b2dd59400c3
parent c41a549a
......@@ -1218,7 +1218,7 @@ void av1_warp_plane(WarpedMotionParams *wm,
#define IDET_PREC_BITS 48
#define IDET_WARPEDMODEL_DIFF_BITS (IDET_PREC_BITS - WARPEDMODEL_PREC_BITS)
static int find_affine_int(const int np, int *pts1, int *pts2,
WarpedMotionParams *wm) {
WarpedMotionParams *wm, int mi_row, int mi_col) {
int64_t A[3][3] = { { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 } };
int64_t C[3][3] = { { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 } };
int64_t Bx[3] = { 0, 0, 0 };
......@@ -1227,7 +1227,7 @@ static int find_affine_int(const int np, int *pts1, int *pts2,
int64_t Det, iDet;
int i, off;
// Offsets to make the values in the arrays smaller
const int ux = pts1[0], uy = pts1[1];
const int ux = mi_col * MI_SIZE * 8, uy = mi_row * MI_SIZE * 8;
// Let source points (xi, yi) map to destimation points (xi', yi'),
// for i = 0, 1, 2, .... n-1
// Then if P = [x0, y0, 1,
......@@ -1326,10 +1326,12 @@ static int find_affine_int(const int np, int *pts1, int *pts2,
}
int find_projection(const int np, int *pts1, int *pts2,
WarpedMotionParams *wm_params) {
WarpedMotionParams *wm_params, int mi_row, int mi_col) {
int result = 1;
switch (wm_params->wmtype) {
case AFFINE: result = find_affine_int(np, pts1, pts2, wm_params); break;
case AFFINE:
result = find_affine_int(np, pts1, pts2, wm_params, mi_row, mi_col);
break;
default: assert(0 && "Invalid warped motion type!"); return 1;
}
if (result == 0) {
......
......@@ -87,5 +87,5 @@ void av1_warp_plane(WarpedMotionParams *wm,
int subsampling_y, int x_scale, int y_scale, int ref_frm);
int find_projection(const int np, int *pts1, int *pts2,
WarpedMotionParams *wm_params);
WarpedMotionParams *wm_params, int mi_row, int mi_col);
#endif // AV1_COMMON_WARPED_MOTION_H_
......@@ -1979,7 +1979,7 @@ static void read_inter_block_mode_info(AV1Decoder *const pbi,
if (mbmi->motion_mode == WARPED_CAUSAL) {
mbmi->wm_params[0].wmtype = DEFAULT_WMTYPE;
find_projection(mbmi->num_proj_ref[0], pts, pts_inref,
&mbmi->wm_params[0]);
&mbmi->wm_params[0], mi_row, mi_col);
}
#endif // CONFIG_WARPED_MOTION
#if CONFIG_SUPERTX
......
......@@ -8771,7 +8771,7 @@ static int64_t handle_inter_mode(
#endif // CONFIG_DUAL_FILTER
if (find_projection(mbmi->num_proj_ref[0], pts, pts_inref,
&mbmi->wm_params[0]) == 0) {
&mbmi->wm_params[0], mi_row, mi_col) == 0) {
int plane;
#if CONFIG_AOM_HIGHBITDEPTH
int use_hbd = xd->cur_buf->flags & YV12_FLAG_HIGHBITDEPTH;
......
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