av1_encode: enable do_border_pad

- Enabled the 'do_border_pad' as the crashes in SSE2 code and
  in Arm builds have been fixed in
  https://aomedia-review.googlesource.com/c/aom/+/214541.

- Simplified the calculation in get_visible_dimensions() by
  using ROUND_POWER_OF_TWO instead of
  ROUND_POWER_OF_TWO_SIGNED.

Bug: 527078408, 527242002

STATS_CHANGED

Change-Id: Icdbf2e16dabfcbf3d14fe690efde49b489da26b1
diff --git a/av1/encoder/encoder.c b/av1/encoder/encoder.c
index ebf7ed7..3842190 100644
--- a/av1/encoder/encoder.c
+++ b/av1/encoder/encoder.c
@@ -4558,9 +4558,7 @@
       cpi->oxcf.algo_cfg.enable_tpl_model && cpi->oxcf.q_cfg.aq_mode == NO_AQ &&
       !cpi->common.seg.enabled && !cpi->roi.enabled && !cpi->oxcf.sb_qp_sweep &&
       !cpi->use_ducky_encode && cpi->oxcf.algo_cfg.sharpness != 3) {
-    // TODO(issue 527242002, issue 527078408): set do_border_pad to true after
-    // fixing crashes in x86 and Arm builds.
-    cpi->do_border_pad = false;
+    cpi->do_border_pad = true;
   } else {
     cpi->do_border_pad = false;
   }
diff --git a/av1/encoder/rdopt_utils.h b/av1/encoder/rdopt_utils.h
index 1c50cb4..89d9c93 100644
--- a/av1/encoder/rdopt_utils.h
+++ b/av1/encoder/rdopt_utils.h
@@ -379,7 +379,7 @@
   } else {
     const int block_height = block_size_high[plane_bsize];
     const int block_rows =
-        ROUND_POWER_OF_TWO_SIGNED(x->pix_to_bottom_edge, pd->subsampling_y) +
+        -ROUND_POWER_OF_TWO(-x->pix_to_bottom_edge, pd->subsampling_y) +
         block_height;
     valid_rows = clamp(block_rows - (blk_row << MI_SIZE_LOG2), 0, rows);
   }
@@ -389,7 +389,7 @@
   } else {
     const int block_width = block_size_wide[plane_bsize];
     const int block_cols =
-        ROUND_POWER_OF_TWO_SIGNED(x->pix_to_right_edge, pd->subsampling_x) +
+        -ROUND_POWER_OF_TWO(-x->pix_to_right_edge, pd->subsampling_x) +
         block_width;
     valid_cols = clamp(block_cols - (blk_col << MI_SIZE_LOG2), 0, cols);
   }