Misc fixes to build with CONFIG_LOOP_RESTORATION=0

Change-Id: I1e6a8a74d0ca1e6aa01d2da12bd9b19c8307154e
diff --git a/av1/common/resize.h b/av1/common/resize.h
index e54eff8..18a7712 100644
--- a/av1/common/resize.h
+++ b/av1/common/resize.h
@@ -100,14 +100,13 @@
 }
 #endif  // CONFIG_HORZONLY_FRAME_SUPERRES
 
-#if CONFIG_HORZONLY_FRAME_SUPERRES && CONFIG_LOOP_RESTORATION
+#if CONFIG_HORZONLY_FRAME_SUPERRES
 #define UPSCALE_NORMATIVE_TAPS 8
-
 extern const int16_t av1_resize_filter_normative[1 << RS_SUBPEL_BITS]
                                                 [UPSCALE_NORMATIVE_TAPS];
 
 int32_t av1_get_upscale_convolve_step(int in_length, int out_length);
-#endif  // CONFIG_HORZONLY_FRAME_SUPERRES && CONFIG_LOOP_RESTORATION
+#endif  // CONFIG_HORZONLY_FRAME_SUPERRES
 
 #ifdef __cplusplus
 }  // extern "C"
diff --git a/av1/decoder/decodeframe.c b/av1/decoder/decodeframe.c
index 71a440d..8292fd8 100644
--- a/av1/decoder/decodeframe.c
+++ b/av1/decoder/decodeframe.c
@@ -602,7 +602,6 @@
                              int mi_row, int mi_col, aom_reader *r,
                              BLOCK_SIZE bsize) {
   AV1_COMMON *const cm = &pbi->common;
-  const int num_planes = av1_num_planes(cm);
   const int num_8x8_wh = mi_size_wide[bsize];
   const int hbs = num_8x8_wh >> 1;
   PARTITION_TYPE partition;
@@ -617,6 +616,7 @@
   if (mi_row >= cm->mi_rows || mi_col >= cm->mi_cols) return;
 
 #if CONFIG_LOOP_RESTORATION
+  const int num_planes = av1_num_planes(cm);
   for (int plane = 0; plane < num_planes; ++plane) {
     int rcol0, rcol1, rrow0, rrow1, tile_tl_idx;
     if (av1_loop_restoration_corners_in_sb(cm, plane, mi_row, mi_col, bsize,
@@ -3567,11 +3567,13 @@
     return;
   }
 
+#if CONFIG_LOOP_RESTORATION
   if (cm->rst_info[0].frame_restoration_type != RESTORE_NONE ||
       cm->rst_info[1].frame_restoration_type != RESTORE_NONE ||
       cm->rst_info[2].frame_restoration_type != RESTORE_NONE) {
     av1_loop_restoration_save_boundary_lines(&pbi->cur_buf->buf, cm, 0);
   }
+#endif  // CONFIG_LOOP_RESTORATION
 
   if (!cm->skip_loop_filter &&
 #if CONFIG_INTRABC
diff --git a/av1/encoder/bitstream.c b/av1/encoder/bitstream.c
index 0ffea21..edeebe2 100644
--- a/av1/encoder/bitstream.c
+++ b/av1/encoder/bitstream.c
@@ -2028,7 +2028,6 @@
                            const TOKENEXTRA *const tok_end, int mi_row,
                            int mi_col, BLOCK_SIZE bsize) {
   const AV1_COMMON *const cm = &cpi->common;
-  const int num_planes = av1_num_planes(cm);
   MACROBLOCKD *const xd = &cpi->td.mb.e_mbd;
   const int hbs = mi_size_wide[bsize] / 2;
 #if CONFIG_EXT_PARTITION_TYPES
@@ -2041,6 +2040,7 @@
   if (mi_row >= cm->mi_rows || mi_col >= cm->mi_cols) return;
 
 #if CONFIG_LOOP_RESTORATION
+  const int num_planes = av1_num_planes(cm);
   for (int plane = 0; plane < num_planes; ++plane) {
     int rcol0, rcol1, rrow0, rrow1, tile_tl_idx;
     if (av1_loop_restoration_corners_in_sb(cm, plane, mi_row, mi_col, bsize,
@@ -4608,7 +4608,6 @@
                                        int insert_frame_header_obu_flag,
                                        uint8_t obu_extension_header) {
   AV1_COMMON *const cm = &cpi->common;
-  const int num_planes = av1_num_planes(cm);
   aom_writer mode_bc;
   int tile_row, tile_col;
   TOKENEXTRA *(*const tok_buffers)[MAX_TILE_COLS] = cpi->tile_tok;
@@ -4807,6 +4806,7 @@
         cpi->td.mb.e_mbd.tile_ctx = &this_tile->tctx;
         mode_bc.allow_update_cdf = 1;
 #if CONFIG_LOOP_RESTORATION
+        const int num_planes = av1_num_planes(cm);
         av1_reset_loop_restoration(&cpi->td.mb.e_mbd, num_planes);
 #endif  // CONFIG_LOOP_RESTORATION
 
diff --git a/av1/encoder/encoder.c b/av1/encoder/encoder.c
index 3c33146..0ed1d0f 100644
--- a/av1/encoder/encoder.c
+++ b/av1/encoder/encoder.c
@@ -5227,8 +5227,10 @@
 #endif  // CONFIG_LOOPFILTER_LEVEL
   }
 
+#if CONFIG_LOOP_RESTORATION
   if (!no_restoration)
     av1_loop_restoration_save_boundary_lines(cm->frame_to_show, cm, 0);
+#endif  // CONFIG_LOOP_RESTORATION
 
   if (no_cdef) {
     cm->cdef_bits = 0;