Consolidate the frame buffer border

Use the same border for lookahead buffers and frame buffers to make
the implementation easy and clear. More CLs will follow.

Change-Id: I4440b3ab95f021bd2117b8bfde4e2d82cf9a2e1d
diff --git a/aom_scale/yv12config.h b/aom_scale/yv12config.h
index 4dcf3bc..cb095b9 100644
--- a/aom_scale/yv12config.h
+++ b/aom_scale/yv12config.h
@@ -27,7 +27,6 @@
 #define AOM_INTERP_EXTEND 4
 #define AOM_BORDER_IN_PIXELS 288
 #define AOM_ENC_NO_SCALE_BORDER 160
-#define AOM_ENC_LOOKAHEAD_BORDER 64
 #define AOM_DEC_BORDER_IN_PIXELS 64
 
 typedef struct yv12_buffer_config {
diff --git a/av1/av1_cx_iface.c b/av1/av1_cx_iface.c
index e321629..ae4c4f4 100644
--- a/av1/av1_cx_iface.c
+++ b/av1/av1_cx_iface.c
@@ -2073,7 +2073,6 @@
         cpi->lookahead = av1_lookahead_init(
             cpi->oxcf.width, cpi->oxcf.height, subsampling_x, subsampling_y,
             use_highbitdepth, lag_in_frames, cpi->oxcf.border_in_pixels,
-            (cpi->oxcf.resize_mode || cpi->oxcf.superres_mode),
             ctx->num_lap_buffers);
       }
       if (!cpi->lookahead)
diff --git a/av1/encoder/lookahead.c b/av1/encoder/lookahead.c
index ec5b858..b0b5c1f 100644
--- a/av1/encoder/lookahead.c
+++ b/av1/encoder/lookahead.c
@@ -45,7 +45,7 @@
 struct lookahead_ctx *av1_lookahead_init(
     unsigned int width, unsigned int height, unsigned int subsampling_x,
     unsigned int subsampling_y, int use_highbitdepth, unsigned int depth,
-    const int border_in_pixels, int is_scale, int num_lap_buffers) {
+    const int border_in_pixels, int num_lap_buffers) {
   struct lookahead_ctx *ctx = NULL;
   int lag_in_frames = clamp(depth, 1, MAX_LAG_BUFFERS);
 
@@ -76,20 +76,14 @@
     }
     ctx->buf = calloc(depth, sizeof(*ctx->buf));
     if (!ctx->buf) goto fail;
-    for (i = 0; i < depth; i++)
-      if (is_scale) {
-        if (aom_alloc_frame_buffer(
-                &ctx->buf[i].img, width, height, subsampling_x, subsampling_y,
-                use_highbitdepth, border_in_pixels, legacy_byte_alignment))
-          goto fail;
-      } else {
-        aom_free_frame_buffer(&ctx->buf[i].img);
-        if (aom_realloc_lookahead_buffer(
-                &ctx->buf[i].img, width, height, subsampling_x, subsampling_y,
-                use_highbitdepth, AOM_ENC_LOOKAHEAD_BORDER,
-                legacy_byte_alignment, NULL, NULL, NULL))
-          goto fail;
-      }
+    for (i = 0; i < depth; i++) {
+      aom_free_frame_buffer(&ctx->buf[i].img);
+      if (aom_realloc_lookahead_buffer(&ctx->buf[i].img, width, height,
+                                       subsampling_x, subsampling_y,
+                                       use_highbitdepth, border_in_pixels,
+                                       legacy_byte_alignment, NULL, NULL, NULL))
+        goto fail;
+    }
   }
   return ctx;
 fail:
diff --git a/av1/encoder/lookahead.h b/av1/encoder/lookahead.h
index adae391..64e5810 100644
--- a/av1/encoder/lookahead.h
+++ b/av1/encoder/lookahead.h
@@ -58,7 +58,7 @@
 struct lookahead_ctx *av1_lookahead_init(
     unsigned int width, unsigned int height, unsigned int subsampling_x,
     unsigned int subsampling_y, int use_highbitdepth, unsigned int depth,
-    const int border_in_pixels, int is_scale, int num_lap_buffers);
+    const int border_in_pixels, int num_lap_buffers);
 
 /**\brief Destroys the lookahead stage
  */