diff --git a/vp9/encoder/vp9_firstpass.c b/vp9/encoder/vp9_firstpass.c
index 726b804add083225da1c278fef80525016fddd39..e250c20f834003b5b50330443f1ba341d24b26d8 100644
--- a/vp9/encoder/vp9_firstpass.c
+++ b/vp9/encoder/vp9_firstpass.c
@@ -532,6 +532,9 @@ void vp9_first_pass(VP9_COMP *cpi) {
     // Disable golden frame for svc first pass for now.
     gld_yv12 = NULL;
     set_ref_ptrs(cm, xd, ref_frame, NONE);
+
+    cpi->Source = vp9_scale_if_required(cm, cpi->un_scaled_source,
+                                        &cpi->scaled_source);
   }
 
   vp9_setup_src_planes(x, cpi->Source, 0, 0);
@@ -848,6 +851,8 @@ void vp9_first_pass(VP9_COMP *cpi) {
     ++twopass->sr_update_lag;
   }
 
+  vp9_extend_frame_borders(new_yv12);
+
   if (cpi->use_svc && cpi->svc.number_temporal_layers == 1) {
     vp9_update_reference_frames(cpi);
   } else {
@@ -855,8 +860,6 @@ void vp9_first_pass(VP9_COMP *cpi) {
     swap_yv12(lst_yv12, new_yv12);
   }
 
-  vp9_extend_frame_borders(lst_yv12);
-
   // Special case for the first frame. Copy into the GF buffer as a second
   // reference.
   if (cm->current_video_frame == 0 && gld_yv12 != NULL) {
diff --git a/vp9/encoder/vp9_onyx_if.c b/vp9/encoder/vp9_onyx_if.c
index 78372b803879827ad58ede3ac0a94d689b2947fc..0aba911b89155c68f394c9a667b6db4be7628893 100644
--- a/vp9/encoder/vp9_onyx_if.c
+++ b/vp9/encoder/vp9_onyx_if.c
@@ -2209,8 +2209,9 @@ static void set_ext_overrides(VP9_COMP *cpi) {
   }
 }
 
-static YV12_BUFFER_CONFIG *scale_if_required(VP9_COMMON *cm,
-  YV12_BUFFER_CONFIG *unscaled, YV12_BUFFER_CONFIG *scaled) {
+YV12_BUFFER_CONFIG *vp9_scale_if_required(VP9_COMMON *cm,
+                                          YV12_BUFFER_CONFIG *unscaled,
+                                          YV12_BUFFER_CONFIG *scaled) {
   if (cm->mi_cols * MI_SIZE != unscaled->y_width ||
       cm->mi_rows * MI_SIZE != unscaled->y_height) {
     scale_and_extend_frame_nonnormative(unscaled, scaled);
@@ -2235,12 +2236,12 @@ static void encode_frame_to_data_rate(VP9_COMP *cpi,
   struct segmentation *const seg = &cm->seg;
   set_ext_overrides(cpi);
 
-  cpi->Source = scale_if_required(cm, cpi->un_scaled_source,
-                                  &cpi->scaled_source);
+  cpi->Source = vp9_scale_if_required(cm, cpi->un_scaled_source,
+                                      &cpi->scaled_source);
 
   if (cpi->unscaled_last_source != NULL)
-    cpi->Last_Source = scale_if_required(cm, cpi->unscaled_last_source,
-                                         &cpi->scaled_last_source);
+    cpi->Last_Source = vp9_scale_if_required(cm, cpi->unscaled_last_source,
+                                             &cpi->scaled_last_source);
 
   vp9_scale_references(cpi);
 
diff --git a/vp9/encoder/vp9_onyx_int.h b/vp9/encoder/vp9_onyx_int.h
index 5f59f1dbbe82f533a65819a8c9d90385db13c163..7cad0cc0415bcab3e1e2848f530ef5f9806d58c4 100644
--- a/vp9/encoder/vp9_onyx_int.h
+++ b/vp9/encoder/vp9_onyx_int.h
@@ -618,6 +618,10 @@ void vp9_update_reference_frames(VP9_COMP *cpi);
 
 int64_t vp9_rescale(int64_t val, int64_t num, int denom);
 
+YV12_BUFFER_CONFIG *vp9_scale_if_required(VP9_COMMON *cm,
+                                          YV12_BUFFER_CONFIG *unscaled,
+                                          YV12_BUFFER_CONFIG *scaled);
+
 static INLINE void set_ref_ptrs(VP9_COMMON *cm, MACROBLOCKD *xd,
                                 MV_REFERENCE_FRAME ref0,
                                 MV_REFERENCE_FRAME ref1) {