]> granicus.if.org Git - libvpx/commitdiff
Add reconstruction using gm parameters
authorSarah Parker <sarahparker@google.com>
Wed, 3 Aug 2016 19:29:27 +0000 (12:29 -0700)
committerSarah Parker <sarahparker@google.com>
Mon, 8 Aug 2016 17:17:05 +0000 (10:17 -0700)
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

vp10/common/reconinter.c
vp10/common/warped_motion.c
vp10/common/warped_motion.h
vp10/encoder/encoder.c

index 8b3b5fc8f7db65a15f882d048a1a3dc84f3e43be..d7b75d6b11c3487e76ff957042e0e49f53605f66 100644 (file)
@@ -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,
index 5f1b4f09b9899d26a113e3bcf31a4993544f67c1..e1c1a07095aa89db95507334c8d54a0f2c1689a0 100644 (file)
@@ -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);
+}
index e244dc0d22079a2a971336a862d42b9ae1df0659..72e7c716af8f180b7a63207f9128d35721c35819 100644 (file)
@@ -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
index e6b6b4a9f6418f07a939d1045b7de2fff0b58587..efb042ad994cf54814f98d0a4dc19a684df23580 100644 (file)
@@ -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;