Merge RD_COST and RD_STATS

BUG=aomedia:442

Change-Id: I9b304230acd2f64d6eab59418c9535f8c302765b
diff --git a/av1/encoder/encodeframe.c b/av1/encoder/encodeframe.c
index de07bd7..646cb2f 100644
--- a/av1/encoder/encodeframe.c
+++ b/av1/encoder/encodeframe.c
@@ -1877,7 +1877,7 @@
 
 static void rd_pick_sb_modes(const AV1_COMP *const cpi, TileDataEnc *tile_data,
                              MACROBLOCK *const x, int mi_row, int mi_col,
-                             RD_COST *rd_cost,
+                             RD_STATS *rd_cost,
 #if CONFIG_SUPERTX
                              int *totalrate_nocoef,
 #endif
@@ -2838,7 +2838,7 @@
                            : PARTITION_NONE;
   const BLOCK_SIZE subsize = get_subsize(bsize, partition);
   RD_SEARCH_MACROBLOCK_CONTEXT x_ctx;
-  RD_COST last_part_rdc, none_rdc, chosen_rdc;
+  RD_STATS last_part_rdc, none_rdc, chosen_rdc;
   BLOCK_SIZE sub_subsize = BLOCK_4X4;
   int splits_below = 0;
   BLOCK_SIZE bs_type = mib[0]->mbmi.sb_type;
@@ -2858,9 +2858,9 @@
   assert(num_4x4_blocks_wide_lookup[bsize] ==
          num_4x4_blocks_high_lookup[bsize]);
 
-  av1_rd_cost_reset(&last_part_rdc);
-  av1_rd_cost_reset(&none_rdc);
-  av1_rd_cost_reset(&chosen_rdc);
+  av1_invalid_rd_stats(&last_part_rdc);
+  av1_invalid_rd_stats(&none_rdc);
+  av1_invalid_rd_stats(&chosen_rdc);
 
   pc_tree->partitioning = partition;
 
@@ -2951,12 +2951,12 @@
                        subsize, &pc_tree->horizontal[0], INT64_MAX);
       if (last_part_rdc.rate != INT_MAX && bsize >= BLOCK_8X8 &&
           mi_row + hbs < cm->mi_rows) {
-        RD_COST tmp_rdc;
+        RD_STATS tmp_rdc;
 #if CONFIG_SUPERTX
         int rt_nocoef = 0;
 #endif
         PICK_MODE_CONTEXT *ctx_h = &pc_tree->horizontal[0];
-        av1_rd_cost_init(&tmp_rdc);
+        av1_init_rd_stats(&tmp_rdc);
         update_state(cpi, td, ctx_h, mi_row, mi_col, subsize, 1);
         encode_superblock(cpi, td, tp, DRY_RUN_NORMAL, mi_row, mi_col, subsize,
                           ctx_h, NULL);
@@ -2969,7 +2969,7 @@
 #endif
                          subsize, &pc_tree->horizontal[1], INT64_MAX);
         if (tmp_rdc.rate == INT_MAX || tmp_rdc.dist == INT64_MAX) {
-          av1_rd_cost_reset(&last_part_rdc);
+          av1_invalid_rd_stats(&last_part_rdc);
 #if CONFIG_SUPERTX
           last_part_rate_nocoef = INT_MAX;
 #endif
@@ -2994,12 +2994,12 @@
                        subsize, &pc_tree->vertical[0], INT64_MAX);
       if (last_part_rdc.rate != INT_MAX && bsize >= BLOCK_8X8 &&
           mi_col + hbs < cm->mi_cols) {
-        RD_COST tmp_rdc;
+        RD_STATS tmp_rdc;
 #if CONFIG_SUPERTX
         int rt_nocoef = 0;
 #endif
         PICK_MODE_CONTEXT *ctx_v = &pc_tree->vertical[0];
-        av1_rd_cost_init(&tmp_rdc);
+        av1_init_rd_stats(&tmp_rdc);
         update_state(cpi, td, ctx_v, mi_row, mi_col, subsize, 1);
         encode_superblock(cpi, td, tp, DRY_RUN_NORMAL, mi_row, mi_col, subsize,
                           ctx_v, NULL);
@@ -3013,7 +3013,7 @@
                          subsize, &pc_tree->vertical[bsize > BLOCK_8X8],
                          INT64_MAX);
         if (tmp_rdc.rate == INT_MAX || tmp_rdc.dist == INT64_MAX) {
-          av1_rd_cost_reset(&last_part_rdc);
+          av1_invalid_rd_stats(&last_part_rdc);
 #if CONFIG_SUPERTX
           last_part_rate_nocoef = INT_MAX;
 #endif
@@ -3049,14 +3049,14 @@
         int x_idx = (i & 1) * hbs;
         int y_idx = (i >> 1) * hbs;
         int jj = i >> 1, ii = i & 0x01;
-        RD_COST tmp_rdc;
+        RD_STATS tmp_rdc;
 #if CONFIG_SUPERTX
         int rt_nocoef;
 #endif
         if ((mi_row + y_idx >= cm->mi_rows) || (mi_col + x_idx >= cm->mi_cols))
           continue;
 
-        av1_rd_cost_init(&tmp_rdc);
+        av1_init_rd_stats(&tmp_rdc);
         rd_use_partition(cpi, td, tile_data,
                          mib + jj * hbs * cm->mi_stride + ii * hbs, tp,
                          mi_row + y_idx, mi_col + x_idx, subsize, &tmp_rdc.rate,
@@ -3066,7 +3066,7 @@
 #endif
                          i != 3, pc_tree->split[i]);
         if (tmp_rdc.rate == INT_MAX || tmp_rdc.dist == INT64_MAX) {
-          av1_rd_cost_reset(&last_part_rdc);
+          av1_invalid_rd_stats(&last_part_rdc);
 #if CONFIG_SUPERTX
           last_part_rate_nocoef = INT_MAX;
 #endif
@@ -3119,7 +3119,7 @@
     for (i = 0; i < 4; i++) {
       int x_idx = (i & 1) * hbs;
       int y_idx = (i >> 1) * hbs;
-      RD_COST tmp_rdc;
+      RD_STATS tmp_rdc;
 #if CONFIG_SUPERTX
       int rt_nocoef = 0;
 #endif
@@ -3151,7 +3151,7 @@
       restore_context(x, &x_ctx, mi_row, mi_col, &buf, bsize);
 #endif
       if (tmp_rdc.rate == INT_MAX || tmp_rdc.dist == INT64_MAX) {
-        av1_rd_cost_reset(&chosen_rdc);
+        av1_invalid_rd_stats(&chosen_rdc);
 #if CONFIG_SUPERTX
         chosen_rate_nocoef = INT_MAX;
 #endif
@@ -3540,7 +3540,7 @@
 #if CONFIG_EXT_PARTITION_TYPES
 static void rd_test_partition3(
     const AV1_COMP *const cpi, ThreadData *td, TileDataEnc *tile_data,
-    TOKENEXTRA **tp, PC_TREE *pc_tree, RD_COST *best_rdc,
+    TOKENEXTRA **tp, PC_TREE *pc_tree, RD_STATS *best_rdc,
     PICK_MODE_CONTEXT ctxs[3], PICK_MODE_CONTEXT *ctx, int mi_row, int mi_col,
     BLOCK_SIZE bsize, PARTITION_TYPE partition,
 #if CONFIG_SUPERTX
@@ -3550,7 +3550,7 @@
     BLOCK_SIZE subsize1, int mi_row2, int mi_col2, BLOCK_SIZE subsize2) {
   MACROBLOCK *const x = &td->mb;
   MACROBLOCKD *const xd = &x->e_mbd;
-  RD_COST this_rdc, sum_rdc;
+  RD_STATS this_rdc, sum_rdc;
 #if CONFIG_SUPERTX
   const AV1_COMMON *const cm = &cpi->common;
   TileInfo *const tile_info = &tile_data->tile_info;
@@ -3670,7 +3670,7 @@
 
         if (!check_intra_sb(cpi, tile_info, mi_row, mi_col, bsize, pc_tree)) {
           TX_TYPE best_tx = DCT_DCT;
-          RD_COST tmp_rdc = { sum_rate_nocoef, 0, 0 };
+          RD_STATS tmp_rdc = { sum_rate_nocoef, 0, 0 };
 
           restore_context(x, x_ctx, mi_row, mi_col, bsize);
 
@@ -3726,7 +3726,7 @@
 static void rd_pick_partition(const AV1_COMP *const cpi, ThreadData *td,
                               TileDataEnc *tile_data, TOKENEXTRA **tp,
                               int mi_row, int mi_col, BLOCK_SIZE bsize,
-                              RD_COST *rd_cost,
+                              RD_STATS *rd_cost,
 #if CONFIG_SUPERTX
                               int *rate_nocoef,
 #endif
@@ -3747,7 +3747,7 @@
   int tmp_partition_cost[PARTITION_TYPES];
 #endif
   BLOCK_SIZE subsize;
-  RD_COST this_rdc, sum_rdc, best_rdc;
+  RD_STATS this_rdc, sum_rdc, best_rdc;
   const int bsize_at_least_8x8 = (bsize >= BLOCK_8X8);
   int do_square_split = bsize_at_least_8x8;
 #if CONFIG_CB4X4
@@ -3844,9 +3844,9 @@
 
   assert(mi_size_wide[bsize] == mi_size_high[bsize]);
 
-  av1_rd_cost_init(&this_rdc);
-  av1_rd_cost_init(&sum_rdc);
-  av1_rd_cost_reset(&best_rdc);
+  av1_init_rd_stats(&this_rdc);
+  av1_init_rd_stats(&sum_rdc);
+  av1_invalid_rd_stats(&best_rdc);
   best_rdc.rdcost = best_rd;
 
   set_offsets(cpi, tile_info, x, mi_row, mi_col, bsize);
@@ -4108,7 +4108,9 @@
 
         if (is_inter_mode(pc_tree->leaf_split[0]->mic.mbmi.mode)) {
           TX_TYPE best_tx = DCT_DCT;
-          RD_COST tmp_rdc = { sum_rate_nocoef, 0, 0 };
+          RD_STATS tmp_rdc;
+          av1_init_rd_stats(&tmp_rdc);
+          tmp_rdc.rate = sum_rate_nocoef;
 
           restore_context(x, &x_ctx, mi_row, mi_col, bsize);
 
@@ -4190,7 +4192,9 @@
 
         if (!check_intra_sb(cpi, tile_info, mi_row, mi_col, bsize, pc_tree)) {
           TX_TYPE best_tx = DCT_DCT;
-          RD_COST tmp_rdc = { sum_rate_nocoef, 0, 0 };
+          RD_STATS tmp_rdc;
+          av1_init_rd_stats(&tmp_rdc);
+          tmp_rdc.rate = sum_rate_nocoef;
 
           restore_context(x, &x_ctx, mi_row, mi_col, bsize);
 
@@ -4339,7 +4343,9 @@
 
       if (!check_intra_sb(cpi, tile_info, mi_row, mi_col, bsize, pc_tree)) {
         TX_TYPE best_tx = DCT_DCT;
-        RD_COST tmp_rdc = { sum_rate_nocoef, 0, 0 };
+        RD_STATS tmp_rdc;
+        av1_init_rd_stats(&tmp_rdc);
+        tmp_rdc.rate = sum_rate_nocoef;
 
         restore_context(x, &x_ctx, mi_row, mi_col, bsize);
 
@@ -4483,7 +4489,9 @@
 
       if (!check_intra_sb(cpi, tile_info, mi_row, mi_col, bsize, pc_tree)) {
         TX_TYPE best_tx = DCT_DCT;
-        RD_COST tmp_rdc = { sum_rate_nocoef, 0, 0 };
+        RD_STATS tmp_rdc;
+        av1_init_rd_stats(&tmp_rdc);
+        tmp_rdc.rate = sum_rate_nocoef;
 
         restore_context(x, &x_ctx, mi_row, mi_col, bsize);
 
@@ -4658,7 +4666,7 @@
     const struct segmentation *const seg = &cm->seg;
     int dummy_rate;
     int64_t dummy_dist;
-    RD_COST dummy_rdc;
+    RD_STATS dummy_rdc;
 #if CONFIG_SUPERTX
     int dummy_rate_nocoef;
 #endif  // CONFIG_SUPERTX
diff --git a/av1/encoder/rd.c b/av1/encoder/rd.c
index 87a7de9..0663ed8 100644
--- a/av1/encoder/rd.c
+++ b/av1/encoder/rd.c
@@ -46,18 +46,6 @@
 // Factor to weigh the rate for switchable interp filters.
 #define SWITCHABLE_INTERP_RATE_FACTOR 1
 
-void av1_rd_cost_reset(RD_COST *rd_cost) {
-  rd_cost->rate = INT_MAX;
-  rd_cost->dist = INT64_MAX;
-  rd_cost->rdcost = INT64_MAX;
-}
-
-void av1_rd_cost_init(RD_COST *rd_cost) {
-  rd_cost->rate = 0;
-  rd_cost->dist = 0;
-  rd_cost->rdcost = 0;
-}
-
 // The baseline rd thresholds for breaking out of the rd loop for
 // certain modes are assumed to be based on 8x8 blocks.
 // This table is used to correct for block size.
diff --git a/av1/encoder/rd.h b/av1/encoder/rd.h
index 6285d47..c0ac1f7 100644
--- a/av1/encoder/rd.h
+++ b/av1/encoder/rd.h
@@ -348,16 +348,83 @@
   int RDDIV;
 } RD_OPT;
 
-typedef struct RD_COST {
-  int rate;
-  int64_t dist;
-  int64_t rdcost;
-} RD_COST;
+static INLINE void av1_init_rd_stats(RD_STATS *rd_stats) {
+#if CONFIG_RD_DEBUG
+  int plane;
+#endif
+  rd_stats->rate = 0;
+  rd_stats->dist = 0;
+  rd_stats->rdcost = 0;
+  rd_stats->sse = 0;
+  rd_stats->skip = 1;
+#if CONFIG_RD_DEBUG
+  for (plane = 0; plane < MAX_MB_PLANE; ++plane) {
+    rd_stats->txb_coeff_cost[plane] = 0;
+#if CONFIG_VAR_TX
+    {
+      int r, c;
+      for (r = 0; r < TXB_COEFF_COST_MAP_SIZE; ++r)
+        for (c = 0; c < TXB_COEFF_COST_MAP_SIZE; ++c)
+          rd_stats->txb_coeff_cost_map[plane][r][c] = 0;
+    }
+#endif
+  }
+#endif
+}
 
-// Reset the rate distortion cost values to maximum (invalid) value.
-void av1_rd_cost_reset(RD_COST *rd_cost);
-// Initialize the rate distortion cost values to zero.
-void av1_rd_cost_init(RD_COST *rd_cost);
+static INLINE void av1_invalid_rd_stats(RD_STATS *rd_stats) {
+#if CONFIG_RD_DEBUG
+  int plane;
+#endif
+  rd_stats->rate = INT_MAX;
+  rd_stats->dist = INT64_MAX;
+  rd_stats->rdcost = INT64_MAX;
+  rd_stats->sse = INT64_MAX;
+  rd_stats->skip = 0;
+#if CONFIG_RD_DEBUG
+  for (plane = 0; plane < MAX_MB_PLANE; ++plane) {
+    rd_stats->txb_coeff_cost[plane] = INT_MAX;
+#if CONFIG_VAR_TX
+    {
+      int r, c;
+      for (r = 0; r < TXB_COEFF_COST_MAP_SIZE; ++r)
+        for (c = 0; c < TXB_COEFF_COST_MAP_SIZE; ++c)
+          rd_stats->txb_coeff_cost_map[plane][r][c] = INT_MAX;
+    }
+#endif
+  }
+#endif
+}
+
+static INLINE void av1_merge_rd_stats(RD_STATS *rd_stats_dst,
+                                      const RD_STATS *rd_stats_src) {
+#if CONFIG_RD_DEBUG
+  int plane;
+#endif
+  rd_stats_dst->rate += rd_stats_src->rate;
+  rd_stats_dst->dist += rd_stats_src->dist;
+  rd_stats_dst->sse += rd_stats_src->sse;
+  rd_stats_dst->skip &= rd_stats_src->skip;
+#if CONFIG_RD_DEBUG
+  for (plane = 0; plane < MAX_MB_PLANE; ++plane) {
+    rd_stats_dst->txb_coeff_cost[plane] += rd_stats_src->txb_coeff_cost[plane];
+#if CONFIG_VAR_TX
+    {
+      // TODO(angiebird): optimize this part
+      int r, c;
+      int ref_txb_coeff_cost = 0;
+      for (r = 0; r < TXB_COEFF_COST_MAP_SIZE; ++r)
+        for (c = 0; c < TXB_COEFF_COST_MAP_SIZE; ++c) {
+          rd_stats_dst->txb_coeff_cost_map[plane][r][c] +=
+              rd_stats_src->txb_coeff_cost_map[plane][r][c];
+          ref_txb_coeff_cost += rd_stats_dst->txb_coeff_cost_map[plane][r][c];
+        }
+      assert(ref_txb_coeff_cost == rd_stats_dst->txb_coeff_cost[plane]);
+    }
+#endif
+  }
+#endif
+}
 
 struct TileInfo;
 struct TileDataEnc;
diff --git a/av1/encoder/rdopt.c b/av1/encoder/rdopt.c
index 6a19c6e..c6b049a 100644
--- a/av1/encoder/rdopt.c
+++ b/av1/encoder/rdopt.c
@@ -9068,7 +9068,7 @@
 // This is a dummy function that forces intrabc on for testing purposes
 // TODO(aconverse@google.com): Implement a real intrabc search
 static int64_t rd_pick_intrabc_mode_sb(const AV1_COMP *cpi, MACROBLOCK *x,
-                                       RD_COST *rd_cost, BLOCK_SIZE bsize,
+                                       RD_STATS *rd_cost, BLOCK_SIZE bsize,
                                        int64_t best_rd) {
   MACROBLOCKD *const xd = &x->e_mbd;
   (void)best_rd;
@@ -9105,7 +9105,7 @@
 #endif  // CONFIG_INTRABC
 
 void av1_rd_pick_intra_mode_sb(const AV1_COMP *cpi, MACROBLOCK *x,
-                               RD_COST *rd_cost, BLOCK_SIZE bsize,
+                               RD_STATS *rd_cost, BLOCK_SIZE bsize,
                                PICK_MODE_CONTEXT *ctx, int64_t best_rd) {
   const AV1_COMMON *const cm = &cpi->common;
   MACROBLOCKD *const xd = &x->e_mbd;
@@ -9310,7 +9310,7 @@
 #if CONFIG_SUPERTX
     int *returnrate_nocoef,
 #endif  // CONFIG_SUPERTX
-    int64_t *best_pred_rd, MB_MODE_INFO *best_mbmode, RD_COST *rd_cost) {
+    int64_t *best_pred_rd, MB_MODE_INFO *best_mbmode, RD_STATS *rd_cost) {
   const AV1_COMMON *const cm = &cpi->common;
   MACROBLOCKD *const xd = &x->e_mbd;
   MB_MODE_INFO *const mbmi = &xd->mi[0]->mbmi;
@@ -9473,7 +9473,7 @@
 
 void av1_rd_pick_inter_mode_sb(const AV1_COMP *cpi, TileDataEnc *tile_data,
                                MACROBLOCK *x, int mi_row, int mi_col,
-                               RD_COST *rd_cost,
+                               RD_STATS *rd_cost,
 #if CONFIG_SUPERTX
                                int *returnrate_nocoef,
 #endif  // CONFIG_SUPERTX
@@ -11358,7 +11358,7 @@
 void av1_rd_pick_inter_mode_sb_seg_skip(const AV1_COMP *cpi,
                                         TileDataEnc *tile_data, MACROBLOCK *x,
                                         int mi_row, int mi_col,
-                                        RD_COST *rd_cost, BLOCK_SIZE bsize,
+                                        RD_STATS *rd_cost, BLOCK_SIZE bsize,
                                         PICK_MODE_CONTEXT *ctx,
                                         int64_t best_rd_so_far) {
   const AV1_COMMON *const cm = &cpi->common;
@@ -11498,7 +11498,7 @@
 void av1_rd_pick_inter_mode_sub8x8(const struct AV1_COMP *cpi,
                                    TileDataEnc *tile_data, struct macroblock *x,
                                    int mi_row, int mi_col,
-                                   struct RD_COST *rd_cost,
+                                   struct RD_STATS *rd_cost,
 #if CONFIG_SUPERTX
                                    int *returnrate_nocoef,
 #endif  // CONFIG_SUPERTX
diff --git a/av1/encoder/rdopt.h b/av1/encoder/rdopt.h
index 41f53a5..a7053b2 100644
--- a/av1/encoder/rdopt.h
+++ b/av1/encoder/rdopt.h
@@ -24,7 +24,7 @@
 struct TileInfo;
 struct AV1_COMP;
 struct macroblock;
-struct RD_COST;
+struct RD_STATS;
 
 #if CONFIG_RD_DEBUG
 static INLINE void av1_update_txb_coeff_cost(RD_STATS *rd_stats, int plane,
@@ -52,82 +52,6 @@
 }
 #endif
 
-static INLINE void av1_init_rd_stats(RD_STATS *rd_stats) {
-#if CONFIG_RD_DEBUG
-  int plane;
-#endif
-  rd_stats->rate = 0;
-  rd_stats->dist = 0;
-  rd_stats->sse = 0;
-  rd_stats->skip = 1;
-#if CONFIG_RD_DEBUG
-  for (plane = 0; plane < MAX_MB_PLANE; ++plane) {
-    rd_stats->txb_coeff_cost[plane] = 0;
-#if CONFIG_VAR_TX
-    {
-      int r, c;
-      for (r = 0; r < TXB_COEFF_COST_MAP_SIZE; ++r)
-        for (c = 0; c < TXB_COEFF_COST_MAP_SIZE; ++c)
-          rd_stats->txb_coeff_cost_map[plane][r][c] = 0;
-    }
-#endif
-  }
-#endif
-}
-
-static INLINE void av1_invalid_rd_stats(RD_STATS *rd_stats) {
-#if CONFIG_RD_DEBUG
-  int plane;
-#endif
-  rd_stats->rate = INT_MAX;
-  rd_stats->dist = INT64_MAX;
-  rd_stats->sse = INT64_MAX;
-  rd_stats->skip = 0;
-#if CONFIG_RD_DEBUG
-  for (plane = 0; plane < MAX_MB_PLANE; ++plane) {
-    rd_stats->txb_coeff_cost[plane] = INT_MAX;
-#if CONFIG_VAR_TX
-    {
-      int r, c;
-      for (r = 0; r < TXB_COEFF_COST_MAP_SIZE; ++r)
-        for (c = 0; c < TXB_COEFF_COST_MAP_SIZE; ++c)
-          rd_stats->txb_coeff_cost_map[plane][r][c] = INT_MAX;
-    }
-#endif
-  }
-#endif
-}
-
-static INLINE void av1_merge_rd_stats(RD_STATS *rd_stats_dst,
-                                      const RD_STATS *rd_stats_src) {
-#if CONFIG_RD_DEBUG
-  int plane;
-#endif
-  rd_stats_dst->rate += rd_stats_src->rate;
-  rd_stats_dst->dist += rd_stats_src->dist;
-  rd_stats_dst->sse += rd_stats_src->sse;
-  rd_stats_dst->skip &= rd_stats_src->skip;
-#if CONFIG_RD_DEBUG
-  for (plane = 0; plane < MAX_MB_PLANE; ++plane) {
-    rd_stats_dst->txb_coeff_cost[plane] += rd_stats_src->txb_coeff_cost[plane];
-#if CONFIG_VAR_TX
-    {
-      // TODO(angiebird): optimize this part
-      int r, c;
-      int ref_txb_coeff_cost = 0;
-      for (r = 0; r < TXB_COEFF_COST_MAP_SIZE; ++r)
-        for (c = 0; c < TXB_COEFF_COST_MAP_SIZE; ++c) {
-          rd_stats_dst->txb_coeff_cost_map[plane][r][c] +=
-              rd_stats_src->txb_coeff_cost_map[plane][r][c];
-          ref_txb_coeff_cost += rd_stats_dst->txb_coeff_cost_map[plane][r][c];
-        }
-      assert(ref_txb_coeff_cost == rd_stats_dst->txb_coeff_cost[plane]);
-    }
-#endif
-  }
-#endif
-}
-
 typedef enum OUTPUT_STATUS {
   OUTPUT_HAS_PREDICTED_PIXELS,
   OUTPUT_HAS_DECODED_PIXELS
@@ -145,7 +69,7 @@
                     int use_fast_coef_costing);
 #endif
 void av1_rd_pick_intra_mode_sb(const struct AV1_COMP *cpi, struct macroblock *x,
-                               struct RD_COST *rd_cost, BLOCK_SIZE bsize,
+                               struct RD_STATS *rd_cost, BLOCK_SIZE bsize,
                                PICK_MODE_CONTEXT *ctx, int64_t best_rd);
 
 unsigned int av1_get_sby_perpixel_variance(const AV1_COMP *cpi,
@@ -160,7 +84,7 @@
 void av1_rd_pick_inter_mode_sb(const struct AV1_COMP *cpi,
                                struct TileDataEnc *tile_data,
                                struct macroblock *x, int mi_row, int mi_col,
-                               struct RD_COST *rd_cost,
+                               struct RD_STATS *rd_cost,
 #if CONFIG_SUPERTX
                                int *returnrate_nocoef,
 #endif  // CONFIG_SUPERTX
@@ -169,7 +93,7 @@
 
 void av1_rd_pick_inter_mode_sb_seg_skip(
     const struct AV1_COMP *cpi, struct TileDataEnc *tile_data,
-    struct macroblock *x, int mi_row, int mi_col, struct RD_COST *rd_cost,
+    struct macroblock *x, int mi_row, int mi_col, struct RD_STATS *rd_cost,
     BLOCK_SIZE bsize, PICK_MODE_CONTEXT *ctx, int64_t best_rd_so_far);
 
 int av1_internal_image_edge(const struct AV1_COMP *cpi);
@@ -180,7 +104,7 @@
 void av1_rd_pick_inter_mode_sub8x8(const struct AV1_COMP *cpi,
                                    struct TileDataEnc *tile_data,
                                    struct macroblock *x, int mi_row, int mi_col,
-                                   struct RD_COST *rd_cost,
+                                   struct RD_STATS *rd_cost,
 #if CONFIG_SUPERTX
                                    int *returnrate_nocoef,
 #endif  // CONFIG_SUPERTX