]> granicus.if.org Git - libvpx/commitdiff
Fix x_offset_q4/y_offset_q4 calculation
authorYunqing Wang <yunqingwang@google.com>
Tue, 29 Oct 2013 17:40:13 +0000 (10:40 -0700)
committerYunqing Wang <yunqingwang@google.com>
Wed, 30 Oct 2013 00:46:55 +0000 (17:46 -0700)
"<< SUBPEL_BITS" needs to be added in the calculation. Call
set_scaled_offsets() to calculate x_offset_q4 and y_offset_q4.

Change-Id: Ied130ea771510e918f51cd1dc3abe57f4c0962b5

vp9/common/vp9_reconinter.c
vp9/encoder/vp9_rdopt.c

index 53b90035f35efd96d3395a15f4dd847f7db7a6f3..1c96788dbb0958712c64577cc7d10c6c81332756 100644 (file)
@@ -161,13 +161,12 @@ static void build_inter_predictors(int plane, int block, BLOCK_SIZE bsize,
     // scaling case. It needs to be done on the scaled MV, not the pre-scaling
     // MV. Note however that it performs the subsampling aware scaling so
     // that the result is always q4.
-    const MV res_mv = clamp_mv_to_umv_border_sb(xd, &mv, bw, bh,
-                                                pd->subsampling_x,
-                                                pd->subsampling_y);
+    // mv_precision precision is MV_PRECISION_Q4.
+    const MV mv_q4 = clamp_mv_to_umv_border_sb(xd, &mv, bw, bh,
+                                               pd->subsampling_x,
+                                               pd->subsampling_y);
 
     uint8_t *pre;
-    // mv_precision precision is MV_PRECISION_Q4.
-    const MV mv_q4 = {res_mv.row, res_mv.col };
     MV32 scaled_mv;
     int xs, ys;
 
index d25112b30e9676374cbc85593cf9b50509d2ad6d..eb3abe3f284e32846b35736258af69630e7cc189 100644 (file)
@@ -2268,12 +2268,8 @@ static void setup_buffer_inter(VP9_COMP *cpi, MACROBLOCK *x,
   // set up scaling factors
   scale[frame_type] = cpi->common.active_ref_scale[frame_type - 1];
 
-  scale[frame_type].x_offset_q4 =
-      ROUND_POWER_OF_TWO(mi_col * MI_SIZE * scale[frame_type].sfc->x_scale_fp,
-       REF_SCALE_SHIFT) & 0xf;
-  scale[frame_type].y_offset_q4 =
-      ROUND_POWER_OF_TWO(mi_row * MI_SIZE * scale[frame_type].sfc->y_scale_fp,
-       REF_SCALE_SHIFT) & 0xf;
+  scale[frame_type].sfc->set_scaled_offsets(&scale[frame_type],
+                                            mi_row * MI_SIZE, mi_col * MI_SIZE);
 
   // TODO(jkoleszar): Is the UV buffer ever used here? If so, need to make this
   // use the UV scaling factors.