COSMETICS: Clean up av1/common/reconinter_template.inc

Change-Id: I8c839c3c06044b75426693b70014d0efd838310b
diff --git a/av1/common/reconinter_template.inc b/av1/common/reconinter_template.inc
index 6665dac..f7edc0d 100644
--- a/av1/common/reconinter_template.inc
+++ b/av1/common/reconinter_template.inc
@@ -9,44 +9,44 @@
  * PATENTS file, you can obtain it at www.aomedia.org/license/patent.
  */
 
-#ifndef IS_ENC
-#error "IS_ENC must be defined for reconinter_template.inc."
+#ifndef IS_DEC
+#error "IS_DEC must be defined for reconinter_template.inc."
 #endif
 
-#if IS_ENC
-#define RENAME(x) av1_enc_##x
+#if IS_DEC
+#define RENAME(x) x
 #else
-#define RENAME(x) av1_dec_##x
-#endif  // IS_ENC
+#define RENAME(x) av1_enc_##x
+#endif  // IS_DEC
 
-#if !IS_ENC
-static AOM_INLINE
-#elif !defined(_MSC_VER)
+#if IS_DEC
+static AOM_INLINE void RENAME(build_one_inter_predictor)(
+    uint8_t *dst, int dst_stride, const MV *src_mv,
+    InterPredParams *inter_pred_params, MACROBLOCKD *xd, int mi_x, int mi_y,
+    int ref, uint8_t **mc_buf) {
+#else
+#if !defined(_MSC_VER)
 // Visual studio seems to prefer a cpp style to inline, so if a declaration of
-// a function is inline, then all must be inline.
+// a function is inline, then all must be inline. Since there is a non-inlined
+// declaration of av1_enc_build_one_inter_predictor in
+// av1/encoder/reconinter_enc.h, we disable the inline keyword here for now.
 AOM_INLINE
-#endif  // !IS_ENC
-    void
-    RENAME(build_one_inter_predictor)(uint8_t *dst, int dst_stride,
-                                      const MV *src_mv,
-                                      InterPredParams *inter_pred_params
-#if !IS_ENC
-                                      ,
-                                      MACROBLOCKD *xd, int mi_x, int mi_y,
-                                      int ref, uint8_t **mc_buf
-#endif  //! IS_ENC
-    ) {
+#endif  // !defined(_MSC_VER)
+void RENAME(build_one_inter_predictor)(uint8_t *dst, int dst_stride,
+                                       const MV *src_mv,
+                                       InterPredParams *inter_pred_params) {
+#endif  // IS_DEC
   SubpelParams subpel_params;
   uint8_t *src;
   int src_stride;
-#if IS_ENC
-  enc_calc_subpel_params(src_mv, inter_pred_params, &src, &subpel_params,
-                         &src_stride);
-#else
+#if IS_DEC
   dec_calc_subpel_params_and_extend(src_mv, inter_pred_params, xd, mi_x, mi_y,
                                     ref, mc_buf, &src, &subpel_params,
                                     &src_stride);
-#endif  // IS_ENC
+#else
+  enc_calc_subpel_params(src_mv, inter_pred_params, &src, &subpel_params,
+                         &src_stride);
+#endif  // IS_DEC
   if (inter_pred_params->comp_mode == UNIFORM_SINGLE ||
       inter_pred_params->comp_mode == UNIFORM_COMP) {
     av1_make_inter_predictor(src, src_stride, dst, dst_stride,
@@ -94,15 +94,18 @@
   return true;
 }
 
+#if IS_DEC
 static AOM_INLINE void build_inter_predictors_sub8x8(const AV1_COMMON *cm,
                                                      MACROBLOCKD *xd, int plane,
                                                      const MB_MODE_INFO *mi,
-                                                     int mi_x, int mi_y
-#if !IS_ENC
-                                                     ,
-                                                     uint8_t **mc_buf
-#endif  // !IS_ENC
-) {
+                                                     int mi_x, int mi_y,
+                                                     uint8_t **mc_buf) {
+#else
+static AOM_INLINE void build_inter_predictors_sub8x8(const AV1_COMMON *cm,
+                                                     MACROBLOCKD *xd, int plane,
+                                                     const MB_MODE_INFO *mi,
+                                                     int mi_x, int mi_y) {
+#endif  // IS_DEC
   const BLOCK_SIZE bsize = mi->bsize;
   struct macroblockd_plane *const pd = &xd->plane[plane];
   const bool ss_x = pd->subsampling_x;
@@ -156,13 +159,14 @@
       inter_pred_params.conv_params =
           get_conv_params_no_round(ref, plane, NULL, 0, is_compound, xd->bd);
 
+#if IS_DEC
       RENAME(build_one_inter_predictor)
-      (dst, dst_buf->stride, &mv, &inter_pred_params
-#if !IS_ENC
-       ,
-       xd, mi_x + x, mi_y + y, ref, mc_buf
-#endif  // !IS_ENC
-      );
+      (dst, dst_buf->stride, &mv, &inter_pred_params, xd, mi_x + x, mi_y + y,
+       ref, mc_buf);
+#else
+      RENAME(build_one_inter_predictor)
+      (dst, dst_buf->stride, &mv, &inter_pred_params);
+#endif  // IS_DEC
 
       ++col;
     }
@@ -170,14 +174,15 @@
   }
 }
 
+#if IS_DEC
 static AOM_INLINE void build_inter_predictors_8x8_and_bigger(
     const AV1_COMMON *cm, MACROBLOCKD *xd, int plane, const MB_MODE_INFO *mi,
-    int build_for_obmc, int bw, int bh, int mi_x, int mi_y
-#if !IS_ENC
-    ,
-    uint8_t **mc_buf
-#endif  // !IS_ENC
-) {
+    int build_for_obmc, int bw, int bh, int mi_x, int mi_y, uint8_t **mc_buf) {
+#else
+static AOM_INLINE void build_inter_predictors_8x8_and_bigger(
+    const AV1_COMMON *cm, MACROBLOCKD *xd, int plane, const MB_MODE_INFO *mi,
+    int build_for_obmc, int bw, int bh, int mi_x, int mi_y) {
+#endif  // IS_DEC
   const int is_compound = has_second_ref(mi);
   const int is_intrabc = is_intrabc_block(mi);
   assert(IMPLIES(is_intrabc, !is_compound));
@@ -237,41 +242,42 @@
       inter_pred_params.mask_comp.seg_mask = xd->seg_mask;
     }
 
+#if IS_DEC
     RENAME(build_one_inter_predictor)
-    (dst, dst_buf->stride, &mv, &inter_pred_params
-#if !IS_ENC
-     ,
-     xd, mi_x, mi_y, ref, mc_buf
-#endif  // !IS_ENC
-    );
+    (dst, dst_buf->stride, &mv, &inter_pred_params, xd, mi_x, mi_y, ref,
+     mc_buf);
+#else
+    RENAME(build_one_inter_predictor)
+    (dst, dst_buf->stride, &mv, &inter_pred_params);
+#endif  // IS_DEC
   }
 }
 
+#if IS_DEC
 static AOM_INLINE void RENAME(build_inter_predictors)(
     const AV1_COMMON *cm, MACROBLOCKD *xd, int plane, const MB_MODE_INFO *mi,
-    int build_for_obmc, int bw, int bh, int mi_x, int mi_y
-#if !IS_ENC
-    ,
-    uint8_t **mc_buf
-#endif  // !IS_ENC
-) {
+    int build_for_obmc, int bw, int bh, int mi_x, int mi_y, uint8_t **mc_buf) {
   if (is_sub8x8_inter(xd, plane, mi->bsize, is_intrabc_block(mi),
                       build_for_obmc)) {
     assert(bw < 8 || bh < 8);
-    build_inter_predictors_sub8x8(cm, xd, plane, mi, mi_x, mi_y
-#if !IS_ENC
-                                  ,
-                                  mc_buf
-#endif  // !IS_ENC
-    );
+    build_inter_predictors_sub8x8(cm, xd, plane, mi, mi_x, mi_y, mc_buf);
   } else {
     build_inter_predictors_8x8_and_bigger(cm, xd, plane, mi, build_for_obmc, bw,
-                                          bh, mi_x, mi_y
-#if !IS_ENC
-                                          ,
-                                          mc_buf
-#endif  // !IS_ENC
-    );
+                                          bh, mi_x, mi_y, mc_buf);
   }
 }
+#else
+static AOM_INLINE void RENAME(build_inter_predictors)(
+    const AV1_COMMON *cm, MACROBLOCKD *xd, int plane, const MB_MODE_INFO *mi,
+    int build_for_obmc, int bw, int bh, int mi_x, int mi_y) {
+  if (is_sub8x8_inter(xd, plane, mi->bsize, is_intrabc_block(mi),
+                      build_for_obmc)) {
+    assert(bw < 8 || bh < 8);
+    build_inter_predictors_sub8x8(cm, xd, plane, mi, mi_x, mi_y);
+  } else {
+    build_inter_predictors_8x8_and_bigger(cm, xd, plane, mi, build_for_obmc, bw,
+                                          bh, mi_x, mi_y);
+  }
+}
+#endif  // IS_DEC
 #undef RENAME
diff --git a/av1/decoder/decodeframe.c b/av1/decoder/decodeframe.c
index f6f8048..9605aae 100644
--- a/av1/decoder/decodeframe.c
+++ b/av1/decoder/decodeframe.c
@@ -646,17 +646,17 @@
       inter_pred_params->use_hbd_buf, mc_buf[ref], pre, src_stride);
 }
 
-#define IS_ENC 0
+#define IS_DEC 1
 #include "av1/common/reconinter_template.inc"
-#undef IS_ENC
+#undef IS_DEC
 
 static void dec_build_inter_predictors(const AV1_COMMON *cm,
                                        DecoderCodingBlock *dcb, int plane,
                                        const MB_MODE_INFO *mi,
                                        int build_for_obmc, int bw, int bh,
                                        int mi_x, int mi_y) {
-  av1_dec_build_inter_predictors(cm, &dcb->xd, plane, mi, build_for_obmc, bw,
-                                 bh, mi_x, mi_y, dcb->mc_buf);
+  build_inter_predictors(cm, &dcb->xd, plane, mi, build_for_obmc, bw, bh, mi_x,
+                         mi_y, dcb->mc_buf);
 }
 
 static AOM_INLINE void dec_build_inter_predictor(const AV1_COMMON *cm,
diff --git a/av1/encoder/reconinter_enc.c b/av1/encoder/reconinter_enc.c
index 16ebb9f..432aa57 100644
--- a/av1/encoder/reconinter_enc.c
+++ b/av1/encoder/reconinter_enc.c
@@ -40,9 +40,9 @@
   *src_stride = pre_buf->stride;
 }
 
-#define IS_ENC 1
+#define IS_DEC 0
 #include "av1/common/reconinter_template.inc"
-#undef IS_ENC
+#undef IS_DEC
 
 static void enc_build_inter_predictors(const AV1_COMMON *cm, MACROBLOCKD *xd,
                                        int plane, const MB_MODE_INFO *mi,