Merge "Get optimized inv_txfm func work with HBD build"
diff --git a/vp10/common/scan.c b/vp10/common/scan.c
index 8edeea8..f11ac8d 100644
--- a/vp10/common/scan.c
+++ b/vp10/common/scan.c
@@ -716,15 +716,13 @@
     { col_scan_16x16, vp10_col_iscan_16x16, col_scan_16x16_neighbors },
     { default_scan_16x16, vp10_default_iscan_16x16,
       default_scan_16x16_neighbors } },
-  {
-      // TX_32X32
-      { default_scan_32x32, vp10_default_iscan_32x32,
-        default_scan_32x32_neighbors },
-      { default_scan_32x32, vp10_default_iscan_32x32,
-        default_scan_32x32_neighbors },
-      { default_scan_32x32, vp10_default_iscan_32x32,
-        default_scan_32x32_neighbors },
-      { default_scan_32x32, vp10_default_iscan_32x32,
-        default_scan_32x32_neighbors },
-  }
+  { // TX_32X32
+    { default_scan_32x32, vp10_default_iscan_32x32,
+      default_scan_32x32_neighbors },
+    { default_scan_32x32, vp10_default_iscan_32x32,
+      default_scan_32x32_neighbors },
+    { default_scan_32x32, vp10_default_iscan_32x32,
+      default_scan_32x32_neighbors },
+    { default_scan_32x32, vp10_default_iscan_32x32,
+      default_scan_32x32_neighbors } },
 };
diff --git a/vp10/decoder/decodemv.c b/vp10/decoder/decodemv.c
index 4a34e52..68a0c79 100644
--- a/vp10/decoder/decodemv.c
+++ b/vp10/decoder/decodemv.c
@@ -24,19 +24,6 @@
 
 #include "vpx_dsp/vpx_dsp_common.h"
 
-static INLINE int read_uniform(vpx_reader *r, int n) {
-  int l = get_unsigned_bits(n);
-  int m = (1 << l) - n;
-  int v = vpx_read_literal(r, l - 1);
-
-  assert(l != 0);
-
-  if (v < m)
-    return v;
-  else
-    return (v << 1) - m + vpx_read_literal(r, 1);
-}
-
 static PREDICTION_MODE read_intra_mode(vpx_reader *r, const vpx_prob *p) {
   return (PREDICTION_MODE)vpx_read_tree(r, vp10_intra_mode_tree, p);
 }
diff --git a/vp10/encoder/bitstream.c b/vp10/encoder/bitstream.c
index 0fd3d5a..e6ee10a 100644
--- a/vp10/encoder/bitstream.c
+++ b/vp10/encoder/bitstream.c
@@ -48,18 +48,6 @@
   { 2, 2 }, { 6, 3 }, { 0, 1 }, { 7, 3 }
 };
 
-static INLINE void write_uniform(vpx_writer *w, int n, int v) {
-  int l = get_unsigned_bits(n);
-  int m = (1 << l) - n;
-  if (l == 0) return;
-  if (v < m) {
-    vpx_write_literal(w, v, l - 1);
-  } else {
-    vpx_write_literal(w, m + ((v - m) >> 1), l - 1);
-    vpx_write_literal(w, (v - m) & 1, 1);
-  }
-}
-
 static struct vp10_token ext_tx_encodings[TX_TYPES];
 
 void vp10_encode_token_init() {
diff --git a/vp10/encoder/rdopt.c b/vp10/encoder/rdopt.c
index ca71429..8e65cb8 100644
--- a/vp10/encoder/rdopt.c
+++ b/vp10/encoder/rdopt.c
@@ -127,15 +127,6 @@
   { { GOLDEN_FRAME, ALTREF_FRAME } }, { { INTRA_FRAME, NONE } },
 };
 
-static INLINE int write_uniform_cost(int n, int v) {
-  int l = get_unsigned_bits(n), m = (1 << l) - n;
-  if (l == 0) return 0;
-  if (v < m)
-    return (l - 1) * vp10_cost_bit(128, 0);
-  else
-    return l * vp10_cost_bit(128, 0);
-}
-
 static void swap_block_ptr(MACROBLOCK *x, PICK_MODE_CONTEXT *ctx, int m, int n,
                            int min_plane, int max_plane) {
   int i;
diff --git a/vpx_dsp/intrapred.c b/vpx_dsp/intrapred.c
index 3a2a8e3..d4f2d06 100644
--- a/vpx_dsp/intrapred.c
+++ b/vpx_dsp/intrapred.c
@@ -42,6 +42,7 @@
       dst[r * stride + c] = dst[(r + 1) * stride + c - 2];
 }
 
+#if CONFIG_MISC_FIXES
 static INLINE void d207e_predictor(uint8_t *dst, ptrdiff_t stride, int bs,
                                    const uint8_t *above, const uint8_t *left) {
   int r, c;
@@ -56,6 +57,7 @@
     dst += stride;
   }
 }
+#endif  // CONFIG_MISC_FIXES
 
 static INLINE void d63_predictor(uint8_t *dst, ptrdiff_t stride, int bs,
                                  const uint8_t *above, const uint8_t *left) {
@@ -74,6 +76,7 @@
   }
 }
 
+#if CONFIG_MISC_FIXES
 static INLINE void d63e_predictor(uint8_t *dst, ptrdiff_t stride, int bs,
                                   const uint8_t *above, const uint8_t *left) {
   int r, c;
@@ -87,6 +90,7 @@
     dst += stride;
   }
 }
+#endif  // CONFIG_MISC_FIXES
 
 static INLINE void d45_predictor(uint8_t *dst, ptrdiff_t stride, int bs,
                                  const uint8_t *above, const uint8_t *left) {
@@ -107,6 +111,7 @@
   }
 }
 
+#if CONFIG_MISC_FIXES
 static INLINE void d45e_predictor(uint8_t *dst, ptrdiff_t stride, int bs,
                                   const uint8_t *above, const uint8_t *left) {
   int r, c;
@@ -119,6 +124,7 @@
     dst += stride;
   }
 }
+#endif  // CONFIG_MISC_FIXES
 
 static INLINE void d117_predictor(uint8_t *dst, ptrdiff_t stride, int bs,
                                   const uint8_t *above, const uint8_t *left) {
diff --git a/vpx_dsp/prob.h b/vpx_dsp/prob.h
index 148116e..6b4f7f9 100644
--- a/vpx_dsp/prob.h
+++ b/vpx_dsp/prob.h
@@ -28,7 +28,7 @@
 
 typedef int8_t vpx_tree_index;
 
-#define TREE_SIZE(leaf_count) (2 * (leaf_count)-2)
+#define TREE_SIZE(leaf_count) (-2 + 2 * (leaf_count))
 
 #define vpx_complement(x) (255 - x)
 
diff --git a/vpx_scale/generic/vpx_scale.c b/vpx_scale/generic/vpx_scale.c
index 93bbd1d..0ac4fad 100644
--- a/vpx_scale/generic/vpx_scale.c
+++ b/vpx_scale/generic/vpx_scale.c
@@ -168,9 +168,9 @@
   (void)source_length;
 
   /* These asserts are needed if there are boundary issues... */
-  /*assert ( dest_scale > source_scale );*/
-  /*assert ( (source_length-1) * dest_scale >= (dest_length-1) * source_scale
-   * );*/
+  /* assert ( dest_scale > source_scale );*/
+  /* assert ( (source_length - 1) * dest_scale >= (dest_length - 1) *
+   * source_scale);*/
 
   for (i = 0; i < dest_length * dest_step; i += dest_step) {
     dest[i] = (char)((left_modifier * left_pixel +