unit_height does not need to be in the inner loop

Change-Id: Ib03758eb5ab32ee7d0f87d216bc5fad591578597
diff --git a/av1/common/blockd.c b/av1/common/blockd.c
index 7a37f6f..7bada8b 100644
--- a/av1/common/blockd.c
+++ b/av1/common/blockd.c
@@ -156,9 +156,9 @@
   // Keep track of the row and column of the blocks we use so that we know
   // if we are in the unrestricted motion border.
   for (r = 0; r < max_blocks_high; r += mu_blocks_high) {
+    const int unit_height = AOMMIN(mu_blocks_high + r, max_blocks_high);
     // Skip visiting the sub blocks that are wholly within the UMV.
     for (c = 0; c < max_blocks_wide; c += mu_blocks_wide) {
-      const int unit_height = AOMMIN(mu_blocks_high + r, max_blocks_high);
       const int unit_width = AOMMIN(mu_blocks_wide + c, max_blocks_wide);
       for (blk_row = r; blk_row < unit_height; blk_row += txh_unit) {
         for (blk_col = c; blk_col < unit_width; blk_col += txw_unit) {
diff --git a/av1/decoder/decodeframe.c b/av1/decoder/decodeframe.c
index dce0eaa..66759eb 100644
--- a/av1/decoder/decodeframe.c
+++ b/av1/decoder/decodeframe.c
@@ -2003,8 +2003,8 @@
       mu_blocks_high = AOMMIN(max_blocks_high, mu_blocks_high);
 
       for (row = 0; row < max_blocks_high; row += mu_blocks_high) {
+        const int unit_height = AOMMIN(mu_blocks_high + row, max_blocks_high);
         for (col = 0; col < max_blocks_wide; col += mu_blocks_wide) {
-          const int unit_height = AOMMIN(mu_blocks_high + row, max_blocks_high);
           const int unit_width = AOMMIN(mu_blocks_wide + col, max_blocks_wide);
 
           for (blk_row = row; blk_row < unit_height; blk_row += stepr)
diff --git a/av1/encoder/bitstream.c b/av1/encoder/bitstream.c
index 69d16d1..856e367 100644
--- a/av1/encoder/bitstream.c
+++ b/av1/encoder/bitstream.c
@@ -2628,9 +2628,9 @@
         const int bkw = tx_size_wide_unit[max_tx_size];
         const int bkh = tx_size_high_unit[max_tx_size];
         for (row = 0; row < num_4x4_h; row += mu_blocks_high) {
+          const int unit_height = AOMMIN(mu_blocks_high + row, num_4x4_h);
           for (col = 0; col < num_4x4_w; col += mu_blocks_wide) {
             int blk_row, blk_col;
-            const int unit_height = AOMMIN(mu_blocks_high + row, num_4x4_h);
             const int unit_width = AOMMIN(mu_blocks_wide + col, num_4x4_w);
             for (blk_row = row; blk_row < unit_height; blk_row += bkh) {
               for (blk_col = col; blk_col < unit_width; blk_col += bkw) {