Optimize Wiener filter selection

* Change the behaviour of search_wiener at borders to match
  the behaviour of the Wiener filter itself
* Reorder the calculation in compute_stats, saving ~5% of
  encode time at low bitrates (tested on bus_cif.y4m at 200kbps)

Change-Id: I5f649d77fd66584451aaf37697ce9c9af69524e4
diff --git a/av1/common/restoration.c b/av1/common/restoration.c
index f8884c8..e718807 100644
--- a/av1/common/restoration.c
+++ b/av1/common/restoration.c
@@ -105,7 +105,7 @@
                           &rst->nhtiles, &rst->nvtiles);
 }
 
-static void extend_frame(uint8_t *data, int width, int height, int stride) {
+void extend_frame(uint8_t *data, int width, int height, int stride) {
   uint8_t *data_p;
   int i;
   for (i = 0; i < height; ++i) {
@@ -842,8 +842,7 @@
 }
 
 #if CONFIG_AOM_HIGHBITDEPTH
-static void extend_frame_highbd(uint16_t *data, int width, int height,
-                                int stride) {
+void extend_frame_highbd(uint16_t *data, int width, int height, int stride) {
   uint16_t *data_p;
   int i, j;
   for (i = 0; i < height; ++i) {