]> granicus.if.org Git - libvpx/commitdiff
Remove the SECOND_LEVEL_CHECKS_BEST macro
authorHui Su <huisu@google.com>
Tue, 18 Sep 2018 16:41:14 +0000 (09:41 -0700)
committerHui Su <huisu@google.com>
Tue, 18 Sep 2018 16:41:14 +0000 (09:41 -0700)
This macro is used only once and makes the code relatively harder to
read and modify.

Change-Id: I8f0344a7050758ed9770ffca211b0237fe7d8b34

vp9/encoder/vp9_mcomp.c

index 12c147ead7a1fc6f10b4dc8461d6cbe42332d0b9..e0462f49c6332dcd57da1617c3ff2a6fbdfeee89 100644 (file)
@@ -263,27 +263,6 @@ static INLINE const uint8_t *pre(const uint8_t *buf, int stride, int r, int c) {
     }                                                             \
   }
 
-// TODO(yunqingwang): SECOND_LEVEL_CHECKS_BEST was a rewrote of
-// SECOND_LEVEL_CHECKS, and SECOND_LEVEL_CHECKS should be rewritten
-// later in the same way.
-#define SECOND_LEVEL_CHECKS_BEST                \
-  {                                             \
-    unsigned int second;                        \
-    int br0 = br;                               \
-    int bc0 = bc;                               \
-    assert(tr == br || tc == bc);               \
-    if (tr == br && tc != bc) {                 \
-      kc = bc - tc;                             \
-    } else if (tr != br && tc == bc) {          \
-      kr = br - tr;                             \
-    }                                           \
-    CHECK_BETTER(second, br0 + kr, bc0);        \
-    CHECK_BETTER(second, br0, bc0 + kc);        \
-    if (br0 != br || bc0 != bc) {               \
-      CHECK_BETTER(second, br0 + kr, bc0 + kc); \
-    }                                           \
-  }
-
 #define SETUP_SUBPEL_SEARCH                                                 \
   const uint8_t *const z = x->plane[0].src.buf;                             \
   const int src_stride = x->plane[0].src.stride;                            \
@@ -755,7 +734,22 @@ uint32_t vp9_find_best_sub_pixel_tree(
       bc = tc;
     }
 
-    if (iters_per_step > 1 && best_idx != -1) SECOND_LEVEL_CHECKS_BEST;
+    if (iters_per_step > 1 && best_idx != -1) {
+      unsigned int second;
+      const int br0 = br;
+      const int bc0 = bc;
+      assert(tr == br || tc == bc);
+      if (tr == br && tc != bc) {
+        kc = bc - tc;
+      } else if (tr != br && tc == bc) {
+        kr = br - tr;
+      }
+      CHECK_BETTER(second, br0 + kr, bc0);
+      CHECK_BETTER(second, br0, bc0 + kc);
+      if (br0 != br || bc0 != bc) {
+        CHECK_BETTER(second, br0 + kr, bc0 + kc);
+      }
+    }
 
     tr = br;
     tc = bc;