Merge changes I4850b36e,Ic4d7128a into nextgenv2

* changes:
  variance_avx2: sync variance functions with c-code
  Resolve -Wshorten-64-to-32 in variance.
diff --git a/aom_dsp/aom_dsp_rtcd_defs.pl b/aom_dsp/aom_dsp_rtcd_defs.pl
index 6af5588..89f09fc 100644
--- a/aom_dsp/aom_dsp_rtcd_defs.pl
+++ b/aom_dsp/aom_dsp_rtcd_defs.pl
@@ -1034,47 +1034,6 @@
 }
 
 
-# Single block SAD
-#
-add_proto qw/unsigned int aom_sad64x64/, "const uint8_t *src_ptr, int src_stride, const uint8_t *ref_ptr, int ref_stride";
-specialize qw/aom_sad64x64 avx2 neon msa sse2/;
-
-add_proto qw/unsigned int aom_sad64x32/, "const uint8_t *src_ptr, int src_stride, const uint8_t *ref_ptr, int ref_stride";
-specialize qw/aom_sad64x32 avx2 msa sse2/;
-
-add_proto qw/unsigned int aom_sad32x64/, "const uint8_t *src_ptr, int src_stride, const uint8_t *ref_ptr, int ref_stride";
-specialize qw/aom_sad32x64 avx2 msa sse2/;
-
-add_proto qw/unsigned int aom_sad32x32/, "const uint8_t *src_ptr, int src_stride, const uint8_t *ref_ptr, int ref_stride";
-specialize qw/aom_sad32x32 avx2 neon msa sse2/;
-
-add_proto qw/unsigned int aom_sad32x16/, "const uint8_t *src_ptr, int src_stride, const uint8_t *ref_ptr, int ref_stride";
-specialize qw/aom_sad32x16 avx2 msa sse2/;
-
-add_proto qw/unsigned int aom_sad16x32/, "const uint8_t *src_ptr, int src_stride, const uint8_t *ref_ptr, int ref_stride";
-specialize qw/aom_sad16x32 msa sse2/;
-
-add_proto qw/unsigned int aom_sad16x16/, "const uint8_t *src_ptr, int src_stride, const uint8_t *ref_ptr, int ref_stride";
-specialize qw/aom_sad16x16 media neon msa sse2/;
-
-add_proto qw/unsigned int aom_sad16x8/, "const uint8_t *src_ptr, int src_stride, const uint8_t *ref_ptr, int ref_stride";
-specialize qw/aom_sad16x8 neon msa sse2/;
-
-add_proto qw/unsigned int aom_sad8x16/, "const uint8_t *src_ptr, int src_stride, const uint8_t *ref_ptr, int ref_stride";
-specialize qw/aom_sad8x16 neon msa sse2/;
-
-add_proto qw/unsigned int aom_sad8x8/, "const uint8_t *src_ptr, int src_stride, const uint8_t *ref_ptr, int ref_stride";
-specialize qw/aom_sad8x8 neon msa sse2/;
-
-add_proto qw/unsigned int aom_sad8x4/, "const uint8_t *src_ptr, int src_stride, const uint8_t *ref_ptr, int ref_stride";
-specialize qw/aom_sad8x4 msa sse2/;
-
-add_proto qw/unsigned int aom_sad4x8/, "const uint8_t *src_ptr, int src_stride, const uint8_t *ref_ptr, int ref_stride";
-specialize qw/aom_sad4x8 msa sse2/;
-
-add_proto qw/unsigned int aom_sad4x4/, "const uint8_t *src_ptr, int src_stride, const uint8_t *ref_ptr, int ref_stride";
-specialize qw/aom_sad4x4 neon msa sse2/;
-
 #
 # Avg
 #
@@ -1136,7 +1095,7 @@
 specialize qw/aom_sad128x128                        sse2/;
 specialize qw/aom_sad128x64                         sse2/;
 specialize qw/aom_sad64x128                         sse2/;
-specialize qw/aom_sad64x64      avx2            msa sse2/;
+specialize qw/aom_sad64x64      avx2       neon msa sse2/;
 specialize qw/aom_sad64x32      avx2            msa sse2/;
 specialize qw/aom_sad32x64      avx2            msa sse2/;
 specialize qw/aom_sad32x32      avx2       neon msa sse2/;
@@ -1328,48 +1287,6 @@
 if (aom_config("CONFIG_ENCODERS") eq "yes") {
 
 #
-# Variance
-#
-add_proto qw/unsigned int aom_variance64x64/, "const uint8_t *src_ptr, int source_stride, const uint8_t *ref_ptr, int ref_stride, unsigned int *sse";
-  specialize qw/aom_variance64x64 sse2 avx2 neon msa/;
-
-add_proto qw/unsigned int aom_variance64x32/, "const uint8_t *src_ptr, int source_stride, const uint8_t *ref_ptr, int ref_stride, unsigned int *sse";
-  specialize qw/aom_variance64x32 sse2 avx2 neon msa/;
-
-add_proto qw/unsigned int aom_variance32x64/, "const uint8_t *src_ptr, int source_stride, const uint8_t *ref_ptr, int ref_stride, unsigned int *sse";
-  specialize qw/aom_variance32x64 sse2 neon msa/;
-
-add_proto qw/unsigned int aom_variance32x32/, "const uint8_t *src_ptr, int source_stride, const uint8_t *ref_ptr, int ref_stride, unsigned int *sse";
-  specialize qw/aom_variance32x32 sse2 avx2 neon msa/;
-
-add_proto qw/unsigned int aom_variance32x16/, "const uint8_t *src_ptr, int source_stride, const uint8_t *ref_ptr, int ref_stride, unsigned int *sse";
-  specialize qw/aom_variance32x16 sse2 avx2 msa/;
-
-add_proto qw/unsigned int aom_variance16x32/, "const uint8_t *src_ptr, int source_stride, const uint8_t *ref_ptr, int ref_stride, unsigned int *sse";
-  specialize qw/aom_variance16x32 sse2 msa/;
-
-add_proto qw/unsigned int aom_variance16x16/, "const uint8_t *src_ptr, int source_stride, const uint8_t *ref_ptr, int ref_stride, unsigned int *sse";
-  specialize qw/aom_variance16x16 sse2 avx2 media neon msa/;
-
-add_proto qw/unsigned int aom_variance16x8/, "const uint8_t *src_ptr, int source_stride, const uint8_t *ref_ptr, int ref_stride, unsigned int *sse";
-  specialize qw/aom_variance16x8 sse2 neon msa/;
-
-add_proto qw/unsigned int aom_variance8x16/, "const uint8_t *src_ptr, int source_stride, const uint8_t *ref_ptr, int ref_stride, unsigned int *sse";
-  specialize qw/aom_variance8x16 sse2 neon msa/;
-
-add_proto qw/unsigned int aom_variance8x8/, "const uint8_t *src_ptr, int source_stride, const uint8_t *ref_ptr, int ref_stride, unsigned int *sse";
-  specialize qw/aom_variance8x8 sse2 media neon msa/;
-
-add_proto qw/unsigned int aom_variance8x4/, "const uint8_t *src_ptr, int source_stride, const uint8_t *ref_ptr, int ref_stride, unsigned int *sse";
-  specialize qw/aom_variance8x4 sse2 msa/;
-
-add_proto qw/unsigned int aom_variance4x8/, "const uint8_t *src_ptr, int source_stride, const uint8_t *ref_ptr, int ref_stride, unsigned int *sse";
-  specialize qw/aom_variance4x8 sse2 msa/;
-
-add_proto qw/unsigned int aom_variance4x4/, "const uint8_t *src_ptr, int source_stride, const uint8_t *ref_ptr, int ref_stride, unsigned int *sse";
-  specialize qw/aom_variance4x4 sse2 msa/;
-
-#
 # Specialty Variance
 #
 add_proto qw/void aom_get16x16var/, "const uint8_t *src_ptr, int source_stride, const uint8_t *ref_ptr, int ref_stride, unsigned int *sse, int *sum";
diff --git a/av1/common/enums.h b/av1/common/enums.h
index cefed6c..7ea6776 100644
--- a/av1/common/enums.h
+++ b/av1/common/enums.h
@@ -255,8 +255,8 @@
   CLPF_128X128 = 3
 } CLPF_BLOCK_SIZE;
 #endif
-typedef enum ATTRIBUTE_PACKED {
 
+typedef enum ATTRIBUTE_PACKED {
   DC_PRED,    // Average of above and left pixels
   V_PRED,     // Vertical
   H_PRED,     // Horizontal
diff --git a/av1/decoder/decodeframe.c b/av1/decoder/decodeframe.c
index acca4cb..65a162b 100644
--- a/av1/decoder/decodeframe.c
+++ b/av1/decoder/decodeframe.c
@@ -1797,10 +1797,10 @@
 
     if (!((mi_row * MI_SIZE) & 127) && !((mi_col * MI_SIZE) & 127) &&
         cm->clpf_size == CLPF_128X128) {
-      cm->clpf_blocks[tl] = aom_read_literal(r, 1, ACCT_STR);
+      cm->clpf_blocks[tl] = aom_read_literal(r, 1);
     } else if (cm->clpf_size == CLPF_64X64 &&
                !clpf_all_skip(cm, mi_col, mi_row, 64 / MI_SIZE)) {
-      cm->clpf_blocks[tl] = aom_read_literal(r, 1, ACCT_STR);
+      cm->clpf_blocks[tl] = aom_read_literal(r, 1);
     } else if (cm->clpf_size == CLPF_32X32) {
       const int tr = tl + 1;
       const int bl = tl + cm->clpf_stride;
@@ -1809,19 +1809,19 @@
 
       // Up to four bits per SB
       if (!clpf_all_skip(cm, mi_col, mi_row, size))
-        cm->clpf_blocks[tl] = aom_read_literal(r, 1, ACCT_STR);
+        cm->clpf_blocks[tl] = aom_read_literal(r, 1);
 
       if (mi_col + size < cm->mi_cols &&
           !clpf_all_skip(cm, mi_col + size, mi_row, size))
-        cm->clpf_blocks[tr] = aom_read_literal(r, 1, ACCT_STR);
+        cm->clpf_blocks[tr] = aom_read_literal(r, 1);
 
       if (mi_row + size < cm->mi_rows &&
           !clpf_all_skip(cm, mi_col, mi_row + size, size))
-        cm->clpf_blocks[bl] = aom_read_literal(r, 1, ACCT_STR);
+        cm->clpf_blocks[bl] = aom_read_literal(r, 1);
 
       if (mi_col + size < cm->mi_cols && mi_row + size < cm->mi_rows &&
           !clpf_all_skip(cm, mi_col + size, mi_row + size, size))
-        cm->clpf_blocks[br] = aom_read_literal(r, 1, ACCT_STR);
+        cm->clpf_blocks[br] = aom_read_literal(r, 1);
     }
   }
 #endif
diff --git a/test/aomenc.sh b/test/aomenc.sh
index 79f3a33..f5e5ab4 100755
--- a/test/aomenc.sh
+++ b/test/aomenc.sh
@@ -36,8 +36,8 @@
   fi
 }
 
-aomenc_can_encode_vp8() {
-  if [ "$(vp8_encode_available)" = "yes" ]; then
+aomenc_can_encode_av1() {
+  if [ "$(av1_encode_available)" = "yes" ]; then
     echo yes
   fi
 }
@@ -58,9 +58,9 @@
 }
 
 # Echo default aomenc real time encoding params. $1 is the codec, which defaults
-# to vp8 if unspecified.
+# to av1 if unspecified.
 aomenc_rt_params() {
-  local readonly codec="${1:-vp8}"
+  local readonly codec="${1:-av1}"
   echo "--codec=${codec}
     --buf-initial-sz=500
     --buf-optimal-sz=600