Commit b659281e authored by Sarah Parker's avatar Sarah Parker

Add reconstruction using gm parameters

This patch only includes inter frame reconstruction using gm
parameters when GLOBAL_MOTION and/or VP9_HIGHBITDEPTH are enabled.
GM is not currently used when EXT_INTER or DUAL_FILTER is enabled.
This will be added in a followup patch. For now, these experiments
will take precedence over GLOBAL_MOTION when they are all enabled.

Change-Id: I930ddda529c44d7245dbb56db3c9c5524cf45473
parent 292ea74f
......@@ -23,6 +23,9 @@
#if CONFIG_OBMC
#include "vp10/common/onyxc_int.h"
#endif // CONFIG_OBMC
#if CONFIG_GLOBAL_MOTION
#include "vp10/common/warped_motion.h"
#endif // CONFIG_GLOBAL_MOTION
#if CONFIG_EXT_INTER
......@@ -704,7 +707,21 @@ void build_inter_predictors(MACROBLOCKD *xd, int plane,
#endif // CONFIG_OBMC
const int is_compound = has_second_ref(&mi->mbmi);
int ref;
#if CONFIG_GLOBAL_MOTION
Global_Motion_Params *gm[2];
int is_global[2];
for (ref = 0; ref < 1 + is_compound; ++ref) {
gm[ref] = &xd->global_motion[mi->mbmi.ref_frame[ref]];
is_global[ref] = (get_y_mode(mi, block) == ZEROMV &&
get_gmtype(gm[ref]) > GLOBAL_ZERO);
}
// TODO(sarahparker) remove these once gm works with all experiments
(void) gm;
(void) is_global;
#endif // CONFIG_GLOBAL_MOTION
// TODO(sarahparker) enable the use of DUAL_FILTER in warped motion functions
// in order to allow GLOBAL_MOTION and DUAL_FILTER to work together
#if CONFIG_DUAL_FILTER
if (mi->mbmi.sb_type < BLOCK_8X8 && plane > 0) {
// block size in log2
......@@ -838,6 +855,19 @@ void build_inter_predictors(MACROBLOCKD *xd, int plane,
#endif // CONFIG_SUPERTX
xd);
else
#else // CONFIG_EXT_INTER
#if CONFIG_GLOBAL_MOTION
if (is_global[ref])
vp10_warp_plane(&(gm[ref]->motion_params),
#if CONFIG_VP9_HIGHBITDEPTH
xd->cur_buf->flags & YV12_FLAG_HIGHBITDEPTH, xd->bd,
#endif // CONFIG_VP9_HIGHBITDEPTH
pre_buf->buf0, pre_buf->width, pre_buf->height,
pre_buf->stride, dst, (mi_x >> pd->subsampling_x) + x,
(mi_y >> pd->subsampling_y) + y, w, h, dst_buf->stride,
pd->subsampling_x, pd->subsampling_y, xs, ys);
else
#endif // CONFIG_GLOBAL_MOTION
#endif // CONFIG_EXT_INTER
vp10_make_inter_predictor(pre, pre_buf->stride, dst, dst_buf->stride,
subpel_x, subpel_y, sf, w, h, ref,
......
......@@ -494,14 +494,14 @@ static uint8_t warp_interpolate(uint8_t *ref, int x, int y,
}
}
void vp10_warp_plane(WarpedMotionParams *wm,
uint8_t *ref,
int width, int height, int stride,
uint8_t *pred,
int p_col, int p_row,
int p_width, int p_height, int p_stride,
int subsampling_x, int subsampling_y,
int x_scale, int y_scale) {
static void warp_plane(WarpedMotionParams *wm,
uint8_t *ref,
int width, int height, int stride,
uint8_t *pred,
int p_col, int p_row,
int p_width, int p_height, int p_stride,
int subsampling_x, int subsampling_y,
int x_scale, int y_scale) {
int i, j;
projectPointsType projectPoints = get_projectPointsType(wm->wmtype);
if (projectPoints == NULL)
......@@ -509,6 +509,8 @@ void vp10_warp_plane(WarpedMotionParams *wm,
for (i = p_row; i < p_row + p_height; ++i) {
for (j = p_col; j < p_col + p_width; ++j) {
int in[2], out[2];
in[0] = j;
in[1] = i;
projectPoints(wm->wmmat, in, out, 1, 2, 2, subsampling_x, subsampling_y);
out[0] = ROUND_POWER_OF_TWO_SIGNED(out[0] * x_scale, 4);
out[1] = ROUND_POWER_OF_TWO_SIGNED(out[1] * y_scale, 4);
......@@ -638,15 +640,15 @@ static uint16_t highbd_warp_interpolate(uint16_t *ref,
}
}
void vp10_highbd_warp_plane(WarpedMotionParams *wm,
uint8_t *ref8,
int width, int height, int stride,
uint8_t *pred8,
int p_col, int p_row,
int p_width, int p_height, int p_stride,
int subsampling_x, int subsampling_y,
int x_scale, int y_scale,
int bd) {
static void highbd_warp_plane(WarpedMotionParams *wm,
uint8_t *ref8,
int width, int height, int stride,
uint8_t *pred8,
int p_col, int p_row,
int p_width, int p_height, int p_stride,
int subsampling_x, int subsampling_y,
int x_scale, int y_scale,
int bd) {
int i, j;
projectPointsType projectPoints = get_projectPointsType(wm->wmtype);
uint16_t *pred = CONVERT_TO_SHORTPTR(pred8);
......@@ -656,6 +658,8 @@ void vp10_highbd_warp_plane(WarpedMotionParams *wm,
for (i = p_row; i < p_row + p_height; ++i) {
for (j = p_col; j < p_col + p_width; ++j) {
int in[2], out[2];
in[0] = j;
in[1] = i;
projectPoints(wm->wmmat, in, out, 1, 2, 2, subsampling_x, subsampling_y);
out[0] = ROUND_POWER_OF_TWO_SIGNED(out[0] * x_scale, 4);
out[1] = ROUND_POWER_OF_TWO_SIGNED(out[1] * y_scale, 4);
......@@ -666,3 +670,30 @@ void vp10_highbd_warp_plane(WarpedMotionParams *wm,
}
}
#endif // CONFIG_VP9_HIGHBITDEPTH
void vp10_warp_plane(WarpedMotionParams *wm,
#if CONFIG_VP9_HIGHBITDEPTH
int use_hbd, int bd,
#endif // CONFIG_VP9_HIGHBITDEPTH
uint8_t *ref,
int width, int height, int stride,
uint8_t *pred,
int p_col, int p_row,
int p_width, int p_height, int p_stride,
int subsampling_x, int subsampling_y,
int x_scale, int y_scale) {
#if CONFIG_VP9_HIGHBITDEPTH
if (use_hbd)
highbd_warp_plane(wm, ref, width, height, stride,
pred, p_col, p_row,
p_width, p_height, p_stride,
subsampling_x, subsampling_y,
x_scale, y_scale, bd);
else
#endif // CONFIG_VP9_HIGHBITDEPTH
warp_plane(wm, ref, width, height, stride,
pred, p_col, p_row,
p_width, p_height, p_stride,
subsampling_x, subsampling_y,
x_scale, y_scale);
}
......@@ -55,22 +55,14 @@ typedef struct {
} WarpedMotionParams;
void vp10_warp_plane(WarpedMotionParams *wm,
#if CONFIG_VP9_HIGHBITDEPTH
int use_hbd, int bd,
#endif // CONFIG_VP9_HIGHBITDEPTH
uint8_t *ref,
int width, int height, int stride,
uint8_t *pred,
int p_col, int p_row,
int p_width, int p_height, int p_stride,
int subsampling_col, int subsampling_row,
int subsampling_x, int subsampling_y,
int x_scale, int y_scale);
#if CONFIG_VP9_HIGHBITDEPTH
void vp10_highbd_warp_plane(WarpedMotionParams *wm,
uint8_t *ref,
int width, int height, int stride,
uint8_t *pred,
int p_col, int p_row,
int p_width, int p_height, int p_stride,
int subsampling_col, int subsampling_row,
int x_scale, int y_scale,
int bd);
#endif // CONFIG_VP9_HIGHBITDEPTH
#endif // VP10_COMMON_WARPED_MOTION_H
......@@ -2227,6 +2227,9 @@ void vp10_change_config(struct VP10_COMP *cpi, const VP10EncoderConfig *oxcf) {
#if CONFIG_VP9_HIGHBITDEPTH
cpi->td.mb.e_mbd.bd = (int)cm->bit_depth;
#endif // CONFIG_VP9_HIGHBITDEPTH
#if CONFIG_GLOBAL_MOTION
cpi->td.mb.e_mbd.global_motion = cm->global_motion;
#endif // CONFIG_GLOBAL_MOTION
if ((oxcf->pass == 0) && (oxcf->rc_mode == VPX_Q)) {
rc->baseline_gf_interval = FIXED_GF_INTERVAL;
......
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