Merge "VP9 denoiser fix: ref frames now updated properly"
diff --git a/test/convolve_test.cc b/test/convolve_test.cc
index 2fcb2df..5b4a20e 100644
--- a/test/convolve_test.cc
+++ b/test/convolve_test.cc
@@ -21,28 +21,28 @@
 #include "vpx_ports/mem.h"
 
 namespace {
-typedef void (*convolve_fn_t)(const uint8_t *src, ptrdiff_t src_stride,
-                              uint8_t *dst, ptrdiff_t dst_stride,
-                              const int16_t *filter_x, int filter_x_stride,
-                              const int16_t *filter_y, int filter_y_stride,
-                              int w, int h);
+typedef void (*ConvolveFunc)(const uint8_t *src, ptrdiff_t src_stride,
+                             uint8_t *dst, ptrdiff_t dst_stride,
+                             const int16_t *filter_x, int filter_x_stride,
+                             const int16_t *filter_y, int filter_y_stride,
+                             int w, int h);
 
 struct ConvolveFunctions {
-  ConvolveFunctions(convolve_fn_t h8, convolve_fn_t h8_avg,
-                    convolve_fn_t v8, convolve_fn_t v8_avg,
-                    convolve_fn_t hv8, convolve_fn_t hv8_avg)
+  ConvolveFunctions(ConvolveFunc h8, ConvolveFunc h8_avg,
+                    ConvolveFunc v8, ConvolveFunc v8_avg,
+                    ConvolveFunc hv8, ConvolveFunc hv8_avg)
       : h8_(h8), v8_(v8), hv8_(hv8), h8_avg_(h8_avg), v8_avg_(v8_avg),
         hv8_avg_(hv8_avg) {}
 
-  convolve_fn_t h8_;
-  convolve_fn_t v8_;
-  convolve_fn_t hv8_;
-  convolve_fn_t h8_avg_;
-  convolve_fn_t v8_avg_;
-  convolve_fn_t hv8_avg_;
+  ConvolveFunc h8_;
+  ConvolveFunc v8_;
+  ConvolveFunc hv8_;
+  ConvolveFunc h8_avg_;
+  ConvolveFunc v8_avg_;
+  ConvolveFunc hv8_avg_;
 };
 
-typedef std::tr1::tuple<int, int, const ConvolveFunctions*> convolve_param_t;
+typedef std::tr1::tuple<int, int, const ConvolveFunctions *> ConvolveParam;
 
 // Reference 8-tap subpixel filter, slightly modified to fit into this test.
 #define VP9_FILTER_WEIGHT 128
@@ -169,7 +169,7 @@
                     output_width, output_height);
 }
 
-class ConvolveTest : public ::testing::TestWithParam<convolve_param_t> {
+class ConvolveTest : public ::testing::TestWithParam<ConvolveParam> {
  public:
   static void SetUpTestCase() {
     // Force input_ to be unaligned, output to be 16 byte aligned.
diff --git a/test/dct16x16_test.cc b/test/dct16x16_test.cc
index b7c2dcc..bd7ddd8 100644
--- a/test/dct16x16_test.cc
+++ b/test/dct16x16_test.cc
@@ -258,15 +258,15 @@
   }
 }
 
-typedef void (*fdct_t)(const int16_t *in, int16_t *out, int stride);
-typedef void (*idct_t)(const int16_t *in, uint8_t *out, int stride);
-typedef void (*fht_t) (const int16_t *in, int16_t *out, int stride,
-                       int tx_type);
-typedef void (*iht_t) (const int16_t *in, uint8_t *out, int stride,
-                       int tx_type);
+typedef void (*FdctFunc)(const int16_t *in, int16_t *out, int stride);
+typedef void (*IdctFunc)(const int16_t *in, uint8_t *out, int stride);
+typedef void (*FhtFunc)(const int16_t *in, int16_t *out, int stride,
+                        int tx_type);
+typedef void (*IhtFunc)(const int16_t *in, uint8_t *out, int stride,
+                        int tx_type);
 
-typedef std::tr1::tuple<fdct_t, idct_t, int> dct_16x16_param_t;
-typedef std::tr1::tuple<fht_t, iht_t, int> ht_16x16_param_t;
+typedef std::tr1::tuple<FdctFunc, IdctFunc, int> Dct16x16Param;
+typedef std::tr1::tuple<FhtFunc, IhtFunc, int> Ht16x16Param;
 
 void fdct16x16_ref(const int16_t *in, int16_t *out, int stride, int tx_type) {
   vp9_fdct16x16_c(in, out, stride);
@@ -463,13 +463,13 @@
   }
   int pitch_;
   int tx_type_;
-  fht_t fwd_txfm_ref;
-  iht_t inv_txfm_ref;
+  FhtFunc fwd_txfm_ref;
+  IhtFunc inv_txfm_ref;
 };
 
 class Trans16x16DCT
     : public Trans16x16TestBase,
-      public ::testing::TestWithParam<dct_16x16_param_t> {
+      public ::testing::TestWithParam<Dct16x16Param> {
  public:
   virtual ~Trans16x16DCT() {}
 
@@ -491,8 +491,8 @@
     inv_txfm_(out, dst, stride);
   }
 
-  fdct_t fwd_txfm_;
-  idct_t inv_txfm_;
+  FdctFunc fwd_txfm_;
+  IdctFunc inv_txfm_;
 };
 
 TEST_P(Trans16x16DCT, AccuracyCheck) {
@@ -519,7 +519,7 @@
 
 class Trans16x16HT
     : public Trans16x16TestBase,
-      public ::testing::TestWithParam<ht_16x16_param_t> {
+      public ::testing::TestWithParam<Ht16x16Param> {
  public:
   virtual ~Trans16x16HT() {}
 
@@ -541,8 +541,8 @@
     inv_txfm_(out, dst, stride, tx_type_);
   }
 
-  fht_t fwd_txfm_;
-  iht_t inv_txfm_;
+  FhtFunc fwd_txfm_;
+  IhtFunc inv_txfm_;
 };
 
 TEST_P(Trans16x16HT, AccuracyCheck) {
diff --git a/test/dct32x32_test.cc b/test/dct32x32_test.cc
index 02250a9..4f34a44 100644
--- a/test/dct32x32_test.cc
+++ b/test/dct32x32_test.cc
@@ -71,12 +71,12 @@
   }
 }
 
-typedef void (*fwd_txfm_t)(const int16_t *in, int16_t *out, int stride);
-typedef void (*inv_txfm_t)(const int16_t *in, uint8_t *out, int stride);
+typedef void (*FwdTxfmFunc)(const int16_t *in, int16_t *out, int stride);
+typedef void (*InvTxfmFunc)(const int16_t *in, uint8_t *out, int stride);
 
-typedef std::tr1::tuple<fwd_txfm_t, inv_txfm_t, int> trans_32x32_param_t;
+typedef std::tr1::tuple<FwdTxfmFunc, InvTxfmFunc, int> Trans32x32Param;
 
-class Trans32x32Test : public ::testing::TestWithParam<trans_32x32_param_t> {
+class Trans32x32Test : public ::testing::TestWithParam<Trans32x32Param> {
  public:
   virtual ~Trans32x32Test() {}
   virtual void SetUp() {
@@ -90,8 +90,8 @@
 
  protected:
   int version_;
-  fwd_txfm_t fwd_txfm_;
-  inv_txfm_t inv_txfm_;
+  FwdTxfmFunc fwd_txfm_;
+  InvTxfmFunc inv_txfm_;
 };
 
 TEST_P(Trans32x32Test, AccuracyCheck) {
diff --git a/test/decode_perf_test.cc b/test/decode_perf_test.cc
index 9b423b3..b612f23 100644
--- a/test/decode_perf_test.cc
+++ b/test/decode_perf_test.cc
@@ -29,9 +29,9 @@
 /*
  DecodePerfTest takes a tuple of filename + number of threads to decode with
  */
-typedef std::tr1::tuple<const char *, unsigned> decode_perf_param_t;
+typedef std::tr1::tuple<const char *, unsigned> DecodePerfParam;
 
-const decode_perf_param_t kVP9DecodePerfVectors[] = {
+const DecodePerfParam kVP9DecodePerfVectors[] = {
   make_tuple("vp90-2-bbb_426x240_tile_1x1_180kbps.webm", 1),
   make_tuple("vp90-2-bbb_640x360_tile_1x2_337kbps.webm", 2),
   make_tuple("vp90-2-bbb_854x480_tile_1x2_651kbps.webm", 2),
@@ -64,7 +64,7 @@
    power/temp/min max frame decode times/etc
  */
 
-class DecodePerfTest : public ::testing::TestWithParam<decode_perf_param_t> {
+class DecodePerfTest : public ::testing::TestWithParam<DecodePerfParam> {
 };
 
 TEST_P(DecodePerfTest, PerfTest) {
diff --git a/test/fdct4x4_test.cc b/test/fdct4x4_test.cc
index ab636bf..bea19f1 100644
--- a/test/fdct4x4_test.cc
+++ b/test/fdct4x4_test.cc
@@ -30,15 +30,15 @@
 
 namespace {
 const int kNumCoeffs = 16;
-typedef void (*fdct_t)(const int16_t *in, int16_t *out, int stride);
-typedef void (*idct_t)(const int16_t *in, uint8_t *out, int stride);
-typedef void (*fht_t) (const int16_t *in, int16_t *out, int stride,
-                       int tx_type);
-typedef void (*iht_t) (const int16_t *in, uint8_t *out, int stride,
-                       int tx_type);
+typedef void (*FdctFunc)(const int16_t *in, int16_t *out, int stride);
+typedef void (*IdctFunc)(const int16_t *in, uint8_t *out, int stride);
+typedef void (*FhtFunc)(const int16_t *in, int16_t *out, int stride,
+                        int tx_type);
+typedef void (*IhtFunc)(const int16_t *in, uint8_t *out, int stride,
+                        int tx_type);
 
-typedef std::tr1::tuple<fdct_t, idct_t, int> dct_4x4_param_t;
-typedef std::tr1::tuple<fht_t, iht_t, int> ht_4x4_param_t;
+typedef std::tr1::tuple<FdctFunc, IdctFunc, int> Dct4x4Param;
+typedef std::tr1::tuple<FhtFunc, IhtFunc, int> Ht4x4Param;
 
 void fdct4x4_ref(const int16_t *in, int16_t *out, int stride, int tx_type) {
   vp9_fdct4x4_c(in, out, stride);
@@ -189,12 +189,12 @@
 
   int pitch_;
   int tx_type_;
-  fht_t fwd_txfm_ref;
+  FhtFunc fwd_txfm_ref;
 };
 
 class Trans4x4DCT
     : public Trans4x4TestBase,
-      public ::testing::TestWithParam<dct_4x4_param_t> {
+      public ::testing::TestWithParam<Dct4x4Param> {
  public:
   virtual ~Trans4x4DCT() {}
 
@@ -215,8 +215,8 @@
     inv_txfm_(out, dst, stride);
   }
 
-  fdct_t fwd_txfm_;
-  idct_t inv_txfm_;
+  FdctFunc fwd_txfm_;
+  IdctFunc inv_txfm_;
 };
 
 TEST_P(Trans4x4DCT, AccuracyCheck) {
@@ -237,7 +237,7 @@
 
 class Trans4x4HT
     : public Trans4x4TestBase,
-      public ::testing::TestWithParam<ht_4x4_param_t> {
+      public ::testing::TestWithParam<Ht4x4Param> {
  public:
   virtual ~Trans4x4HT() {}
 
@@ -259,8 +259,8 @@
     inv_txfm_(out, dst, stride, tx_type_);
   }
 
-  fht_t fwd_txfm_;
-  iht_t inv_txfm_;
+  FhtFunc fwd_txfm_;
+  IhtFunc inv_txfm_;
 };
 
 TEST_P(Trans4x4HT, AccuracyCheck) {
@@ -281,7 +281,7 @@
 
 class Trans4x4WHT
     : public Trans4x4TestBase,
-      public ::testing::TestWithParam<dct_4x4_param_t> {
+      public ::testing::TestWithParam<Dct4x4Param> {
  public:
   virtual ~Trans4x4WHT() {}
 
@@ -302,8 +302,8 @@
     inv_txfm_(out, dst, stride);
   }
 
-  fdct_t fwd_txfm_;
-  idct_t inv_txfm_;
+  FdctFunc fwd_txfm_;
+  IdctFunc inv_txfm_;
 };
 
 TEST_P(Trans4x4WHT, AccuracyCheck) {
diff --git a/test/fdct8x8_test.cc b/test/fdct8x8_test.cc
index 3e14c24..2590837 100644
--- a/test/fdct8x8_test.cc
+++ b/test/fdct8x8_test.cc
@@ -29,15 +29,15 @@
 using libvpx_test::ACMRandom;
 
 namespace {
-typedef void (*fdct_t)(const int16_t *in, int16_t *out, int stride);
-typedef void (*idct_t)(const int16_t *in, uint8_t *out, int stride);
-typedef void (*fht_t) (const int16_t *in, int16_t *out, int stride,
-                       int tx_type);
-typedef void (*iht_t) (const int16_t *in, uint8_t *out, int stride,
-                       int tx_type);
+typedef void (*FdctFunc)(const int16_t *in, int16_t *out, int stride);
+typedef void (*IdctFunc)(const int16_t *in, uint8_t *out, int stride);
+typedef void (*FhtFunc)(const int16_t *in, int16_t *out, int stride,
+                        int tx_type);
+typedef void (*IhtFunc)(const int16_t *in, uint8_t *out, int stride,
+                        int tx_type);
 
-typedef std::tr1::tuple<fdct_t, idct_t, int> dct_8x8_param_t;
-typedef std::tr1::tuple<fht_t, iht_t, int> ht_8x8_param_t;
+typedef std::tr1::tuple<FdctFunc, IdctFunc, int> Dct8x8Param;
+typedef std::tr1::tuple<FhtFunc, IhtFunc, int> Ht8x8Param;
 
 void fdct8x8_ref(const int16_t *in, int16_t *out, int stride, int tx_type) {
   vp9_fdct8x8_c(in, out, stride);
@@ -236,12 +236,12 @@
 
   int pitch_;
   int tx_type_;
-  fht_t fwd_txfm_ref;
+  FhtFunc fwd_txfm_ref;
 };
 
 class FwdTrans8x8DCT
     : public FwdTrans8x8TestBase,
-      public ::testing::TestWithParam<dct_8x8_param_t> {
+      public ::testing::TestWithParam<Dct8x8Param> {
  public:
   virtual ~FwdTrans8x8DCT() {}
 
@@ -263,8 +263,8 @@
     inv_txfm_(out, dst, stride);
   }
 
-  fdct_t fwd_txfm_;
-  idct_t inv_txfm_;
+  FdctFunc fwd_txfm_;
+  IdctFunc inv_txfm_;
 };
 
 TEST_P(FwdTrans8x8DCT, SignBiasCheck) {
@@ -281,7 +281,7 @@
 
 class FwdTrans8x8HT
     : public FwdTrans8x8TestBase,
-      public ::testing::TestWithParam<ht_8x8_param_t> {
+      public ::testing::TestWithParam<Ht8x8Param> {
  public:
   virtual ~FwdTrans8x8HT() {}
 
@@ -303,8 +303,8 @@
     inv_txfm_(out, dst, stride, tx_type_);
   }
 
-  fht_t fwd_txfm_;
-  iht_t inv_txfm_;
+  FhtFunc fwd_txfm_;
+  IhtFunc inv_txfm_;
 };
 
 TEST_P(FwdTrans8x8HT, SignBiasCheck) {
diff --git a/test/idct_test.cc b/test/idct_test.cc
index c7f609d..2ff9e64 100644
--- a/test/idct_test.cc
+++ b/test/idct_test.cc
@@ -16,11 +16,11 @@
 
 #include "vpx/vpx_integer.h"
 
-typedef void (*idct_fn_t)(int16_t *input, unsigned char *pred_ptr,
-                          int pred_stride, unsigned char *dst_ptr,
-                          int dst_stride);
+typedef void (*IdctFunc)(int16_t *input, unsigned char *pred_ptr,
+                         int pred_stride, unsigned char *dst_ptr,
+                         int dst_stride);
 namespace {
-class IDCTTest : public ::testing::TestWithParam<idct_fn_t> {
+class IDCTTest : public ::testing::TestWithParam<IdctFunc> {
  protected:
   virtual void SetUp() {
     int i;
@@ -33,7 +33,7 @@
 
   virtual void TearDown() { libvpx_test::ClearSystemState(); }
 
-  idct_fn_t UUT;
+  IdctFunc UUT;
   int16_t input[16];
   unsigned char output[256];
   unsigned char predict[256];
diff --git a/test/intrapred_test.cc b/test/intrapred_test.cc
index d93251d..ead4760 100644
--- a/test/intrapred_test.cc
+++ b/test/intrapred_test.cc
@@ -216,16 +216,16 @@
   int num_planes_;
 };
 
-typedef void (*intra_pred_y_fn_t)(MACROBLOCKD *x,
-                                  uint8_t *yabove_row,
-                                  uint8_t *yleft,
-                                  int left_stride,
-                                  uint8_t *ypred_ptr,
-                                  int y_stride);
+typedef void (*IntraPredYFunc)(MACROBLOCKD *x,
+                               uint8_t *yabove_row,
+                               uint8_t *yleft,
+                               int left_stride,
+                               uint8_t *ypred_ptr,
+                               int y_stride);
 
 class IntraPredYTest
     : public IntraPredBase,
-      public ::testing::TestWithParam<intra_pred_y_fn_t> {
+      public ::testing::TestWithParam<IntraPredYFunc> {
  public:
   static void SetUpTestCase() {
     mb_ = reinterpret_cast<MACROBLOCKD*>(
@@ -267,7 +267,7 @@
                                       data_ptr_[0], kStride));
   }
 
-  intra_pred_y_fn_t pred_fn_;
+  IntraPredYFunc pred_fn_;
   static uint8_t* data_array_;
   static MACROBLOCKD * mb_;
   static MODE_INFO *mi_;
@@ -295,19 +295,19 @@
                             vp8_build_intra_predictors_mby_s_ssse3));
 #endif
 
-typedef void (*intra_pred_uv_fn_t)(MACROBLOCKD *x,
-                                   uint8_t *uabove_row,
-                                   uint8_t *vabove_row,
-                                   uint8_t *uleft,
-                                   uint8_t *vleft,
-                                   int left_stride,
-                                   uint8_t *upred_ptr,
-                                   uint8_t *vpred_ptr,
-                                   int pred_stride);
+typedef void (*IntraPredUvFunc)(MACROBLOCKD *x,
+                                uint8_t *uabove_row,
+                                uint8_t *vabove_row,
+                                uint8_t *uleft,
+                                uint8_t *vleft,
+                                int left_stride,
+                                uint8_t *upred_ptr,
+                                uint8_t *vpred_ptr,
+                                int pred_stride);
 
 class IntraPredUVTest
     : public IntraPredBase,
-      public ::testing::TestWithParam<intra_pred_uv_fn_t> {
+      public ::testing::TestWithParam<IntraPredUvFunc> {
  public:
   static void SetUpTestCase() {
     mb_ = reinterpret_cast<MACROBLOCKD*>(
@@ -349,7 +349,7 @@
              data_ptr_[0], data_ptr_[1], kStride);
   }
 
-  intra_pred_uv_fn_t pred_fn_;
+  IntraPredUvFunc pred_fn_;
   // We use 24 so that the data pointer of the first pixel in each row of
   // each macroblock is 8-byte aligned, and this gives us access to the
   // top-left and top-right corner pixels belonging to the top-left/right
diff --git a/test/partial_idct_test.cc b/test/partial_idct_test.cc
index fd24c75..15f4e6c 100644
--- a/test/partial_idct_test.cc
+++ b/test/partial_idct_test.cc
@@ -26,14 +26,14 @@
 using libvpx_test::ACMRandom;
 
 namespace {
-typedef void (*fwd_txfm_t)(const int16_t *in, int16_t *out, int stride);
-typedef void (*inv_txfm_t)(const int16_t *in, uint8_t *out, int stride);
-typedef std::tr1::tuple<fwd_txfm_t,
-                        inv_txfm_t,
-                        inv_txfm_t,
-                        TX_SIZE, int> partial_itxfm_param_t;
+typedef void (*FwdTxfmFunc)(const int16_t *in, int16_t *out, int stride);
+typedef void (*InvTxfmFunc)(const int16_t *in, uint8_t *out, int stride);
+typedef std::tr1::tuple<FwdTxfmFunc,
+                        InvTxfmFunc,
+                        InvTxfmFunc,
+                        TX_SIZE, int> PartialInvTxfmParam;
 const int kMaxNumCoeffs = 1024;
-class PartialIDctTest : public ::testing::TestWithParam<partial_itxfm_param_t> {
+class PartialIDctTest : public ::testing::TestWithParam<PartialInvTxfmParam> {
  public:
   virtual ~PartialIDctTest() {}
   virtual void SetUp() {
@@ -49,9 +49,9 @@
  protected:
   int last_nonzero_;
   TX_SIZE tx_size_;
-  fwd_txfm_t ftxfm_;
-  inv_txfm_t full_itxfm_;
-  inv_txfm_t partial_itxfm_;
+  FwdTxfmFunc ftxfm_;
+  InvTxfmFunc full_itxfm_;
+  InvTxfmFunc partial_itxfm_;
 };
 
 TEST_P(PartialIDctTest, RunQuantCheck) {
diff --git a/test/pp_filter_test.cc b/test/pp_filter_test.cc
index 1144083..a9b16e0 100644
--- a/test/pp_filter_test.cc
+++ b/test/pp_filter_test.cc
@@ -15,18 +15,18 @@
 #include "vpx/vpx_integer.h"
 #include "vpx_mem/vpx_mem.h"
 
-typedef void (*post_proc_func_t)(unsigned char *src_ptr,
-                                 unsigned char *dst_ptr,
-                                 int src_pixels_per_line,
-                                 int dst_pixels_per_line,
-                                 int cols,
-                                 unsigned char *flimit,
-                                 int size);
+typedef void (*PostProcFunc)(unsigned char *src_ptr,
+                             unsigned char *dst_ptr,
+                             int src_pixels_per_line,
+                             int dst_pixels_per_line,
+                             int cols,
+                             unsigned char *flimit,
+                             int size);
 
 namespace {
 
 class VP8PostProcessingFilterTest
-    : public ::testing::TestWithParam<post_proc_func_t> {
+    : public ::testing::TestWithParam<PostProcFunc> {
  public:
   virtual void TearDown() {
     libvpx_test::ClearSystemState();
diff --git a/test/sad_test.cc b/test/sad_test.cc
index 23dbd05..dbd2cf5 100644
--- a/test/sad_test.cc
+++ b/test/sad_test.cc
@@ -30,29 +30,27 @@
 
 
 #if CONFIG_VP8_ENCODER
-typedef unsigned int (*sad_m_by_n_fn_t)(const unsigned char *source_ptr,
-                                        int source_stride,
-                                        const unsigned char *reference_ptr,
-                                        int reference_stride,
-                                        unsigned int max_sad);
-typedef std::tr1::tuple<int, int, sad_m_by_n_fn_t> sad_m_by_n_test_param_t;
+typedef unsigned int (*SadMxNFunc)(const unsigned char *source_ptr,
+                                   int source_stride,
+                                   const unsigned char *reference_ptr,
+                                   int reference_stride,
+                                   unsigned int max_sad);
+typedef std::tr1::tuple<int, int, SadMxNFunc> SadMxNParam;
 #endif
 #if CONFIG_VP9_ENCODER
-typedef unsigned int (*sad_m_by_n_fn_vp9_t)(const unsigned char *source_ptr,
-                                            int source_stride,
-                                            const unsigned char *reference_ptr,
-                                            int reference_stride);
-typedef std::tr1::tuple<int, int, sad_m_by_n_fn_vp9_t>
-                  sad_m_by_n_test_param_vp9_t;
+typedef unsigned int (*SadMxNVp9Func)(const unsigned char *source_ptr,
+                                      int source_stride,
+                                      const unsigned char *reference_ptr,
+                                      int reference_stride);
+typedef std::tr1::tuple<int, int, SadMxNVp9Func> SadMxNVp9Param;
 #endif
 
-typedef void (*sad_n_by_n_by_4_fn_t)(const uint8_t *src_ptr,
-                                     int src_stride,
-                                     const unsigned char * const ref_ptr[],
-                                     int ref_stride,
-                                     unsigned int *sad_array);
-typedef std::tr1::tuple<int, int, sad_n_by_n_by_4_fn_t>
-        sad_n_by_n_by_4_test_param_t;
+typedef void (*SadMxNx4Func)(const uint8_t *src_ptr,
+                             int src_stride,
+                             const unsigned char *const ref_ptr[],
+                             int ref_stride,
+                             unsigned int *sad_array);
+typedef std::tr1::tuple<int, int, SadMxNx4Func> SadMxNx4Param;
 
 using libvpx_test::ACMRandom;
 
@@ -140,7 +138,7 @@
 
 class SADx4Test
     : public SADTestBase,
-      public ::testing::WithParamInterface<sad_n_by_n_by_4_test_param_t> {
+      public ::testing::WithParamInterface<SadMxNx4Param> {
  public:
   SADx4Test() : SADTestBase(GET_PARAM(0), GET_PARAM(1)) {}
 
@@ -169,7 +167,7 @@
 #if CONFIG_VP8_ENCODER
 class SADTest
     : public SADTestBase,
-      public ::testing::WithParamInterface<sad_m_by_n_test_param_t> {
+      public ::testing::WithParamInterface<SadMxNParam> {
  public:
   SADTest() : SADTestBase(GET_PARAM(0), GET_PARAM(1)) {}
 
@@ -201,7 +199,7 @@
 #if CONFIG_VP9_ENCODER
 class SADVP9Test
     : public SADTestBase,
-      public ::testing::WithParamInterface<sad_m_by_n_test_param_vp9_t> {
+      public ::testing::WithParamInterface<SadMxNVp9Param> {
  public:
   SADVP9Test() : SADTestBase(GET_PARAM(0), GET_PARAM(1)) {}
 
@@ -382,12 +380,12 @@
 //------------------------------------------------------------------------------
 // C functions
 #if CONFIG_VP8_ENCODER
-const sad_m_by_n_fn_t sad_16x16_c = vp8_sad16x16_c;
-const sad_m_by_n_fn_t sad_8x16_c = vp8_sad8x16_c;
-const sad_m_by_n_fn_t sad_16x8_c = vp8_sad16x8_c;
-const sad_m_by_n_fn_t sad_8x8_c = vp8_sad8x8_c;
-const sad_m_by_n_fn_t sad_4x4_c = vp8_sad4x4_c;
-const sad_m_by_n_test_param_t c_tests[] = {
+const SadMxNFunc sad_16x16_c = vp8_sad16x16_c;
+const SadMxNFunc sad_8x16_c = vp8_sad8x16_c;
+const SadMxNFunc sad_16x8_c = vp8_sad16x8_c;
+const SadMxNFunc sad_8x8_c = vp8_sad8x8_c;
+const SadMxNFunc sad_4x4_c = vp8_sad4x4_c;
+const SadMxNParam c_tests[] = {
   make_tuple(16, 16, sad_16x16_c),
   make_tuple(8, 16, sad_8x16_c),
   make_tuple(16, 8, sad_16x8_c),
@@ -398,16 +396,16 @@
 #endif  // CONFIG_VP8_ENCODER
 
 #if CONFIG_VP9_ENCODER
-const sad_m_by_n_fn_vp9_t sad_64x64_c_vp9 = vp9_sad64x64_c;
-const sad_m_by_n_fn_vp9_t sad_32x32_c_vp9 = vp9_sad32x32_c;
-const sad_m_by_n_fn_vp9_t sad_16x16_c_vp9 = vp9_sad16x16_c;
-const sad_m_by_n_fn_vp9_t sad_8x16_c_vp9 = vp9_sad8x16_c;
-const sad_m_by_n_fn_vp9_t sad_16x8_c_vp9 = vp9_sad16x8_c;
-const sad_m_by_n_fn_vp9_t sad_8x8_c_vp9 = vp9_sad8x8_c;
-const sad_m_by_n_fn_vp9_t sad_8x4_c_vp9 = vp9_sad8x4_c;
-const sad_m_by_n_fn_vp9_t sad_4x8_c_vp9 = vp9_sad4x8_c;
-const sad_m_by_n_fn_vp9_t sad_4x4_c_vp9 = vp9_sad4x4_c;
-const sad_m_by_n_test_param_vp9_t c_vp9_tests[] = {
+const SadMxNVp9Func sad_64x64_c_vp9 = vp9_sad64x64_c;
+const SadMxNVp9Func sad_32x32_c_vp9 = vp9_sad32x32_c;
+const SadMxNVp9Func sad_16x16_c_vp9 = vp9_sad16x16_c;
+const SadMxNVp9Func sad_8x16_c_vp9 = vp9_sad8x16_c;
+const SadMxNVp9Func sad_16x8_c_vp9 = vp9_sad16x8_c;
+const SadMxNVp9Func sad_8x8_c_vp9 = vp9_sad8x8_c;
+const SadMxNVp9Func sad_8x4_c_vp9 = vp9_sad8x4_c;
+const SadMxNVp9Func sad_4x8_c_vp9 = vp9_sad4x8_c;
+const SadMxNVp9Func sad_4x4_c_vp9 = vp9_sad4x4_c;
+const SadMxNVp9Param c_vp9_tests[] = {
   make_tuple(64, 64, sad_64x64_c_vp9),
   make_tuple(32, 32, sad_32x32_c_vp9),
   make_tuple(16, 16, sad_16x16_c_vp9),
@@ -420,19 +418,19 @@
 };
 INSTANTIATE_TEST_CASE_P(C, SADVP9Test, ::testing::ValuesIn(c_vp9_tests));
 
-const sad_n_by_n_by_4_fn_t sad_64x64x4d_c = vp9_sad64x64x4d_c;
-const sad_n_by_n_by_4_fn_t sad_64x32x4d_c = vp9_sad64x32x4d_c;
-const sad_n_by_n_by_4_fn_t sad_32x64x4d_c = vp9_sad32x64x4d_c;
-const sad_n_by_n_by_4_fn_t sad_32x32x4d_c = vp9_sad32x32x4d_c;
-const sad_n_by_n_by_4_fn_t sad_32x16x4d_c = vp9_sad32x16x4d_c;
-const sad_n_by_n_by_4_fn_t sad_16x32x4d_c = vp9_sad16x32x4d_c;
-const sad_n_by_n_by_4_fn_t sad_16x16x4d_c = vp9_sad16x16x4d_c;
-const sad_n_by_n_by_4_fn_t sad_16x8x4d_c = vp9_sad16x8x4d_c;
-const sad_n_by_n_by_4_fn_t sad_8x16x4d_c = vp9_sad8x16x4d_c;
-const sad_n_by_n_by_4_fn_t sad_8x8x4d_c = vp9_sad8x8x4d_c;
-const sad_n_by_n_by_4_fn_t sad_8x4x4d_c = vp9_sad8x4x4d_c;
-const sad_n_by_n_by_4_fn_t sad_4x8x4d_c = vp9_sad4x8x4d_c;
-const sad_n_by_n_by_4_fn_t sad_4x4x4d_c = vp9_sad4x4x4d_c;
+const SadMxNx4Func sad_64x64x4d_c = vp9_sad64x64x4d_c;
+const SadMxNx4Func sad_64x32x4d_c = vp9_sad64x32x4d_c;
+const SadMxNx4Func sad_32x64x4d_c = vp9_sad32x64x4d_c;
+const SadMxNx4Func sad_32x32x4d_c = vp9_sad32x32x4d_c;
+const SadMxNx4Func sad_32x16x4d_c = vp9_sad32x16x4d_c;
+const SadMxNx4Func sad_16x32x4d_c = vp9_sad16x32x4d_c;
+const SadMxNx4Func sad_16x16x4d_c = vp9_sad16x16x4d_c;
+const SadMxNx4Func sad_16x8x4d_c = vp9_sad16x8x4d_c;
+const SadMxNx4Func sad_8x16x4d_c = vp9_sad8x16x4d_c;
+const SadMxNx4Func sad_8x8x4d_c = vp9_sad8x8x4d_c;
+const SadMxNx4Func sad_8x4x4d_c = vp9_sad8x4x4d_c;
+const SadMxNx4Func sad_4x8x4d_c = vp9_sad4x8x4d_c;
+const SadMxNx4Func sad_4x4x4d_c = vp9_sad4x4x4d_c;
 INSTANTIATE_TEST_CASE_P(C, SADx4Test, ::testing::Values(
                         make_tuple(64, 64, sad_64x64x4d_c),
                         make_tuple(64, 32, sad_64x32x4d_c),
@@ -453,7 +451,7 @@
 // ARM functions
 #if HAVE_MEDIA
 #if CONFIG_VP8_ENCODER
-const sad_m_by_n_fn_t sad_16x16_armv6 = vp8_sad16x16_armv6;
+const SadMxNFunc sad_16x16_armv6 = vp8_sad16x16_armv6;
 INSTANTIATE_TEST_CASE_P(MEDIA, SADTest, ::testing::Values(
                         make_tuple(16, 16, sad_16x16_armv6)));
 #endif  // CONFIG_VP8_ENCODER
@@ -461,11 +459,11 @@
 
 #if HAVE_NEON
 #if CONFIG_VP8_ENCODER
-const sad_m_by_n_fn_t sad_16x16_neon = vp8_sad16x16_neon;
-const sad_m_by_n_fn_t sad_8x16_neon = vp8_sad8x16_neon;
-const sad_m_by_n_fn_t sad_16x8_neon = vp8_sad16x8_neon;
-const sad_m_by_n_fn_t sad_8x8_neon = vp8_sad8x8_neon;
-const sad_m_by_n_fn_t sad_4x4_neon = vp8_sad4x4_neon;
+const SadMxNFunc sad_16x16_neon = vp8_sad16x16_neon;
+const SadMxNFunc sad_8x16_neon = vp8_sad8x16_neon;
+const SadMxNFunc sad_16x8_neon = vp8_sad16x8_neon;
+const SadMxNFunc sad_8x8_neon = vp8_sad8x8_neon;
+const SadMxNFunc sad_4x4_neon = vp8_sad4x4_neon;
 INSTANTIATE_TEST_CASE_P(NEON, SADTest, ::testing::Values(
                         make_tuple(16, 16, sad_16x16_neon),
                         make_tuple(8, 16, sad_8x16_neon),
@@ -474,10 +472,10 @@
                         make_tuple(4, 4, sad_4x4_neon)));
 #endif  // CONFIG_VP8_ENCODER
 #if CONFIG_VP9_ENCODER
-const sad_m_by_n_fn_vp9_t sad_64x64_neon_vp9 = vp9_sad64x64_neon;
-const sad_m_by_n_fn_vp9_t sad_32x32_neon_vp9 = vp9_sad32x32_neon;
-const sad_m_by_n_fn_vp9_t sad_16x16_neon_vp9 = vp9_sad16x16_neon;
-const sad_m_by_n_test_param_vp9_t neon_vp9_tests[] = {
+const SadMxNVp9Func sad_64x64_neon_vp9 = vp9_sad64x64_neon;
+const SadMxNVp9Func sad_32x32_neon_vp9 = vp9_sad32x32_neon;
+const SadMxNVp9Func sad_16x16_neon_vp9 = vp9_sad16x16_neon;
+const SadMxNVp9Param neon_vp9_tests[] = {
   make_tuple(64, 64, sad_64x64_neon_vp9),
   make_tuple(32, 32, sad_32x32_neon_vp9),
   make_tuple(16, 16, sad_16x16_neon_vp9),
@@ -490,12 +488,12 @@
 // x86 functions
 #if HAVE_MMX
 #if CONFIG_VP8_ENCODER
-const sad_m_by_n_fn_t sad_16x16_mmx = vp8_sad16x16_mmx;
-const sad_m_by_n_fn_t sad_8x16_mmx = vp8_sad8x16_mmx;
-const sad_m_by_n_fn_t sad_16x8_mmx = vp8_sad16x8_mmx;
-const sad_m_by_n_fn_t sad_8x8_mmx = vp8_sad8x8_mmx;
-const sad_m_by_n_fn_t sad_4x4_mmx = vp8_sad4x4_mmx;
-const sad_m_by_n_test_param_t mmx_tests[] = {
+const SadMxNFunc sad_16x16_mmx = vp8_sad16x16_mmx;
+const SadMxNFunc sad_8x16_mmx = vp8_sad8x16_mmx;
+const SadMxNFunc sad_16x8_mmx = vp8_sad16x8_mmx;
+const SadMxNFunc sad_8x8_mmx = vp8_sad8x8_mmx;
+const SadMxNFunc sad_4x4_mmx = vp8_sad4x4_mmx;
+const SadMxNParam mmx_tests[] = {
   make_tuple(16, 16, sad_16x16_mmx),
   make_tuple(8, 16, sad_8x16_mmx),
   make_tuple(16, 8, sad_16x8_mmx),
@@ -506,12 +504,12 @@
 #endif  // CONFIG_VP8_ENCODER
 
 #if CONFIG_VP9_ENCODER
-const sad_m_by_n_fn_vp9_t sad_16x16_mmx_vp9 = vp9_sad16x16_mmx;
-const sad_m_by_n_fn_vp9_t sad_8x16_mmx_vp9 = vp9_sad8x16_mmx;
-const sad_m_by_n_fn_vp9_t sad_16x8_mmx_vp9 = vp9_sad16x8_mmx;
-const sad_m_by_n_fn_vp9_t sad_8x8_mmx_vp9 = vp9_sad8x8_mmx;
-const sad_m_by_n_fn_vp9_t sad_4x4_mmx_vp9 = vp9_sad4x4_mmx;
-const sad_m_by_n_test_param_vp9_t mmx_vp9_tests[] = {
+const SadMxNVp9Func sad_16x16_mmx_vp9 = vp9_sad16x16_mmx;
+const SadMxNVp9Func sad_8x16_mmx_vp9 = vp9_sad8x16_mmx;
+const SadMxNVp9Func sad_16x8_mmx_vp9 = vp9_sad16x8_mmx;
+const SadMxNVp9Func sad_8x8_mmx_vp9 = vp9_sad8x8_mmx;
+const SadMxNVp9Func sad_4x4_mmx_vp9 = vp9_sad4x4_mmx;
+const SadMxNVp9Param mmx_vp9_tests[] = {
   make_tuple(16, 16, sad_16x16_mmx_vp9),
   make_tuple(8, 16, sad_8x16_mmx_vp9),
   make_tuple(16, 8, sad_16x8_mmx_vp9),
@@ -525,14 +523,14 @@
 #if HAVE_SSE
 #if CONFIG_VP9_ENCODER
 #if CONFIG_USE_X86INC
-const sad_m_by_n_fn_vp9_t sad_4x4_sse_vp9 = vp9_sad4x4_sse;
-const sad_m_by_n_fn_vp9_t sad_4x8_sse_vp9 = vp9_sad4x8_sse;
+const SadMxNVp9Func sad_4x4_sse_vp9 = vp9_sad4x4_sse;
+const SadMxNVp9Func sad_4x8_sse_vp9 = vp9_sad4x8_sse;
 INSTANTIATE_TEST_CASE_P(SSE, SADVP9Test, ::testing::Values(
                         make_tuple(4, 4, sad_4x4_sse_vp9),
                         make_tuple(4, 8, sad_4x8_sse_vp9)));
 
-const sad_n_by_n_by_4_fn_t sad_4x8x4d_sse = vp9_sad4x8x4d_sse;
-const sad_n_by_n_by_4_fn_t sad_4x4x4d_sse = vp9_sad4x4x4d_sse;
+const SadMxNx4Func sad_4x8x4d_sse = vp9_sad4x8x4d_sse;
+const SadMxNx4Func sad_4x4x4d_sse = vp9_sad4x4x4d_sse;
 INSTANTIATE_TEST_CASE_P(SSE, SADx4Test, ::testing::Values(
                         make_tuple(4, 8, sad_4x8x4d_sse),
                         make_tuple(4, 4, sad_4x4x4d_sse)));
@@ -542,12 +540,12 @@
 
 #if HAVE_SSE2
 #if CONFIG_VP8_ENCODER
-const sad_m_by_n_fn_t sad_16x16_wmt = vp8_sad16x16_wmt;
-const sad_m_by_n_fn_t sad_8x16_wmt = vp8_sad8x16_wmt;
-const sad_m_by_n_fn_t sad_16x8_wmt = vp8_sad16x8_wmt;
-const sad_m_by_n_fn_t sad_8x8_wmt = vp8_sad8x8_wmt;
-const sad_m_by_n_fn_t sad_4x4_wmt = vp8_sad4x4_wmt;
-const sad_m_by_n_test_param_t sse2_tests[] = {
+const SadMxNFunc sad_16x16_wmt = vp8_sad16x16_wmt;
+const SadMxNFunc sad_8x16_wmt = vp8_sad8x16_wmt;
+const SadMxNFunc sad_16x8_wmt = vp8_sad16x8_wmt;
+const SadMxNFunc sad_8x8_wmt = vp8_sad8x8_wmt;
+const SadMxNFunc sad_4x4_wmt = vp8_sad4x4_wmt;
+const SadMxNParam sse2_tests[] = {
   make_tuple(16, 16, sad_16x16_wmt),
   make_tuple(8, 16, sad_8x16_wmt),
   make_tuple(16, 8, sad_16x8_wmt),
@@ -559,18 +557,18 @@
 
 #if CONFIG_VP9_ENCODER
 #if CONFIG_USE_X86INC
-const sad_m_by_n_fn_vp9_t sad_64x64_sse2_vp9 = vp9_sad64x64_sse2;
-const sad_m_by_n_fn_vp9_t sad_64x32_sse2_vp9 = vp9_sad64x32_sse2;
-const sad_m_by_n_fn_vp9_t sad_32x64_sse2_vp9 = vp9_sad32x64_sse2;
-const sad_m_by_n_fn_vp9_t sad_32x32_sse2_vp9 = vp9_sad32x32_sse2;
-const sad_m_by_n_fn_vp9_t sad_32x16_sse2_vp9 = vp9_sad32x16_sse2;
-const sad_m_by_n_fn_vp9_t sad_16x32_sse2_vp9 = vp9_sad16x32_sse2;
-const sad_m_by_n_fn_vp9_t sad_16x16_sse2_vp9 = vp9_sad16x16_sse2;
-const sad_m_by_n_fn_vp9_t sad_16x8_sse2_vp9 = vp9_sad16x8_sse2;
-const sad_m_by_n_fn_vp9_t sad_8x16_sse2_vp9 = vp9_sad8x16_sse2;
-const sad_m_by_n_fn_vp9_t sad_8x8_sse2_vp9 = vp9_sad8x8_sse2;
-const sad_m_by_n_fn_vp9_t sad_8x4_sse2_vp9 = vp9_sad8x4_sse2;
-const sad_m_by_n_test_param_vp9_t sse2_vp9_tests[] = {
+const SadMxNVp9Func sad_64x64_sse2_vp9 = vp9_sad64x64_sse2;
+const SadMxNVp9Func sad_64x32_sse2_vp9 = vp9_sad64x32_sse2;
+const SadMxNVp9Func sad_32x64_sse2_vp9 = vp9_sad32x64_sse2;
+const SadMxNVp9Func sad_32x32_sse2_vp9 = vp9_sad32x32_sse2;
+const SadMxNVp9Func sad_32x16_sse2_vp9 = vp9_sad32x16_sse2;
+const SadMxNVp9Func sad_16x32_sse2_vp9 = vp9_sad16x32_sse2;
+const SadMxNVp9Func sad_16x16_sse2_vp9 = vp9_sad16x16_sse2;
+const SadMxNVp9Func sad_16x8_sse2_vp9 = vp9_sad16x8_sse2;
+const SadMxNVp9Func sad_8x16_sse2_vp9 = vp9_sad8x16_sse2;
+const SadMxNVp9Func sad_8x8_sse2_vp9 = vp9_sad8x8_sse2;
+const SadMxNVp9Func sad_8x4_sse2_vp9 = vp9_sad8x4_sse2;
+const SadMxNVp9Param sse2_vp9_tests[] = {
   make_tuple(64, 64, sad_64x64_sse2_vp9),
   make_tuple(64, 32, sad_64x32_sse2_vp9),
   make_tuple(32, 64, sad_32x64_sse2_vp9),
@@ -585,17 +583,17 @@
 };
 INSTANTIATE_TEST_CASE_P(SSE2, SADVP9Test, ::testing::ValuesIn(sse2_vp9_tests));
 
-const sad_n_by_n_by_4_fn_t sad_64x64x4d_sse2 = vp9_sad64x64x4d_sse2;
-const sad_n_by_n_by_4_fn_t sad_64x32x4d_sse2 = vp9_sad64x32x4d_sse2;
-const sad_n_by_n_by_4_fn_t sad_32x64x4d_sse2 = vp9_sad32x64x4d_sse2;
-const sad_n_by_n_by_4_fn_t sad_32x32x4d_sse2 = vp9_sad32x32x4d_sse2;
-const sad_n_by_n_by_4_fn_t sad_32x16x4d_sse2 = vp9_sad32x16x4d_sse2;
-const sad_n_by_n_by_4_fn_t sad_16x32x4d_sse2 = vp9_sad16x32x4d_sse2;
-const sad_n_by_n_by_4_fn_t sad_16x16x4d_sse2 = vp9_sad16x16x4d_sse2;
-const sad_n_by_n_by_4_fn_t sad_16x8x4d_sse2 = vp9_sad16x8x4d_sse2;
-const sad_n_by_n_by_4_fn_t sad_8x16x4d_sse2 = vp9_sad8x16x4d_sse2;
-const sad_n_by_n_by_4_fn_t sad_8x8x4d_sse2 = vp9_sad8x8x4d_sse2;
-const sad_n_by_n_by_4_fn_t sad_8x4x4d_sse2 = vp9_sad8x4x4d_sse2;
+const SadMxNx4Func sad_64x64x4d_sse2 = vp9_sad64x64x4d_sse2;
+const SadMxNx4Func sad_64x32x4d_sse2 = vp9_sad64x32x4d_sse2;
+const SadMxNx4Func sad_32x64x4d_sse2 = vp9_sad32x64x4d_sse2;
+const SadMxNx4Func sad_32x32x4d_sse2 = vp9_sad32x32x4d_sse2;
+const SadMxNx4Func sad_32x16x4d_sse2 = vp9_sad32x16x4d_sse2;
+const SadMxNx4Func sad_16x32x4d_sse2 = vp9_sad16x32x4d_sse2;
+const SadMxNx4Func sad_16x16x4d_sse2 = vp9_sad16x16x4d_sse2;
+const SadMxNx4Func sad_16x8x4d_sse2 = vp9_sad16x8x4d_sse2;
+const SadMxNx4Func sad_8x16x4d_sse2 = vp9_sad8x16x4d_sse2;
+const SadMxNx4Func sad_8x8x4d_sse2 = vp9_sad8x8x4d_sse2;
+const SadMxNx4Func sad_8x4x4d_sse2 = vp9_sad8x4x4d_sse2;
 INSTANTIATE_TEST_CASE_P(SSE2, SADx4Test, ::testing::Values(
                         make_tuple(64, 64, sad_64x64x4d_sse2),
                         make_tuple(64, 32, sad_64x32x4d_sse2),
@@ -614,11 +612,11 @@
 
 #if HAVE_SSE3
 #if CONFIG_VP8_ENCODER
-const sad_n_by_n_by_4_fn_t sad_16x16x4d_sse3 = vp8_sad16x16x4d_sse3;
-const sad_n_by_n_by_4_fn_t sad_16x8x4d_sse3 = vp8_sad16x8x4d_sse3;
-const sad_n_by_n_by_4_fn_t sad_8x16x4d_sse3 = vp8_sad8x16x4d_sse3;
-const sad_n_by_n_by_4_fn_t sad_8x8x4d_sse3 = vp8_sad8x8x4d_sse3;
-const sad_n_by_n_by_4_fn_t sad_4x4x4d_sse3 = vp8_sad4x4x4d_sse3;
+const SadMxNx4Func sad_16x16x4d_sse3 = vp8_sad16x16x4d_sse3;
+const SadMxNx4Func sad_16x8x4d_sse3 = vp8_sad16x8x4d_sse3;
+const SadMxNx4Func sad_8x16x4d_sse3 = vp8_sad8x16x4d_sse3;
+const SadMxNx4Func sad_8x8x4d_sse3 = vp8_sad8x8x4d_sse3;
+const SadMxNx4Func sad_4x4x4d_sse3 = vp8_sad4x4x4d_sse3;
 INSTANTIATE_TEST_CASE_P(SSE3, SADx4Test, ::testing::Values(
                         make_tuple(16, 16, sad_16x16x4d_sse3),
                         make_tuple(16, 8, sad_16x8x4d_sse3),
@@ -631,7 +629,7 @@
 #if HAVE_SSSE3
 #if CONFIG_USE_X86INC
 #if CONFIG_VP8_ENCODER
-const sad_m_by_n_fn_t sad_16x16_sse3 = vp8_sad16x16_sse3;
+const SadMxNFunc sad_16x16_sse3 = vp8_sad16x16_sse3;
 INSTANTIATE_TEST_CASE_P(SSE3, SADTest, ::testing::Values(
                         make_tuple(16, 16, sad_16x16_sse3)));
 #endif  // CONFIG_VP8_ENCODER
@@ -650,8 +648,8 @@
                           const uint8_t *const ref_ptr[], int ref_stride,
                           unsigned int *sad_array);
 }
-const sad_n_by_n_by_4_fn_t sad_64x64x4d_avx2 = vp9_sad64x64x4d_avx2;
-const sad_n_by_n_by_4_fn_t sad_32x32x4d_avx2 = vp9_sad32x32x4d_avx2;
+const SadMxNx4Func sad_64x64x4d_avx2 = vp9_sad64x64x4d_avx2;
+const SadMxNx4Func sad_32x32x4d_avx2 = vp9_sad32x32x4d_avx2;
 INSTANTIATE_TEST_CASE_P(DISABLED_AVX2, SADx4Test, ::testing::Values(
                         make_tuple(32, 32, sad_32x32x4d_avx2),
                         make_tuple(64, 64, sad_64x64x4d_avx2)));
diff --git a/test/sixtap_predict_test.cc b/test/sixtap_predict_test.cc
index ac7aa99..1e6d915 100644
--- a/test/sixtap_predict_test.cc
+++ b/test/sixtap_predict_test.cc
@@ -23,17 +23,17 @@
 
 namespace {
 
-typedef void (*sixtap_predict_fn_t)(uint8_t *src_ptr,
-                                    int  src_pixels_per_line,
-                                    int  xoffset,
-                                    int  yoffset,
-                                    uint8_t *dst_ptr,
-                                    int  dst_pitch);
+typedef void (*SixtapPredictFunc)(uint8_t *src_ptr,
+                                  int src_pixels_per_line,
+                                  int xoffset,
+                                  int yoffset,
+                                  uint8_t *dst_ptr,
+                                  int dst_pitch);
 
-typedef std::tr1::tuple<int, int, sixtap_predict_fn_t> sixtap_predict_param_t;
+typedef std::tr1::tuple<int, int, SixtapPredictFunc> SixtapPredictParam;
 
 class SixtapPredictTest
-    : public ::testing::TestWithParam<sixtap_predict_param_t> {
+    : public ::testing::TestWithParam<SixtapPredictParam> {
  public:
   static void SetUpTestCase() {
     src_ = reinterpret_cast<uint8_t*>(vpx_memalign(kDataAlignment, kSrcSize));
@@ -74,7 +74,7 @@
 
   int width_;
   int height_;
-  sixtap_predict_fn_t sixtap_predict_;
+  SixtapPredictFunc sixtap_predict_;
   // The src stores the macroblock we will filter on, and makes it 1 byte larger
   // in order to test unaligned access. The result is stored in dst and dst_c(c
   // reference code result).
@@ -184,10 +184,10 @@
 
 using std::tr1::make_tuple;
 
-const sixtap_predict_fn_t sixtap_16x16_c = vp8_sixtap_predict16x16_c;
-const sixtap_predict_fn_t sixtap_8x8_c = vp8_sixtap_predict8x8_c;
-const sixtap_predict_fn_t sixtap_8x4_c = vp8_sixtap_predict8x4_c;
-const sixtap_predict_fn_t sixtap_4x4_c = vp8_sixtap_predict4x4_c;
+const SixtapPredictFunc sixtap_16x16_c = vp8_sixtap_predict16x16_c;
+const SixtapPredictFunc sixtap_8x8_c = vp8_sixtap_predict8x8_c;
+const SixtapPredictFunc sixtap_8x4_c = vp8_sixtap_predict8x4_c;
+const SixtapPredictFunc sixtap_4x4_c = vp8_sixtap_predict4x4_c;
 INSTANTIATE_TEST_CASE_P(
     C, SixtapPredictTest, ::testing::Values(
         make_tuple(16, 16, sixtap_16x16_c),
@@ -195,9 +195,9 @@
         make_tuple(8, 4, sixtap_8x4_c),
         make_tuple(4, 4, sixtap_4x4_c)));
 #if HAVE_NEON
-const sixtap_predict_fn_t sixtap_16x16_neon = vp8_sixtap_predict16x16_neon;
-const sixtap_predict_fn_t sixtap_8x8_neon = vp8_sixtap_predict8x8_neon;
-const sixtap_predict_fn_t sixtap_8x4_neon = vp8_sixtap_predict8x4_neon;
+const SixtapPredictFunc sixtap_16x16_neon = vp8_sixtap_predict16x16_neon;
+const SixtapPredictFunc sixtap_8x8_neon = vp8_sixtap_predict8x8_neon;
+const SixtapPredictFunc sixtap_8x4_neon = vp8_sixtap_predict8x4_neon;
 INSTANTIATE_TEST_CASE_P(
     DISABLED_NEON, SixtapPredictTest, ::testing::Values(
         make_tuple(16, 16, sixtap_16x16_neon),
@@ -205,10 +205,10 @@
         make_tuple(8, 4, sixtap_8x4_neon)));
 #endif
 #if HAVE_MMX
-const sixtap_predict_fn_t sixtap_16x16_mmx = vp8_sixtap_predict16x16_mmx;
-const sixtap_predict_fn_t sixtap_8x8_mmx = vp8_sixtap_predict8x8_mmx;
-const sixtap_predict_fn_t sixtap_8x4_mmx = vp8_sixtap_predict8x4_mmx;
-const sixtap_predict_fn_t sixtap_4x4_mmx = vp8_sixtap_predict4x4_mmx;
+const SixtapPredictFunc sixtap_16x16_mmx = vp8_sixtap_predict16x16_mmx;
+const SixtapPredictFunc sixtap_8x8_mmx = vp8_sixtap_predict8x8_mmx;
+const SixtapPredictFunc sixtap_8x4_mmx = vp8_sixtap_predict8x4_mmx;
+const SixtapPredictFunc sixtap_4x4_mmx = vp8_sixtap_predict4x4_mmx;
 INSTANTIATE_TEST_CASE_P(
     MMX, SixtapPredictTest, ::testing::Values(
         make_tuple(16, 16, sixtap_16x16_mmx),
@@ -217,9 +217,9 @@
         make_tuple(4, 4, sixtap_4x4_mmx)));
 #endif
 #if HAVE_SSE2
-const sixtap_predict_fn_t sixtap_16x16_sse2 = vp8_sixtap_predict16x16_sse2;
-const sixtap_predict_fn_t sixtap_8x8_sse2 = vp8_sixtap_predict8x8_sse2;
-const sixtap_predict_fn_t sixtap_8x4_sse2 = vp8_sixtap_predict8x4_sse2;
+const SixtapPredictFunc sixtap_16x16_sse2 = vp8_sixtap_predict16x16_sse2;
+const SixtapPredictFunc sixtap_8x8_sse2 = vp8_sixtap_predict8x8_sse2;
+const SixtapPredictFunc sixtap_8x4_sse2 = vp8_sixtap_predict8x4_sse2;
 INSTANTIATE_TEST_CASE_P(
     SSE2, SixtapPredictTest, ::testing::Values(
         make_tuple(16, 16, sixtap_16x16_sse2),
@@ -227,10 +227,10 @@
         make_tuple(8, 4, sixtap_8x4_sse2)));
 #endif
 #if HAVE_SSSE3
-const sixtap_predict_fn_t sixtap_16x16_ssse3 = vp8_sixtap_predict16x16_ssse3;
-const sixtap_predict_fn_t sixtap_8x8_ssse3 = vp8_sixtap_predict8x8_ssse3;
-const sixtap_predict_fn_t sixtap_8x4_ssse3 = vp8_sixtap_predict8x4_ssse3;
-const sixtap_predict_fn_t sixtap_4x4_ssse3 = vp8_sixtap_predict4x4_ssse3;
+const SixtapPredictFunc sixtap_16x16_ssse3 = vp8_sixtap_predict16x16_ssse3;
+const SixtapPredictFunc sixtap_8x8_ssse3 = vp8_sixtap_predict8x8_ssse3;
+const SixtapPredictFunc sixtap_8x4_ssse3 = vp8_sixtap_predict8x4_ssse3;
+const SixtapPredictFunc sixtap_4x4_ssse3 = vp8_sixtap_predict4x4_ssse3;
 INSTANTIATE_TEST_CASE_P(
     SSSE3, SixtapPredictTest, ::testing::Values(
         make_tuple(16, 16, sixtap_16x16_ssse3),
diff --git a/test/subtract_test.cc b/test/subtract_test.cc
index 2db3dd7..6619fb1 100644
--- a/test/subtract_test.cc
+++ b/test/subtract_test.cc
@@ -18,11 +18,11 @@
 #include "vp8/encoder/block.h"
 #include "vpx_mem/vpx_mem.h"
 
-typedef void (*subtract_b_fn_t)(BLOCK *be, BLOCKD *bd, int pitch);
+typedef void (*SubtractBlockFunc)(BLOCK *be, BLOCKD *bd, int pitch);
 
 namespace {
 
-class SubtractBlockTest : public ::testing::TestWithParam<subtract_b_fn_t> {
+class SubtractBlockTest : public ::testing::TestWithParam<SubtractBlockFunc> {
  public:
   virtual void TearDown() {
     libvpx_test::ClearSystemState();
diff --git a/test/video_source.h b/test/video_source.h
index 94500b4..78e7d46 100644
--- a/test/video_source.h
+++ b/test/video_source.h
@@ -10,6 +10,9 @@
 #ifndef TEST_VIDEO_SOURCE_H_
 #define TEST_VIDEO_SOURCE_H_
 
+#if defined(_WIN32)
+#include <windows.h>
+#endif
 #include <cstdio>
 #include <cstdlib>
 #include <string>
@@ -55,10 +58,70 @@
   return fopen(path_to_source.c_str(), "wb");
 }
 
-static FILE *OpenTempOutFile() {
-  return tmpfile();
+static std::string GetTempOutFilename() {
+  std::string basename;
+#if defined(_WIN32)
+  char fname[MAX_PATH];
+  // Assume for now that the filename generated is unique per process
+  const UINT ret = GetTempFileNameA(
+      GetDataPath().c_str(), "lvx", 0, fname);
+  if (ret != 0) {
+    const char *slash = strrchr(fname, '\\');
+    if (slash == NULL) slash = strrchr(fname, '/');
+    if (slash == NULL)
+      basename.assign(fname);
+    else
+      basename.assign(slash + 1);
+  } else {
+    basename.clear();
+  }
+#else
+  char fname[256];
+  const std::string templ = GetDataPath() + "/libvpx_test_XXXXXX";
+  strncpy(fname, templ.c_str(), templ.size());
+  fname[templ.size()] = '\0';
+  const int fd = mkstemp(fname);
+  if (fd != -1) {
+    close(fd);
+    basename.assign(strrchr(fname, '/') + 1);
+  } else {
+    basename.clear();
+  }
+#endif
+  return basename;
 }
 
+class TempOutFile {
+ public:
+  TempOutFile() {
+    file_name_ = GetTempOutFilename();
+    file_ = OpenTestOutFile(file_name_);
+  }
+  ~TempOutFile() {
+    CloseFile();
+    if (!file_name_.empty()) {
+      const std::string path_to_source = GetDataPath() + "/" + file_name_;
+      EXPECT_EQ(0, remove(path_to_source.c_str()));
+    }
+  }
+  FILE *file() {
+    return file_;
+  }
+  const std::string& file_name() {
+    return file_name_;
+  }
+  void CloseFile() {
+    if (file_) {
+      fclose(file_);
+      file_ = NULL;
+    }
+  }
+
+ protected:
+  FILE *file_;
+  std::string file_name_;
+};
+
 // Abstract base class for test video sources, which provide a stream of
 // vpx_image_t images with associated timestamps and duration.
 class VideoSource {
diff --git a/test/vp9_subtract_test.cc b/test/vp9_subtract_test.cc
index d7df286..2e96763 100644
--- a/test/vp9_subtract_test.cc
+++ b/test/vp9_subtract_test.cc
@@ -17,14 +17,14 @@
 #include "vp9/common/vp9_blockd.h"
 #include "vpx_mem/vpx_mem.h"
 
-typedef void (*subtract_fn_t)(int rows, int cols,
-                              int16_t *diff_ptr, ptrdiff_t diff_stride,
-                              const uint8_t *src_ptr, ptrdiff_t src_stride,
-                              const uint8_t *pred_ptr, ptrdiff_t pred_stride);
+typedef void (*SubtractFunc)(int rows, int cols,
+                             int16_t *diff_ptr, ptrdiff_t diff_stride,
+                             const uint8_t *src_ptr, ptrdiff_t src_stride,
+                             const uint8_t *pred_ptr, ptrdiff_t pred_stride);
 
 namespace vp9 {
 
-class VP9SubtractBlockTest : public ::testing::TestWithParam<subtract_fn_t> {
+class VP9SubtractBlockTest : public ::testing::TestWithParam<SubtractFunc> {
  public:
   virtual void TearDown() {
     libvpx_test::ClearSystemState();
diff --git a/test/y4m_test.cc b/test/y4m_test.cc
index 73ff683..060f8c4 100644
--- a/test/y4m_test.cc
+++ b/test/y4m_test.cc
@@ -24,14 +24,14 @@
 static const unsigned int kHeight = 90;
 static const unsigned int kFrames = 10;
 
-typedef struct {
+struct Y4mTestParam {
   const char *filename;
   unsigned int bit_depth;
   vpx_img_fmt format;
   const char *md5raw;
-} test_entry_type;
+};
 
-const test_entry_type kY4mTestVectors[] = {
+const Y4mTestParam kY4mTestVectors[] = {
   {"park_joy_90p_8_420.y4m", 8, VPX_IMG_FMT_I420,
     "e5406275b9fc6bb3436c31d4a05c1cab"},
   {"park_joy_90p_8_422.y4m", 8, VPX_IMG_FMT_I422,
@@ -70,7 +70,7 @@
 }
 
 class Y4mVideoSourceTest
-    : public ::testing::TestWithParam<test_entry_type>,
+    : public ::testing::TestWithParam<Y4mTestParam>,
       public ::libvpx_test::Y4mVideoSource {
  protected:
   Y4mVideoSourceTest() : Y4mVideoSource("", 0, 0) {}
@@ -126,7 +126,7 @@
 };
 
 TEST_P(Y4mVideoSourceTest, SourceTest) {
-  const test_entry_type t = GetParam();
+  const Y4mTestParam t = GetParam();
   Init(t.filename, kFrames);
   HeaderChecks(t.bit_depth, t.format);
   Md5Check(t.md5raw);
@@ -138,14 +138,11 @@
 class Y4mVideoWriteTest
     : public Y4mVideoSourceTest {
  protected:
-  Y4mVideoWriteTest() : Y4mVideoSourceTest() {}
+  Y4mVideoWriteTest() {}
 
-  virtual void ReplaceInputFp(FILE *input_file) {
+  virtual ~Y4mVideoWriteTest() {
     CloseSource();
-    frame_ = 0;
-    input_file_ = input_file;
-    rewind(input_file_);
-    ReadSourceToStart();
+    delete tmpfile_;
   }
 
   // Writes out a y4m file and then reads it back
@@ -153,30 +150,32 @@
     ASSERT_TRUE(input_file_ != NULL);
     char buf[Y4M_BUFFER_SIZE] = {0};
     const struct VpxRational framerate = {y4m_.fps_n, y4m_.fps_d};
-    FILE *out_file = libvpx_test::OpenTempOutFile();
-    ASSERT_TRUE(out_file != NULL);
+    tmpfile_ = new libvpx_test::TempOutFile;
+    ASSERT_TRUE(tmpfile_->file() != NULL);
     y4m_write_file_header(buf, sizeof(buf),
                           kWidth, kHeight,
                           &framerate, y4m_.vpx_fmt,
                           y4m_.bit_depth);
-    fputs(buf, out_file);
+    fputs(buf, tmpfile_->file());
     for (unsigned int i = start_; i < limit_; i++) {
       y4m_write_frame_header(buf, sizeof(buf));
-      fputs(buf, out_file);
-      write_image_file(img(), out_file);
+      fputs(buf, tmpfile_->file());
+      write_image_file(img(), tmpfile_->file());
       Next();
     }
-    ReplaceInputFp(out_file);
+    tmpfile_->CloseFile();
+    Y4mVideoSourceTest::Init(tmpfile_->file_name(), limit_);
   }
 
   virtual void Init(const std::string &file_name, int limit) {
     Y4mVideoSourceTest::Init(file_name, limit);
     WriteY4mAndReadBack();
   }
+  libvpx_test::TempOutFile *tmpfile_;
 };
 
 TEST_P(Y4mVideoWriteTest, WriteTest) {
-  const test_entry_type t = GetParam();
+  const Y4mTestParam t = GetParam();
   Init(t.filename, kFrames);
   HeaderChecks(t.bit_depth, t.format);
   Md5Check(t.md5raw);
diff --git a/vp8/common/rtcd_defs.pl b/vp8/common/rtcd_defs.pl
index f587079..fd9afd2 100644
--- a/vp8/common/rtcd_defs.pl
+++ b/vp8/common/rtcd_defs.pl
@@ -220,7 +220,8 @@
 $vp8_sixtap_predict8x4_dspr2=vp8_sixtap_predict8x4_dspr2;
 
 add_proto qw/void vp8_sixtap_predict4x4/, "unsigned char *src, int src_pitch, int xofst, int yofst, unsigned char *dst, int dst_pitch";
-specialize qw/vp8_sixtap_predict4x4 mmx ssse3 media neon dspr2/;
+# Disable neon while investigating https://code.google.com/p/webm/issues/detail?id=817
+specialize qw/vp8_sixtap_predict4x4 mmx ssse3 media dspr2/;
 $vp8_sixtap_predict4x4_media=vp8_sixtap_predict4x4_armv6;
 $vp8_sixtap_predict4x4_dspr2=vp8_sixtap_predict4x4_dspr2;
 
diff --git a/vp9/decoder/vp9_decodeframe.c b/vp9/decoder/vp9_decodeframe.c
index 03b4df5..614bf4b 100644
--- a/vp9/decoder/vp9_decodeframe.c
+++ b/vp9/decoder/vp9_decodeframe.c
@@ -621,6 +621,11 @@
 }
 
 static void resize_context_buffers(VP9_COMMON *cm, int width, int height) {
+#if CONFIG_SIZE_LIMIT
+  if (width > DECODE_WIDTH_LIMIT || height > DECODE_HEIGHT_LIMIT)
+    vpx_internal_error(&cm->error, VPX_CODEC_CORRUPT_FRAME,
+                       "Width and height beyond allowed size.");
+#endif
   if (cm->width != width || cm->height != height) {
     // Change in frame size (assumption: color format does not change).
     if (cm->width == 0 || cm->height == 0 ||
diff --git a/y4menc.c b/y4menc.c
index 9211452..b647e8d 100644
--- a/y4menc.c
+++ b/y4menc.c
@@ -48,6 +48,7 @@
               "C420p16 XYSCSS=420P16\n";
       break;
     default:
+      color = NULL;
       assert(0);
   }
   return snprintf(buf, len, "YUV4MPEG2 W%u H%u F%u:%u I%c %s", width, height,