store the hash for blocks that are predictively skipped

Change-Id: I334281aee38be03a383ae6899970b4200ec43c01
diff --git a/av1/encoder/rdopt.c b/av1/encoder/rdopt.c
index 58df21a..63188c0 100644
--- a/av1/encoder/rdopt.c
+++ b/av1/encoder/rdopt.c
@@ -4439,7 +4439,18 @@
 
 static void save_tx_rd_info(int n4, uint32_t hash, const MACROBLOCK *const x,
                             const RD_STATS *const rd_stats,
-                            TX_RD_INFO *const tx_rd_info) {
+                            TX_RD_RECORD *tx_rd_record) {
+  int index;
+  if (tx_rd_record->num < RD_RECORD_BUFFER_LEN) {
+    index =
+        (tx_rd_record->index_start + tx_rd_record->num) % RD_RECORD_BUFFER_LEN;
+    ++tx_rd_record->num;
+  } else {
+    index = tx_rd_record->index_start;
+    tx_rd_record->index_start =
+        (tx_rd_record->index_start + 1) % RD_RECORD_BUFFER_LEN;
+  }
+  TX_RD_INFO *const tx_rd_info = &tx_rd_record->tx_rd_info[index];
   const MACROBLOCKD *const xd = &x->e_mbd;
   const MB_MODE_INFO *const mbmi = &xd->mi[0]->mbmi;
   tx_rd_info->hash_value = hash;
@@ -4796,6 +4807,8 @@
   if (is_inter && cpi->sf.tx_type_search.use_skip_flag_prediction &&
       predict_skip_flag(x, bsize)) {
     set_skip_flag(cpi, x, rd_stats, bsize);
+    // Save the RD search results into tx_rd_record.
+    if (within_border) save_tx_rd_info(n4, hash, x, rd_stats, tx_rd_record);
     return;
   }
 
@@ -4890,19 +4903,7 @@
   memcpy(x->blk_skip[0], best_blk_skip, sizeof(best_blk_skip[0]) * n4);
 
   // Save the RD search results into tx_rd_record.
-  if (within_border) {
-    int index;
-    if (tx_rd_record->num < RD_RECORD_BUFFER_LEN) {
-      index = (tx_rd_record->index_start + tx_rd_record->num) %
-              RD_RECORD_BUFFER_LEN;
-      ++tx_rd_record->num;
-    } else {
-      index = tx_rd_record->index_start;
-      tx_rd_record->index_start =
-          (tx_rd_record->index_start + 1) % RD_RECORD_BUFFER_LEN;
-    }
-    save_tx_rd_info(n4, hash, x, rd_stats, &tx_rd_record->tx_rd_info[index]);
-  }
+  if (within_border) save_tx_rd_info(n4, hash, x, rd_stats, tx_rd_record);
 }
 
 static void tx_block_rd(const AV1_COMP *cpi, MACROBLOCK *x, int blk_row,