Merge "Rd fixes and cleanups" into nextgenv2
diff --git a/aom_dsp/x86/variance_impl_avx2.c b/aom_dsp/x86/variance_impl_avx2.c
index e9f312d..ebded7e 100644
--- a/aom_dsp/x86/variance_impl_avx2.c
+++ b/aom_dsp/x86/variance_impl_avx2.c
@@ -16,22 +16,22 @@
 
 /* clang-format off */
 DECLARE_ALIGNED(32, static const uint8_t, bilinear_filters_avx2[512]) = {
-  16, 0, 16, 0, 16, 0, 16, 0, 16, 0, 16, 0, 16, 0, 16, 0,
-  16, 0, 16, 0, 16, 0, 16, 0, 16, 0, 16, 0, 16, 0, 16, 0,
-  14, 2, 14, 2, 14, 2, 14, 2, 14, 2, 14, 2, 14, 2, 14, 2,
-  14, 2, 14, 2, 14, 2, 14, 2, 14, 2, 14, 2, 14, 2, 14, 2,
-  12, 4, 12, 4, 12, 4, 12, 4, 12, 4, 12, 4, 12, 4, 12, 4,
-  12, 4, 12, 4, 12, 4, 12, 4, 12, 4, 12, 4, 12, 4, 12, 4,
-  10, 6, 10, 6, 10, 6, 10, 6, 10, 6, 10, 6, 10, 6, 10, 6,
-  10, 6, 10, 6, 10, 6, 10, 6, 10, 6, 10, 6, 10, 6, 10, 6,
-  8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8,
-  8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8,
-  6, 10, 6, 10, 6, 10, 6, 10, 6, 10, 6, 10, 6, 10, 6, 10,
-  6, 10, 6, 10, 6, 10, 6, 10, 6, 10, 6, 10, 6, 10, 6, 10,
-  4, 12, 4, 12, 4, 12, 4, 12, 4, 12, 4, 12, 4, 12, 4, 12,
-  4, 12, 4, 12, 4, 12, 4, 12, 4, 12, 4, 12, 4, 12, 4, 12,
-  2, 14, 2, 14, 2, 14, 2, 14, 2, 14, 2, 14, 2, 14, 2, 14,
-  2, 14, 2, 14, 2, 14, 2, 14, 2, 14, 2, 14, 2, 14, 2, 14,
+  16,  0, 16,  0, 16,  0, 16,  0, 16,  0, 16,  0, 16,  0, 16,  0,
+  16,  0, 16,  0, 16,  0, 16,  0, 16,  0, 16,  0, 16,  0, 16,  0,
+  14,  2, 14,  2, 14,  2, 14,  2, 14,  2, 14,  2, 14,  2, 14,  2,
+  14,  2, 14,  2, 14,  2, 14,  2, 14,  2, 14,  2, 14,  2, 14,  2,
+  12,  4, 12,  4, 12,  4, 12,  4, 12,  4, 12,  4, 12,  4, 12,  4,
+  12,  4, 12,  4, 12,  4, 12,  4, 12,  4, 12,  4, 12,  4, 12,  4,
+  10,  6, 10,  6, 10,  6, 10,  6, 10,  6, 10,  6, 10,  6, 10,  6,
+  10,  6, 10,  6, 10,  6, 10,  6, 10,  6, 10,  6, 10,  6, 10,  6,
+   8,  8,  8,  8,  8,  8,  8,  8,  8,  8,  8,  8,  8,  8,  8,  8,
+   8,  8,  8,  8,  8,  8,  8,  8,  8,  8,  8,  8,  8,  8,  8,  8,
+   6, 10,  6, 10,  6, 10,  6, 10,  6, 10,  6, 10,  6, 10,  6, 10,
+   6, 10,  6, 10,  6, 10,  6, 10,  6, 10,  6, 10,  6, 10,  6, 10,
+   4, 12,  4, 12,  4, 12,  4, 12,  4, 12,  4, 12,  4, 12,  4, 12,
+   4, 12,  4, 12,  4, 12,  4, 12,  4, 12,  4, 12,  4, 12,  4, 12,
+   2, 14,  2, 14,  2, 14,  2, 14,  2, 14,  2, 14,  2, 14,  2, 14,
+   2, 14,  2, 14,  2, 14,  2, 14,  2, 14,  2, 14,  2, 14,  2, 14,
 };
 /* clang-format on */
 
diff --git a/aom_mem/aom_mem.c b/aom_mem/aom_mem.c
index 144085f..4514fb5 100644
--- a/aom_mem/aom_mem.c
+++ b/aom_mem/aom_mem.c
@@ -42,7 +42,7 @@
   const size_t aligned_size = GetAlignedMallocSize(size, align);
   void *const addr = malloc(aligned_size);
   if (addr) {
-    x = align_addr((unsigned char *)addr + ADDRESS_STORAGE_SIZE, (int)align);
+    x = align_addr((unsigned char *)addr + ADDRESS_STORAGE_SIZE, align);
     SetActualMallocAddress(x, addr);
   }
   return x;
diff --git a/aom_mem/include/aom_mem_intrnl.h b/aom_mem/include/aom_mem_intrnl.h
index 2e96fa4..3cdfbe0 100644
--- a/aom_mem/include/aom_mem_intrnl.h
+++ b/aom_mem/include/aom_mem_intrnl.h
@@ -27,6 +27,6 @@
 
 /*returns an addr aligned to the byte boundary specified by align*/
 #define align_addr(addr, align) \
-  (void *)(((size_t)(addr) + ((align)-1)) & (size_t) - (align))
+  (void *)(((size_t)(addr) + ((align)-1)) & ~(size_t)((align)-1))
 
 #endif  // AOM_MEM_INCLUDE_AOM_MEM_INTRNL_H_
diff --git a/av1/av1_common.mk b/av1/av1_common.mk
index 1fd39bc..cd3e1d1 100644
--- a/av1/av1_common.mk
+++ b/av1/av1_common.mk
@@ -62,8 +62,9 @@
 AV1_COMMON_SRCS-yes += common/common_data.h
 AV1_COMMON_SRCS-yes += common/scan.c
 AV1_COMMON_SRCS-yes += common/scan.h
-AV1_COMMON_SRCS-yes += common/av1_fwd_txfm.h
-AV1_COMMON_SRCS-yes += common/av1_fwd_txfm.c
+# TODO(angiebird) the forward transform belongs under encoder/
+AV1_COMMON_SRCS-$(CONFIG_AV1_ENCODER) += common/av1_fwd_txfm.h
+AV1_COMMON_SRCS-$(CONFIG_AV1_ENCODER) += common/av1_fwd_txfm.c
 AV1_COMMON_SRCS-yes += common/av1_txfm.h
 AV1_COMMON_SRCS-yes += common/av1_fwd_txfm1d.h
 AV1_COMMON_SRCS-yes += common/av1_fwd_txfm1d.c
@@ -113,13 +114,14 @@
 AV1_COMMON_SRCS-$(HAVE_MSA) += common/mips/msa/idct16x16_msa.c
 
 AV1_COMMON_SRCS-$(HAVE_SSE2) += common/x86/idct_intrin_sse2.c
+ifeq ($(CONFIG_AV1_ENCODER),yes)
 AV1_COMMON_SRCS-$(HAVE_SSE2) += common/x86/av1_fwd_txfm_sse2.c
 AV1_COMMON_SRCS-$(HAVE_SSE2) += common/x86/av1_fwd_dct32x32_impl_sse2.h
 AV1_COMMON_SRCS-$(HAVE_SSE2) += common/x86/av1_fwd_txfm_impl_sse2.h
 AV1_COMMON_SRCS-$(HAVE_SSE4_1) += common/x86/av1_txfm1d_sse4.h
 AV1_COMMON_SRCS-$(HAVE_SSE4_1) += common/x86/av1_fwd_txfm1d_sse4.c
 AV1_COMMON_SRCS-$(HAVE_SSE4_1) += common/x86/av1_fwd_txfm2d_sse4.c
-
+endif
 ifeq ($(CONFIG_AOM_HIGHBITDEPTH),yes)
 AV1_COMMON_SRCS-$(HAVE_SSE4_1) += common/x86/highbd_txfm_utility_sse4.h
 endif
diff --git a/av1/common/av1_convolve.c b/av1/common/av1_convolve.c
index dec6759..1f8d623 100644
--- a/av1/common/av1_convolve.c
+++ b/av1/common/av1_convolve.c
@@ -96,9 +96,9 @@
 void av1_convolve(const uint8_t *src, int src_stride, uint8_t *dst,
                   int dst_stride, int w, int h,
 #if CONFIG_DUAL_FILTER
-                  const INTERP_FILTER *interp_filter,
+                  const InterpFilter *interp_filter,
 #else
-                  const INTERP_FILTER interp_filter,
+                  const InterpFilter interp_filter,
 #endif
                   const int subpel_x_q4, int x_step_q4, const int subpel_y_q4,
                   int y_step_q4, int ref_idx) {
@@ -270,9 +270,9 @@
 void av1_highbd_convolve(const uint8_t *src8, int src_stride, uint8_t *dst8,
                          int dst_stride, int w, int h,
 #if CONFIG_DUAL_FILTER
-                         const INTERP_FILTER *interp_filter,
+                         const InterpFilter *interp_filter,
 #else
-                         const INTERP_FILTER interp_filter,
+                         const InterpFilter interp_filter,
 #endif
                          const int subpel_x_q4, int x_step_q4,
                          const int subpel_y_q4, int y_step_q4, int ref_idx,
diff --git a/av1/common/av1_convolve.h b/av1/common/av1_convolve.h
index f082a8a..804c102 100644
--- a/av1/common/av1_convolve.h
+++ b/av1/common/av1_convolve.h
@@ -9,9 +9,9 @@
 void av1_convolve(const uint8_t *src, int src_stride, uint8_t *dst,
                   int dst_stride, int w, int h,
 #if CONFIG_DUAL_FILTER
-                  const INTERP_FILTER *interp_filter,
+                  const InterpFilter *interp_filter,
 #else
-                  const INTERP_FILTER interp_filter,
+                  const InterpFilter interp_filter,
 #endif
                   const int subpel_x, int xstep, const int subpel_y, int ystep,
                   int avg);
@@ -20,9 +20,9 @@
 void av1_highbd_convolve(const uint8_t *src, int src_stride, uint8_t *dst,
                          int dst_stride, int w, int h,
 #if CONFIG_DUAL_FILTER
-                         const INTERP_FILTER *interp_filter,
+                         const InterpFilter *interp_filter,
 #else
-                         const INTERP_FILTER interp_filter,
+                         const InterpFilter interp_filter,
 #endif
                          const int subpel_x, int xstep, const int subpel_y,
                          int ystep, int avg, int bd);
diff --git a/av1/common/av1_rtcd_defs.pl b/av1/common/av1_rtcd_defs.pl
index c1b0f9e..3e00367 100644
--- a/av1/common/av1_rtcd_defs.pl
+++ b/av1/common/av1_rtcd_defs.pl
@@ -83,57 +83,6 @@
 
     add_proto qw/void av1_iht16x16_256_add/, "const tran_low_t *input, uint8_t *output, int pitch, int tx_type";
     specialize qw/av1_iht16x16_256_add/;
-
-    add_proto qw/void av1_fdct4x4/, "const int16_t *input, tran_low_t *output, int stride";
-    specialize qw/av1_fdct4x4/;
-
-    add_proto qw/void av1_fdct4x4_1/, "const int16_t *input, tran_low_t *output, int stride";
-    specialize qw/av1_fdct4x4_1/;
-
-    add_proto qw/void av1_fdct8x8/, "const int16_t *input, tran_low_t *output, int stride";
-    specialize qw/av1_fdct8x8/;
-
-    add_proto qw/void av1_fdct8x8_1/, "const int16_t *input, tran_low_t *output, int stride";
-    specialize qw/av1_fdct8x8_1/;
-
-    add_proto qw/void av1_fdct16x16/, "const int16_t *input, tran_low_t *output, int stride";
-    specialize qw/av1_fdct16x16/;
-
-    add_proto qw/void av1_fdct16x16_1/, "const int16_t *input, tran_low_t *output, int stride";
-    specialize qw/av1_fdct16x16_1/;
-
-    add_proto qw/void av1_fdct32x32/, "const int16_t *input, tran_low_t *output, int stride";
-    specialize qw/av1_fdct32x32/;
-
-    add_proto qw/void av1_fdct32x32_rd/, "const int16_t *input, tran_low_t *output, int stride";
-    specialize qw/av1_fdct32x32_rd/;
-
-    add_proto qw/void av1_fdct32x32_1/, "const int16_t *input, tran_low_t *output, int stride";
-    specialize qw/av1_fdct32x32_1/;
-
-    add_proto qw/void av1_highbd_fdct4x4/, "const int16_t *input, tran_low_t *output, int stride";
-    specialize qw/av1_highbd_fdct4x4/;
-
-    add_proto qw/void av1_highbd_fdct8x8/, "const int16_t *input, tran_low_t *output, int stride";
-    specialize qw/av1_highbd_fdct8x8/;
-
-    add_proto qw/void av1_highbd_fdct8x8_1/, "const int16_t *input, tran_low_t *output, int stride";
-    specialize qw/av1_highbd_fdct8x8_1/;
-
-    add_proto qw/void av1_highbd_fdct16x16/, "const int16_t *input, tran_low_t *output, int stride";
-    specialize qw/av1_highbd_fdct16x16/;
-
-    add_proto qw/void av1_highbd_fdct16x16_1/, "const int16_t *input, tran_low_t *output, int stride";
-    specialize qw/av1_highbd_fdct16x16_1/;
-
-    add_proto qw/void av1_highbd_fdct32x32/, "const int16_t *input, tran_low_t *output, int stride";
-    specialize qw/av1_highbd_fdct32x32/;
-
-    add_proto qw/void av1_highbd_fdct32x32_rd/, "const int16_t *input, tran_low_t *output, int stride";
-    specialize qw/av1_highbd_fdct32x32_rd/;
-
-    add_proto qw/void av1_highbd_fdct32x32_1/, "const int16_t *input, tran_low_t *output, int stride";
-    specialize qw/av1_highbd_fdct32x32_1/;
   } else {
     add_proto qw/void av1_iht4x4_16_add/, "const tran_low_t *input, uint8_t *dest, int dest_stride, int tx_type";
     specialize qw/av1_iht4x4_16_add sse2/;
@@ -161,57 +110,6 @@
 
     add_proto qw/void av1_iht16x16_256_add/, "const tran_low_t *input, uint8_t *output, int pitch, int tx_type";
     specialize qw/av1_iht16x16_256_add sse2/;
-
-    add_proto qw/void av1_fdct4x4/, "const int16_t *input, tran_low_t *output, int stride";
-    specialize qw/av1_fdct4x4 sse2/;
-
-    add_proto qw/void av1_fdct4x4_1/, "const int16_t *input, tran_low_t *output, int stride";
-    specialize qw/av1_fdct4x4_1 sse2/;
-
-    add_proto qw/void av1_fdct8x8/, "const int16_t *input, tran_low_t *output, int stride";
-    specialize qw/av1_fdct8x8 sse2/;
-
-    add_proto qw/void av1_fdct8x8_1/, "const int16_t *input, tran_low_t *output, int stride";
-    specialize qw/av1_fdct8x8_1 sse2/;
-
-    add_proto qw/void av1_fdct16x16/, "const int16_t *input, tran_low_t *output, int stride";
-    specialize qw/av1_fdct16x16 sse2/;
-
-    add_proto qw/void av1_fdct16x16_1/, "const int16_t *input, tran_low_t *output, int stride";
-    specialize qw/av1_fdct16x16_1 sse2/;
-
-    add_proto qw/void av1_fdct32x32/, "const int16_t *input, tran_low_t *output, int stride";
-    specialize qw/av1_fdct32x32 sse2/;
-
-    add_proto qw/void av1_fdct32x32_rd/, "const int16_t *input, tran_low_t *output, int stride";
-    specialize qw/av1_fdct32x32_rd sse2/;
-
-    add_proto qw/void av1_fdct32x32_1/, "const int16_t *input, tran_low_t *output, int stride";
-    specialize qw/av1_fdct32x32_1 sse2/;
-
-    add_proto qw/void av1_highbd_fdct4x4/, "const int16_t *input, tran_low_t *output, int stride";
-    specialize qw/av1_highbd_fdct4x4 sse2/;
-
-    add_proto qw/void av1_highbd_fdct8x8/, "const int16_t *input, tran_low_t *output, int stride";
-    specialize qw/av1_highbd_fdct8x8 sse2/;
-
-    add_proto qw/void av1_highbd_fdct8x8_1/, "const int16_t *input, tran_low_t *output, int stride";
-    specialize qw/av1_highbd_fdct8x8_1/;
-
-    add_proto qw/void av1_highbd_fdct16x16/, "const int16_t *input, tran_low_t *output, int stride";
-    specialize qw/av1_highbd_fdct16x16 sse2/;
-
-    add_proto qw/void av1_highbd_fdct16x16_1/, "const int16_t *input, tran_low_t *output, int stride";
-    specialize qw/av1_highbd_fdct16x16_1/;
-
-    add_proto qw/void av1_highbd_fdct32x32/, "const int16_t *input, tran_low_t *output, int stride";
-    specialize qw/av1_highbd_fdct32x32 sse2/;
-
-    add_proto qw/void av1_highbd_fdct32x32_rd/, "const int16_t *input, tran_low_t *output, int stride";
-    specialize qw/av1_highbd_fdct32x32_rd sse2/;
-
-    add_proto qw/void av1_highbd_fdct32x32_1/, "const int16_t *input, tran_low_t *output, int stride";
-    specialize qw/av1_highbd_fdct32x32_1/;
   }
 } else {
   # Force C versions if CONFIG_EMULATE_HARDWARE is 1
@@ -242,33 +140,6 @@
 
     add_proto qw/void av1_iht16x16_256_add/, "const tran_low_t *input, uint8_t *output, int pitch, int tx_type";
     specialize qw/av1_iht16x16_256_add/;
-
-    add_proto qw/void av1_fdct4x4/, "const int16_t *input, tran_low_t *output, int stride";
-    specialize qw/av1_fdct4x4/;
-
-    add_proto qw/void av1_fdct4x4_1/, "const int16_t *input, tran_low_t *output, int stride";
-    specialize qw/av1_fdct4x4_1/;
-
-    add_proto qw/void av1_fdct8x8/, "const int16_t *input, tran_low_t *output, int stride";
-    specialize qw/av1_fdct8x8/;
-
-    add_proto qw/void av1_fdct8x8_1/, "const int16_t *input, tran_low_t *output, int stride";
-    specialize qw/av1_fdct8x8_1/;
-
-    add_proto qw/void av1_fdct16x16/, "const int16_t *input, tran_low_t *output, int stride";
-    specialize qw/av1_fdct16x16/;
-
-    add_proto qw/void av1_fdct16x16_1/, "const int16_t *input, tran_low_t *output, int stride";
-    specialize qw/av1_fdct16x16_1/;
-
-    add_proto qw/void av1_fdct32x32/, "const int16_t *input, tran_low_t *output, int stride";
-    specialize qw/av1_fdct32x32/;
-
-    add_proto qw/void av1_fdct32x32_rd/, "const int16_t *input, tran_low_t *output, int stride";
-    specialize qw/av1_fdct32x32_rd/;
-
-    add_proto qw/void av1_fdct32x32_1/, "const int16_t *input, tran_low_t *output, int stride";
-    specialize qw/av1_fdct32x32_1/;
   } else {
     add_proto qw/void av1_iht4x4_16_add/, "const tran_low_t *input, uint8_t *dest, int dest_stride, int tx_type";
     specialize qw/av1_iht4x4_16_add sse2 neon dspr2/;
@@ -302,33 +173,6 @@
       specialize qw/av1_iht8x8_64_add msa/;
       specialize qw/av1_iht16x16_256_add msa/;
     }
-
-    add_proto qw/void av1_fdct4x4/, "const int16_t *input, tran_low_t *output, int stride";
-    specialize qw/av1_fdct4x4 sse2/;
-
-    add_proto qw/void av1_fdct4x4_1/, "const int16_t *input, tran_low_t *output, int stride";
-    specialize qw/av1_fdct4x4_1 sse2/;
-
-    add_proto qw/void av1_fdct8x8/, "const int16_t *input, tran_low_t *output, int stride";
-    specialize qw/av1_fdct8x8 sse2/;
-
-    add_proto qw/void av1_fdct8x8_1/, "const int16_t *input, tran_low_t *output, int stride";
-    specialize qw/av1_fdct8x8_1 sse2/;
-
-    add_proto qw/void av1_fdct16x16/, "const int16_t *input, tran_low_t *output, int stride";
-    specialize qw/av1_fdct16x16 sse2/;
-
-    add_proto qw/void av1_fdct16x16_1/, "const int16_t *input, tran_low_t *output, int stride";
-    specialize qw/av1_fdct16x16_1 sse2/;
-
-    add_proto qw/void av1_fdct32x32/, "const int16_t *input, tran_low_t *output, int stride";
-    specialize qw/av1_fdct32x32 sse2/;
-
-    add_proto qw/void av1_fdct32x32_rd/, "const int16_t *input, tran_low_t *output, int stride";
-    specialize qw/av1_fdct32x32_rd sse2/;
-
-    add_proto qw/void av1_fdct32x32_1/, "const int16_t *input, tran_low_t *output, int stride";
-    specialize qw/av1_fdct32x32_1 sse2/;
   }
 }
 
@@ -557,6 +401,109 @@
 
   add_proto qw/void av1_fwht4x4/, "const int16_t *input, tran_low_t *output, int stride";
   specialize qw/av1_fwht4x4/;
+  if (aom_config("CONFIG_EMULATE_HARDWARE") eq "yes") {
+    add_proto qw/void av1_fdct4x4/, "const int16_t *input, tran_low_t *output, int stride";
+    specialize qw/av1_fdct4x4/;
+
+    add_proto qw/void av1_fdct4x4_1/, "const int16_t *input, tran_low_t *output, int stride";
+    specialize qw/av1_fdct4x4_1/;
+
+    add_proto qw/void av1_fdct8x8/, "const int16_t *input, tran_low_t *output, int stride";
+    specialize qw/av1_fdct8x8/;
+
+    add_proto qw/void av1_fdct8x8_1/, "const int16_t *input, tran_low_t *output, int stride";
+    specialize qw/av1_fdct8x8_1/;
+
+    add_proto qw/void av1_fdct16x16/, "const int16_t *input, tran_low_t *output, int stride";
+    specialize qw/av1_fdct16x16/;
+
+    add_proto qw/void av1_fdct16x16_1/, "const int16_t *input, tran_low_t *output, int stride";
+    specialize qw/av1_fdct16x16_1/;
+
+    add_proto qw/void av1_fdct32x32/, "const int16_t *input, tran_low_t *output, int stride";
+    specialize qw/av1_fdct32x32/;
+
+    add_proto qw/void av1_fdct32x32_rd/, "const int16_t *input, tran_low_t *output, int stride";
+    specialize qw/av1_fdct32x32_rd/;
+
+    add_proto qw/void av1_fdct32x32_1/, "const int16_t *input, tran_low_t *output, int stride";
+    specialize qw/av1_fdct32x32_1/;
+
+    add_proto qw/void av1_highbd_fdct4x4/, "const int16_t *input, tran_low_t *output, int stride";
+    specialize qw/av1_highbd_fdct4x4/;
+
+    add_proto qw/void av1_highbd_fdct8x8/, "const int16_t *input, tran_low_t *output, int stride";
+    specialize qw/av1_highbd_fdct8x8/;
+
+    add_proto qw/void av1_highbd_fdct8x8_1/, "const int16_t *input, tran_low_t *output, int stride";
+    specialize qw/av1_highbd_fdct8x8_1/;
+
+    add_proto qw/void av1_highbd_fdct16x16/, "const int16_t *input, tran_low_t *output, int stride";
+    specialize qw/av1_highbd_fdct16x16/;
+
+    add_proto qw/void av1_highbd_fdct16x16_1/, "const int16_t *input, tran_low_t *output, int stride";
+    specialize qw/av1_highbd_fdct16x16_1/;
+
+    add_proto qw/void av1_highbd_fdct32x32/, "const int16_t *input, tran_low_t *output, int stride";
+    specialize qw/av1_highbd_fdct32x32/;
+
+    add_proto qw/void av1_highbd_fdct32x32_rd/, "const int16_t *input, tran_low_t *output, int stride";
+    specialize qw/av1_highbd_fdct32x32_rd/;
+
+    add_proto qw/void av1_highbd_fdct32x32_1/, "const int16_t *input, tran_low_t *output, int stride";
+    specialize qw/av1_highbd_fdct32x32_1/;
+  } else {
+    add_proto qw/void av1_fdct4x4/, "const int16_t *input, tran_low_t *output, int stride";
+    specialize qw/av1_fdct4x4 sse2/;
+
+    add_proto qw/void av1_fdct4x4_1/, "const int16_t *input, tran_low_t *output, int stride";
+    specialize qw/av1_fdct4x4_1 sse2/;
+
+    add_proto qw/void av1_fdct8x8/, "const int16_t *input, tran_low_t *output, int stride";
+    specialize qw/av1_fdct8x8 sse2/;
+
+    add_proto qw/void av1_fdct8x8_1/, "const int16_t *input, tran_low_t *output, int stride";
+    specialize qw/av1_fdct8x8_1 sse2/;
+
+    add_proto qw/void av1_fdct16x16/, "const int16_t *input, tran_low_t *output, int stride";
+    specialize qw/av1_fdct16x16 sse2/;
+
+    add_proto qw/void av1_fdct16x16_1/, "const int16_t *input, tran_low_t *output, int stride";
+    specialize qw/av1_fdct16x16_1 sse2/;
+
+    add_proto qw/void av1_fdct32x32/, "const int16_t *input, tran_low_t *output, int stride";
+    specialize qw/av1_fdct32x32 sse2/;
+
+    add_proto qw/void av1_fdct32x32_rd/, "const int16_t *input, tran_low_t *output, int stride";
+    specialize qw/av1_fdct32x32_rd sse2/;
+
+    add_proto qw/void av1_fdct32x32_1/, "const int16_t *input, tran_low_t *output, int stride";
+    specialize qw/av1_fdct32x32_1 sse2/;
+
+    add_proto qw/void av1_highbd_fdct4x4/, "const int16_t *input, tran_low_t *output, int stride";
+    specialize qw/av1_highbd_fdct4x4 sse2/;
+
+    add_proto qw/void av1_highbd_fdct8x8/, "const int16_t *input, tran_low_t *output, int stride";
+    specialize qw/av1_highbd_fdct8x8 sse2/;
+
+    add_proto qw/void av1_highbd_fdct8x8_1/, "const int16_t *input, tran_low_t *output, int stride";
+    specialize qw/av1_highbd_fdct8x8_1/;
+
+    add_proto qw/void av1_highbd_fdct16x16/, "const int16_t *input, tran_low_t *output, int stride";
+    specialize qw/av1_highbd_fdct16x16 sse2/;
+
+    add_proto qw/void av1_highbd_fdct16x16_1/, "const int16_t *input, tran_low_t *output, int stride";
+    specialize qw/av1_highbd_fdct16x16_1/;
+
+    add_proto qw/void av1_highbd_fdct32x32/, "const int16_t *input, tran_low_t *output, int stride";
+    specialize qw/av1_highbd_fdct32x32 sse2/;
+
+    add_proto qw/void av1_highbd_fdct32x32_rd/, "const int16_t *input, tran_low_t *output, int stride";
+    specialize qw/av1_highbd_fdct32x32_rd sse2/;
+
+    add_proto qw/void av1_highbd_fdct32x32_1/, "const int16_t *input, tran_low_t *output, int stride";
+    specialize qw/av1_highbd_fdct32x32_1/;
+  }
 } else {
   add_proto qw/void av1_fht4x4/, "const int16_t *input, tran_low_t *output, int stride, int tx_type";
   specialize qw/av1_fht4x4 sse2/;
@@ -596,6 +543,61 @@
 
   add_proto qw/void av1_fwht4x4/, "const int16_t *input, tran_low_t *output, int stride";
   specialize qw/av1_fwht4x4/;
+  if (aom_config("CONFIG_EMULATE_HARDWARE") eq "yes") {
+    add_proto qw/void av1_fdct4x4/, "const int16_t *input, tran_low_t *output, int stride";
+    specialize qw/av1_fdct4x4/;
+
+    add_proto qw/void av1_fdct4x4_1/, "const int16_t *input, tran_low_t *output, int stride";
+    specialize qw/av1_fdct4x4_1/;
+
+    add_proto qw/void av1_fdct8x8/, "const int16_t *input, tran_low_t *output, int stride";
+    specialize qw/av1_fdct8x8/;
+
+    add_proto qw/void av1_fdct8x8_1/, "const int16_t *input, tran_low_t *output, int stride";
+    specialize qw/av1_fdct8x8_1/;
+
+    add_proto qw/void av1_fdct16x16/, "const int16_t *input, tran_low_t *output, int stride";
+    specialize qw/av1_fdct16x16/;
+
+    add_proto qw/void av1_fdct16x16_1/, "const int16_t *input, tran_low_t *output, int stride";
+    specialize qw/av1_fdct16x16_1/;
+
+    add_proto qw/void av1_fdct32x32/, "const int16_t *input, tran_low_t *output, int stride";
+    specialize qw/av1_fdct32x32/;
+
+    add_proto qw/void av1_fdct32x32_rd/, "const int16_t *input, tran_low_t *output, int stride";
+    specialize qw/av1_fdct32x32_rd/;
+
+    add_proto qw/void av1_fdct32x32_1/, "const int16_t *input, tran_low_t *output, int stride";
+    specialize qw/av1_fdct32x32_1/;
+  } else {
+    add_proto qw/void av1_fdct4x4/, "const int16_t *input, tran_low_t *output, int stride";
+    specialize qw/av1_fdct4x4 sse2/;
+
+    add_proto qw/void av1_fdct4x4_1/, "const int16_t *input, tran_low_t *output, int stride";
+    specialize qw/av1_fdct4x4_1 sse2/;
+
+    add_proto qw/void av1_fdct8x8/, "const int16_t *input, tran_low_t *output, int stride";
+    specialize qw/av1_fdct8x8 sse2/;
+
+    add_proto qw/void av1_fdct8x8_1/, "const int16_t *input, tran_low_t *output, int stride";
+    specialize qw/av1_fdct8x8_1 sse2/;
+
+    add_proto qw/void av1_fdct16x16/, "const int16_t *input, tran_low_t *output, int stride";
+    specialize qw/av1_fdct16x16 sse2/;
+
+    add_proto qw/void av1_fdct16x16_1/, "const int16_t *input, tran_low_t *output, int stride";
+    specialize qw/av1_fdct16x16_1 sse2/;
+
+    add_proto qw/void av1_fdct32x32/, "const int16_t *input, tran_low_t *output, int stride";
+    specialize qw/av1_fdct32x32 sse2/;
+
+    add_proto qw/void av1_fdct32x32_rd/, "const int16_t *input, tran_low_t *output, int stride";
+    specialize qw/av1_fdct32x32_rd sse2/;
+
+    add_proto qw/void av1_fdct32x32_1/, "const int16_t *input, tran_low_t *output, int stride";
+    specialize qw/av1_fdct32x32_1 sse2/;
+  }
 }
 
 add_proto qw/void av1_fwd_idtx/, "const int16_t *src_diff, tran_low_t *coeff, int stride, int bs, int tx_type";
diff --git a/av1/common/blockd.h b/av1/common/blockd.h
index f035bb5..f9f82e1 100644
--- a/av1/common/blockd.h
+++ b/av1/common/blockd.h
@@ -203,9 +203,9 @@
 
 // Only for INTER blocks
 #if CONFIG_DUAL_FILTER
-  INTERP_FILTER interp_filter[4];
+  InterpFilter interp_filter[4];
 #else
-  INTERP_FILTER interp_filter;
+  InterpFilter interp_filter;
 #endif
   MV_REFERENCE_FRAME ref_frame[2];
   TX_TYPE tx_type;
diff --git a/av1/common/filter.c b/av1/common/filter.c
index 3960ab4..544e3da 100644
--- a/av1/common/filter.c
+++ b/av1/common/filter.c
@@ -222,7 +222,7 @@
 #endif  // USE_TEMPORALFILTER_12TAP
 
 InterpFilterParams av1_get_interp_filter_params(
-    const INTERP_FILTER interp_filter) {
+    const InterpFilter interp_filter) {
 #if USE_TEMPORALFILTER_12TAP
   if (interp_filter == TEMPORALFILTER_12TAP)
     return av1_interp_temporalfilter_12tap;
@@ -230,7 +230,7 @@
   return av1_interp_filter_params_list[interp_filter];
 }
 
-const int16_t *av1_get_interp_filter_kernel(const INTERP_FILTER interp_filter) {
+const int16_t *av1_get_interp_filter_kernel(const InterpFilter interp_filter) {
 #if USE_TEMPORALFILTER_12TAP
   if (interp_filter == TEMPORALFILTER_12TAP)
     return av1_interp_temporalfilter_12tap.filter_ptr;
diff --git a/av1/common/filter.h b/av1/common/filter.h
index c757e0e..8b3aaa3 100644
--- a/av1/common/filter.h
+++ b/av1/common/filter.h
@@ -55,7 +55,7 @@
 #define SWITCHABLE_FILTER_CONTEXTS (SWITCHABLE_FILTERS + 1)
 #endif
 
-typedef uint8_t INTERP_FILTER;
+typedef uint8_t InterpFilter;
 
 #if CONFIG_EXT_INTRA
 typedef enum {
@@ -76,9 +76,9 @@
 } InterpFilterParams;
 
 InterpFilterParams av1_get_interp_filter_params(
-    const INTERP_FILTER interp_filter);
+    const InterpFilter interp_filter);
 
-const int16_t *av1_get_interp_filter_kernel(const INTERP_FILTER interp_filter);
+const int16_t *av1_get_interp_filter_kernel(const InterpFilter interp_filter);
 
 static INLINE const int16_t *av1_get_interp_filter_subpel_kernel(
     const InterpFilterParams filter_params, const int subpel) {
@@ -86,7 +86,7 @@
 }
 
 static INLINE int av1_is_interpolating_filter(
-    const INTERP_FILTER interp_filter) {
+    const InterpFilter interp_filter) {
   const InterpFilterParams ip = av1_get_interp_filter_params(interp_filter);
   return (ip.filter_ptr[ip.taps / 2 - 1] == 128);
 }
diff --git a/av1/common/onyxc_int.h b/av1/common/onyxc_int.h
index e2bd218..a14b34f 100644
--- a/av1/common/onyxc_int.h
+++ b/av1/common/onyxc_int.h
@@ -271,7 +271,7 @@
   uint8_t *current_frame_seg_map;
   int seg_map_alloc_size;
 
-  INTERP_FILTER interp_filter;
+  InterpFilter interp_filter;
 
   loop_filter_info_n lf_info;
 #if CONFIG_LOOP_RESTORATION
diff --git a/av1/common/pred_common.c b/av1/common/pred_common.c
index 6fe1188..5d8cad0 100644
--- a/av1/common/pred_common.c
+++ b/av1/common/pred_common.c
@@ -16,10 +16,10 @@
 
 // Returns a context number for the given MB prediction signal
 #if CONFIG_DUAL_FILTER
-static INTERP_FILTER get_ref_filter_type(const MODE_INFO *mi,
-                                         const MACROBLOCKD *xd, int dir,
-                                         MV_REFERENCE_FRAME ref_frame) {
-  INTERP_FILTER ref_type = SWITCHABLE_FILTERS;
+static InterpFilter get_ref_filter_type(const MODE_INFO *mi,
+                                        const MACROBLOCKD *xd, int dir,
+                                        MV_REFERENCE_FRAME ref_frame) {
+  InterpFilter ref_type = SWITCHABLE_FILTERS;
   const MB_MODE_INFO *ref_mbmi = &mi->mbmi;
   int use_subpel[2] = {
     has_subpel_mv_component(mi, xd, dir),
diff --git a/av1/common/reconinter.c b/av1/common/reconinter.c
index 6a28161..a16f7ef 100644
--- a/av1/common/reconinter.c
+++ b/av1/common/reconinter.c
@@ -418,9 +418,9 @@
                                      const struct scale_factors *sf, int w,
                                      int h,
 #if CONFIG_DUAL_FILTER
-                                     const INTERP_FILTER *interp_filter,
+                                     const InterpFilter *interp_filter,
 #else
-                                     const INTERP_FILTER interp_filter,
+                                     const InterpFilter interp_filter,
 #endif
                                      int xs, int ys,
 #if CONFIG_SUPERTX
@@ -431,11 +431,11 @@
 // The prediction filter types used here should be those for
 // the second reference block.
 #if CONFIG_DUAL_FILTER
-  INTERP_FILTER tmp_ipf[4] = {
+  InterpFilter tmp_ipf[4] = {
     interp_filter[2], interp_filter[3], interp_filter[2], interp_filter[3],
   };
 #else
-  INTERP_FILTER tmp_ipf = interp_filter;
+  InterpFilter tmp_ipf = interp_filter;
 #endif  // CONFIG_DUAL_FILTER
 #if CONFIG_AOM_HIGHBITDEPTH
   DECLARE_ALIGNED(16, uint8_t, tmp_dst_[2 * MAX_SB_SQUARE]);
@@ -491,9 +491,9 @@
     const uint8_t *src, int src_stride, uint8_t *dst, int dst_stride,
     const MV *src_mv, const struct scale_factors *sf, int w, int h, int ref,
 #if CONFIG_DUAL_FILTER
-    const INTERP_FILTER *interp_filter,
+    const InterpFilter *interp_filter,
 #else
-    const INTERP_FILTER interp_filter,
+    const InterpFilter interp_filter,
 #endif
     enum mv_precision precision, int x, int y, int bd) {
   const int is_q4 = precision == MV_PRECISION_Q4;
@@ -516,9 +516,9 @@
                                const struct scale_factors *sf, int w, int h,
                                int ref,
 #if CONFIG_DUAL_FILTER
-                               const INTERP_FILTER *interp_filter,
+                               const InterpFilter *interp_filter,
 #else
-                               const INTERP_FILTER interp_filter,
+                               const InterpFilter interp_filter,
 #endif
                                enum mv_precision precision, int x, int y) {
   const int is_q4 = precision == MV_PRECISION_Q4;
diff --git a/av1/common/reconinter.h b/av1/common/reconinter.h
index 379ba51..26a4590 100644
--- a/av1/common/reconinter.h
+++ b/av1/common/reconinter.h
@@ -27,9 +27,9 @@
                                    const struct scale_factors *sf, int w, int h,
                                    int ref_idx,
 #if CONFIG_DUAL_FILTER
-                                   const INTERP_FILTER *interp_filter,
+                                   const InterpFilter *interp_filter,
 #else
-                                   const INTERP_FILTER interp_filter,
+                                   const InterpFilter interp_filter,
 #endif
                                    int xs, int ys) {
 #if CONFIG_DUAL_FILTER
@@ -86,9 +86,9 @@
                                           const struct scale_factors *sf, int w,
                                           int h, int ref,
 #if CONFIG_DUAL_FILTER
-                                          const INTERP_FILTER *interp_filter,
+                                          const InterpFilter *interp_filter,
 #else
-                                          const INTERP_FILTER interp_filter,
+                                          const InterpFilter interp_filter,
 #endif
                                           int xs, int ys, int bd) {
 #if CONFIG_DUAL_FILTER
@@ -229,9 +229,9 @@
     const int subpel_x, const int subpel_y, const struct scale_factors *sf,
     int w, int h, int ref,
 #if CONFIG_DUAL_FILTER
-    const INTERP_FILTER *interp_filter,
+    const InterpFilter *interp_filter,
 #else
-    const INTERP_FILTER interp_filter,
+    const InterpFilter interp_filter,
 #endif
     int xs, int ys, const MACROBLOCKD *xd) {
   (void)xd;
@@ -252,9 +252,9 @@
                                      const struct scale_factors *sf, int w,
                                      int h,
 #if CONFIG_DUAL_FILTER
-                                     const INTERP_FILTER *interp_filter,
+                                     const InterpFilter *interp_filter,
 #else
-                                     const INTERP_FILTER interp_filter,
+                                     const InterpFilter interp_filter,
 #endif
                                      int xs, int ys,
 #if CONFIG_SUPERTX
@@ -371,9 +371,9 @@
                                const struct scale_factors *sf, int w, int h,
                                int do_avg,
 #if CONFIG_DUAL_FILTER
-                               const INTERP_FILTER *interp_filter,
+                               const InterpFilter *interp_filter,
 #else
-                               const INTERP_FILTER interp_filter,
+                               const InterpFilter interp_filter,
 #endif
                                enum mv_precision precision, int x, int y);
 
@@ -382,9 +382,9 @@
     const uint8_t *src, int src_stride, uint8_t *dst, int dst_stride,
     const MV *mv_q3, const struct scale_factors *sf, int w, int h, int do_avg,
 #if CONFIG_DUAL_FILTER
-    const INTERP_FILTER *interp_filter,
+    const InterpFilter *interp_filter,
 #else
-    const INTERP_FILTER interp_filter,
+    const InterpFilter interp_filter,
 #endif
     enum mv_precision precision, int x, int y, int bd);
 #endif
diff --git a/av1/common/restoration.c b/av1/common/restoration.c
index a4aad7b..d50181e 100644
--- a/av1/common/restoration.c
+++ b/av1/common/restoration.c
@@ -42,7 +42,7 @@
 static BilateralParamsType bilateral_level_to_params_arr[BILATERAL_LEVELS] = {
   // Values are rounded to 1/16 th precision
   { 8, 9, 30 },   { 9, 8, 30 },   { 9, 11, 32 },  { 11, 9, 32 },
-  { 14, 14, 32 }, { 18, 18, 36 }, { 24, 24, 40 }, { 32, 32, 40 },
+  { 14, 14, 36 }, { 18, 18, 36 }, { 24, 24, 40 }, { 32, 32, 40 },
 };
 
 static BilateralParamsType
diff --git a/av1/common/restoration.h b/av1/common/restoration.h
index 6c53a77..d8a312d 100644
--- a/av1/common/restoration.h
+++ b/av1/common/restoration.h
@@ -27,7 +27,7 @@
 // #define DEF_BILATERAL_LEVEL     2
 
 #define RESTORATION_TILESIZES 3
-#define BILATERAL_TILESIZE 0
+#define BILATERAL_TILESIZE 1
 #define WIENER_TILESIZE 2
 
 #define RESTORATION_HALFWIN 3
diff --git a/av1/common/warped_motion.h b/av1/common/warped_motion.h
index d957401..d7e8a22 100644
--- a/av1/common/warped_motion.h
+++ b/av1/common/warped_motion.h
@@ -61,13 +61,13 @@
                               const int subsampling_x, const int subsampling_y);
 
 double av1_warp_erroradv(WarpedMotionParams *wm,
-#if CONFIG_VP9_HIGHBITDEPTH
-                          int use_hbd, int bd,
-#endif  // CONFIG_VP9_HIGHBITDEPTH
-                          uint8_t *ref, int width, int height, int stride,
-                          uint8_t *dst, int p_col, int p_row, int p_width,
-                          int p_height, int p_stride, int subsampling_x,
-                          int subsampling_y, int x_scale, int y_scale);
+#if CONFIG_AOM_HIGHBITDEPTH
+                         int use_hbd, int bd,
+#endif  // CONFIG_AOM_HIGHBITDEPTH
+                         uint8_t *ref, int width, int height, int stride,
+                         uint8_t *dst, int p_col, int p_row, int p_width,
+                         int p_height, int p_stride, int subsampling_x,
+                         int subsampling_y, int x_scale, int y_scale);
 
 void av1_warp_plane(WarpedMotionParams *wm,
 #if CONFIG_AOM_HIGHBITDEPTH
diff --git a/av1/decoder/decodeframe.c b/av1/decoder/decodeframe.c
index 8d3202c..6e52c79 100644
--- a/av1/decoder/decodeframe.c
+++ b/av1/decoder/decodeframe.c
@@ -2108,7 +2108,7 @@
   }
 }
 
-static INTERP_FILTER read_interp_filter(struct aom_read_bit_buffer *rb) {
+static InterpFilter read_interp_filter(struct aom_read_bit_buffer *rb) {
   return aom_rb_read_bit(rb) ? SWITCHABLE
                              : aom_rb_read_literal(rb, 2 + CONFIG_EXT_INTERP);
 }
diff --git a/av1/decoder/decodemv.c b/av1/decoder/decodemv.c
index 535c5b5..290f6c1 100644
--- a/av1/decoder/decodemv.c
+++ b/av1/decoder/decodemv.c
@@ -862,12 +862,12 @@
 }
 #endif  // CONFIG_OBMC || CONFIG_WARPED_MOTION
 
-static INLINE INTERP_FILTER read_interp_filter(AV1_COMMON *const cm,
-                                               MACROBLOCKD *const xd,
+static INLINE InterpFilter read_interp_filter(AV1_COMMON *const cm,
+                                              MACROBLOCKD *const xd,
 #if CONFIG_DUAL_FILTER
-                                               int dir,
+                                              int dir,
 #endif
-                                               aom_reader *r) {
+                                              aom_reader *r) {
 #if CONFIG_EXT_INTERP
   if (!av1_is_interp_needed(xd)) return EIGHTTAP_REGULAR;
 #endif
@@ -880,7 +880,7 @@
     const int ctx = av1_get_pred_context_switchable_interp(xd);
 #endif
     FRAME_COUNTS *counts = xd->counts;
-    const INTERP_FILTER type = (INTERP_FILTER)aom_read_tree(
+    const InterpFilter type = (InterpFilter)aom_read_tree(
         r, av1_switchable_interp_tree, cm->fc->switchable_interp_prob[ctx]);
     if (counts) ++counts->switchable_interp[ctx][type];
     return type;
diff --git a/av1/encoder/bitstream.c b/av1/encoder/bitstream.c
index 7c33aea..49f1b44 100644
--- a/av1/encoder/bitstream.c
+++ b/av1/encoder/bitstream.c
@@ -2624,7 +2624,7 @@
   }
 }
 
-static void write_interp_filter(INTERP_FILTER filter,
+static void write_interp_filter(InterpFilter filter,
                                 struct aom_write_bit_buffer *wb) {
   aom_wb_write_bit(wb, filter == SWITCHABLE);
   if (filter != SWITCHABLE)
diff --git a/av1/encoder/context_tree.h b/av1/encoder/context_tree.h
index c77eb24..c798cdf 100644
--- a/av1/encoder/context_tree.h
+++ b/av1/encoder/context_tree.h
@@ -58,7 +58,7 @@
   // motion vector cache for adaptive motion search control in partition
   // search loop
   MV pred_mv[TOTAL_REFS_PER_FRAME];
-  INTERP_FILTER pred_interp_filter;
+  InterpFilter pred_interp_filter;
 #if CONFIG_EXT_PARTITION_TYPES
   PARTITION_TYPE partition;
 #endif
diff --git a/av1/encoder/encodeframe.c b/av1/encoder/encodeframe.c
index 200b02c..8796ac9 100644
--- a/av1/encoder/encodeframe.c
+++ b/av1/encoder/encodeframe.c
@@ -4403,7 +4403,80 @@
 #if CONFIG_GLOBAL_MOTION
 #define MIN_TRANS_THRESH 8
 #define GLOBAL_MOTION_ADVANTAGE_THRESH 0.60
-#define GLOBAL_MOTION_MODEL TRANSLATION
+#define GLOBAL_MOTION_MODEL ROTZOOM
+static void refine_integerized_param(WarpedMotionParams *wm,
+#if CONFIG_AOM_HIGHBITDEPTH
+                                     int use_hbd, int bd,
+#endif  // CONFIG_AOM_HIGHBITDEPTH
+                                     uint8_t *ref, int r_width, int r_height,
+                                     int r_stride, uint8_t *dst, int d_width,
+                                     int d_height, int d_stride,
+                                     int n_refinements) {
+  int i = 0, p;
+  int n_params = n_trans_model_params[wm->wmtype];
+  int16_t *param_mat = (int16_t *)wm->wmmat;
+  double step_error;
+  int step;
+  int16_t *param;
+  int16_t curr_param;
+  int16_t best_param;
+
+  double best_error =
+      av1_warp_erroradv(wm,
+#if CONFIG_AOM_HIGHBITDEPTH
+                        use_hbd, bd,
+#endif  // CONFIG_AOM_HIGHBITDEPTH
+                        ref, r_width, r_height, r_stride, dst, 0, 0, d_width,
+                        d_height, d_stride, 0, 0, 16, 16);
+  for (p = 0; p < n_params; ++p) {
+    param = param_mat + p;
+    step = 1 << (n_refinements + 1);
+    curr_param = *param;
+    best_param = curr_param;
+    for (i = 0; i < n_refinements; i++) {
+      // look to the left
+      *param = curr_param - step;
+      step_error =
+          av1_warp_erroradv(wm,
+#if CONFIG_AOM_HIGHBITDEPTH
+                            use_hbd, bd,
+#endif  // CONFIG_AOM_HIGHBITDEPTH
+                            ref, r_width, r_height, r_stride, dst, 0, 0,
+                            d_width, d_height, d_stride, 0, 0, 16, 16);
+      if (step_error < best_error) {
+        step >>= 1;
+        best_error = step_error;
+        best_param = *param;
+        curr_param = best_param;
+        continue;
+      }
+
+      // look to the right
+      *param = curr_param + step;
+      step_error =
+          av1_warp_erroradv(wm,
+#if CONFIG_AOM_HIGHBITDEPTH
+                            use_hbd, bd,
+#endif  // CONFIG_AOM_HIGHBITDEPTH
+                            ref, r_width, r_height, r_stride, dst, 0, 0,
+                            d_width, d_height, d_stride, 0, 0, 16, 16);
+      if (step_error < best_error) {
+        step >>= 1;
+        best_error = step_error;
+        best_param = *param;
+        curr_param = best_param;
+        continue;
+      }
+
+      // no improvement found-> means we're either already at a minimum or
+      // step is too wide
+      step >>= 1;
+    }
+
+    *param = best_param;
+  }
+}
+
 static void convert_to_params(double *H, TransformationType type,
                               int16_t *model) {
   int i;
@@ -4416,6 +4489,7 @@
   model[1] = (int16_t)clamp(model[1], GM_TRANS_MIN, GM_TRANS_MAX) *
              GM_TRANS_DECODE_FACTOR;
 
+  // TODO(sarahparker) 1 should be subtracted here
   for (i = 2; i < n_params; ++i) {
     model[i] = (int16_t)floor(H[i] * (1 << GM_ALPHA_PREC_BITS) + 0.5);
     model[i] = (int16_t)clamp(model[i], GM_ALPHA_MIN, GM_ALPHA_MAX) *
@@ -4476,6 +4550,14 @@
           convert_model_to_params(H, GLOBAL_MOTION_MODEL,
                                   &cm->global_motion[frame]);
           if (get_gmtype(&cm->global_motion[frame]) > GLOBAL_ZERO) {
+            refine_integerized_param(
+                &cm->global_motion[frame].motion_params,
+#if CONFIG_AOM_HIGHBITDEPTH
+                xd->cur_buf->flags & YV12_FLAG_HIGHBITDEPTH, xd->bd,
+#endif  // CONFIG_AOM_HIGHBITDEPTH
+                ref_buf->y_buffer, ref_buf->y_width, ref_buf->y_height,
+                ref_buf->y_stride, cpi->Source->y_buffer, cpi->Source->y_width,
+                cpi->Source->y_height, cpi->Source->y_stride, 3);
             // compute the advantage of using gm parameters over 0 motion
             double erroradvantage = av1_warp_erroradv(
                 &cm->global_motion[frame].motion_params,
diff --git a/av1/encoder/encoder.c b/av1/encoder/encoder.c
index 65e1f3c..3e9e2c2 100644
--- a/av1/encoder/encoder.c
+++ b/av1/encoder/encoder.c
@@ -4429,7 +4429,7 @@
 }
 
 static int setup_interp_filter_search_mask(AV1_COMP *cpi) {
-  INTERP_FILTER ifilter;
+  InterpFilter ifilter;
   int ref_total[TOTAL_REFS_PER_FRAME] = { 0 };
   MV_REFERENCE_FRAME ref;
   int mask = 0;
diff --git a/av1/encoder/rdopt.c b/av1/encoder/rdopt.c
index 2980fad..6b9faeb 100644
--- a/av1/encoder/rdopt.c
+++ b/av1/encoder/rdopt.c
@@ -4582,12 +4582,12 @@
   int_mv ref_mv[2];
   int ite, ref;
 #if CONFIG_DUAL_FILTER
-  INTERP_FILTER interp_filter[4] = {
+  InterpFilter interp_filter[4] = {
     mbmi->interp_filter[0], mbmi->interp_filter[1], mbmi->interp_filter[2],
     mbmi->interp_filter[3],
   };
 #else
-  const INTERP_FILTER interp_filter = mbmi->interp_filter;
+  const InterpFilter interp_filter = mbmi->interp_filter;
 #endif
   struct scale_factors sf;
 
@@ -6348,11 +6348,11 @@
 #endif  // CONFIG_EXT_INTER
 
 #if !CONFIG_DUAL_FILTER
-static INTERP_FILTER predict_interp_filter(
+static InterpFilter predict_interp_filter(
     const AV1_COMP *cpi, const MACROBLOCK *x, const BLOCK_SIZE bsize,
     const int mi_row, const int mi_col,
-    INTERP_FILTER (*single_filter)[TOTAL_REFS_PER_FRAME]) {
-  INTERP_FILTER best_filter = SWITCHABLE;
+    InterpFilter (*single_filter)[TOTAL_REFS_PER_FRAME]) {
+  InterpFilter best_filter = SWITCHABLE;
   const AV1_COMMON *cm = &cpi->common;
   const MACROBLOCKD *xd = &x->e_mbd;
   int bsl = mi_width_log2_lookup[bsize];
@@ -6372,7 +6372,7 @@
   return SWITCHABLE;
 #else
   if (pred_filter_search) {
-    INTERP_FILTER af = SWITCHABLE, lf = SWITCHABLE;
+    InterpFilter af = SWITCHABLE, lf = SWITCHABLE;
     if (xd->up_available) af = xd->mi[-xd->mi_stride]->mbmi.interp_filter;
     if (xd->left_available) lf = xd->mi[-1]->mbmi.interp_filter;
 
@@ -6660,7 +6660,7 @@
 #else
     int_mv single_newmv[TOTAL_REFS_PER_FRAME],
 #endif  // CONFIG_EXT_INTER
-    INTERP_FILTER (*single_filter)[TOTAL_REFS_PER_FRAME],
+    InterpFilter (*single_filter)[TOTAL_REFS_PER_FRAME],
     int (*single_skippable)[TOTAL_REFS_PER_FRAME], int64_t *psse,
     const int64_t ref_best_rd) {
   AV1_COMMON *cm = &cpi->common;
@@ -6725,11 +6725,11 @@
   // Index use case:
   // {0, 1} -> (vertical, horizontal) filter types for the first ref frame
   // {2, 3} -> (vertical, horizontal) filter types for the second ref frame
-  INTERP_FILTER best_filter[4] = {
+  InterpFilter best_filter[4] = {
     SWITCHABLE, SWITCHABLE, SWITCHABLE, SWITCHABLE,
   };
 #else
-  INTERP_FILTER best_filter = SWITCHABLE;
+  InterpFilter best_filter = SWITCHABLE;
 #endif
 
   int skip_txfm_sb = 0;
@@ -7523,12 +7523,12 @@
 #endif  // CONFIG_EXT_INTER
 #if CONFIG_EXT_INTERP
 #if CONFIG_DUAL_FILTER
-    INTERP_FILTER obmc_interp_filter[2][2] = {
+    InterpFilter obmc_interp_filter[2][2] = {
       { mbmi->interp_filter[0], mbmi->interp_filter[1] },  // obmc == 0
       { mbmi->interp_filter[0], mbmi->interp_filter[1] }   // obmc == 1
     };
 #else
-    INTERP_FILTER obmc_interp_filter[2] = {
+    InterpFilter obmc_interp_filter[2] = {
       mbmi->interp_filter,  // obmc == 0
       mbmi->interp_filter   // obmc == 1
     };
@@ -8205,7 +8205,7 @@
 #else
   int_mv single_newmv[TOTAL_REFS_PER_FRAME] = { { 0 } };
 #endif  // CONFIG_EXT_INTER
-  INTERP_FILTER single_inter_filter[MB_MODE_COUNT][TOTAL_REFS_PER_FRAME];
+  InterpFilter single_inter_filter[MB_MODE_COUNT][TOTAL_REFS_PER_FRAME];
   int single_skippable[MB_MODE_COUNT][TOTAL_REFS_PER_FRAME];
   static const int flag_list[TOTAL_REFS_PER_FRAME] = {
     0,
@@ -8994,10 +8994,9 @@
           clamp_mv2(&cur_mv.as_mv, xd);
 
           if (!mv_check_bounds(x, &cur_mv.as_mv)) {
-            INTERP_FILTER
-            dummy_single_inter_filter[MB_MODE_COUNT][TOTAL_REFS_PER_FRAME] = {
-              { 0 }
-            };
+            InterpFilter
+                dummy_single_inter_filter[MB_MODE_COUNT][TOTAL_REFS_PER_FRAME] =
+                    { { 0 } };
             int dummy_single_skippable[MB_MODE_COUNT][TOTAL_REFS_PER_FRAME] = {
               { 0 }
             };
@@ -9775,7 +9774,7 @@
   unsigned int ref_costs_single[TOTAL_REFS_PER_FRAME];
   unsigned int ref_costs_comp[TOTAL_REFS_PER_FRAME];
   aom_prob comp_mode_p;
-  INTERP_FILTER best_filter = SWITCHABLE;
+  InterpFilter best_filter = SWITCHABLE;
   int64_t this_rd = INT64_MAX;
   int rate2 = 0;
   const int64_t distortion2 = 0;
@@ -9935,9 +9934,9 @@
   unsigned int ref_costs_comp[TOTAL_REFS_PER_FRAME];
   aom_prob comp_mode_p;
 #if CONFIG_DUAL_FILTER
-  INTERP_FILTER tmp_best_filter[4] = { 0 };
+  InterpFilter tmp_best_filter[4] = { 0 };
 #else
-  INTERP_FILTER tmp_best_filter = SWITCHABLE;
+  InterpFilter tmp_best_filter = SWITCHABLE;
 #endif
   int rate_uv_intra, rate_uv_tokenonly;
   int64_t dist_uv;
diff --git a/av1/encoder/speed_features.h b/av1/encoder/speed_features.h
index 20296c4..a6a4278 100644
--- a/av1/encoder/speed_features.h
+++ b/av1/encoder/speed_features.h
@@ -453,7 +453,7 @@
   int encode_breakout_thresh;
 
   // default interp filter choice
-  INTERP_FILTER default_interp_filter;
+  InterpFilter default_interp_filter;
 
   // Early termination in transform size search, which only applies while
   // tx_size_search_method is USE_FULL_RD.
diff --git a/av1/encoder/temporal_filter.c b/av1/encoder/temporal_filter.c
index 4ac47b9..909d539 100644
--- a/av1/encoder/temporal_filter.c
+++ b/av1/encoder/temporal_filter.c
@@ -42,16 +42,16 @@
 
 #if USE_TEMPORALFILTER_12TAP
 #if CONFIG_DUAL_FILTER
-  const INTERP_FILTER interp_filter[4] = { TEMPORALFILTER_12TAP,
-                                           TEMPORALFILTER_12TAP,
-                                           TEMPORALFILTER_12TAP,
-                                           TEMPORALFILTER_12TAP };
+  const InterpFilter interp_filter[4] = { TEMPORALFILTER_12TAP,
+                                          TEMPORALFILTER_12TAP,
+                                          TEMPORALFILTER_12TAP,
+                                          TEMPORALFILTER_12TAP };
 #else
-  const INTERP_FILTER interp_filter = TEMPORALFILTER_12TAP;
+  const InterpFilter interp_filter = TEMPORALFILTER_12TAP;
 #endif
   (void)xd;
 #else
-  const INTERP_FILTER interp_filter = xd->mi[0]->mbmi.interp_filter;
+  const InterpFilter interp_filter = xd->mi[0]->mbmi.interp_filter;
 #endif  // USE_TEMPORALFILTER_12TAP
 
   if (uv_block_width == 8) {
diff --git a/examples.mk b/examples.mk
index 69c2ea3..66ba693 100644
--- a/examples.mk
+++ b/examples.mk
@@ -1,13 +1,15 @@
 ##
-##  Copyright (c) 2010 The WebM project authors. All Rights Reserved.
+## Copyright (c) 2016, Alliance for Open Media. All rights reserved
 ##
-##  Use of this source code is governed by a BSD-style license
-##  that can be found in the LICENSE file in the root of the source
-##  tree. An additional intellectual property rights grant can be found
-##  in the file PATENTS.  All contributing project authors may
-##  be found in the AUTHORS file in the root of the source tree.
+## This source code is subject to the terms of the BSD 2 Clause License and
+## the Alliance for Open Media Patent License 1.0. If the BSD 2 Clause License
+## was not distributed with this source code in the LICENSE file, you can
+## obtain it at www.aomedia.org/license/software. If the Alliance for Open
+## Media Patent License 1.0 was not distributed with this source code in the
+## PATENTS file, you can obtain it at www.aomedia.org/license/patent.
 ##
 
+
 LIBYUV_SRCS +=  third_party/libyuv/include/libyuv/basic_types.h  \
                 third_party/libyuv/include/libyuv/convert.h \
                 third_party/libyuv/include/libyuv/convert_argb.h \
@@ -172,27 +174,25 @@
 set_maps.SRCS                      += aom_ports/msvc.h
 set_maps.GUID                       = ECB2D24D-98B8-4015-A465-A4AF3DCC145F
 set_maps.DESCRIPTION                = Set active and ROI maps
-
-
-ifeq ($(CONFIG_AV1_ENCODER), yes)
+ifeq ($(CONFIG_ENCODERS),yes)
 ifeq ($(CONFIG_DECODERS),yes)
-EXAMPLES-yes                       += aom_cx_set_ref.c
-aom_cx_set_ref.SRCS                 += ivfenc.h ivfenc.c
-aom_cx_set_ref.SRCS                 += tools_common.h tools_common.c
-aom_cx_set_ref.SRCS                 += video_common.h
-aom_cx_set_ref.SRCS                 += video_writer.h video_writer.c
-aom_cx_set_ref.GUID                  = 65D7F14A-2EE6-4293-B958-AB5107A03B55
-aom_cx_set_ref.DESCRIPTION           = AV1 set encoder reference frame
+EXAMPLES-$(CONFIG_ENCODERS)        += aom_cx_set_ref.c
+aom_cx_set_ref.SRCS                += ivfenc.h ivfenc.c
+aom_cx_set_ref.SRCS                += tools_common.h tools_common.c
+aom_cx_set_ref.SRCS                += video_common.h
+aom_cx_set_ref.SRCS                += video_writer.h video_writer.c
+aom_cx_set_ref.SRCS                += aom_ports/msvc.h
+aom_cx_set_ref.GUID                 = C5E31F7F-96F6-48BD-BD3E-10EBF6E8057A
+aom_cx_set_ref.DESCRIPTION          = AV1 set encoder reference frame
 endif
 endif
 
-
 # Handle extra library flags depending on codec configuration
 
 # We should not link to math library (libm) on RVCT
 # when building for bare-metal targets
 ifeq ($(CONFIG_OS_SUPPORT), yes)
-CODEC_EXTRA_LIBS-$(CONFIG_AV1)        += m
+CODEC_EXTRA_LIBS-$(CONFIG_AV1)            += m
 else
     ifeq ($(CONFIG_GCC), yes)
     CODEC_EXTRA_LIBS-$(CONFIG_AV1)        += m
diff --git a/test/aomcx_set_ref.sh b/test/aomcx_set_ref.sh
new file mode 100755
index 0000000..a6ac73d
--- /dev/null
+++ b/test/aomcx_set_ref.sh
@@ -0,0 +1,58 @@
+#!/bin/sh
+## Copyright (c) 2016, Alliance for Open Media. All rights reserved
+##
+## This source code is subject to the terms of the BSD 2 Clause License and
+## the Alliance for Open Media Patent License 1.0. If the BSD 2 Clause License
+## was not distributed with this source code in the LICENSE file, you can
+## obtain it at www.aomedia.org/license/software. If the Alliance for Open
+## Media Patent License 1.0 was not distributed with this source code in the
+## PATENTS file, you can obtain it at www.aomedia.org/license/patent.
+##
+## This file tests the libaom aom_cx_set_ref example. To add new tests to this
+## file, do the following:
+##   1. Write a shell function (this is your test).
+##   2. Add the function to aom_cx_set_ref_tests (on a new line).
+##
+. $(dirname $0)/tools_common.sh
+
+# Environment check: $YUV_RAW_INPUT is required.
+aom_cx_set_ref_verify_environment() {
+  if [ ! -e "${YUV_RAW_INPUT}" ]; then
+    echo "Libaom test data must exist in LIBAOM_TEST_DATA_PATH."
+    return 1
+  fi
+}
+
+# Runs aom_cx_set_ref and updates the reference frame before encoding frame 90.
+# $1 is the codec name, which aom_cx_set_ref does not support at present: It's
+# currently used only to name the output file.
+# TODO(tomfinegan): Pass the codec param once the example is updated to support
+# AV1.
+aom_set_ref() {
+  local encoder="${LIBAOM_BIN_PATH}/aom_cx_set_ref${AOM_TEST_EXE_SUFFIX}"
+  local codec="$1"
+  local output_file="${AOM_TEST_OUTPUT_DIR}/aom_cx_set_ref_${codec}.ivf"
+  local ref_frame_num=4
+  local limit=20
+  if [ ! -x "${encoder}" ]; then
+    elog "${encoder} does not exist or is not executable."
+    return 1
+  fi
+
+  eval "${AOM_TEST_PREFIX}" "${encoder}" "${codec}" "${YUV_RAW_INPUT_WIDTH}" \
+      "${YUV_RAW_INPUT_HEIGHT}" "${YUV_RAW_INPUT}" "${output_file}" \
+      "${ref_frame_num}" "${limit}" ${devnull}
+
+  [ -e "${output_file}" ] || return 1
+}
+
+aom_cx_set_ref_av1() {
+  if [ "$(av1_encode_available)" = "yes" ]; then
+    aom_set_ref av1 || return 1
+  fi
+}
+
+aom_cx_set_ref_tests="aom_cx_set_ref_av1"
+
+run_tests aom_cx_set_ref_verify_environment "${aom_cx_set_ref_tests}"
+
diff --git a/test/av1_convolve_optimz_test.cc b/test/av1_convolve_optimz_test.cc
index 11ca48c..a2923dd 100644
--- a/test/av1_convolve_optimz_test.cc
+++ b/test/av1_convolve_optimz_test.cc
@@ -34,14 +34,14 @@
 //  <convolve_horiz_func, convolve_vert_func,
 //  <width, height>, filter_params, subpel_x_q4, avg>
 typedef tuple<int, int> BlockDimension;
-typedef tuple<conv_filter_t, conv_filter_t, BlockDimension, INTERP_FILTER, int,
+typedef tuple<conv_filter_t, conv_filter_t, BlockDimension, InterpFilter, int,
               int> ConvParams;
 #if CONFIG_AOM_HIGHBITDEPTH
 // Test parameter list:
 //  <convolve_horiz_func, convolve_vert_func,
 //  <width, height>, filter_params, subpel_x_q4, avg, bit_dpeth>
 typedef tuple<hbd_conv_filter_t, hbd_conv_filter_t, BlockDimension,
-              INTERP_FILTER, int, int, int> HbdConvParams;
+              InterpFilter, int, int, int> HbdConvParams;
 #endif
 
 // Note:
@@ -211,7 +211,7 @@
 };
 
 // 10/12-tap filters
-const INTERP_FILTER kFilter[] = { 6, 4, 2 };
+const InterpFilter kFilter[] = { 6, 4, 2 };
 
 const int kSubpelQ4[] = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 };
 
diff --git a/test/av1_convolve_test.cc b/test/av1_convolve_test.cc
index af15cef..435e106 100644
--- a/test/av1_convolve_test.cc
+++ b/test/av1_convolve_test.cc
@@ -32,12 +32,12 @@
 TEST(AV1ConvolveTest, av1_convolve8) {
   ACMRandom rnd(ACMRandom::DeterministicSeed());
 #if CONFIG_DUAL_FILTER
-  INTERP_FILTER interp_filter[4] = { EIGHTTAP_REGULAR, EIGHTTAP_REGULAR,
-                                     EIGHTTAP_REGULAR, EIGHTTAP_REGULAR };
+  InterpFilter interp_filter[4] = { EIGHTTAP_REGULAR, EIGHTTAP_REGULAR,
+                                    EIGHTTAP_REGULAR, EIGHTTAP_REGULAR };
   InterpFilterParams filter_params =
       av1_get_interp_filter_params(interp_filter[0]);
 #else
-  INTERP_FILTER interp_filter = EIGHTTAP_REGULAR;
+  InterpFilter interp_filter = EIGHTTAP_REGULAR;
   InterpFilterParams filter_params =
       av1_get_interp_filter_params(interp_filter);
 #endif
@@ -79,12 +79,12 @@
 TEST(AV1ConvolveTest, av1_convolve) {
   ACMRandom rnd(ACMRandom::DeterministicSeed());
 #if CONFIG_DUAL_FILTER
-  INTERP_FILTER interp_filter[4] = { EIGHTTAP_REGULAR, EIGHTTAP_REGULAR,
-                                     EIGHTTAP_REGULAR, EIGHTTAP_REGULAR };
+  InterpFilter interp_filter[4] = { EIGHTTAP_REGULAR, EIGHTTAP_REGULAR,
+                                    EIGHTTAP_REGULAR, EIGHTTAP_REGULAR };
   InterpFilterParams filter_params =
       av1_get_interp_filter_params(interp_filter[0]);
 #else
-  INTERP_FILTER interp_filter = EIGHTTAP_REGULAR;
+  InterpFilter interp_filter = EIGHTTAP_REGULAR;
   InterpFilterParams filter_params =
       av1_get_interp_filter_params(interp_filter);
 #endif
@@ -139,12 +139,12 @@
 TEST(AV1ConvolveTest, av1_convolve_avg) {
   ACMRandom rnd(ACMRandom::DeterministicSeed());
 #if CONFIG_DUAL_FILTER
-  INTERP_FILTER interp_filter[4] = { EIGHTTAP_REGULAR, EIGHTTAP_REGULAR,
-                                     EIGHTTAP_REGULAR, EIGHTTAP_REGULAR };
+  InterpFilter interp_filter[4] = { EIGHTTAP_REGULAR, EIGHTTAP_REGULAR,
+                                    EIGHTTAP_REGULAR, EIGHTTAP_REGULAR };
   InterpFilterParams filter_params =
       av1_get_interp_filter_params(interp_filter[0]);
 #else
-  INTERP_FILTER interp_filter = EIGHTTAP_REGULAR;
+  InterpFilter interp_filter = EIGHTTAP_REGULAR;
   InterpFilterParams filter_params =
       av1_get_interp_filter_params(interp_filter);
 #endif
@@ -205,12 +205,12 @@
 TEST(AV1ConvolveTest, av1_highbd_convolve) {
   ACMRandom rnd(ACMRandom::DeterministicSeed());
 #if CONFIG_DUAL_FILTER
-  INTERP_FILTER interp_filter[4] = { EIGHTTAP_REGULAR, EIGHTTAP_REGULAR,
-                                     EIGHTTAP_REGULAR, EIGHTTAP_REGULAR };
+  InterpFilter interp_filter[4] = { EIGHTTAP_REGULAR, EIGHTTAP_REGULAR,
+                                    EIGHTTAP_REGULAR, EIGHTTAP_REGULAR };
   InterpFilterParams filter_params =
       av1_get_interp_filter_params(interp_filter[0]);
 #else
-  INTERP_FILTER interp_filter = EIGHTTAP_REGULAR;
+  InterpFilter interp_filter = EIGHTTAP_REGULAR;
   InterpFilterParams filter_params =
       av1_get_interp_filter_params(interp_filter);
 #endif
@@ -266,12 +266,12 @@
 TEST(AV1ConvolveTest, av1_highbd_convolve_avg) {
   ACMRandom rnd(ACMRandom::DeterministicSeed());
 #if CONFIG_DUAL_FILTER
-  INTERP_FILTER interp_filter[4] = { EIGHTTAP_REGULAR, EIGHTTAP_REGULAR,
-                                     EIGHTTAP_REGULAR, EIGHTTAP_REGULAR };
+  InterpFilter interp_filter[4] = { EIGHTTAP_REGULAR, EIGHTTAP_REGULAR,
+                                    EIGHTTAP_REGULAR, EIGHTTAP_REGULAR };
   InterpFilterParams filter_params =
       av1_get_interp_filter_params(interp_filter[0]);
 #else
-  INTERP_FILTER interp_filter = EIGHTTAP_REGULAR;
+  InterpFilter interp_filter = EIGHTTAP_REGULAR;
   InterpFilterParams filter_params =
       av1_get_interp_filter_params(interp_filter);
 #endif
@@ -337,7 +337,7 @@
 #define highbd_convolve_speed(func, block_size, frame_size)                  \
   TEST(AV1ConvolveTest, func##_speed_##block_size##_##frame_size) {          \
     ACMRandom rnd(ACMRandom::DeterministicSeed());                           \
-    INTERP_FILTER interp_filter = EIGHTTAP;                                  \
+    InterpFilter interp_filter = EIGHTTAP;                                   \
     InterpFilterParams filter_params =                                       \
         av1_get_interp_filter_params(interp_filter);                         \
     int filter_size = filter_params.tap;                                     \
@@ -389,7 +389,7 @@
 #define lowbd_convolve_speed(func, block_size, frame_size)                  \
   TEST(AV1ConvolveTest, func##_speed_l_##block_size##_##frame_size) {       \
     ACMRandom rnd(ACMRandom::DeterministicSeed());                          \
-    INTERP_FILTER interp_filter = EIGHTTAP;                                 \
+    InterpFilter interp_filter = EIGHTTAP;                                  \
     InterpFilterParams filter_params =                                      \
         av1_get_interp_filter_params(interp_filter);                        \
     int filter_size = filter_params.tap;                                    \
diff --git a/test/av1_inv_txfm_test.cc b/test/av1_inv_txfm_test.cc
index 1a7c102..83a7680 100644
--- a/test/av1_inv_txfm_test.cc
+++ b/test/av1_inv_txfm_test.cc
@@ -109,6 +109,7 @@
                       IdctParam(&av1_idct16_c, &reference_idct_1d, 16, 4),
                       IdctParam(&av1_idct32_c, &reference_idct_1d, 32, 6)));
 
+#if CONFIG_AV1_ENCODER
 typedef void (*FwdTxfmFunc)(const int16_t *in, tran_low_t *out, int stride);
 typedef void (*InvTxfmFunc)(const tran_low_t *in, uint8_t *out, int stride);
 typedef std::tr1::tuple<FwdTxfmFunc, InvTxfmFunc, InvTxfmFunc, TX_SIZE, int>
@@ -272,4 +273,5 @@
                                  &av1_idct8x8_1_add_c, TX_8X8, 1),
                       make_tuple(&av1_fdct4x4_c, &av1_idct4x4_16_add_c,
                                  &av1_idct4x4_1_add_c, TX_4X4, 1)));
+#endif  // CONFIG_AV1_ENCODER
 }  // namespace
diff --git a/test/convolve_test.cc b/test/convolve_test.cc
index 3bbbe95..2610264 100644
--- a/test/convolve_test.cc
+++ b/test/convolve_test.cc
@@ -636,7 +636,7 @@
 TEST(ConvolveTest, FiltersWontSaturateWhenAddedPairwise) {
   for (int filter_bank = 0; filter_bank < kNumFilterBanks; ++filter_bank) {
     const InterpKernel *filters =
-        av1_filter_kernels[static_cast<INTERP_FILTER>(filter_bank)];
+        av1_filter_kernels[static_cast<InterpFilter>(filter_bank)];
     for (int i = 0; i < kNumFilters; i++) {
       const int p0 = filters[i][0] + filters[i][1];
       const int p1 = filters[i][2] + filters[i][3];
@@ -674,7 +674,7 @@
 
   for (int filter_bank = 0; filter_bank < kNumFilterBanks; ++filter_bank) {
     const InterpKernel *filters =
-        av1_filter_kernels[static_cast<INTERP_FILTER>(filter_bank)];
+        av1_filter_kernels[static_cast<InterpFilter>(filter_bank)];
 
     for (int filter_x = 0; filter_x < kNumFilters; ++filter_x) {
       for (int filter_y = 0; filter_y < kNumFilters; ++filter_y) {
@@ -751,7 +751,7 @@
 
   for (int filter_bank = 0; filter_bank < kNumFilterBanks; ++filter_bank) {
     const InterpKernel *filters =
-        av1_filter_kernels[static_cast<INTERP_FILTER>(filter_bank)];
+        av1_filter_kernels[static_cast<InterpFilter>(filter_bank)];
 
     for (int filter_x = 0; filter_x < kNumFilters; ++filter_x) {
       for (int filter_y = 0; filter_y < kNumFilters; ++filter_y) {
@@ -848,7 +848,7 @@
 
       for (int filter_bank = 0; filter_bank < kNumFilterBanks; ++filter_bank) {
         const InterpKernel *filters =
-            av1_filter_kernels[static_cast<INTERP_FILTER>(filter_bank)];
+            av1_filter_kernels[static_cast<InterpFilter>(filter_bank)];
         for (int filter_x = 0; filter_x < kNumFilters; ++filter_x) {
           for (int filter_y = 0; filter_y < kNumFilters; ++filter_y) {
             wrapper_filter_block2d_8_c(in, kInputStride, filters[filter_x],