Prepare to remove subpel_bits field.

Downstream clients of the Q Mode API always set subpel_bits to 0
and use whole-pixel MV's, so this field is no longer necessary
(and wastes a lot of memory, since it's stored with every MV).

In advance of removing the field:
- Ignore subpel_bits, and assume MV's are in whole pixels
- Round to whole pixels in ducky_encode.cc

Bug: b/241589513
Change-Id: I8dd1cdc6fe1a9148183bcf4559063b0043d93aaa
diff --git a/av1/qmode_rc/ducky_encode.cc b/av1/qmode_rc/ducky_encode.cc
index 6d50fca..a48d9dd 100644
--- a/av1/qmode_rc/ducky_encode.cc
+++ b/av1/qmode_rc/ducky_encode.cc
@@ -528,10 +528,10 @@
           if (tpl_stats_ptr->ref_frame_index[i] >= 0) {
             block_stats.ref_frame_index[i] =
                 ref_frame_index_mapping[tpl_stats_ptr->ref_frame_index[i] + 1];
-            block_stats.mv[i] = {
-              tpl_stats_ptr->mv[tpl_stats_ptr->ref_frame_index[i]].as_mv.row,
-              tpl_stats_ptr->mv[tpl_stats_ptr->ref_frame_index[i]].as_mv.col, 3
-            };
+            const auto &mv =
+                tpl_stats_ptr->mv[tpl_stats_ptr->ref_frame_index[i]].as_mv;
+            block_stats.mv[i] = { GET_MV_RAWPEL(mv.row), GET_MV_RAWPEL(mv.col),
+                                  0 };
           }
         }
         tpl_frame_stats.block_stats_list.push_back(block_stats);
diff --git a/av1/qmode_rc/ratectrl_qmode.cc b/av1/qmode_rc/ratectrl_qmode.cc
index 4bfe07e..2c710bf 100644
--- a/av1/qmode_rc/ratectrl_qmode.cc
+++ b/av1/qmode_rc/ratectrl_qmode.cc
@@ -1170,17 +1170,6 @@
   return std::max(sum, 1.0);
 }
 
-// This is a generalization of GET_MV_RAWPEL that allows for an arbitrary
-// number of fractional bits.
-// TODO(angiebird): Add unit test to this function
-int GetFullpelValue(int subpel_value, int subpel_bits) {
-  const int subpel_scale = (1 << subpel_bits);
-  const int sign = subpel_value >= 0 ? 1 : -1;
-  int fullpel_value = (abs(subpel_value) + subpel_scale / 2) >> subpel_bits;
-  fullpel_value *= sign;
-  return fullpel_value;
-}
-
 double GetPropagationFraction(const TplUnitDepStats &unit_dep_stats) {
   assert(unit_dep_stats.intra_cost >= unit_dep_stats.inter_cost);
   return (unit_dep_stats.intra_cost - unit_dep_stats.inter_cost) /
@@ -1228,14 +1217,12 @@
             tpl_gop_dep_stats->frame_dep_stats_list[ref_coding_idx_list[i]];
         assert(!ref_frame_dep_stats.alt_unit_stats.empty());
         const auto &mv = base_mv[i];
-        const int mv_row = GetFullpelValue(mv.row, mv.subpel_bits);
-        const int mv_col = GetFullpelValue(mv.col, mv.subpel_bits);
-        const int ref_pixel_r = unit_row * unit_size + mv_row;
-        const int ref_pixel_c = unit_col * unit_size + mv_col;
+        const int ref_pixel_r = unit_row * unit_size + mv.row;
+        const int ref_pixel_c = unit_col * unit_size + mv.col;
         const int ref_unit_row_low =
-            (unit_row * unit_size + mv_row) / unit_size;
+            (unit_row * unit_size + mv.row) / unit_size;
         const int ref_unit_col_low =
-            (unit_col * unit_size + mv_col) / unit_size;
+            (unit_col * unit_size + mv.col) / unit_size;
 
         for (int j = 0; j < 2; ++j) {
           for (int k = 0; k < 2; ++k) {
@@ -1303,14 +1290,12 @@
             tpl_gop_dep_stats->frame_dep_stats_list[ref_coding_idx_list[i]];
         assert(!ref_frame_dep_stats.unit_stats.empty());
         const auto &mv = unit_dep_stats.mv[i];
-        const int mv_row = GetFullpelValue(mv.row, mv.subpel_bits);
-        const int mv_col = GetFullpelValue(mv.col, mv.subpel_bits);
-        const int ref_pixel_r = unit_row * unit_size + mv_row;
-        const int ref_pixel_c = unit_col * unit_size + mv_col;
+        const int ref_pixel_r = unit_row * unit_size + mv.row;
+        const int ref_pixel_c = unit_col * unit_size + mv.col;
         const int ref_unit_row_low =
-            (unit_row * unit_size + mv_row) / unit_size;
+            (unit_row * unit_size + mv.row) / unit_size;
         const int ref_unit_col_low =
-            (unit_col * unit_size + mv_col) / unit_size;
+            (unit_col * unit_size + mv.col) / unit_size;
 
         for (int j = 0; j < 2; ++j) {
           for (int k = 0; k < 2; ++k) {