Fix static analyzer warnings

With clang v7 we are getting inflow of static analyzer warnings. With
this fix the number of shallow warnigns is 0 and number of deep
warnings is 37

BUG=aomedia:2312

Change-Id: I64846cb078d48f115ee490d0a9c8e1abfa2faae7
diff --git a/av1/common/onyxc_int.h b/av1/common/onyxc_int.h
index 8117dfc..3df1e83 100644
--- a/av1/common/onyxc_int.h
+++ b/av1/common/onyxc_int.h
@@ -1076,6 +1076,7 @@
 
 static INLINE int max_block_wide(const MACROBLOCKD *xd, BLOCK_SIZE bsize,
                                  int plane) {
+  assert(bsize < BLOCK_SIZES_ALL);
   int max_blocks_wide = block_size_wide[bsize];
   const struct macroblockd_plane *const pd = &xd->plane[plane];
 
diff --git a/av1/common/restoration.c b/av1/common/restoration.c
index 9e472b8..69d898f 100644
--- a/av1/common/restoration.c
+++ b/av1/common/restoration.c
@@ -1146,7 +1146,7 @@
   static const copy_fun copy_funs[3] = { aom_yv12_partial_coloc_copy_y,
                                          aom_yv12_partial_coloc_copy_u,
                                          aom_yv12_partial_coloc_copy_v };
-
+  assert(num_planes <= 3);
   for (int plane = 0; plane < num_planes; ++plane) {
     if (cm->rst_info[plane].frame_restoration_type == RESTORE_NONE) continue;
     AV1PixelRect tile_rect = loop_rest_ctxt->ctxt[plane].tile_rect;
diff --git a/av1/encoder/bitstream.c b/av1/encoder/bitstream.c
index 2d58364..d052ac6 100644
--- a/av1/encoder/bitstream.c
+++ b/av1/encoder/bitstream.c
@@ -1373,6 +1373,7 @@
   MACROBLOCKD *const xd = &x->e_mbd;
   const struct macroblockd_plane *const pd = &xd->plane[plane];
   const BLOCK_SIZE bsize = mbmi->sb_type;
+  assert(bsize < BLOCK_SIZES_ALL);
   const BLOCK_SIZE bsizec =
       scale_chroma_bsize(bsize, pd->subsampling_x, pd->subsampling_y);
 
diff --git a/av1/encoder/encodeframe.c b/av1/encoder/encodeframe.c
index a6b9d3c..8ca501d 100644
--- a/av1/encoder/encodeframe.c
+++ b/av1/encoder/encodeframe.c
@@ -1970,6 +1970,8 @@
   const SPEED_FEATURES *const sf = &cpi->sf;
   MACROBLOCK *const x = &td->mb;
   MACROBLOCKD *const xd = &x->e_mbd;
+  // Only square blocks from 8x8 to 128x128 are supported
+  assert(bsize >= BLOCK_8X8 && bsize <= BLOCK_128X128);
   const int bs = mi_size_wide[bsize];
   const int hbs = bs / 2;
   const PARTITION_TYPE partition =
diff --git a/av1/encoder/encodemb.c b/av1/encoder/encodemb.c
index 8e9da61..68225e9 100644
--- a/av1/encoder/encodemb.c
+++ b/av1/encoder/encodemb.c
@@ -638,6 +638,7 @@
   const MACROBLOCKD *const xd = &x->e_mbd;
   ENTROPY_CONTEXT ta[MAX_MIB_SIZE] = { 0 };
   ENTROPY_CONTEXT tl[MAX_MIB_SIZE] = { 0 };
+  assert(bsize < BLOCK_SIZES_ALL);
 
   struct encode_b_args arg = {
     cpi, x, NULL, &(xd->mi[0]->skip), ta, tl, enable_optimize_b
diff --git a/av1/encoder/nonrd_pickmode.c b/av1/encoder/nonrd_pickmode.c
index dbb9b0b..3fc5bd4 100644
--- a/av1/encoder/nonrd_pickmode.c
+++ b/av1/encoder/nonrd_pickmode.c
@@ -650,6 +650,7 @@
   int64_t rate_sum = 0;
   int64_t dist_sum = 0;
   int64_t total_sse = 0;
+  assert(bsize < BLOCK_SIZES_ALL);
 
   for (plane = plane_from; plane <= plane_to; ++plane) {
     struct macroblock_plane *const p = &x->plane[plane];
diff --git a/av1/encoder/rdopt.c b/av1/encoder/rdopt.c
index 4d9d00f..d6e2233 100644
--- a/av1/encoder/rdopt.c
+++ b/av1/encoder/rdopt.c
@@ -5392,6 +5392,7 @@
                                        TXB_RD_INFO_NODE *rd_info_tree) {
   MACROBLOCKD *const xd = &x->e_mbd;
   assert(is_inter_block(xd->mi[0]));
+  assert(bsize < BLOCK_SIZES_ALL);
 
   // TODO(debargha): enable this as a speed feature where the
   // select_inter_block_yrd() function above will use a simplified search
@@ -6027,6 +6028,7 @@
   int64_t rate_sum = 0;
   int64_t dist_sum = 0;
   int64_t total_sse = 0;
+  assert(bsize < BLOCK_SIZES_ALL);
 
   for (int plane = plane_from; plane <= plane_to; ++plane) {
     struct macroblock_plane *const p = &x->plane[plane];
@@ -8418,6 +8420,7 @@
     pred_filter_search = is_pred_filter_search_allowed(cpi, bsize, mi_row,
                                                        mi_col, af, af, lf, lf);
     if (pred_filter_search) {
+      assert(af != SWITCHABLE);
       filter_idx = SWITCHABLE * (af & 0xf);
       // This assert tells that (filter_x == filter_y) for non-dual filter case
       assert((filter_sets[filter_idx] & 0xffff) ==