Fix a bug in ext-inter

Fix a case where handle_inter_mode could return without restoring
the original values of xd->plane[i].dst.buf. This fixes an
assertion failure in aom_blend_a64_mask, as well as very slightly
improving the rd costing accuracy.

Change-Id: I7f720bcf676c6aa9858c1a4c8f6571a76a9b0772
diff --git a/av1/encoder/rdopt.c b/av1/encoder/rdopt.c
index 964532f..a7234ba 100644
--- a/av1/encoder/rdopt.c
+++ b/av1/encoder/rdopt.c
@@ -7008,6 +7008,9 @@
   else
 #endif  // CONFIG_AOM_HIGHBITDEPTH
     tmp_buf = tmp_buf_;
+  // Make sure that we didn't leave the plane destination buffers set
+  // to tmp_buf at the end of the last iteration
+  assert(xd->plane[0].dst.buf != tmp_buf);
 
   if (is_comp_pred) {
     if (frame_mv[refs[0]].as_int == INVALID_MV ||
@@ -7505,8 +7508,10 @@
       }
     }
     if (ref_best_rd < INT64_MAX &&
-        AOMMIN(best_rd_wedge, best_rd_nowedge) / 3 > ref_best_rd)
+        AOMMIN(best_rd_wedge, best_rd_nowedge) / 3 > ref_best_rd) {
+      restore_dst_buf(xd, orig_dst, orig_dst_stride);
       return INT64_MAX;
+    }
 
     pred_exists = 0;
 
@@ -7575,6 +7580,7 @@
     best_interintra_rd = rd;
 
     if (ref_best_rd < INT64_MAX && best_interintra_rd > 2 * ref_best_rd) {
+      // Don't need to call restore_dst_buf here
       return INT64_MAX;
     }
     if (is_interintra_wedge_used(bsize)) {