]> granicus.if.org Git - libvpx/commitdiff
vp10: remove clamp_mv2() call from vp10_find_best_ref_mvs().
authorRonald S. Bultje <rsbultje@gmail.com>
Fri, 2 Oct 2015 15:51:54 +0000 (11:51 -0400)
committerRonald S. Bultje <rsbultje@gmail.com>
Mon, 12 Oct 2015 18:45:18 +0000 (14:45 -0400)
This actually has no effect whatsoever, since the input MVs themselves
are clamped by clamp_mv_ref() already, which is significantly more
restrictive in its bounds.

Change-Id: I4a3a7b2b121ee422c56428c2a12d930c3813c06e

vp10/common/mvref_common.c
vp10/common/mvref_common.h
vp10/decoder/decodemv.c
vp10/encoder/rdopt.c

index 26785606538e4cc266d259046cd8872d233e1e07..9bf701fcca388a5ef8e3a2895457681e772728bc 100644 (file)
@@ -168,14 +168,13 @@ static void lower_mv_precision(MV *mv, int allow_hp) {
   }
 }
 
-void vp10_find_best_ref_mvs(MACROBLOCKD *xd, int allow_hp,
+void vp10_find_best_ref_mvs(int allow_hp,
                            int_mv *mvlist, int_mv *nearest_mv,
                            int_mv *near_mv) {
   int i;
   // Make sure all the candidates are properly clamped etc
   for (i = 0; i < MAX_MV_REF_CANDIDATES; ++i) {
     lower_mv_precision(&mvlist[i].as_mv, allow_hp);
-    clamp_mv2(&mvlist[i].as_mv, xd);
   }
   *nearest_mv = mvlist[0];
   *near_mv = mvlist[1];
index 0774f7035856447d98a8a0a004ad9b753bd27eb6..e92ad52cdfed0e079891b4d21be796b3e714f817 100644 (file)
 extern "C" {
 #endif
 
-#define LEFT_TOP_MARGIN ((VP9_ENC_BORDER_IN_PIXELS - VP9_INTERP_EXTEND) << 3)
-#define RIGHT_BOTTOM_MARGIN ((VP9_ENC_BORDER_IN_PIXELS -\
-                                VP9_INTERP_EXTEND) << 3)
-
 #define MVREF_NEIGHBOURS 8
 
 typedef struct position {
@@ -200,14 +196,6 @@ static INLINE int is_inside(const TileInfo *const tile,
            mi_col + mi_pos->col >= tile->mi_col_end);
 }
 
-// TODO(jingning): this mv clamping function should be block size dependent.
-static INLINE void clamp_mv2(MV *mv, const MACROBLOCKD *xd) {
-  clamp_mv(mv, xd->mb_to_left_edge - LEFT_TOP_MARGIN,
-               xd->mb_to_right_edge + RIGHT_BOTTOM_MARGIN,
-               xd->mb_to_top_edge - LEFT_TOP_MARGIN,
-               xd->mb_to_bottom_edge + RIGHT_BOTTOM_MARGIN);
-}
-
 typedef void (*find_mv_refs_sync)(void *const data, int mi_row);
 void vp10_find_mv_refs(const VP10_COMMON *cm, const MACROBLOCKD *xd,
                       MODE_INFO *mi, MV_REFERENCE_FRAME ref_frame,
@@ -218,7 +206,7 @@ void vp10_find_mv_refs(const VP10_COMMON *cm, const MACROBLOCKD *xd,
 // check a list of motion vectors by sad score using a number rows of pixels
 // above and a number cols of pixels in the left to select the one with best
 // score to use as ref motion vector
-void vp10_find_best_ref_mvs(MACROBLOCKD *xd, int allow_hp,
+void vp10_find_best_ref_mvs(int allow_hp,
                            int_mv *mvlist, int_mv *nearest_mv, int_mv *near_mv);
 
 void vp10_append_sub8x8_mvs_for_idx(VP10_COMMON *cm, MACROBLOCKD *xd,
index f157ada20e19116b8f1a3f37b18e492d7b790798..2fb8da24b435b3dbe065e8efd392dd584fbf987f 100644 (file)
@@ -523,8 +523,8 @@ static void read_inter_block_mode_info(VP10Decoder *const pbi,
 
   if (bsize < BLOCK_8X8 || mbmi->mode != ZEROMV) {
     for (ref = 0; ref < 1 + is_compound; ++ref) {
-      vp10_find_best_ref_mvs(xd, allow_hp, ref_mvs[mbmi->ref_frame[ref]],
-                            &nearestmv[ref], &nearmv[ref]);
+      vp10_find_best_ref_mvs(allow_hp, ref_mvs[mbmi->ref_frame[ref]],
+                             &nearestmv[ref], &nearmv[ref]);
     }
   }
 
index e3bbdd3462dfa4718b5b44769dda6f90c51c9aa3..3aeb9b348c3d19530424140d93878d1a46829f58 100644 (file)
@@ -2142,9 +2142,9 @@ static void setup_buffer_inter(VP10_COMP *cpi, MACROBLOCK *x,
                    NULL, NULL, mbmi_ext->mode_context);
 
   // Candidate refinement carried out at encoder and decoder
-  vp10_find_best_ref_mvs(xd, cm->allow_high_precision_mv, candidates,
-                        &frame_nearest_mv[ref_frame],
-                        &frame_near_mv[ref_frame]);
+  vp10_find_best_ref_mvs(cm->allow_high_precision_mv, candidates,
+                         &frame_nearest_mv[ref_frame],
+                         &frame_near_mv[ref_frame]);
 
   // Further refinement that is encode side only to test the top few candidates
   // in full and choose the best as the centre point for subsequent searches.
@@ -2315,6 +2315,18 @@ static int discount_newmv_test(const VP10_COMP *cpi,
            (mode_mv[NEARMV][ref_frame].as_int == INVALID_MV)));
 }
 
+#define LEFT_TOP_MARGIN ((VP9_ENC_BORDER_IN_PIXELS - VP9_INTERP_EXTEND) << 3)
+#define RIGHT_BOTTOM_MARGIN ((VP9_ENC_BORDER_IN_PIXELS -\
+                                VP9_INTERP_EXTEND) << 3)
+
+// TODO(jingning): this mv clamping function should be block size dependent.
+static INLINE void clamp_mv2(MV *mv, const MACROBLOCKD *xd) {
+  clamp_mv(mv, xd->mb_to_left_edge - LEFT_TOP_MARGIN,
+               xd->mb_to_right_edge + RIGHT_BOTTOM_MARGIN,
+               xd->mb_to_top_edge - LEFT_TOP_MARGIN,
+               xd->mb_to_bottom_edge + RIGHT_BOTTOM_MARGIN);
+}
+
 static int64_t handle_inter_mode(VP10_COMP *cpi, MACROBLOCK *x,
                                  BLOCK_SIZE bsize,
                                  int *rate2, int64_t *distortion,