shithub: libvpx

Download patch

ref: 4cca47b5385adb8ace28b10db7a20f337b15bbeb
parent: d47828ed59999ca9379860c13a753e092062748c
author: Ronald S. Bultje <rbultje@google.com>
date: Tue Dec 18 10:31:19 EST 2012

Use standard integer types for pixel values and coefficients.

For coefficients, use int16_t (instead of short); for pixel values in
16-bit intermediates, use uint16_t (instead of unsigned short); for all
others, use uint8_t (instead of unsigned char).

Change-Id: I3619cd9abf106c3742eccc2e2f5e89a62774f7da

--- a/vp9/common/vp9_alloccommon.h
+++ b/vp9/common/vp9_alloccommon.h
@@ -23,4 +23,4 @@
 void vp9_update_mode_info_border(VP9_COMMON *cpi, MODE_INFO *mi_base);
 void vp9_update_mode_info_in_image(VP9_COMMON *cpi, MODE_INFO *mi);
 
-#endif
+#endif  // VP9_COMMON_VP9_ALLOCCOMMON_H_
--- a/vp9/common/vp9_blockd.c
+++ b/vp9/common/vp9_blockd.c
@@ -12,7 +12,7 @@
 #include "vp9/common/vp9_blockd.h"
 #include "vpx_mem/vpx_mem.h"
 
-const unsigned char vp9_block2left[TX_SIZE_MAX_SB][25] = {
+const uint8_t vp9_block2left[TX_SIZE_MAX_SB][25] = {
   {0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8},
   {0, 0, 0, 0, 0, 0, 0, 0, 2, 2, 2, 2, 2, 2, 2, 2, 4, 4, 4, 4, 6, 6, 6, 6, 8},
   {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 4, 4, 4, 6, 6, 6, 6, 8},
@@ -20,7 +20,7 @@
   {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 4, 4, 4, 6, 6, 6, 6, 8}
 #endif
 };
-const unsigned char vp9_block2above[TX_SIZE_MAX_SB][25] = {
+const uint8_t vp9_block2above[TX_SIZE_MAX_SB][25] = {
   {0, 1, 2, 3, 0, 1, 2, 3, 0, 1, 2, 3, 0, 1, 2, 3, 4, 5, 4, 5, 6, 7, 6, 7, 8},
   {0, 0, 0, 0, 2, 2, 2, 2, 0, 0, 0, 0, 2, 2, 2, 2, 4, 4, 4, 4, 6, 6, 6, 6, 8},
   {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 4, 4, 4, 6, 6, 6, 6, 8},
--- a/vp9/common/vp9_blockd.h
+++ b/vp9/common/vp9_blockd.h
@@ -279,19 +279,19 @@
 } MODE_INFO;
 
 typedef struct blockd {
-  short *qcoeff;
-  short *dqcoeff;
-  unsigned char  *predictor;
-  short *diff;
-  short *dequant;
+  int16_t *qcoeff;
+  int16_t *dqcoeff;
+  uint8_t *predictor;
+  int16_t *diff;
+  int16_t *dequant;
 
   /* 16 Y blocks, 4 U blocks, 4 V blocks each with 16 entries */
-  unsigned char **base_pre;
-  unsigned char **base_second_pre;
+  uint8_t **base_pre;
+  uint8_t **base_second_pre;
   int pre;
   int pre_stride;
 
-  unsigned char **base_dst;
+  uint8_t **base_dst;
   int dst;
   int dst_stride;
 
@@ -303,18 +303,18 @@
 #if CONFIG_TX32X32 && CONFIG_SUPERBLOCKS
 typedef struct superblockd {
   /* 32x32 Y and 16x16 U/V. No 2nd order transform yet. */
-  DECLARE_ALIGNED(16, short, diff[32*32+16*16*2]);
-  DECLARE_ALIGNED(16, short, qcoeff[32*32+16*16*2]);
-  DECLARE_ALIGNED(16, short, dqcoeff[32*32+16*16*2]);
+  DECLARE_ALIGNED(16, int16_t, diff[32*32+16*16*2]);
+  DECLARE_ALIGNED(16, int16_t, qcoeff[32*32+16*16*2]);
+  DECLARE_ALIGNED(16, int16_t, dqcoeff[32*32+16*16*2]);
 } SUPERBLOCKD;
 #endif
 
 typedef struct macroblockd {
-  DECLARE_ALIGNED(16, short, diff[400]);      /* from idct diff */
-  DECLARE_ALIGNED(16, unsigned char,  predictor[384]);
-  DECLARE_ALIGNED(16, short, qcoeff[400]);
-  DECLARE_ALIGNED(16, short, dqcoeff[400]);
-  DECLARE_ALIGNED(16, unsigned short,  eobs[25]);
+  DECLARE_ALIGNED(16, int16_t,  diff[400]);      /* from idct diff */
+  DECLARE_ALIGNED(16, uint8_t,  predictor[384]);
+  DECLARE_ALIGNED(16, int16_t,  qcoeff[400]);
+  DECLARE_ALIGNED(16, int16_t,  dqcoeff[400]);
+  DECLARE_ALIGNED(16, uint16_t, eobs[25]);
 
 #if CONFIG_TX32X32 && CONFIG_SUPERBLOCKS
   SUPERBLOCKD sb_coeff_data;
@@ -389,10 +389,10 @@
   unsigned int frames_till_alt_ref_frame;
 
   /* Inverse transform function pointers. */
-  void (*inv_xform4x4_1_x8)(short *input, short *output, int pitch);
-  void (*inv_xform4x4_x8)(short *input, short *output, int pitch);
-  void (*inv_walsh4x4_1)(short *in, short *out);
-  void (*inv_walsh4x4_lossless)(short *in, short *out);
+  void (*inv_xform4x4_1_x8)(int16_t *input, int16_t *output, int pitch);
+  void (*inv_xform4x4_x8)(int16_t *input, int16_t *output, int pitch);
+  void (*inv_walsh4x4_1)(int16_t *in, int16_t *out);
+  void (*inv_walsh4x4_lossless)(int16_t *in, int16_t *out);
 
 
   vp9_subpix_fn_t  subpixel_predict;
@@ -412,7 +412,7 @@
    * to keep a copy of the reference area. This buffer can be used for other
    * purpose.
    */
-  DECLARE_ALIGNED(32, unsigned char, y_buf[22 * 32]);
+  DECLARE_ALIGNED(32, uint8_t, y_buf[22 * 32]);
 #endif
 
   int mb_index;   // Index of the MB in the SB (0..3)
@@ -502,8 +502,8 @@
   return tx_type;
 }
 
-extern const unsigned char vp9_block2left[TX_SIZE_MAX_SB][25];
-extern const unsigned char vp9_block2above[TX_SIZE_MAX_SB][25];
+extern const uint8_t vp9_block2left[TX_SIZE_MAX_SB][25];
+extern const uint8_t vp9_block2above[TX_SIZE_MAX_SB][25];
 
 #define USE_ADST_FOR_I16X16_8X8   0
 #define USE_ADST_FOR_I16X16_4X4   0
@@ -665,4 +665,4 @@
     }
   }
 }
-#endif  /* __INC_BLOCKD_H */
+#endif  // VP9_COMMON_VP9_BLOCKD_H_
--- a/vp9/common/vp9_coefupdateprobs.h
+++ b/vp9/common/vp9_coefupdateprobs.h
@@ -8,6 +8,8 @@
  *  be found in the AUTHORS file in the root of the source tree.
  */
 
+#ifndef VP9_COMMON_VP9_COEFUPDATEPROBS_H_
+#define VP9_COMMON_VP9_COEFUPDATEPROBS_H__
 
 /* Update probabilities for the nodes in the token entropy tree.
    Generated file included by vp9_entropy.c */
@@ -14,3 +16,5 @@
 #define COEF_UPDATE_PROB 252
 #define COEF_UPDATE_PROB_8X8 252
 #define COEF_UPDATE_PROB_16X16 252
+
+#endif  // VP9_COMMON_VP9_COEFUPDATEPROBS_H__
--- a/vp9/common/vp9_common.h
+++ b/vp9/common/vp9_common.h
@@ -8,7 +8,6 @@
  *  be found in the AUTHORS file in the root of the source tree.
  */
 
-
 #ifndef VP9_COMMON_VP9_COMMON_H_
 #define VP9_COMMON_VP9_COMMON_H_
 
@@ -18,28 +17,30 @@
 
 #include "vpx_mem/vpx_mem.h"
 #include "vpx/vpx_integer.h"
-#include "vp9/common/vp9_common_types.h"
 
+#define TRUE    1
+#define FALSE   0
+
 /* Only need this for fixed-size arrays, for structs just assign. */
 
-#define vp9_copy( Dest, Src) { \
-    assert( sizeof( Dest) == sizeof( Src)); \
-    vpx_memcpy( Dest, Src, sizeof( Src)); \
+#define vp9_copy(Dest, Src) { \
+    assert(sizeof(Dest) == sizeof(Src)); \
+    vpx_memcpy(Dest, Src, sizeof(Src)); \
   }
 
 /* Use this for variably-sized arrays. */
 
-#define vp9_copy_array( Dest, Src, N) { \
-    assert( sizeof( *Dest) == sizeof( *Src)); \
-    vpx_memcpy( Dest, Src, N * sizeof( *Src)); \
+#define vp9_copy_array(Dest, Src, N) { \
+    assert(sizeof(*Dest) == sizeof(*Src)); \
+    vpx_memcpy(Dest, Src, N * sizeof(*Src)); \
   }
 
-#define vp9_zero( Dest)  vpx_memset( &Dest, 0, sizeof( Dest));
+#define vp9_zero(Dest) vpx_memset(&Dest, 0, sizeof(Dest));
 
-#define vp9_zero_array( Dest, N)  vpx_memset( Dest, 0, N * sizeof( *Dest));
+#define vp9_zero_array(Dest, N) vpx_memset(Dest, 0, N * sizeof(*Dest));
 
 static __inline uint8_t clip_pixel(int val) {
   return (val > 255) ? 255u : (val < 0) ? 0u : val;
 }
 
-#endif  /* common_h */
+#endif  // VP9_COMMON_VP9_COMMON_H_
--- a/vp9/common/vp9_common_types.h
+++ /dev/null
@@ -1,18 +1,0 @@
-/*
- *  Copyright (c) 2010 The WebM project authors. 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.
- */
-
-
-#ifndef VP9_COMMON_VP9_COMMON_TYPES_H_
-#define VP9_COMMON_VP9_COMMON_TYPES_H_
-
-#define TRUE    1
-#define FALSE   0
-
-#endif
--- a/vp9/common/vp9_default_coef_probs.h
+++ b/vp9/common/vp9_default_coef_probs.h
@@ -1210,4 +1210,4 @@
     }
   }
 };
-#endif
+#endif  // CONFIG_SUPERBLOCKS && CONFIG_TX32X32
--- a/vp9/common/vp9_entropy.c
+++ b/vp9/common/vp9_entropy.c
@@ -17,18 +17,12 @@
 #include "vp9/common/vp9_onyxc_int.h"
 #include "vp9/common/vp9_entropymode.h"
 #include "vpx_mem/vpx_mem.h"
-
-#define uchar unsigned char     /* typedefs can clash */
-#define uint  unsigned int
-
-typedef const uchar cuchar;
-typedef const uint cuint;
-
+#include "vpx/vpx_integer.h"
 #include "vp9/common/vp9_coefupdateprobs.h"
 
 const int vp9_i8x8_block[4] = {0, 2, 8, 10};
 
-DECLARE_ALIGNED(16, const unsigned char, vp9_norm[256]) = {
+DECLARE_ALIGNED(16, const uint8_t, vp9_norm[256]) = {
   0, 7, 6, 6, 5, 5, 5, 5, 4, 4, 4, 4, 4, 4, 4, 4,
   3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
   2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
@@ -51,7 +45,7 @@
   0, 1, 2, 3, 6, 4, 5, 6, 6, 6, 6, 6, 6, 7, 7, 7
 };
 
-DECLARE_ALIGNED(16, cuchar, vp9_prev_token_class[MAX_ENTROPY_TOKENS]) = {
+DECLARE_ALIGNED(16, const uint8_t, vp9_prev_token_class[MAX_ENTROPY_TOKENS]) = {
   0, 1, 2, 2, 3, 3, 3, 3, 3, 3, 3, 0
 };
 
--- a/vp9/common/vp9_entropy.h
+++ b/vp9/common/vp9_entropy.h
@@ -8,10 +8,10 @@
  *  be found in the AUTHORS file in the root of the source tree.
  */
 
-
 #ifndef VP9_COMMON_VP9_ENTROPY_H_
 #define VP9_COMMON_VP9_ENTROPY_H_
 
+#include "vpx/vpx_integer.h"
 #include "vp9/common/vp9_treecoder.h"
 #include "vp9/common/vp9_blockd.h"
 #include "vp9/common/vp9_common.h"
@@ -110,7 +110,8 @@
 #define SUBEXP_PARAM                4   /* Subexponential code parameter */
 #define MODULUS_PARAM               13  /* Modulus parameter */
 
-extern DECLARE_ALIGNED(16, const unsigned char, vp9_prev_token_class[MAX_ENTROPY_TOKENS]);
+extern DECLARE_ALIGNED(16, const uint8_t,
+                       vp9_prev_token_class[MAX_ENTROPY_TOKENS]);
 
 struct VP9Common;
 void vp9_default_coef_probs(struct VP9Common *);
@@ -135,4 +136,4 @@
     vpx_memset(xd->left_context, 0, sizeof(ENTROPY_CONTEXT_PLANES));
 }
 
-#endif
+#endif  // VP9_COMMON_VP9_ENTROPY_H_
--- a/vp9/common/vp9_entropymode.h
+++ b/vp9/common/vp9_entropymode.h
@@ -8,7 +8,6 @@
  *  be found in the AUTHORS file in the root of the source tree.
  */
 
-
 #ifndef VP9_COMMON_VP9_ENTROPYMODE_H_
 #define VP9_COMMON_VP9_ENTROPYMODE_H_
 
@@ -114,4 +113,4 @@
 extern const  vp9_prob vp9_switchable_interp_prob[VP9_SWITCHABLE_FILTERS + 1]
                                                  [VP9_SWITCHABLE_FILTERS - 1];
 
-#endif
+#endif  // VP9_COMMON_VP9_ENTROPYMODE_H_
--- a/vp9/common/vp9_entropymv.h
+++ b/vp9/common/vp9_entropymv.h
@@ -126,4 +126,5 @@
     unsigned int (*branch_ct_class0_hp)[2],
     unsigned int (*branch_ct_hp)[2]);
 void vp9_counts_process(nmv_context_counts *NMVcount, int usehp);
-#endif
+
+#endif  // VP9_COMMON_VP9_ENTROPYMV_H_
--- a/vp9/common/vp9_extend.c
+++ b/vp9/common/vp9_extend.c
@@ -11,9 +11,9 @@
 #include "vp9/common/vp9_extend.h"
 #include "vpx_mem/vpx_mem.h"
 
-static void copy_and_extend_plane(unsigned char *s, /* source */
+static void copy_and_extend_plane(uint8_t *s,       /* source */
                                   int sp,           /* source pitch */
-                                  unsigned char *d, /* destination */
+                                  uint8_t *d,       /* destination */
                                   int dp,           /* destination pitch */
                                   int h,            /* height */
                                   int w,            /* width */
@@ -22,8 +22,8 @@
                                   int eb,           /* extend bottom border */
                                   int er) {         /* extend right border */
   int i;
-  unsigned char *src_ptr1, *src_ptr2;
-  unsigned char *dest_ptr1, *dest_ptr2;
+  uint8_t *src_ptr1, *src_ptr2;
+  uint8_t *dest_ptr1, *dest_ptr2;
   int linesize;
 
   /* copy the left and right most columns out */
@@ -143,8 +143,8 @@
 }
 
 /* note the extension is only for the last row, for intra prediction purpose */
-void vp9_extend_mb_row(YV12_BUFFER_CONFIG *ybf, unsigned char *YPtr,
-                       unsigned char *UPtr, unsigned char *VPtr) {
+void vp9_extend_mb_row(YV12_BUFFER_CONFIG *ybf, uint8_t *YPtr,
+                       uint8_t *UPtr, uint8_t *VPtr) {
   int i;
 
   YPtr += ybf->y_stride * 14;
--- a/vp9/common/vp9_extend.h
+++ b/vp9/common/vp9_extend.h
@@ -12,9 +12,10 @@
 #define VP9_COMMON_VP9_EXTEND_H_
 
 #include "vpx_scale/yv12config.h"
+#include "vpx/vpx_integer.h"
 
-void vp9_extend_mb_row(YV12_BUFFER_CONFIG *ybf, unsigned char *YPtr,
-                       unsigned char *UPtr, unsigned char *VPtr);
+void vp9_extend_mb_row(YV12_BUFFER_CONFIG *ybf, uint8_t *YPtr,
+                       uint8_t *UPtr, uint8_t *VPtr);
 
 void vp9_copy_and_extend_frame(YV12_BUFFER_CONFIG *src,
                                YV12_BUFFER_CONFIG *dst);
@@ -24,4 +25,4 @@
                                          int srcy, int srcx,
                                          int srch, int srcw);
 
-#endif  // __INC_EXTEND_H
+#endif  // VP9_COMMON_VP9_EXTEND_H_
--- a/vp9/common/vp9_filter.c
+++ b/vp9/common/vp9_filter.c
@@ -15,7 +15,7 @@
 #include "vp9_rtcd.h"
 #include "vp9/common/vp9_common.h"
 
-DECLARE_ALIGNED(16, const short, vp9_bilinear_filters[SUBPEL_SHIFTS][2]) = {
+DECLARE_ALIGNED(16, const int16_t, vp9_bilinear_filters[SUBPEL_SHIFTS][2]) = {
   { 128,   0 },
   { 120,   8 },
   { 112,  16 },
@@ -36,7 +36,7 @@
 
 #define FILTER_ALPHA       0
 #define FILTER_ALPHA_SHARP 1
-DECLARE_ALIGNED(16, const short, vp9_sub_pel_filters_8[SUBPEL_SHIFTS][8]) = {
+DECLARE_ALIGNED(16, const int16_t, vp9_sub_pel_filters_8[SUBPEL_SHIFTS][8]) = {
 #if FILTER_ALPHA == 0
   /* Lagrangian interpolation filter */
   { 0,   0,   0, 128,   0,   0,   0,  0},
@@ -82,7 +82,7 @@
 #endif  /* FILTER_ALPHA */
 };
 
-DECLARE_ALIGNED(16, const short, vp9_sub_pel_filters_8s[SUBPEL_SHIFTS][8]) = {
+DECLARE_ALIGNED(16, const int16_t, vp9_sub_pel_filters_8s[SUBPEL_SHIFTS][8]) = {
 #if FILTER_ALPHA_SHARP == 1
   /* dct based filter */
   {0,   0,   0, 128,   0,   0,   0, 0},
@@ -122,7 +122,7 @@
 #endif  /* FILTER_ALPHA_SHARP */
 };
 
-DECLARE_ALIGNED(16, const short, vp9_sub_pel_filters_6[SUBPEL_SHIFTS][6]) = {
+DECLARE_ALIGNED(16, const int16_t, vp9_sub_pel_filters_6[SUBPEL_SHIFTS][6]) = {
   {0,   0, 128,   0,   0, 0},
   {1,  -5, 125,   8,  -2, 1},
   {1,  -8, 122,  17,  -5, 1},
@@ -141,13 +141,13 @@
   {1,  -2,   8, 125,  -5, 1}
 };
 
-static void filter_block2d_first_pass_6(unsigned char *src_ptr,
+static void filter_block2d_first_pass_6(uint8_t *src_ptr,
                                         int *output_ptr,
                                         unsigned int src_pixels_per_line,
                                         unsigned int pixel_step,
                                         unsigned int output_height,
                                         unsigned int output_width,
-                                        const short *vp9_filter) {
+                                        const int16_t *vp9_filter) {
   unsigned int i, j;
   int temp;
 
@@ -173,13 +173,13 @@
 }
 
 static void filter_block2d_second_pass_6(int *src_ptr,
-                                         unsigned char *output_ptr,
+                                         uint8_t *output_ptr,
                                          int output_pitch,
                                          unsigned int src_pixels_per_line,
                                          unsigned int pixel_step,
                                          unsigned int output_height,
                                          unsigned int output_width,
-                                         const short *vp9_filter) {
+                                         const int16_t *vp9_filter) {
   unsigned int i, j;
   int temp;
 
@@ -214,13 +214,13 @@
  * ((filter_result + dest + 1) >> 1) and stores that in the output.
  */
 static void filter_block2d_second_pass_avg_6(int *src_ptr,
-                                             unsigned char *output_ptr,
+                                             uint8_t *output_ptr,
                                              int output_pitch,
                                              unsigned int src_pixels_per_line,
                                              unsigned int pixel_step,
                                              unsigned int output_height,
                                              unsigned int output_width,
-                                             const short *vp9_filter) {
+                                             const int16_t *vp9_filter) {
   unsigned int i, j;
   int temp;
 
@@ -248,12 +248,12 @@
 }
 
 #define Interp_Extend 3
-static void filter_block2d_6(unsigned char  *src_ptr,
-                             unsigned char  *output_ptr,
+static void filter_block2d_6(uint8_t *src_ptr,
+                             uint8_t *output_ptr,
                              unsigned int src_pixels_per_line,
                              int output_pitch,
-                             const short  *HFilter,
-                             const short  *VFilter) {
+                             const int16_t *HFilter,
+                             const int16_t *VFilter) {
   int FData[(3 + Interp_Extend * 2) * 4]; /* Temp data buffer used in filtering */
 
   /* First filter 1-D horizontally... */
@@ -265,14 +265,14 @@
 }
 
 
-void vp9_sixtap_predict_c(unsigned char  *src_ptr,
-                          int   src_pixels_per_line,
-                          int  xoffset,
-                          int  yoffset,
-                          unsigned char *dst_ptr,
+void vp9_sixtap_predict_c(uint8_t *src_ptr,
+                          int src_pixels_per_line,
+                          int xoffset,
+                          int yoffset,
+                          uint8_t *dst_ptr,
                           int dst_pitch) {
-  const short  *HFilter;
-  const short  *VFilter;
+  const int16_t *HFilter;
+  const int16_t *VFilter;
 
   HFilter = vp9_sub_pel_filters_6[xoffset];   /* 6 tap */
   VFilter = vp9_sub_pel_filters_6[yoffset];   /* 6 tap */
@@ -287,12 +287,12 @@
  * then averages that with the content already present in the output
  * ((filter_result + dest + 1) >> 1) and stores that in the output.
  */
-static void filter_block2d_avg_6(unsigned char  *src_ptr,
-                                 unsigned char  *output_ptr,
+static void filter_block2d_avg_6(uint8_t *src_ptr,
+                                 uint8_t *output_ptr,
                                  unsigned int src_pixels_per_line,
                                  int output_pitch,
-                                 const short  *HFilter,
-                                 const short  *VFilter) {
+                                 const int16_t *HFilter,
+                                 const int16_t *VFilter) {
   int FData[(3 + Interp_Extend * 2) * 4]; /* Temp data buffer used in filtering */
 
   /* First filter 1-D horizontally... */
@@ -305,17 +305,14 @@
                                    output_pitch, 4, 4, 4, 4, VFilter);
 }
 
-void vp9_sixtap_predict_avg_c
-(
-  unsigned char  *src_ptr,
-  int   src_pixels_per_line,
-  int  xoffset,
-  int  yoffset,
-  unsigned char *dst_ptr,
-  int dst_pitch
-) {
-  const short  *HFilter;
-  const short  *VFilter;
+void vp9_sixtap_predict_avg_c(uint8_t *src_ptr,
+                              int src_pixels_per_line,
+                              int xoffset,
+                              int yoffset,
+                              uint8_t *dst_ptr,
+                              int dst_pitch) {
+  const int16_t *HFilter;
+  const int16_t *VFilter;
 
   HFilter = vp9_sub_pel_filters_6[xoffset];   /* 6 tap */
   VFilter = vp9_sub_pel_filters_6[yoffset];   /* 6 tap */
@@ -324,17 +321,14 @@
                        dst_pitch, HFilter, VFilter);
 }
 
-void vp9_sixtap_predict8x8_c
-(
-  unsigned char  *src_ptr,
-  int  src_pixels_per_line,
-  int  xoffset,
-  int  yoffset,
-  unsigned char *dst_ptr,
-  int  dst_pitch
-) {
-  const short  *HFilter;
-  const short  *VFilter;
+void vp9_sixtap_predict8x8_c(uint8_t *src_ptr,
+                             int src_pixels_per_line,
+                             int xoffset,
+                             int yoffset,
+                             uint8_t *dst_ptr,
+                             int dst_pitch) {
+  const int16_t *HFilter;
+  const int16_t *VFilter;
   // int FData[(7+Interp_Extend*2)*16];   /* Temp data buffer used in filtering */
   int FData[(7 + Interp_Extend * 2) * 8]; /* Temp data buffer used in filtering */
 
@@ -351,17 +345,14 @@
 
 }
 
-void vp9_sixtap_predict_avg8x8_c
-(
-  unsigned char  *src_ptr,
-  int  src_pixels_per_line,
-  int  xoffset,
-  int  yoffset,
-  unsigned char *dst_ptr,
-  int  dst_pitch
-) {
-  const short  *HFilter;
-  const short  *VFilter;
+void vp9_sixtap_predict_avg8x8_c(uint8_t *src_ptr,
+                                 int src_pixels_per_line,
+                                 int xoffset,
+                                 int yoffset,
+                                 uint8_t *dst_ptr,
+                                 int dst_pitch) {
+  const int16_t *HFilter;
+  const int16_t *VFilter;
   // int FData[(7+Interp_Extend*2)*16];   /* Temp data buffer used in filtering */
   int FData[(7 + Interp_Extend * 2) * 8]; /* Temp data buffer used in filtering */
 
@@ -376,17 +367,14 @@
   filter_block2d_second_pass_avg_6(FData + 8 * (Interp_Extend - 1), dst_ptr, dst_pitch, 8, 8, 8, 8, VFilter);
 }
 
-void vp9_sixtap_predict8x4_c
-(
-  unsigned char  *src_ptr,
-  int  src_pixels_per_line,
-  int  xoffset,
-  int  yoffset,
-  unsigned char *dst_ptr,
-  int  dst_pitch
-) {
-  const short  *HFilter;
-  const short  *VFilter;
+void vp9_sixtap_predict8x4_c(uint8_t *src_ptr,
+                             int src_pixels_per_line,
+                             int xoffset,
+                             int yoffset,
+                             uint8_t *dst_ptr,
+                             int dst_pitch) {
+  const int16_t *HFilter;
+  const int16_t *VFilter;
   // int FData[(7+Interp_Extend*2)*16];   /* Temp data buffer used in filtering */
   int FData[(3 + Interp_Extend * 2) * 8]; /* Temp data buffer used in filtering */
 
@@ -403,17 +391,14 @@
 
 }
 
-void vp9_sixtap_predict16x16_c
-(
-  unsigned char  *src_ptr,
-  int  src_pixels_per_line,
-  int  xoffset,
-  int  yoffset,
-  unsigned char *dst_ptr,
-  int  dst_pitch
-) {
-  const short  *HFilter;
-  const short  *VFilter;
+void vp9_sixtap_predict16x16_c(uint8_t *src_ptr,
+                               int src_pixels_per_line,
+                               int xoffset,
+                               int yoffset,
+                               uint8_t *dst_ptr,
+                               int dst_pitch) {
+  const int16_t *HFilter;
+  const int16_t *VFilter;
   // int FData[(15+Interp_Extend*2)*24];   /* Temp data buffer used in filtering */
   int FData[(15 + Interp_Extend * 2) * 16]; /* Temp data buffer used in filtering */
 
@@ -430,17 +415,14 @@
 
 }
 
-void vp9_sixtap_predict_avg16x16_c
-(
-  unsigned char  *src_ptr,
-  int  src_pixels_per_line,
-  int  xoffset,
-  int  yoffset,
-  unsigned char *dst_ptr,
-  int  dst_pitch
-) {
-  const short  *HFilter;
-  const short  *VFilter;
+void vp9_sixtap_predict_avg16x16_c(uint8_t *src_ptr,
+                                   int src_pixels_per_line,
+                                   int xoffset,
+                                   int yoffset,
+                                   uint8_t *dst_ptr,
+                                   int dst_pitch) {
+  const int16_t *HFilter;
+  const int16_t *VFilter;
   // int FData[(15+Interp_Extend*2)*24];   /* Temp data buffer used in filtering */
   int FData[(15 + Interp_Extend * 2) * 16]; /* Temp data buffer used in filtering */
 
@@ -470,13 +452,13 @@
   {16,16},
 };
 
-static void filter_block2d_8_c(const unsigned char *src_ptr,
-                               const unsigned int   src_stride,
-                               const short *HFilter,
-                               const short *VFilter,
+static void filter_block2d_8_c(const uint8_t *src_ptr,
+                               const unsigned int src_stride,
+                               const int16_t *HFilter,
+                               const int16_t *VFilter,
                                const filter_size_t filter_size,
-                               unsigned char *dst_ptr,
-                               unsigned int   dst_stride) {
+                               uint8_t *dst_ptr,
+                               unsigned int dst_stride) {
   const unsigned int output_width = filter_size_to_wh[filter_size][0];
   const unsigned int output_height = filter_size_to_wh[filter_size][1];
 
@@ -495,12 +477,12 @@
    *                               = 23
    * and filter_max_width = 16
    */
-  unsigned char intermediate_buffer[23 * 16];
+  uint8_t intermediate_buffer[23 * 16];
   const int intermediate_next_stride = 1 - intermediate_height * output_width;
 
   // Horizontal pass (src -> transposed intermediate).
   {
-    unsigned char *output_ptr = intermediate_buffer;
+    uint8_t *output_ptr = intermediate_buffer;
     const int src_next_row_stride = src_stride - output_width;
     unsigned int i, j;
     src_ptr -= (kInterp_Extend - 1) * src_stride + (kInterp_Extend - 1);
@@ -529,7 +511,7 @@
 
   // Vertical pass (transposed intermediate -> dst).
   {
-    unsigned char *src_ptr = intermediate_buffer;
+    uint8_t *src_ptr = intermediate_buffer;
     const int dst_next_row_stride = dst_stride - output_width;
     unsigned int i, j;
     for (i = 0; i < output_height; i++) {
@@ -555,11 +537,11 @@
   }
 }
 
-void vp9_filter_block2d_4x4_8_c(const unsigned char *src_ptr,
+void vp9_filter_block2d_4x4_8_c(const uint8_t *src_ptr,
                                 const unsigned int src_stride,
-                                const short *HFilter_aligned16,
-                                const short *VFilter_aligned16,
-                                unsigned char *dst_ptr,
+                                const int16_t *HFilter_aligned16,
+                                const int16_t *VFilter_aligned16,
+                                uint8_t *dst_ptr,
                                 unsigned int dst_stride) {
   filter_block2d_8_c(src_ptr, src_stride,
                      HFilter_aligned16, VFilter_aligned16,
@@ -566,11 +548,11 @@
                      VPX_FILTER_4x4, dst_ptr, dst_stride);
 }
 
-void vp9_filter_block2d_8x4_8_c(const unsigned char *src_ptr,
+void vp9_filter_block2d_8x4_8_c(const uint8_t *src_ptr,
                                 const unsigned int src_stride,
-                                const short *HFilter_aligned16,
-                                const short *VFilter_aligned16,
-                                unsigned char *dst_ptr,
+                                const int16_t *HFilter_aligned16,
+                                const int16_t *VFilter_aligned16,
+                                uint8_t *dst_ptr,
                                 unsigned int dst_stride) {
   filter_block2d_8_c(src_ptr, src_stride,
                      HFilter_aligned16, VFilter_aligned16,
@@ -577,11 +559,11 @@
                      VPX_FILTER_8x4, dst_ptr, dst_stride);
 }
 
-void vp9_filter_block2d_8x8_8_c(const unsigned char *src_ptr,
+void vp9_filter_block2d_8x8_8_c(const uint8_t *src_ptr,
                                 const unsigned int src_stride,
-                                const short *HFilter_aligned16,
-                                const short *VFilter_aligned16,
-                                unsigned char *dst_ptr,
+                                const int16_t *HFilter_aligned16,
+                                const int16_t *VFilter_aligned16,
+                                uint8_t *dst_ptr,
                                 unsigned int dst_stride) {
   filter_block2d_8_c(src_ptr, src_stride,
                      HFilter_aligned16, VFilter_aligned16,
@@ -588,11 +570,11 @@
                      VPX_FILTER_8x8, dst_ptr, dst_stride);
 }
 
-void vp9_filter_block2d_16x16_8_c(const unsigned char *src_ptr,
+void vp9_filter_block2d_16x16_8_c(const uint8_t *src_ptr,
                                   const unsigned int src_stride,
-                                  const short *HFilter_aligned16,
-                                  const short *VFilter_aligned16,
-                                  unsigned char *dst_ptr,
+                                  const int16_t *HFilter_aligned16,
+                                  const int16_t *VFilter_aligned16,
+                                  uint8_t *dst_ptr,
                                   unsigned int dst_stride) {
   filter_block2d_8_c(src_ptr, src_stride,
                      HFilter_aligned16, VFilter_aligned16,
@@ -599,9 +581,9 @@
                      VPX_FILTER_16x16, dst_ptr, dst_stride);
 }
 
-static void block2d_average_c(unsigned char *src,
-                              unsigned int   src_stride,
-                              unsigned char *output_ptr,
+static void block2d_average_c(uint8_t *src,
+                              unsigned int src_stride,
+                              uint8_t *output_ptr,
                               unsigned int output_stride,
                               const filter_size_t filter_size) {
   const unsigned int output_width = filter_size_to_wh[filter_size][0];
@@ -618,14 +600,14 @@
 
 #define block2d_average block2d_average_c
 
-void vp9_eighttap_predict_c(unsigned char  *src_ptr,
-                            int   src_pixels_per_line,
-                            int  xoffset,
-                            int  yoffset,
-                            unsigned char *dst_ptr,
+void vp9_eighttap_predict_c(uint8_t *src_ptr,
+                            int src_pixels_per_line,
+                            int xoffset,
+                            int yoffset,
+                            uint8_t *dst_ptr,
                             int dst_pitch) {
-  const short  *HFilter;
-  const short  *VFilter;
+  const int16_t *HFilter;
+  const int16_t *VFilter;
 
   HFilter = vp9_sub_pel_filters_8[xoffset];
   VFilter = vp9_sub_pel_filters_8[yoffset];
@@ -635,15 +617,15 @@
                            dst_ptr, dst_pitch);
 }
 
-void vp9_eighttap_predict_avg4x4_c(unsigned char  *src_ptr,
-                                   int   src_pixels_per_line,
-                                   int  xoffset,
-                                   int  yoffset,
-                                   unsigned char *dst_ptr,
+void vp9_eighttap_predict_avg4x4_c(uint8_t *src_ptr,
+                                   int src_pixels_per_line,
+                                   int xoffset,
+                                   int yoffset,
+                                   uint8_t *dst_ptr,
                                    int dst_pitch) {
-  const short  *HFilter = vp9_sub_pel_filters_8[xoffset];
-  const short  *VFilter = vp9_sub_pel_filters_8[yoffset];
-  unsigned char tmp[4 * 4];
+  const int16_t *HFilter = vp9_sub_pel_filters_8[xoffset];
+  const int16_t *VFilter = vp9_sub_pel_filters_8[yoffset];
+  uint8_t tmp[4 * 4];
 
   vp9_filter_block2d_4x4_8(src_ptr, src_pixels_per_line,
                            HFilter, VFilter,
@@ -651,14 +633,14 @@
   block2d_average(tmp, 4, dst_ptr, dst_pitch, VPX_FILTER_4x4);
 }
 
-void vp9_eighttap_predict_sharp_c(unsigned char  *src_ptr,
-                                  int   src_pixels_per_line,
-                                  int  xoffset,
-                                  int  yoffset,
-                                  unsigned char *dst_ptr,
+void vp9_eighttap_predict_sharp_c(uint8_t *src_ptr,
+                                  int src_pixels_per_line,
+                                  int xoffset,
+                                  int yoffset,
+                                  uint8_t *dst_ptr,
                                   int dst_pitch) {
-  const short  *HFilter;
-  const short  *VFilter;
+  const int16_t *HFilter;
+  const int16_t *VFilter;
 
   HFilter = vp9_sub_pel_filters_8s[xoffset];
   VFilter = vp9_sub_pel_filters_8s[yoffset];
@@ -668,15 +650,15 @@
                            dst_ptr, dst_pitch);
 }
 
-void vp9_eighttap_predict_avg4x4_sharp_c(unsigned char  *src_ptr,
-                                         int   src_pixels_per_line,
-                                         int  xoffset,
-                                         int  yoffset,
-                                         unsigned char *dst_ptr,
+void vp9_eighttap_predict_avg4x4_sharp_c(uint8_t *src_ptr,
+                                         int src_pixels_per_line,
+                                         int xoffset,
+                                         int yoffset,
+                                         uint8_t *dst_ptr,
                                          int dst_pitch) {
-  const short  *HFilter = vp9_sub_pel_filters_8s[xoffset];
-  const short  *VFilter = vp9_sub_pel_filters_8s[yoffset];
-  unsigned char tmp[4 * 4];
+  const int16_t *HFilter = vp9_sub_pel_filters_8s[xoffset];
+  const int16_t *VFilter = vp9_sub_pel_filters_8s[yoffset];
+  uint8_t tmp[4 * 4];
 
   vp9_filter_block2d_4x4_8(src_ptr, src_pixels_per_line,
                            HFilter, VFilter,
@@ -684,14 +666,14 @@
   block2d_average(tmp, 4, dst_ptr, dst_pitch, VPX_FILTER_4x4);
 }
 
-void vp9_eighttap_predict8x8_c(unsigned char  *src_ptr,
-                               int  src_pixels_per_line,
-                               int  xoffset,
-                               int  yoffset,
-                               unsigned char *dst_ptr,
-                               int  dst_pitch) {
-  const short  *HFilter = vp9_sub_pel_filters_8[xoffset];
-  const short  *VFilter = vp9_sub_pel_filters_8[yoffset];
+void vp9_eighttap_predict8x8_c(uint8_t *src_ptr,
+                               int src_pixels_per_line,
+                               int xoffset,
+                               int yoffset,
+                               uint8_t *dst_ptr,
+                               int dst_pitch) {
+  const int16_t *HFilter = vp9_sub_pel_filters_8[xoffset];
+  const int16_t *VFilter = vp9_sub_pel_filters_8[yoffset];
 
   vp9_filter_block2d_8x8_8(src_ptr, src_pixels_per_line,
                            HFilter, VFilter,
@@ -698,14 +680,14 @@
                            dst_ptr, dst_pitch);
 }
 
-void vp9_eighttap_predict8x8_sharp_c(unsigned char  *src_ptr,
-                                     int  src_pixels_per_line,
-                                     int  xoffset,
-                                     int  yoffset,
-                                     unsigned char *dst_ptr,
-                                     int  dst_pitch) {
-  const short  *HFilter = vp9_sub_pel_filters_8s[xoffset];
-  const short  *VFilter = vp9_sub_pel_filters_8s[yoffset];
+void vp9_eighttap_predict8x8_sharp_c(uint8_t *src_ptr,
+                                     int src_pixels_per_line,
+                                     int xoffset,
+                                     int yoffset,
+                                     uint8_t *dst_ptr,
+                                     int dst_pitch) {
+  const int16_t *HFilter = vp9_sub_pel_filters_8s[xoffset];
+  const int16_t *VFilter = vp9_sub_pel_filters_8s[yoffset];
 
   vp9_filter_block2d_8x8_8(src_ptr, src_pixels_per_line,
                            HFilter, VFilter,
@@ -712,15 +694,15 @@
                            dst_ptr, dst_pitch);
 }
 
-void vp9_eighttap_predict_avg8x8_c(unsigned char  *src_ptr,
-                                   int  src_pixels_per_line,
-                                   int  xoffset,
-                                   int  yoffset,
-                                   unsigned char *dst_ptr,
-                                   int  dst_pitch) {
-  unsigned char tmp[8 * 8];
-  const short  *HFilter = vp9_sub_pel_filters_8[xoffset];
-  const short  *VFilter = vp9_sub_pel_filters_8[yoffset];
+void vp9_eighttap_predict_avg8x8_c(uint8_t *src_ptr,
+                                   int src_pixels_per_line,
+                                   int xoffset,
+                                   int yoffset,
+                                   uint8_t *dst_ptr,
+                                   int dst_pitch) {
+  uint8_t tmp[8 * 8];
+  const int16_t *HFilter = vp9_sub_pel_filters_8[xoffset];
+  const int16_t *VFilter = vp9_sub_pel_filters_8[yoffset];
 
   vp9_filter_block2d_8x8_8(src_ptr, src_pixels_per_line,
                            HFilter, VFilter,
@@ -728,15 +710,15 @@
   block2d_average(tmp, 8, dst_ptr, dst_pitch, VPX_FILTER_8x8);
 }
 
-void vp9_eighttap_predict_avg8x8_sharp_c(unsigned char  *src_ptr,
-                                         int  src_pixels_per_line,
-                                         int  xoffset,
-                                         int  yoffset,
-                                         unsigned char *dst_ptr,
-                                         int  dst_pitch) {
-  unsigned char tmp[8 * 8];
-  const short  *HFilter = vp9_sub_pel_filters_8s[xoffset];
-  const short  *VFilter = vp9_sub_pel_filters_8s[yoffset];
+void vp9_eighttap_predict_avg8x8_sharp_c(uint8_t *src_ptr,
+                                         int src_pixels_per_line,
+                                         int xoffset,
+                                         int yoffset,
+                                         uint8_t *dst_ptr,
+                                         int dst_pitch) {
+  uint8_t tmp[8 * 8];
+  const int16_t *HFilter = vp9_sub_pel_filters_8s[xoffset];
+  const int16_t *VFilter = vp9_sub_pel_filters_8s[yoffset];
 
   vp9_filter_block2d_8x8_8(src_ptr, src_pixels_per_line,
                            HFilter, VFilter,
@@ -744,14 +726,14 @@
   block2d_average(tmp, 8, dst_ptr, dst_pitch, VPX_FILTER_8x8);
 }
 
-void vp9_eighttap_predict8x4_c(unsigned char  *src_ptr,
-                               int  src_pixels_per_line,
-                               int  xoffset,
-                               int  yoffset,
-                               unsigned char *dst_ptr,
-                               int  dst_pitch) {
-  const short  *HFilter = vp9_sub_pel_filters_8[xoffset];
-  const short  *VFilter = vp9_sub_pel_filters_8[yoffset];
+void vp9_eighttap_predict8x4_c(uint8_t *src_ptr,
+                               int src_pixels_per_line,
+                               int xoffset,
+                               int yoffset,
+                               uint8_t *dst_ptr,
+                               int dst_pitch) {
+  const int16_t *HFilter = vp9_sub_pel_filters_8[xoffset];
+  const int16_t *VFilter = vp9_sub_pel_filters_8[yoffset];
 
   vp9_filter_block2d_8x4_8(src_ptr, src_pixels_per_line,
                            HFilter, VFilter,
@@ -758,14 +740,14 @@
                            dst_ptr, dst_pitch);
 }
 
-void vp9_eighttap_predict8x4_sharp_c(unsigned char  *src_ptr,
-                                     int  src_pixels_per_line,
-                                     int  xoffset,
-                                     int  yoffset,
-                                     unsigned char *dst_ptr,
-                                     int  dst_pitch) {
-  const short  *HFilter = vp9_sub_pel_filters_8s[xoffset];
-  const short  *VFilter = vp9_sub_pel_filters_8s[yoffset];
+void vp9_eighttap_predict8x4_sharp_c(uint8_t *src_ptr,
+                                     int src_pixels_per_line,
+                                     int xoffset,
+                                     int yoffset,
+                                     uint8_t *dst_ptr,
+                                     int dst_pitch) {
+  const int16_t *HFilter = vp9_sub_pel_filters_8s[xoffset];
+  const int16_t *VFilter = vp9_sub_pel_filters_8s[yoffset];
 
   vp9_filter_block2d_8x4_8(src_ptr, src_pixels_per_line,
                            HFilter, VFilter,
@@ -772,14 +754,14 @@
                            dst_ptr, dst_pitch);
 }
 
-void vp9_eighttap_predict16x16_c(unsigned char  *src_ptr,
-                                 int  src_pixels_per_line,
-                                 int  xoffset,
-                                 int  yoffset,
-                                 unsigned char *dst_ptr,
-                                 int  dst_pitch) {
-  const short  *HFilter = vp9_sub_pel_filters_8[xoffset];
-  const short  *VFilter = vp9_sub_pel_filters_8[yoffset];
+void vp9_eighttap_predict16x16_c(uint8_t *src_ptr,
+                                 int src_pixels_per_line,
+                                 int xoffset,
+                                 int yoffset,
+                                 uint8_t *dst_ptr,
+                                 int dst_pitch) {
+  const int16_t *HFilter = vp9_sub_pel_filters_8[xoffset];
+  const int16_t *VFilter = vp9_sub_pel_filters_8[yoffset];
 
   vp9_filter_block2d_16x16_8(src_ptr, src_pixels_per_line,
                        HFilter, VFilter,
@@ -786,14 +768,14 @@
                        dst_ptr, dst_pitch);
 }
 
-void vp9_eighttap_predict16x16_sharp_c(unsigned char  *src_ptr,
-                                       int  src_pixels_per_line,
-                                       int  xoffset,
-                                       int  yoffset,
-                                       unsigned char *dst_ptr,
-                                       int  dst_pitch) {
-  const short  *HFilter = vp9_sub_pel_filters_8s[xoffset];
-  const short  *VFilter = vp9_sub_pel_filters_8s[yoffset];
+void vp9_eighttap_predict16x16_sharp_c(uint8_t *src_ptr,
+                                       int src_pixels_per_line,
+                                       int xoffset,
+                                       int yoffset,
+                                       uint8_t *dst_ptr,
+                                       int dst_pitch) {
+  const int16_t *HFilter = vp9_sub_pel_filters_8s[xoffset];
+  const int16_t *VFilter = vp9_sub_pel_filters_8s[yoffset];
 
   vp9_filter_block2d_16x16_8(src_ptr, src_pixels_per_line,
                        HFilter, VFilter,
@@ -800,15 +782,15 @@
                        dst_ptr, dst_pitch);
 }
 
-void vp9_eighttap_predict_avg16x16_c(unsigned char  *src_ptr,
-                                     int  src_pixels_per_line,
-                                     int  xoffset,
-                                     int  yoffset,
-                                     unsigned char *dst_ptr,
-                                     int  dst_pitch) {
-  DECLARE_ALIGNED_ARRAY(16, unsigned char, tmp, 16 * 16);
-  const short  *HFilter = vp9_sub_pel_filters_8[xoffset];
-  const short  *VFilter = vp9_sub_pel_filters_8[yoffset];
+void vp9_eighttap_predict_avg16x16_c(uint8_t *src_ptr,
+                                     int src_pixels_per_line,
+                                     int xoffset,
+                                     int yoffset,
+                                     uint8_t *dst_ptr,
+                                     int dst_pitch) {
+  DECLARE_ALIGNED_ARRAY(16, uint8_t, tmp, 16 * 16);
+  const int16_t *HFilter = vp9_sub_pel_filters_8[xoffset];
+  const int16_t *VFilter = vp9_sub_pel_filters_8[yoffset];
 
   vp9_filter_block2d_16x16_8(src_ptr, src_pixels_per_line,
                        HFilter, VFilter,
@@ -816,15 +798,15 @@
   block2d_average(tmp, 16, dst_ptr, dst_pitch, VPX_FILTER_16x16);
 }
 
-void vp9_eighttap_predict_avg16x16_sharp_c(unsigned char  *src_ptr,
-                                           int  src_pixels_per_line,
-                                           int  xoffset,
-                                           int  yoffset,
-                                           unsigned char *dst_ptr,
-                                           int  dst_pitch) {
-  DECLARE_ALIGNED_ARRAY(16, unsigned char, tmp, 16 * 16);
-  const short  *HFilter = vp9_sub_pel_filters_8s[xoffset];
-  const short  *VFilter = vp9_sub_pel_filters_8s[yoffset];
+void vp9_eighttap_predict_avg16x16_sharp_c(uint8_t *src_ptr,
+                                           int src_pixels_per_line,
+                                           int xoffset,
+                                           int yoffset,
+                                           uint8_t *dst_ptr,
+                                           int dst_pitch) {
+  DECLARE_ALIGNED_ARRAY(16, uint8_t, tmp, 16 * 16);
+  const int16_t *HFilter = vp9_sub_pel_filters_8s[xoffset];
+  const int16_t *VFilter = vp9_sub_pel_filters_8s[yoffset];
 
   vp9_filter_block2d_16x16_8(src_ptr, src_pixels_per_line,
                        HFilter, VFilter,
@@ -854,12 +836,12 @@
  *                  Two filter taps should sum to VP9_FILTER_WEIGHT.
  *
  ****************************************************************************/
-static void filter_block2d_bil_first_pass(unsigned char  *src_ptr,
-                                          unsigned short *dst_ptr,
-                                          unsigned int    src_stride,
-                                          unsigned int    height,
-                                          unsigned int    width,
-                                          const short    *vp9_filter) {
+static void filter_block2d_bil_first_pass(uint8_t *src_ptr,
+                                          uint16_t *dst_ptr,
+                                          unsigned int src_stride,
+                                          unsigned int height,
+                                          unsigned int width,
+                                          const int16_t *vp9_filter) {
   unsigned int i, j;
 
   for (i = 0; i < height; i++) {
@@ -899,13 +881,13 @@
  *                  Two filter taps should sum to VP9_FILTER_WEIGHT.
  *
  ****************************************************************************/
-static void filter_block2d_bil_second_pass(unsigned short *src_ptr,
-                                           unsigned char  *dst_ptr,
-                                           int             dst_pitch,
-                                           unsigned int    height,
-                                           unsigned int    width,
-                                           const short    *vp9_filter) {
-  unsigned int  i, j;
+static void filter_block2d_bil_second_pass(uint16_t *src_ptr,
+                                           uint8_t *dst_ptr,
+                                           int dst_pitch,
+                                           unsigned int height,
+                                           unsigned int width,
+                                           const int16_t *vp9_filter) {
+  unsigned int i, j;
   int temp;
 
   for (i = 0; i < height; i++) {
@@ -932,13 +914,13 @@
  * with the values already present in the output and stores the result of
  * that back into the output ((filter_result + dest + 1) >> 1).
  */
-static void filter_block2d_bil_second_pass_avg(unsigned short *src_ptr,
-                                               unsigned char  *dst_ptr,
-                                               int             dst_pitch,
-                                               unsigned int    height,
-                                               unsigned int    width,
-                                               const short    *vp9_filter) {
-  unsigned int  i, j;
+static void filter_block2d_bil_second_pass_avg(uint16_t *src_ptr,
+                                               uint8_t *dst_ptr,
+                                               int dst_pitch,
+                                               unsigned int height,
+                                               unsigned int width,
+                                               const int16_t *vp9_filter) {
+  unsigned int i, j;
   int temp;
 
   for (i = 0; i < height; i++) {
@@ -979,16 +961,16 @@
  *  SPECIAL NOTES : The largest block size can be handled here is 16x16
  *
  ****************************************************************************/
-static void filter_block2d_bil(unsigned char *src_ptr,
-                               unsigned char *dst_ptr,
-                               unsigned int   src_pitch,
-                               unsigned int   dst_pitch,
-                               const short   *HFilter,
-                               const short   *VFilter,
-                               int            Width,
-                               int            Height) {
+static void filter_block2d_bil(uint8_t *src_ptr,
+                               uint8_t *dst_ptr,
+                               unsigned int src_pitch,
+                               unsigned int dst_pitch,
+                               const int16_t *HFilter,
+                               const int16_t *VFilter,
+                               int Width,
+                               int Height) {
 
-  unsigned short FData[17 * 16];  /* Temp data buffer used in filtering */
+  uint16_t FData[17 * 16];  /* Temp data buffer used in filtering */
 
   /* First filter 1-D horizontally... */
   filter_block2d_bil_first_pass(src_ptr, FData, src_pitch, Height + 1, Width, HFilter);
@@ -997,15 +979,15 @@
   filter_block2d_bil_second_pass(FData, dst_ptr, dst_pitch, Height, Width, VFilter);
 }
 
-static void filter_block2d_bil_avg(unsigned char *src_ptr,
-                                   unsigned char *dst_ptr,
-                                   unsigned int   src_pitch,
-                                   unsigned int   dst_pitch,
-                                   const short   *HFilter,
-                                   const short   *VFilter,
-                                   int            Width,
-                                   int            Height) {
-  unsigned short FData[17 * 16];  /* Temp data buffer used in filtering */
+static void filter_block2d_bil_avg(uint8_t *src_ptr,
+                                   uint8_t *dst_ptr,
+                                   unsigned int src_pitch,
+                                   unsigned int dst_pitch,
+                                   const int16_t *HFilter,
+                                   const int16_t *VFilter,
+                                   int Width,
+                                   int Height) {
+  uint16_t FData[17 * 16];  /* Temp data buffer used in filtering */
 
   /* First filter 1-D horizontally... */
   filter_block2d_bil_first_pass(src_ptr, FData, src_pitch, Height + 1, Width, HFilter);
@@ -1014,14 +996,14 @@
   filter_block2d_bil_second_pass_avg(FData, dst_ptr, dst_pitch, Height, Width, VFilter);
 }
 
-void vp9_bilinear_predict4x4_c(unsigned char  *src_ptr,
-                               int   src_pixels_per_line,
-                               int  xoffset,
-                               int  yoffset,
-                               unsigned char *dst_ptr,
+void vp9_bilinear_predict4x4_c(uint8_t *src_ptr,
+                               int src_pixels_per_line,
+                               int xoffset,
+                               int yoffset,
+                               uint8_t *dst_ptr,
                                int dst_pitch) {
-  const short *HFilter;
-  const short *VFilter;
+  const int16_t *HFilter;
+  const int16_t *VFilter;
 
   HFilter = vp9_bilinear_filters[xoffset];
   VFilter = vp9_bilinear_filters[yoffset];
@@ -1029,14 +1011,14 @@
   filter_block2d_bil(src_ptr, dst_ptr, src_pixels_per_line, dst_pitch, HFilter, VFilter, 4, 4);
 }
 
-void vp9_bilinear_predict_avg4x4_c(unsigned char  *src_ptr,
-                                   int   src_pixels_per_line,
-                                   int  xoffset,
-                                   int  yoffset,
-                                   unsigned char *dst_ptr,
+void vp9_bilinear_predict_avg4x4_c(uint8_t *src_ptr,
+                                   int src_pixels_per_line,
+                                   int xoffset,
+                                   int yoffset,
+                                   uint8_t *dst_ptr,
                                    int dst_pitch) {
-  const short *HFilter;
-  const short *VFilter;
+  const int16_t *HFilter;
+  const int16_t *VFilter;
 
   HFilter = vp9_bilinear_filters[xoffset];
   VFilter = vp9_bilinear_filters[yoffset];
@@ -1045,14 +1027,14 @@
                          dst_pitch, HFilter, VFilter, 4, 4);
 }
 
-void vp9_bilinear_predict8x8_c(unsigned char  *src_ptr,
-                               int  src_pixels_per_line,
-                               int  xoffset,
-                               int  yoffset,
-                               unsigned char *dst_ptr,
-                               int  dst_pitch) {
-  const short *HFilter;
-  const short *VFilter;
+void vp9_bilinear_predict8x8_c(uint8_t *src_ptr,
+                               int src_pixels_per_line,
+                               int xoffset,
+                               int yoffset,
+                               uint8_t *dst_ptr,
+                               int dst_pitch) {
+  const int16_t *HFilter;
+  const int16_t *VFilter;
 
   HFilter = vp9_bilinear_filters[xoffset];
   VFilter = vp9_bilinear_filters[yoffset];
@@ -1061,14 +1043,14 @@
 
 }
 
-void vp9_bilinear_predict_avg8x8_c(unsigned char  *src_ptr,
-                                   int  src_pixels_per_line,
-                                   int  xoffset,
-                                   int  yoffset,
-                                   unsigned char *dst_ptr,
-                                   int  dst_pitch) {
-  const short *HFilter;
-  const short *VFilter;
+void vp9_bilinear_predict_avg8x8_c(uint8_t *src_ptr,
+                                   int src_pixels_per_line,
+                                   int xoffset,
+                                   int yoffset,
+                                   uint8_t *dst_ptr,
+                                   int dst_pitch) {
+  const int16_t *HFilter;
+  const int16_t *VFilter;
 
   HFilter = vp9_bilinear_filters[xoffset];
   VFilter = vp9_bilinear_filters[yoffset];
@@ -1077,14 +1059,14 @@
                          dst_pitch, HFilter, VFilter, 8, 8);
 }
 
-void vp9_bilinear_predict8x4_c(unsigned char  *src_ptr,
-                               int  src_pixels_per_line,
-                               int  xoffset,
-                               int  yoffset,
-                               unsigned char *dst_ptr,
-                               int  dst_pitch) {
-  const short *HFilter;
-  const short *VFilter;
+void vp9_bilinear_predict8x4_c(uint8_t *src_ptr,
+                               int src_pixels_per_line,
+                               int xoffset,
+                               int yoffset,
+                               uint8_t *dst_ptr,
+                               int dst_pitch) {
+  const int16_t *HFilter;
+  const int16_t *VFilter;
 
   HFilter = vp9_bilinear_filters[xoffset];
   VFilter = vp9_bilinear_filters[yoffset];
@@ -1093,14 +1075,14 @@
 
 }
 
-void vp9_bilinear_predict16x16_c(unsigned char  *src_ptr,
-                                 int  src_pixels_per_line,
-                                 int  xoffset,
-                                 int  yoffset,
-                                 unsigned char *dst_ptr,
-                                 int  dst_pitch) {
-  const short *HFilter;
-  const short *VFilter;
+void vp9_bilinear_predict16x16_c(uint8_t *src_ptr,
+                                 int src_pixels_per_line,
+                                 int xoffset,
+                                 int yoffset,
+                                 uint8_t *dst_ptr,
+                                 int dst_pitch) {
+  const int16_t *HFilter;
+  const int16_t *VFilter;
 
   HFilter = vp9_bilinear_filters[xoffset];
   VFilter = vp9_bilinear_filters[yoffset];
@@ -1108,14 +1090,14 @@
   filter_block2d_bil(src_ptr, dst_ptr, src_pixels_per_line, dst_pitch, HFilter, VFilter, 16, 16);
 }
 
-void vp9_bilinear_predict_avg16x16_c(unsigned char  *src_ptr,
-                                     int  src_pixels_per_line,
-                                     int  xoffset,
-                                     int  yoffset,
-                                     unsigned char *dst_ptr,
-                                     int  dst_pitch) {
-  const short *HFilter;
-  const short *VFilter;
+void vp9_bilinear_predict_avg16x16_c(uint8_t *src_ptr,
+                                     int src_pixels_per_line,
+                                     int xoffset,
+                                     int yoffset,
+                                     uint8_t *dst_ptr,
+                                     int dst_pitch) {
+  const int16_t *HFilter;
+  const int16_t *VFilter;
 
   HFilter = vp9_bilinear_filters[xoffset];
   VFilter = vp9_bilinear_filters[yoffset];
--- a/vp9/common/vp9_filter.h
+++ b/vp9/common/vp9_filter.h
@@ -13,6 +13,7 @@
 
 #include "vpx_config.h"
 #include "vpx_scale/yv12config.h"
+#include "vpx/vpx_integer.h"
 
 #define BLOCK_HEIGHT_WIDTH 4
 #define VP9_FILTER_WEIGHT 128
@@ -20,9 +21,9 @@
 
 #define SUBPEL_SHIFTS 16
 
-extern const short vp9_bilinear_filters[SUBPEL_SHIFTS][2];
-extern const short vp9_sub_pel_filters_6[SUBPEL_SHIFTS][6];
-extern const short vp9_sub_pel_filters_8[SUBPEL_SHIFTS][8];
-extern const short vp9_sub_pel_filters_8s[SUBPEL_SHIFTS][8];
+extern const int16_t vp9_bilinear_filters[SUBPEL_SHIFTS][2];
+extern const int16_t vp9_sub_pel_filters_6[SUBPEL_SHIFTS][6];
+extern const int16_t vp9_sub_pel_filters_8[SUBPEL_SHIFTS][8];
+extern const int16_t vp9_sub_pel_filters_8s[SUBPEL_SHIFTS][8];
 
-#endif // FILTER_H
+#endif  // VP9_COMMON_VP9_FILTER_H_
--- a/vp9/common/vp9_findnearmv.c
+++ b/vp9/common/vp9_findnearmv.c
@@ -14,7 +14,7 @@
 #include "vp9/common/vp9_subpelvar.h"
 #include <limits.h>
 
-const unsigned char vp9_mbsplit_offset[4][16] = {
+const uint8_t vp9_mbsplit_offset[4][16] = {
   { 0,  8,  0,  0,  0,  0,  0,  0,  0,  0,   0,  0,  0,  0,  0,  0},
   { 0,  2,  0,  0,  0,  0,  0,  0,  0,  0,   0,  0,  0,  0,  0,  0},
   { 0,  2,  8, 10,  0,  0,  0,  0,  0,  0,   0,  0,  0,  0,  0,  0},
@@ -42,23 +42,23 @@
 }
 
 #define SP(x) (((x) & 7) << 1)
-unsigned int vp9_sad3x16_c(const unsigned char *src_ptr,
+unsigned int vp9_sad3x16_c(const uint8_t *src_ptr,
                            int  src_stride,
-                           const unsigned char *ref_ptr,
+                           const uint8_t *ref_ptr,
                            int  ref_stride) {
   return sad_mx_n_c(src_ptr, src_stride, ref_ptr, ref_stride, 3, 16);
 }
-unsigned int vp9_sad16x3_c(const unsigned char *src_ptr,
+unsigned int vp9_sad16x3_c(const uint8_t *src_ptr,
                            int  src_stride,
-                           const unsigned char *ref_ptr,
+                           const uint8_t *ref_ptr,
                            int  ref_stride) {
   return sad_mx_n_c(src_ptr, src_stride, ref_ptr, ref_stride, 16, 3);
 }
 
 #if CONFIG_SUBPELREFMV
-unsigned int vp9_variance2x16_c(const unsigned char *src_ptr,
+unsigned int vp9_variance2x16_c(const uint8_t *src_ptr,
                                 const int  source_stride,
-                                const unsigned char *ref_ptr,
+                                const uint8_t *ref_ptr,
                                 const int  recon_stride,
                                 unsigned int *sse) {
   int sum;
@@ -66,9 +66,9 @@
   return (*sse - (((unsigned int)sum * sum) >> 5));
 }
 
-unsigned int vp9_variance16x2_c(const unsigned char *src_ptr,
+unsigned int vp9_variance16x2_c(const uint8_t *src_ptr,
                                 const int  source_stride,
-                                const unsigned char *ref_ptr,
+                                const uint8_t *ref_ptr,
                                 const int  recon_stride,
                                 unsigned int *sse) {
   int sum;
@@ -76,16 +76,16 @@
   return (*sse - (((unsigned int)sum * sum) >> 5));
 }
 
-unsigned int vp9_sub_pixel_variance16x2_c(const unsigned char  *src_ptr,
+unsigned int vp9_sub_pixel_variance16x2_c(const uint8_t *src_ptr,
                                           const int  src_pixels_per_line,
                                           const int  xoffset,
                                           const int  yoffset,
-                                          const unsigned char *dst_ptr,
+                                          const uint8_t *dst_ptr,
                                           const int dst_pixels_per_line,
                                           unsigned int *sse) {
-  unsigned short FData3[16 * 3];  // Temp data buffer used in filtering
-  unsigned char  temp2[2 * 16];
-  const short *HFilter, *VFilter;
+  uint16_t FData3[16 * 3];  // Temp data buffer used in filtering
+  uint8_t temp2[2 * 16];
+  const int16_t *HFilter, *VFilter;
 
   HFilter = vp9_bilinear_filters[xoffset];
   VFilter = vp9_bilinear_filters[yoffset];
@@ -97,16 +97,16 @@
   return vp9_variance16x2_c(temp2, 16, dst_ptr, dst_pixels_per_line, sse);
 }
 
-unsigned int vp9_sub_pixel_variance2x16_c(const unsigned char  *src_ptr,
+unsigned int vp9_sub_pixel_variance2x16_c(const uint8_t *src_ptr,
                                           const int  src_pixels_per_line,
                                           const int  xoffset,
                                           const int  yoffset,
-                                          const unsigned char *dst_ptr,
+                                          const uint8_t *dst_ptr,
                                           const int dst_pixels_per_line,
                                           unsigned int *sse) {
-  unsigned short FData3[2 * 17];  // Temp data buffer used in filtering
-  unsigned char  temp2[2 * 16];
-  const short *HFilter, *VFilter;
+  uint16_t FData3[2 * 17];  // Temp data buffer used in filtering
+  uint8_t temp2[2 * 16];
+  const int16_t *HFilter, *VFilter;
 
   HFilter = vp9_bilinear_filters[xoffset];
   VFilter = vp9_bilinear_filters[yoffset];
@@ -124,16 +124,16 @@
  * score to use as ref motion vector
  */
 void vp9_find_best_ref_mvs(MACROBLOCKD *xd,
-                           unsigned char *ref_y_buffer,
+                           uint8_t *ref_y_buffer,
                            int ref_y_stride,
                            int_mv *mvlist,
                            int_mv *nearest,
                            int_mv *near) {
   int i, j;
-  unsigned char *above_src;
-  unsigned char *left_src;
-  unsigned char *above_ref;
-  unsigned char *left_ref;
+  uint8_t *above_src;
+  uint8_t *left_src;
+  uint8_t *above_ref;
+  uint8_t *left_ref;
   unsigned int score;
 #if CONFIG_SUBPELREFMV
   unsigned int sse;
--- a/vp9/common/vp9_findnearmv.h
+++ b/vp9/common/vp9_findnearmv.h
@@ -22,7 +22,7 @@
  * score to use as ref motion vector
  */
 void vp9_find_best_ref_mvs(MACROBLOCKD *xd,
-                           unsigned char *ref_y_buffer,
+                           uint8_t *ref_y_buffer,
                            int ref_y_stride,
                            int_mv *mvlist,
                            int_mv *nearest,
@@ -81,7 +81,7 @@
                            vp9_prob p[VP9_MVREFS - 1],
                            const int context);
 
-extern const unsigned char vp9_mbsplit_offset[4][16];
+extern const uint8_t vp9_mbsplit_offset[4][16];
 
 static int left_block_mv(const MODE_INFO *cur_mb, int b) {
   if (!(b & 3)) {
@@ -181,4 +181,4 @@
   return (cur_mb->bmi + b - 4)->as_mode.first;
 }
 
-#endif
+#endif  // VP9_COMMON_VP9_FINDNEARMV_H_
--- a/vp9/common/vp9_header.h
+++ b/vp9/common/vp9_header.h
@@ -8,7 +8,6 @@
  *  be found in the AUTHORS file in the root of the source tree.
  */
 
-
 #ifndef VP9_COMMON_VP9_HEADER_H_
 #define VP9_COMMON_VP9_HEADER_H_
 
@@ -38,5 +37,4 @@
 #define VP9_HEADER_SIZE 3
 #endif
 
-
-#endif
+#endif  // VP9_COMMON_VP9_HEADER_H_
--- a/vp9/common/vp9_idctllm.c
+++ b/vp9/common/vp9_idctllm.c
@@ -483,12 +483,12 @@
   }
 }
 
-void vp9_short_idct4x4llm_c(short *input, short *output, int pitch) {
+void vp9_short_idct4x4llm_c(int16_t *input, int16_t *output, int pitch) {
   int i;
   int a1, b1, c1, d1;
 
-  short *ip = input;
-  short *op = output;
+  int16_t *ip = input;
+  int16_t *op = output;
   int temp1, temp2;
   int shortpitch = pitch >> 1;
 
@@ -540,10 +540,10 @@
   }
 }
 
-void vp9_short_idct4x4llm_1_c(short *input, short *output, int pitch) {
+void vp9_short_idct4x4llm_1_c(int16_t *input, int16_t *output, int pitch) {
   int i;
   int a1;
-  short *op = output;
+  int16_t *op = output;
   int shortpitch = pitch >> 1;
   a1 = ((input[0] + 16) >> 5);
   for (i = 0; i < 4; i++) {
@@ -555,8 +555,8 @@
   }
 }
 
-void vp9_dc_only_idct_add_c(short input_dc, unsigned char *pred_ptr,
-                            unsigned char *dst_ptr, int pitch, int stride) {
+void vp9_dc_only_idct_add_c(int input_dc, uint8_t *pred_ptr,
+                            uint8_t *dst_ptr, int pitch, int stride) {
   int a1 = ((input_dc + 16) >> 5);
   int r, c;
 
@@ -570,11 +570,11 @@
   }
 }
 
-void vp9_short_inv_walsh4x4_c(short *input, short *output) {
+void vp9_short_inv_walsh4x4_c(int16_t *input, int16_t *output) {
   int i;
   int a1, b1, c1, d1;
-  short *ip = input;
-  short *op = output;
+  int16_t *ip = input;
+  int16_t *op = output;
 
   for (i = 0; i < 4; i++) {
     a1 = ((ip[0] + ip[3]));
@@ -607,11 +607,11 @@
   }
 }
 
-void vp9_short_inv_walsh4x4_1_c(short *in, short *out) {
+void vp9_short_inv_walsh4x4_1_c(int16_t *in, int16_t *out) {
   int i;
-  short tmp[4];
-  short *ip = in;
-  short *op = tmp;
+  int16_t tmp[4];
+  int16_t *ip = in;
+  int16_t *op = tmp;
 
   op[0] = (ip[0] + 1) >> 1;
   op[1] = op[2] = op[3] = (ip[0] >> 1);
@@ -627,11 +627,11 @@
 }
 
 #if CONFIG_LOSSLESS
-void vp9_short_inv_walsh4x4_lossless_c(short *input, short *output) {
+void vp9_short_inv_walsh4x4_lossless_c(int16_t *input, int16_t *output) {
   int i;
   int a1, b1, c1, d1;
-  short *ip = input;
-  short *op = output;
+  int16_t *ip = input;
+  int16_t *op = output;
 
   for (i = 0; i < 4; i++) {
     a1 = ((ip[0] + ip[3])) >> Y2_WHT_UPSCALE_FACTOR;
@@ -667,11 +667,11 @@
   }
 }
 
-void vp9_short_inv_walsh4x4_1_lossless_c(short *in, short *out) {
+void vp9_short_inv_walsh4x4_1_lossless_c(int16_t *in, int16_t *out) {
   int i;
-  short tmp[4];
-  short *ip = in;
-  short *op = tmp;
+  int16_t tmp[4];
+  int16_t *ip = in;
+  int16_t *op = tmp;
 
   op[0] = ((ip[0] >> Y2_WHT_UPSCALE_FACTOR) + 1) >> 1;
   op[1] = op[2] = op[3] = ((ip[0] >> Y2_WHT_UPSCALE_FACTOR) >> 1);
@@ -686,11 +686,11 @@
   }
 }
 
-void vp9_short_inv_walsh4x4_x8_c(short *input, short *output, int pitch) {
+void vp9_short_inv_walsh4x4_x8_c(int16_t *input, int16_t *output, int pitch) {
   int i;
   int a1, b1, c1, d1;
-  short *ip = input;
-  short *op = output;
+  int16_t *ip = input;
+  int16_t *op = output;
   int shortpitch = pitch >> 1;
 
   for (i = 0; i < 4; i++) {
@@ -727,11 +727,11 @@
   }
 }
 
-void vp9_short_inv_walsh4x4_1_x8_c(short *in, short *out, int pitch) {
+void vp9_short_inv_walsh4x4_1_x8_c(int16_t *in, int16_t *out, int pitch) {
   int i;
-  short tmp[4];
-  short *ip = in;
-  short *op = tmp;
+  int16_t tmp[4];
+  int16_t *ip = in;
+  int16_t *op = tmp;
   int shortpitch = pitch >> 1;
 
   op[0] = ((ip[0] >> WHT_UPSCALE_FACTOR) + 1) >> 1;
@@ -748,8 +748,8 @@
   }
 }
 
-void vp9_dc_only_inv_walsh_add_c(short input_dc, unsigned char *pred_ptr,
-                                 unsigned char *dst_ptr,
+void vp9_dc_only_inv_walsh_add_c(short input_dc, uint8_t *pred_ptr,
+                                 uint8_t *dst_ptr,
                                  int pitch, int stride) {
   int r, c;
   short tmp[16];
@@ -767,13 +767,13 @@
 #endif
 
 void vp9_dc_only_idct_add_8x8_c(short input_dc,
-                                unsigned char *pred_ptr,
-                                unsigned char *dst_ptr,
+                                uint8_t *pred_ptr,
+                                uint8_t *dst_ptr,
                                 int pitch, int stride) {
   int a1 = ((input_dc + 16) >> 5);
   int r, c, b;
-  unsigned char *orig_pred = pred_ptr;
-  unsigned char *orig_dst = dst_ptr;
+  uint8_t *orig_pred = pred_ptr;
+  uint8_t *orig_dst = dst_ptr;
   for (b = 0; b < 4; b++) {
     for (r = 0; r < 4; r++) {
       for (c = 0; c < 4; c++) {
@@ -911,7 +911,7 @@
 }
 
 #define TX_DIM 8
-void vp9_short_idct8x8_c(short *coefs, short *block, int pitch) {
+void vp9_short_idct8x8_c(int16_t *coefs, int16_t *block, int pitch) {
   int X[TX_DIM * TX_DIM];
   int i, j;
   int shortpitch = pitch >> 1;
@@ -1030,7 +1030,7 @@
   blk[8 * 7] = (x7 - x1) >> 14;
 }
 
-void vp9_short_idct10_8x8_c(short *coefs, short *block, int pitch) {
+void vp9_short_idct10_8x8_c(int16_t *coefs, int16_t *block, int pitch) {
   int X[TX_DIM * TX_DIM];
   int i, j;
   int shortpitch = pitch >> 1;
@@ -1043,7 +1043,7 @@
   }
 
   /* Do first 4 row idct only since non-zero dct coefficients are all in
-   *  upper-left 4x4 area. */
+   * upper-left 4x4 area. */
   for (i = 0; i < 4; i++)
     idctrow10(X + 8 * i);
 
@@ -1057,10 +1057,10 @@
   }
 }
 
-void vp9_short_ihaar2x2_c(short *input, short *output, int pitch) {
+void vp9_short_ihaar2x2_c(int16_t *input, int16_t *output, int pitch) {
   int i;
-  short *ip = input; // 0,1, 4, 8
-  short *op = output;
+  int16_t *ip = input;  // 0, 1, 4, 8
+  int16_t *op = output;
   for (i = 0; i < 16; i++) {
     op[i] = 0;
   }
@@ -1074,7 +1074,7 @@
 
 #if 0
 // Keep a really bad float version as reference for now.
-void vp9_short_idct16x16_c(short *input, short *output, int pitch) {
+void vp9_short_idct16x16_c(int16_t *input, int16_t *output, int pitch) {
 
   vp9_clear_system_state(); // Make it simd safe : __asm emms;
   {
@@ -1334,7 +1334,7 @@
 }
 #endif
 
-void vp9_short_idct16x16_c(short *input, short *output, int pitch) {
+void vp9_short_idct16x16_c(int16_t *input, int16_t *output, int pitch) {
 
   vp9_clear_system_state(); // Make it simd safe : __asm emms;
   {
@@ -2069,7 +2069,7 @@
   output[stride*31] = step2[ 0] - step2[(31 - 15)];
 }
 
-void vp9_short_idct32x32_c(short *input, short *output, int pitch) {
+void vp9_short_idct32x32_c(int16_t *input, int16_t *output, int pitch) {
   vp9_clear_system_state();  // Make it simd safe : __asm emms;
   {
     double out[32*32], out2[32*32];
@@ -2109,9 +2109,9 @@
 #if DWT_TYPE == 53
 
 // Note: block length must be even for this implementation
-static void synthesis_53_row(int length, short *lowpass, short *highpass,
-                             short *x) {
-  short r, *a, *b;
+static void synthesis_53_row(int length, int16_t *lowpass, int16_t *highpass,
+                             int16_t *x) {
+  int16_t r, *a, *b;
   int n;
 
   n = length >> 1;
@@ -2134,9 +2134,9 @@
   *x++ = *b + ((r + 1) >> 1);
 }
 
-static void synthesis_53_col(int length, short *lowpass, short *highpass,
-                             short *x) {
-  short r, *a, *b;
+static void synthesis_53_col(int length, int16_t *lowpass, int16_t *highpass,
+                             int16_t *x) {
+  int16_t r, *a, *b;
   int n;
 
   n = length >> 1;
@@ -2160,8 +2160,8 @@
   *x++ = ((*b) << 1) + *a;
 }
 
-void dyadic_synthesize_53(int levels, int width, int height, short *c,
-                          int pitch_c, short *x, int pitch_x) {
+void dyadic_synthesize_53(int levels, int width, int height, int16_t *c,
+                          int pitch_c, int16_t *x, int pitch_x) {
   int th[16], tw[16], lv, i, j, nh, nw, hh = height, hw = width;
   short buffer[2 * DWT_MAX_LENGTH];
 
@@ -2201,9 +2201,9 @@
 #elif DWT_TYPE == 26
 
 // Note: block length must be even for this implementation
-static void synthesis_26_row(int length, short *lowpass, short *highpass,
-                             short *x) {
-  short r, s, *a, *b;
+static void synthesis_26_row(int length, int16_t *lowpass, int16_t *highpass,
+                             int16_t *x) {
+  int16_t r, s, *a, *b;
   int i, n = length >> 1;
 
   if (n >= 4) {
@@ -2226,9 +2226,9 @@
   }
 }
 
-static void synthesis_26_col(int length, short *lowpass, short *highpass,
-                             short *x) {
-  short r, s, *a, *b;
+static void synthesis_26_col(int length, int16_t *lowpass, int16_t *highpass,
+                             int16_t *x) {
+  int16_t r, s, *a, *b;
   int i, n = length >> 1;
 
   if (n >= 4) {
@@ -2251,10 +2251,10 @@
   }
 }
 
-void dyadic_synthesize_26(int levels, int width, int height, short *c,
-                          int pitch_c, short *x, int pitch_x) {
+void dyadic_synthesize_26(int levels, int width, int height, int16_t *c,
+                          int pitch_c, int16_t *x, int pitch_x) {
   int th[16], tw[16], lv, i, j, nh, nw, hh = height, hw = width;
-  short buffer[2 * DWT_MAX_LENGTH];
+  int16_t buffer[2 * DWT_MAX_LENGTH];
 
   th[0] = hh;
   tw[0] = hw;
@@ -2331,8 +2331,8 @@
   x[length - 1] -= 2 * a_predict1 * x[length - 2];
 }
 
-void dyadic_synthesize_97(int levels, int width, int height, short *c,
-                          int pitch_c, short *x, int pitch_x) {
+void dyadic_synthesize_97(int levels, int width, int height, int16_t *c,
+                          int pitch_c, int16_t *x, int pitch_x) {
   int th[16], tw[16], lv, i, j, nh, nw, hh = height, hw = width;
   double buffer[2 * DWT_MAX_LENGTH];
   double y[DWT_MAX_LENGTH * DWT_MAX_LENGTH];
@@ -2578,7 +2578,7 @@
   vp9_clear_system_state();  // Make it simd safe : __asm emms;
 }
 
-void vp9_short_idct16x16_c_f(short *input, short *output, int pitch) {
+void vp9_short_idct16x16_c_f(int16_t *input, int16_t *output, int pitch) {
   vp9_clear_system_state();  // Make it simd safe : __asm emms;
   {
     double out[16*16], out2[16*16];
@@ -2608,12 +2608,12 @@
   vp9_clear_system_state();  // Make it simd safe : __asm emms;
 }
 
-void vp9_short_idct32x32_c(short *input, short *output, int pitch) {
+void vp9_short_idct32x32_c(int16_t *input, int16_t *output, int pitch) {
   // assume out is a 32x32 buffer
   // Temporary buffer to hold a 16x16 block for 16x16 inverse dct
-  short buffer[16 * 16];
+  int16_t buffer[16 * 16];
   // Temporary buffer to hold a 32x32 block for inverse 32x32 dwt
-  short buffer2[32 * 32];
+  int16_t buffer2[32 * 32];
   // Note: pitch is in bytes, short_pitch is in short units
   const int short_pitch = pitch >> 1;
   int i;
--- a/vp9/common/vp9_invtrans.c
+++ b/vp9/common/vp9_invtrans.c
@@ -72,7 +72,7 @@
   vp9_inverse_transform_mbuv_4x4(xd);
 }
 
-void vp9_inverse_transform_b_8x8(short *input_dqcoeff, short *output_coeff,
+void vp9_inverse_transform_b_8x8(int16_t *input_dqcoeff, int16_t *output_coeff,
                                  int pitch) {
   vp9_short_idct8x8(input_dqcoeff, output_coeff, pitch);
 }
@@ -123,8 +123,8 @@
   vp9_inverse_transform_mbuv_8x8(xd);
 }
 
-void vp9_inverse_transform_b_16x16(short *input_dqcoeff,
-                                   short *output_coeff, int pitch) {
+void vp9_inverse_transform_b_16x16(int16_t *input_dqcoeff,
+                                   int16_t *output_coeff, int pitch) {
   vp9_short_idct16x16(input_dqcoeff, output_coeff, pitch);
 }
 
--- a/vp9/common/vp9_invtrans.h
+++ b/vp9/common/vp9_invtrans.h
@@ -12,6 +12,7 @@
 #define VP9_COMMON_VP9_INVTRANS_H_
 
 #include "vpx_ports/config.h"
+#include "vpx/vpx_integer.h"
 #include "vp9/common/vp9_blockd.h"
 
 extern void vp9_inverse_transform_b_4x4(MACROBLOCKD *xd, int block, int pitch);
@@ -22,8 +23,8 @@
 
 extern void vp9_inverse_transform_mbuv_4x4(MACROBLOCKD *xd);
 
-extern void vp9_inverse_transform_b_8x8(short *input_dqcoeff,
-                                        short *output_coeff, int pitch);
+extern void vp9_inverse_transform_b_8x8(int16_t *input_dqcoeff,
+                                        int16_t *output_coeff, int pitch);
 
 extern void vp9_inverse_transform_mb_8x8(MACROBLOCKD *xd);
 
@@ -31,8 +32,8 @@
 
 extern void vp9_inverse_transform_mbuv_8x8(MACROBLOCKD *xd);
 
-extern void vp9_inverse_transform_b_16x16(short *input_dqcoeff,
-                                          short *output_coeff, int pitch);
+extern void vp9_inverse_transform_b_16x16(int16_t *input_dqcoeff,
+                                          int16_t *output_coeff, int pitch);
 
 extern void vp9_inverse_transform_mb_16x16(MACROBLOCKD *xd);
 
@@ -43,4 +44,4 @@
 extern void vp9_inverse_transform_sbuv_16x16(SUPERBLOCKD *xd_sb);
 #endif
 
-#endif  // __INC_INVTRANS_H
+#endif  // VP9_COMMON_VP9_INVTRANS_H_
--- a/vp9/common/vp9_loopfilter.c
+++ b/vp9/common/vp9_loopfilter.c
@@ -188,7 +188,7 @@
 
   int filter_level;
 
-  unsigned char *y_ptr, *u_ptr, *v_ptr;
+  uint8_t *y_ptr, *u_ptr, *v_ptr;
 
   /* Point at base of Mb MODE_INFO list */
   const MODE_INFO *mode_info_context = cm->mi;
@@ -325,7 +325,7 @@
                                  int default_filt_lvl) {
   YV12_BUFFER_CONFIG *post = cm->frame_to_show;
 
-  unsigned char *y_ptr;
+  uint8_t *y_ptr;
   int mb_row;
   int mb_col;
 
@@ -425,7 +425,7 @@
                                    int default_filt_lvl) {
   YV12_BUFFER_CONFIG *post = cm->frame_to_show;
 
-  unsigned char *y_ptr;
+  uint8_t *y_ptr;
   int mb_row;
   int mb_col;
   int mb_cols = post->y_width  >> 4;
--- a/vp9/common/vp9_loopfilter.h
+++ b/vp9/common/vp9_loopfilter.h
@@ -49,26 +49,26 @@
 };
 
 #define prototype_loopfilter(sym) \
-  void sym(unsigned char *src, int pitch, const unsigned char *blimit,\
+  void sym(uint8_t *src, int pitch, const unsigned char *blimit, \
            const unsigned char *limit, const unsigned char *thresh, int count)
 
 #define prototype_loopfilter_block(sym) \
-  void sym(unsigned char *y, unsigned char *u, unsigned char *v, \
+  void sym(uint8_t *y, uint8_t *u, uint8_t *v, \
            int ystride, int uv_stride, struct loop_filter_info *lfi)
 
 #define prototype_simple_loopfilter(sym) \
-  void sym(unsigned char *y, int ystride, const unsigned char *blimit)
+  void sym(uint8_t *y, int ystride, const unsigned char *blimit)
 
 #if ARCH_X86 || ARCH_X86_64
 #include "x86/vp9_loopfilter_x86.h"
 #endif
 
-typedef void loop_filter_uvfunction(unsigned char *u,   /* source pointer */
+typedef void loop_filter_uvfunction(uint8_t *u,   /* source pointer */
                                     int p,              /* pitch */
                                     const unsigned char *blimit,
                                     const unsigned char *limit,
                                     const unsigned char *thresh,
-                                    unsigned char *v);
+                                    uint8_t *v);
 
 /* assorted loopfilter functions which get used elsewhere */
 struct VP9Common;
@@ -93,4 +93,4 @@
 void vp9_loop_filter_update_sharpness(loop_filter_info_n *lfi,
                                       int sharpness_lvl);
 
-#endif  // loopfilter_h
+#endif  // VP9_COMMON_VP9_LOOPFILTER_H_
--- a/vp9/common/vp9_loopfilter_filters.c
+++ b/vp9/common/vp9_loopfilter_filters.c
@@ -13,20 +13,20 @@
 #include "vp9/common/vp9_loopfilter.h"
 #include "vp9/common/vp9_onyxc_int.h"
 
-typedef unsigned char uc;
-
-static __inline signed char signed_char_clamp(int t) {
+static __inline int8_t signed_char_clamp(int t) {
   t = (t < -128 ? -128 : t);
   t = (t > 127 ? 127 : t);
-  return (signed char) t;
+  return (int8_t) t;
 }
 
 
 /* should we apply any filter at all ( 11111111 yes, 00000000 no) */
-static __inline signed char filter_mask(uc limit, uc blimit,
-                                        uc p3, uc p2, uc p1, uc p0,
-                                        uc q0, uc q1, uc q2, uc q3) {
-  signed char mask = 0;
+static __inline int8_t filter_mask(uint8_t limit, uint8_t blimit,
+                                   uint8_t p3, uint8_t p2,
+                                   uint8_t p1, uint8_t p0,
+                                   uint8_t q0, uint8_t q1,
+                                   uint8_t q2, uint8_t q3) {
+  int8_t mask = 0;
   mask |= (abs(p3 - p2) > limit) * -1;
   mask |= (abs(p2 - p1) > limit) * -1;
   mask |= (abs(p1 - p0) > limit) * -1;
@@ -39,27 +39,26 @@
 }
 
 /* is there high variance internal edge ( 11111111 yes, 00000000 no) */
-static __inline signed char hevmask(uc thresh, uc p1, uc p0, uc q0, uc q1) {
-  signed char hev = 0;
+static __inline int8_t hevmask(uint8_t thresh, uint8_t p1, uint8_t p0,
+                               uint8_t q0, uint8_t q1) {
+  int8_t hev = 0;
   hev  |= (abs(p1 - p0) > thresh) * -1;
   hev  |= (abs(q1 - q0) > thresh) * -1;
   return hev;
 }
 
-static __inline void filter(signed char mask, uc hev, uc *op1,
-                            uc *op0, uc *oq0, uc *oq1)
+static __inline void filter(int8_t mask, uint8_t hev, uint8_t *op1,
+                            uint8_t *op0, uint8_t *oq0, uint8_t *oq1) {
+  int8_t ps0, qs0;
+  int8_t ps1, qs1;
+  int8_t filter, Filter1, Filter2;
+  int8_t u;
 
-{
-  signed char ps0, qs0;
-  signed char ps1, qs1;
-  signed char filter, Filter1, Filter2;
-  signed char u;
+  ps1 = (int8_t) *op1 ^ 0x80;
+  ps0 = (int8_t) *op0 ^ 0x80;
+  qs0 = (int8_t) *oq0 ^ 0x80;
+  qs1 = (int8_t) *oq1 ^ 0x80;
 
-  ps1 = (signed char) * op1 ^ 0x80;
-  ps0 = (signed char) * op0 ^ 0x80;
-  qs0 = (signed char) * oq0 ^ 0x80;
-  qs1 = (signed char) * oq1 ^ 0x80;
-
   /* add outer taps if we have high edge variance */
   filter = signed_char_clamp(ps1 - qs1);
   filter &= hev;
@@ -91,20 +90,16 @@
   *oq1 = u ^ 0x80;
   u = signed_char_clamp(ps1 + filter);
   *op1 = u ^ 0x80;
-
 }
 
-void vp9_loop_filter_horizontal_edge_c
-(
-  unsigned char *s,
-  int p, /* pitch */
-  const unsigned char *blimit,
-  const unsigned char *limit,
-  const unsigned char *thresh,
-  int count
-) {
-  int  hev = 0; /* high edge variance */
-  signed char mask = 0;
+void vp9_loop_filter_horizontal_edge_c(uint8_t *s,
+                                       int p, /* pitch */
+                                       const unsigned char *blimit,
+                                       const unsigned char *limit,
+                                       const unsigned char *thresh,
+                                       int count) {
+  int hev = 0; /* high edge variance */
+  int8_t mask = 0;
   int i = 0;
 
   /* loop filter designed to work using chars so that we can make maximum use
@@ -123,7 +118,7 @@
   } while (++i < count * 8);
 }
 
-void vp9_loop_filter_vertical_edge_c(unsigned char *s,
+void vp9_loop_filter_vertical_edge_c(uint8_t *s,
                                      int p,
                                      const unsigned char *blimit,
                                      const unsigned char *limit,
@@ -130,7 +125,7 @@
                                      const unsigned char *thresh,
                                      int count) {
   int  hev = 0; /* high edge variance */
-  signed char mask = 0;
+  int8_t mask = 0;
   int i = 0;
 
   /* loop filter designed to work using chars so that we can make maximum use
@@ -148,10 +143,12 @@
     s += p;
   } while (++i < count * 8);
 }
-static __inline signed char flatmask(uc thresh,
-                                     uc p4, uc p3, uc p2, uc p1, uc p0,
-                                     uc q0, uc q1, uc q2, uc q3, uc q4) {
-  signed char flat = 0;
+static __inline signed char flatmask(uint8_t thresh,
+                                     uint8_t p4, uint8_t p3, uint8_t p2,
+                                     uint8_t p1, uint8_t p0,
+                                     uint8_t q0, uint8_t q1, uint8_t q2,
+                                     uint8_t q3, uint8_t q4) {
+  int8_t flat = 0;
   flat |= (abs(p1 - p0) > 1) * -1;
   flat |= (abs(q1 - q0) > 1) * -1;
   flat |= (abs(p0 - p2) > 1) * -1;
@@ -164,16 +161,18 @@
   return flat;
 }
 
-static __inline void mbfilter(signed char mask, uc hev, uc flat,
-                              uc *op4, uc *op3, uc *op2, uc *op1, uc *op0,
-                              uc *oq0, uc *oq1, uc *oq2, uc *oq3, uc *oq4) {
+static __inline void mbfilter(int8_t mask, uint8_t hev, uint8_t flat,
+                              uint8_t *op4, uint8_t *op3, uint8_t *op2,
+                              uint8_t *op1, uint8_t *op0,
+                              uint8_t *oq0, uint8_t *oq1, uint8_t *oq2,
+                              uint8_t *oq3, uint8_t *oq4) {
   /* use a 7 tap filter [1, 1, 1, 2, 1, 1, 1] for flat line */
   if (flat && mask) {
-    unsigned char p0, q0;
-    unsigned char p1, q1;
-    unsigned char p2, q2;
-    unsigned char p3, q3;
-    unsigned char p4, q4;
+    uint8_t p0, q0;
+    uint8_t p1, q1;
+    uint8_t p2, q2;
+    uint8_t p3, q3;
+    uint8_t p4, q4;
 
     p4 = *op4;
     p3 = *op3;
@@ -193,15 +192,15 @@
     *oq1 = (p1 + p0 + q0 + q1 + q1 + q2 + q3 + q4 + 4) >> 3;
     *oq2 = (p0 + q0 + q1 + q2 + q2 + q3 + q4 + q4 + 4) >> 3;
   } else {
-    signed char ps0, qs0;
-    signed char ps1, qs1;
-    signed char filter, Filter1, Filter2;
-    signed char u;
+    int8_t ps0, qs0;
+    int8_t ps1, qs1;
+    int8_t filter, Filter1, Filter2;
+    int8_t u;
 
-    ps1 = (signed char) * op1 ^ 0x80;
-    ps0 = (signed char) * op0 ^ 0x80;
-    qs0 = (signed char) * oq0 ^ 0x80;
-    qs1 = (signed char) * oq1 ^ 0x80;
+    ps1 = (int8_t) *op1 ^ 0x80;
+    ps0 = (int8_t) *op0 ^ 0x80;
+    qs0 = (int8_t) *oq0 ^ 0x80;
+    qs1 = (int8_t) *oq1 ^ 0x80;
 
     /* add outer taps if we have high edge variance */
     filter = signed_char_clamp(ps1 - qs1);
@@ -233,18 +232,16 @@
     *op1 = u ^ 0x80;
   }
 }
-void vp9_mbloop_filter_horizontal_edge_c
-(
-  unsigned char *s,
-  int p,
-  const unsigned char *blimit,
-  const unsigned char *limit,
-  const unsigned char *thresh,
-  int count
-) {
-  signed char hev = 0; /* high edge variance */
-  signed char mask = 0;
-  signed char flat = 0;
+
+void vp9_mbloop_filter_horizontal_edge_c(uint8_t *s,
+                                         int p,
+                                         const unsigned char *blimit,
+                                         const unsigned char *limit,
+                                         const unsigned char *thresh,
+                                         int count) {
+  int8_t hev = 0; /* high edge variance */
+  int8_t mask = 0;
+  int8_t flat = 0;
   int i = 0;
 
   /* loop filter designed to work using chars so that we can make maximum use
@@ -251,7 +248,6 @@
    * of 8 bit simd instructions.
    */
   do {
-
     mask = filter_mask(limit[0], blimit[0],
                        s[-4 * p], s[-3 * p], s[-2 * p], s[-1 * p],
                        s[ 0 * p], s[ 1 * p], s[ 2 * p], s[ 3 * p]);
@@ -269,22 +265,19 @@
   } while (++i < count * 8);
 
 }
-void vp9_mbloop_filter_vertical_edge_c
-(
-  unsigned char *s,
-  int p,
-  const unsigned char *blimit,
-  const unsigned char *limit,
-  const unsigned char *thresh,
-  int count
-) {
-  signed char hev = 0; /* high edge variance */
-  signed char mask = 0;
-  signed char flat = 0;
+
+void vp9_mbloop_filter_vertical_edge_c(uint8_t *s,
+                                       int p,
+                                       const unsigned char *blimit,
+                                       const unsigned char *limit,
+                                       const unsigned char *thresh,
+                                       int count) {
+  int8_t hev = 0; /* high edge variance */
+  int8_t mask = 0;
+  int8_t flat = 0;
   int i = 0;
 
   do {
-
     mask = filter_mask(limit[0], blimit[0],
                        s[-4], s[-3], s[-2], s[-1],
                        s[0], s[1], s[2], s[3]);
@@ -302,26 +295,26 @@
 }
 
 /* should we apply any filter at all ( 11111111 yes, 00000000 no) */
-static __inline signed char simple_filter_mask(uc blimit,
-                                               uc p1, uc p0,
-                                               uc q0, uc q1) {
+static __inline int8_t simple_filter_mask(uint8_t blimit,
+                                          uint8_t p1, uint8_t p0,
+                                          uint8_t q0, uint8_t q1) {
   /* Why does this cause problems for win32?
    * error C2143: syntax error : missing ';' before 'type'
    *  (void) limit;
    */
-  signed char mask = (abs(p0 - q0) * 2 + abs(p1 - q1) / 2  <= blimit) * -1;
+  int8_t mask = (abs(p0 - q0) * 2 + abs(p1 - q1) / 2  <= blimit) * -1;
   return mask;
 }
 
-static __inline void simple_filter(signed char mask,
-                                   uc *op1, uc *op0,
-                                   uc *oq0, uc *oq1) {
-  signed char filter, Filter1, Filter2;
-  signed char p1 = (signed char) * op1 ^ 0x80;
-  signed char p0 = (signed char) * op0 ^ 0x80;
-  signed char q0 = (signed char) * oq0 ^ 0x80;
-  signed char q1 = (signed char) * oq1 ^ 0x80;
-  signed char u;
+static __inline void simple_filter(int8_t mask,
+                                   uint8_t *op1, uint8_t *op0,
+                                   uint8_t *oq0, uint8_t *oq1) {
+  int8_t filter, Filter1, Filter2;
+  int8_t p1 = (int8_t) *op1 ^ 0x80;
+  int8_t p0 = (int8_t) *op0 ^ 0x80;
+  int8_t q0 = (int8_t) *oq0 ^ 0x80;
+  int8_t q1 = (int8_t) *oq1 ^ 0x80;
+  int8_t u;
 
   filter = signed_char_clamp(p1 - q1);
   filter = signed_char_clamp(filter + 3 * (q0 - p0));
@@ -339,13 +332,10 @@
   *op0 = u ^ 0x80;
 }
 
-void vp9_loop_filter_simple_horizontal_edge_c
-(
-  unsigned char *s,
-  int p,
-  const unsigned char *blimit
-) {
-  signed char mask = 0;
+void vp9_loop_filter_simple_horizontal_edge_c(uint8_t *s,
+                                              int p,
+                                              const unsigned char *blimit) {
+  int8_t mask = 0;
   int i = 0;
 
   do {
@@ -359,13 +349,10 @@
   } while (++i < 16);
 }
 
-void vp9_loop_filter_simple_vertical_edge_c
-(
-  unsigned char *s,
-  int p,
-  const unsigned char *blimit
-) {
-  signed char mask = 0;
+void vp9_loop_filter_simple_vertical_edge_c(uint8_t *s,
+                                            int p,
+                                            const unsigned char *blimit) {
+  int8_t mask = 0;
   int i = 0;
 
   do {
@@ -373,12 +360,11 @@
     simple_filter(mask, s - 2, s - 1, s, s + 1);
     s += p;
   } while (++i < 16);
-
 }
 
 /* Vertical MB Filtering */
-void vp9_loop_filter_mbv_c(unsigned char *y_ptr, unsigned char *u_ptr,
-                           unsigned char *v_ptr, int y_stride, int uv_stride,
+void vp9_loop_filter_mbv_c(uint8_t *y_ptr, uint8_t *u_ptr,
+                           uint8_t *v_ptr, int y_stride, int uv_stride,
                            struct loop_filter_info *lfi) {
   vp9_mbloop_filter_vertical_edge_c(y_ptr, y_stride,
                                     lfi->mblim, lfi->lim, lfi->hev_thr, 2);
@@ -393,8 +379,8 @@
 }
 
 /* Vertical B Filtering */
-void vp9_loop_filter_bv_c(unsigned char *y_ptr, unsigned char *u_ptr,
-                          unsigned char *v_ptr, int y_stride, int uv_stride,
+void vp9_loop_filter_bv_c(uint8_t*y_ptr, uint8_t *u_ptr,
+                          uint8_t *v_ptr, int y_stride, int uv_stride,
                           struct loop_filter_info *lfi) {
   vp9_loop_filter_vertical_edge_c(y_ptr + 4, y_stride,
                                   lfi->blim, lfi->lim, lfi->hev_thr, 2);
@@ -413,8 +399,8 @@
 }
 
 /* Horizontal MB filtering */
-void vp9_loop_filter_mbh_c(unsigned char *y_ptr, unsigned char *u_ptr,
-                           unsigned char *v_ptr, int y_stride, int uv_stride,
+void vp9_loop_filter_mbh_c(uint8_t *y_ptr, uint8_t *u_ptr,
+                           uint8_t *v_ptr, int y_stride, int uv_stride,
                            struct loop_filter_info *lfi) {
   vp9_mbloop_filter_horizontal_edge_c(y_ptr, y_stride,
                                       lfi->mblim, lfi->lim, lfi->hev_thr, 2);
@@ -429,8 +415,8 @@
 }
 
 /* Horizontal B Filtering */
-void vp9_loop_filter_bh_c(unsigned char *y_ptr, unsigned char *u_ptr,
-                          unsigned char *v_ptr, int y_stride, int uv_stride,
+void vp9_loop_filter_bh_c(uint8_t *y_ptr, uint8_t *u_ptr,
+                          uint8_t *v_ptr, int y_stride, int uv_stride,
                           struct loop_filter_info *lfi) {
   vp9_loop_filter_horizontal_edge_c(y_ptr + 4 * y_stride, y_stride,
                                     lfi->blim, lfi->lim, lfi->hev_thr, 2);
@@ -448,14 +434,14 @@
                                       lfi->blim, lfi->lim, lfi->hev_thr, 1);
 }
 
-void vp9_loop_filter_bh8x8_c(unsigned char *y_ptr, unsigned char *u_ptr,
-                             unsigned char *v_ptr, int y_stride, int uv_stride,
+void vp9_loop_filter_bh8x8_c(uint8_t *y_ptr, uint8_t *u_ptr,
+                             uint8_t *v_ptr, int y_stride, int uv_stride,
                              struct loop_filter_info *lfi) {
   vp9_mbloop_filter_horizontal_edge_c(
     y_ptr + 8 * y_stride, y_stride, lfi->blim, lfi->lim, lfi->hev_thr, 2);
 }
 
-void vp9_loop_filter_bhs_c(unsigned char *y_ptr, int y_stride,
+void vp9_loop_filter_bhs_c(uint8_t *y_ptr, int y_stride,
                            const unsigned char *blimit) {
   vp9_loop_filter_simple_horizontal_edge_c(y_ptr + 4 * y_stride,
                                            y_stride, blimit);
@@ -465,14 +451,14 @@
                                            y_stride, blimit);
 }
 
-void vp9_loop_filter_bv8x8_c(unsigned char *y_ptr, unsigned char *u_ptr,
-                             unsigned char *v_ptr, int y_stride, int uv_stride,
+void vp9_loop_filter_bv8x8_c(uint8_t *y_ptr, uint8_t *u_ptr,
+                             uint8_t *v_ptr, int y_stride, int uv_stride,
                              struct loop_filter_info *lfi) {
   vp9_mbloop_filter_vertical_edge_c(
     y_ptr + 8, y_stride, lfi->blim, lfi->lim, lfi->hev_thr, 2);
 }
 
-void vp9_loop_filter_bvs_c(unsigned char *y_ptr, int y_stride,
+void vp9_loop_filter_bvs_c(uint8_t *y_ptr, int y_stride,
                            const unsigned char *blimit) {
   vp9_loop_filter_simple_vertical_edge_c(y_ptr + 4, y_stride, blimit);
   vp9_loop_filter_simple_vertical_edge_c(y_ptr + 8, y_stride, blimit);
--- a/vp9/common/vp9_mbpitch.c
+++ b/vp9/common/vp9_mbpitch.c
@@ -16,17 +16,13 @@
   DEST = 1
 } BLOCKSET;
 
-static void setup_block
-(
-  BLOCKD *b,
-  int mv_stride,
-  unsigned char **base,
-  unsigned char **base2,
-  int Stride,
-  int offset,
-  BLOCKSET bs
-) {
-
+static void setup_block(BLOCKD *b,
+                        int mv_stride,
+                        uint8_t **base,
+                        uint8_t **base2,
+                        int Stride,
+                        int offset,
+                        BLOCKSET bs) {
   if (bs == DEST) {
     b->dst_stride = Stride;
     b->dst = offset;
@@ -37,15 +33,13 @@
     b->base_pre = base;
     b->base_second_pre = base2;
   }
-
 }
 
-
 static void setup_macroblock(MACROBLOCKD *xd, BLOCKSET bs) {
   int block;
 
-  unsigned char **y, **u, **v;
-  unsigned char **y2, **u2, **v2;
+  uint8_t **y, **u, **v;
+  uint8_t **y2, **u2, **v2;
   BLOCKD *blockd = xd->block;
   int stride;
 
@@ -117,7 +111,6 @@
 }
 
 void vp9_build_block_doffsets(MACROBLOCKD *xd) {
-
   /* handle the destination pitch features */
   setup_macroblock(xd, DEST);
   setup_macroblock(xd, PRED);
--- a/vp9/common/vp9_modecont.h
+++ b/vp9/common/vp9_modecont.h
@@ -8,9 +8,9 @@
  *  be found in the AUTHORS file in the root of the source tree.
  */
 
-
 #ifndef VP9_COMMON_VP9_MODECONT_H_
 #define VP9_COMMON_VP9_MODECONT_H_
 
 extern const int vp9_default_mode_contexts[INTER_MODE_CONTEXTS][4];
-#endif
+
+#endif  // VP9_COMMON_VP9_MODECONT_H_
--- a/vp9/common/vp9_mv.h
+++ b/vp9/common/vp9_mv.h
@@ -8,14 +8,14 @@
  *  be found in the AUTHORS file in the root of the source tree.
  */
 
-
 #ifndef VP9_COMMON_VP9_MV_H_
 #define VP9_COMMON_VP9_MV_H_
+
 #include "vpx/vpx_integer.h"
 
 typedef struct {
-  short row;
-  short col;
+  int16_t row;
+  int16_t col;
 } MV;
 
 typedef union int_mv {
@@ -23,4 +23,4 @@
   MV as_mv;
 } int_mv; /* facilitates faster equality tests and copies */
 
-#endif
+#endif  // VP9_COMMON_VP9_MV_H_
--- a/vp9/common/vp9_mvref_common.h
+++ b/vp9/common/vp9_mvref_common.h
@@ -11,18 +11,14 @@
 #include "vp9/common/vp9_onyxc_int.h"
 #include "vp9/common/vp9_blockd.h"
 
-
 #ifndef VP9_COMMON_VP9_MVREF_COMMON_H_
 #define VP9_COMMON_VP9_MVREF_COMMON_H_
 
-void vp9_find_mv_refs(
-  MACROBLOCKD *xd,
-  MODE_INFO *here,
-  MODE_INFO *lf_here,
-  MV_REFERENCE_FRAME ref_frame,
-  int_mv * mv_ref_list,
-  int *ref_sign_bias
-);
+void vp9_find_mv_refs(MACROBLOCKD *xd,
+                      MODE_INFO *here,
+                      MODE_INFO *lf_here,
+                      MV_REFERENCE_FRAME ref_frame,
+                      int_mv *mv_ref_list,
+                      int *ref_sign_bias);
 
-#endif
-
+#endif  // VP9_COMMON_VP9_MVREF_COMMON_H_
--- a/vp9/common/vp9_onyx.h
+++ b/vp9/common/vp9_onyx.h
@@ -8,7 +8,6 @@
  *  be found in the AUTHORS file in the root of the source tree.
  */
 
-
 #ifndef VP9_COMMON_VP9_ONYX_H_
 #define VP9_COMMON_VP9_ONYX_H_
 
@@ -221,4 +220,4 @@
 }
 #endif
 
-#endif  // __INC_ONYX_H
+#endif  // VP9_COMMON_VP9_ONYX_H_
--- a/vp9/common/vp9_onyxc_int.h
+++ b/vp9/common/vp9_onyxc_int.h
@@ -8,7 +8,6 @@
  *  be found in the AUTHORS file in the root of the source tree.
  */
 
-
 #ifndef VP9_COMMON_VP9_ONYXC_INT_H_
 #define VP9_COMMON_VP9_ONYXC_INT_H_
 
@@ -142,9 +141,9 @@
 typedef struct VP9Common {
   struct vpx_internal_error_info  error;
 
-  DECLARE_ALIGNED(16, short, Y1dequant[QINDEX_RANGE][16]);
-  DECLARE_ALIGNED(16, short, Y2dequant[QINDEX_RANGE][16]);
-  DECLARE_ALIGNED(16, short, UVdequant[QINDEX_RANGE][16]);
+  DECLARE_ALIGNED(16, int16_t, Y1dequant[QINDEX_RANGE][16]);
+  DECLARE_ALIGNED(16, int16_t, Y2dequant[QINDEX_RANGE][16]);
+  DECLARE_ALIGNED(16, int16_t, UVdequant[QINDEX_RANGE][16]);
 
   int Width;
   int Height;
@@ -299,4 +298,4 @@
 
 } VP9_COMMON;
 
-#endif  // __INC_ONYX_INT_H
+#endif  // VP9_COMMON_VP9_ONYXC_INT_H_
--- a/vp9/common/vp9_onyxd.h
+++ /dev/null
@@ -1,67 +1,0 @@
-/*
- *  Copyright (c) 2010 The WebM project authors. 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.
- */
-
-
-#ifndef VP9_COMMON_VP9_ONYXD_H_
-#define VP9_COMMON_VP9_ONYXD_H_
-
-
-/* Create/destroy static data structures. */
-#ifdef __cplusplus
-extern "C"
-{
-#endif
-#include "vpx_scale/yv12config.h"
-#include "vp9/common/vp9_ppflags.h"
-#include "vpx_ports/mem.h"
-#include "vpx/vpx_codec.h"
-
-  typedef void   *VP9D_PTR;
-  typedef struct {
-    int     Width;
-    int     Height;
-    int     Version;
-    int     postprocess;
-    int     max_threads;
-    int     input_partition;
-  } VP9D_CONFIG;
-  typedef enum {
-    VP9_LAST_FLAG = 1,
-    VP9_GOLD_FLAG = 2,
-    VP9_ALT_FLAG = 4
-  } VP9_REFFRAME;
-
-  void vp9_initialize_dec(void);
-
-  int vp9_receive_compressed_data(VP9D_PTR comp, unsigned long size,
-                                  const unsigned char **dest,
-                                  int64_t time_stamp);
-
-  int vp9_get_raw_frame(VP9D_PTR comp, YV12_BUFFER_CONFIG *sd,
-                        int64_t *time_stamp, int64_t *time_end_stamp,
-                        vp9_ppflags_t *flags);
-
-  vpx_codec_err_t vp9_get_reference_dec(VP9D_PTR comp,
-                                        VP9_REFFRAME ref_frame_flag,
-                                        YV12_BUFFER_CONFIG *sd);
-
-  vpx_codec_err_t vp9_set_reference_dec(VP9D_PTR comp,
-                                        VP9_REFFRAME ref_frame_flag,
-                                        YV12_BUFFER_CONFIG *sd);
-
-  VP9D_PTR vp9_create_decompressor(VP9D_CONFIG *oxcf);
-
-  void vp9_remove_decompressor(VP9D_PTR comp);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif  // __INC_ONYXD_H
--- a/vp9/common/vp9_postproc.c
+++ b/vp9/common/vp9_postproc.c
@@ -132,20 +132,20 @@
 
 /****************************************************************************
  */
-void vp9_post_proc_down_and_across_c(unsigned char *src_ptr,
-                                     unsigned char *dst_ptr,
+void vp9_post_proc_down_and_across_c(uint8_t *src_ptr,
+                                     uint8_t *dst_ptr,
                                      int src_pixels_per_line,
                                      int dst_pixels_per_line,
                                      int rows,
                                      int cols,
                                      int flimit) {
-  unsigned char *p_src, *p_dst;
+  uint8_t *p_src, *p_dst;
   int row;
   int col;
   int i;
   int v;
   int pitch = src_pixels_per_line;
-  unsigned char d[8];
+  uint8_t d[8];
   (void)dst_pixels_per_line;
 
   for (row = 0; row < rows; row++) {
@@ -215,12 +215,12 @@
   return x * x / 3;
 }
 
-void vp9_mbpost_proc_across_ip_c(unsigned char *src, int pitch,
+void vp9_mbpost_proc_across_ip_c(uint8_t *src, int pitch,
                                  int rows, int cols, int flimit) {
   int r, c, i;
 
-  unsigned char *s = src;
-  unsigned char d[16];
+  uint8_t *s = src;
+  uint8_t d[16];
 
 
   for (r = 0; r < rows; r++) {
@@ -253,16 +253,16 @@
   }
 }
 
-void vp9_mbpost_proc_down_c(unsigned char *dst, int pitch,
+void vp9_mbpost_proc_down_c(uint8_t *dst, int pitch,
                             int rows, int cols, int flimit) {
   int r, c, i;
   const short *rv3 = &vp9_rv[63 & rand()];
 
   for (c = 0; c < cols; c++) {
-    unsigned char *s = &dst[c];
+    uint8_t *s = &dst[c];
     int sumsq = 0;
     int sum   = 0;
-    unsigned char d[16];
+    uint8_t d[16];
     const short *rv2 = rv3 + ((c * 17) & 127);
 
     for (i = -8; i <= 6; i++) {
@@ -439,7 +439,7 @@
  *  SPECIAL NOTES : None.
  *
  ****************************************************************************/
-void vp9_plane_add_noise_c(unsigned char *Start, char *noise,
+void vp9_plane_add_noise_c(uint8_t *Start, char *noise,
                            char blackclamp[16],
                            char whiteclamp[16],
                            char bothclamp[16],
@@ -447,7 +447,7 @@
   unsigned int i, j;
 
   for (i = 0; i < Height; i++) {
-    unsigned char *Pos = Start + i * Pitch;
+    uint8_t *Pos = Start + i * Pitch;
     char  *Ref = (char *)(noise + (rand() & 0xff));
 
     for (j = 0; j < Width; j++) {
@@ -466,7 +466,7 @@
  * edges unblended to give distinction to macro blocks in areas
  * filled with the same color block.
  */
-void vp9_blend_mb_inner_c(unsigned char *y, unsigned char *u, unsigned char *v,
+void vp9_blend_mb_inner_c(uint8_t *y, uint8_t *u, uint8_t *v,
                           int y1, int u1, int v1, int alpha, int stride) {
   int i, j;
   int y1_const = y1 * ((1 << 16) - alpha);
@@ -499,7 +499,7 @@
 /* Blend only the edge of the macro block.  Leave center
  * unblended to allow for other visualizations to be layered.
  */
-void vp9_blend_mb_outer_c(unsigned char *y, unsigned char *u, unsigned char *v,
+void vp9_blend_mb_outer_c(uint8_t *y, uint8_t *u, uint8_t *v,
                           int y1, int u1, int v1, int alpha, int stride) {
   int i, j;
   int y1_const = y1 * ((1 << 16) - alpha);
@@ -554,7 +554,7 @@
   }
 }
 
-void vp9_blend_b_c(unsigned char *y, unsigned char *u, unsigned char *v,
+void vp9_blend_b_c(uint8_t *y, uint8_t *u, uint8_t *v,
                    int y1, int u1, int v1, int alpha, int stride) {
   int i, j;
   int y1_const = y1 * ((1 << 16) - alpha);
@@ -688,7 +688,7 @@
 
   if (flags & VP9D_DEBUG_TXT_MBLK_MODES) {
     int i, j;
-    unsigned char *y_ptr;
+    uint8_t *y_ptr;
     YV12_BUFFER_CONFIG *post = &oci->post_proc_buffer;
     int mb_rows = post->y_height >> 4;
     int mb_cols = post->y_width  >> 4;
@@ -717,7 +717,7 @@
 
   if (flags & VP9D_DEBUG_TXT_DC_DIFF) {
     int i, j;
-    unsigned char *y_ptr;
+    uint8_t *y_ptr;
     YV12_BUFFER_CONFIG *post = &oci->post_proc_buffer;
     int mb_rows = post->y_height >> 4;
     int mb_cols = post->y_width  >> 4;
@@ -764,7 +764,7 @@
     YV12_BUFFER_CONFIG *post = &oci->post_proc_buffer;
     int width  = post->y_width;
     int height = post->y_height;
-    unsigned char *y_buffer = oci->post_proc_buffer.y_buffer;
+    uint8_t *y_buffer = oci->post_proc_buffer.y_buffer;
     int y_stride = oci->post_proc_buffer.y_stride;
     MODE_INFO *mi = oci->mi;
     int x0, y0;
@@ -906,9 +906,9 @@
     YV12_BUFFER_CONFIG *post = &oci->post_proc_buffer;
     int width  = post->y_width;
     int height = post->y_height;
-    unsigned char *y_ptr = oci->post_proc_buffer.y_buffer;
-    unsigned char *u_ptr = oci->post_proc_buffer.u_buffer;
-    unsigned char *v_ptr = oci->post_proc_buffer.v_buffer;
+    uint8_t *y_ptr = oci->post_proc_buffer.y_buffer;
+    uint8_t *u_ptr = oci->post_proc_buffer.u_buffer;
+    uint8_t *v_ptr = oci->post_proc_buffer.v_buffer;
     int y_stride = oci->post_proc_buffer.y_stride;
     MODE_INFO *mi = oci->mi;
 
@@ -920,7 +920,7 @@
             ((ppflags->display_mb_modes_flag & B_PRED) ||
              ppflags->display_b_modes_flag)) {
           int by, bx;
-          unsigned char *yl, *ul, *vl;
+          uint8_t *yl, *ul, *vl;
           union b_mode_info *bmi = mi->bmi;
 
           yl = y_ptr + x;
@@ -971,9 +971,9 @@
     YV12_BUFFER_CONFIG *post = &oci->post_proc_buffer;
     int width  = post->y_width;
     int height = post->y_height;
-    unsigned char *y_ptr = oci->post_proc_buffer.y_buffer;
-    unsigned char *u_ptr = oci->post_proc_buffer.u_buffer;
-    unsigned char *v_ptr = oci->post_proc_buffer.v_buffer;
+    uint8_t *y_ptr = oci->post_proc_buffer.y_buffer;
+    uint8_t *u_ptr = oci->post_proc_buffer.u_buffer;
+    uint8_t *v_ptr = oci->post_proc_buffer.v_buffer;
     int y_stride = oci->post_proc_buffer.y_stride;
     MODE_INFO *mi = oci->mi;
 
--- a/vp9/common/vp9_postproc.h
+++ b/vp9/common/vp9_postproc.h
@@ -38,4 +38,5 @@
                  int                         q,
                  int                         low_var_thresh,
                  int                         flag);
-#endif
+
+#endif  // VP9_COMMON_VP9_POSTPROC_H_
--- a/vp9/common/vp9_ppflags.h
+++ b/vp9/common/vp9_ppflags.h
@@ -8,9 +8,9 @@
  *  be found in the AUTHORS file in the root of the source tree.
  */
 
-
 #ifndef VP9_COMMON_VP9_PPFLAGS_H_
 #define VP9_COMMON_VP9_PPFLAGS_H_
+
 enum {
   VP9D_NOFILTERING            = 0,
   VP9D_DEBLOCK                = 1 << 0,
@@ -35,4 +35,4 @@
   int display_mv_flag;
 } vp9_ppflags_t;
 
-#endif
+#endif  // VP9_COMMON_VP9_PPFLAGS_H_
--- a/vp9/common/vp9_pragmas.h
+++ b/vp9/common/vp9_pragmas.h
@@ -8,9 +8,9 @@
  *  be found in the AUTHORS file in the root of the source tree.
  */
 
+#ifndef VP9_COMMON_VP9_PRAGMAS_H_
+#define VP9_COMMON_VP9_PRAGMAS_H_
 
-
-
 #ifdef __INTEL_COMPILER
 #pragma warning(disable:997 1011 170)
 #endif
@@ -17,3 +17,5 @@
 #ifdef _MSC_VER
 #pragma warning(disable:4799)
 #endif
+
+#endif  // VP9_COMMON_VP9_PRAGMAS_H_
--- a/vp9/common/vp9_pred_common.h
+++ b/vp9/common/vp9_pred_common.h
@@ -52,4 +52,4 @@
                                        const MACROBLOCKD *const xd);
 extern void vp9_compute_mod_refprobs(VP9_COMMON *const cm);
 
-#endif /* __INC_PRED_COMMON_H__ */
+#endif  // VP9_COMMON_VP9_PRED_COMMON_H_
--- a/vp9/common/vp9_quant_common.h
+++ b/vp9/common/vp9_quant_common.h
@@ -8,12 +8,14 @@
  *  be found in the AUTHORS file in the root of the source tree.
  */
 
+#ifndef VP9_COMMON_VP9_QUANT_COMMON_H_
+#define VP9_COMMON_VP9_QUANT_COMMON_H_
 
 #include "string.h"
 #include "vp9/common/vp9_blockd.h"
 #include "vp9/common/vp9_onyxc_int.h"
 
-extern void vp9_init_quant_tables();
+extern void vp9_init_quant_tables(void);
 extern int vp9_ac_yquant(int QIndex);
 extern int vp9_dc_quant(int QIndex, int Delta);
 extern int vp9_dc2quant(int QIndex, int Delta);
@@ -20,3 +22,5 @@
 extern int vp9_ac2quant(int QIndex, int Delta);
 extern int vp9_dc_uv_quant(int QIndex, int Delta);
 extern int vp9_ac_uv_quant(int QIndex, int Delta);
+
+#endif  // VP9_COMMON_VP9_QUANT_COMMON_H_
--- a/vp9/common/vp9_recon.c
+++ b/vp9/common/vp9_recon.c
@@ -13,13 +13,10 @@
 #include "vp9_rtcd.h"
 #include "vp9/common/vp9_blockd.h"
 
-void vp9_recon_b_c
-(
-  unsigned char *pred_ptr,
-  short *diff_ptr,
-  unsigned char *dst_ptr,
-  int stride
-) {
+void vp9_recon_b_c(uint8_t *pred_ptr,
+                   int16_t *diff_ptr,
+                   uint8_t *dst_ptr,
+                   int stride) {
   int r, c;
 
   for (r = 0; r < 4; r++) {
@@ -33,13 +30,10 @@
   }
 }
 
-void vp9_recon_uv_b_c
-(
-  unsigned char *pred_ptr,
-  short *diff_ptr,
-  unsigned char *dst_ptr,
-  int stride
-) {
+void vp9_recon_uv_b_c(uint8_t *pred_ptr,
+                      int16_t *diff_ptr,
+                      uint8_t *dst_ptr,
+                      int stride) {
   int r, c;
 
   for (r = 0; r < 4; r++) {
@@ -52,13 +46,11 @@
     pred_ptr += 8;
   }
 }
-void vp9_recon4b_c
-(
-  unsigned char *pred_ptr,
-  short *diff_ptr,
-  unsigned char *dst_ptr,
-  int stride
-) {
+
+void vp9_recon4b_c(uint8_t *pred_ptr,
+                   int16_t *diff_ptr,
+                   uint8_t *dst_ptr,
+                   int stride) {
   int r, c;
 
   for (r = 0; r < 4; r++) {
@@ -72,13 +64,10 @@
   }
 }
 
-void vp9_recon2b_c
-(
-  unsigned char *pred_ptr,
-  short *diff_ptr,
-  unsigned char *dst_ptr,
-  int stride
-) {
+void vp9_recon2b_c(uint8_t *pred_ptr,
+                   int16_t *diff_ptr,
+                   uint8_t *dst_ptr,
+                   int stride) {
   int r, c;
 
   for (r = 0; r < 4; r++) {
@@ -97,7 +86,7 @@
   int x, y;
   BLOCKD *b = &xd->block[0];
   int stride = b->dst_stride;
-  short *diff = b->diff;
+  int16_t *diff = b->diff;
 
   for (y = 0; y < 16; y++) {
     for (x = 0; x < 16; x++) {
@@ -115,7 +104,7 @@
   for (i = 0; i < 2; i++, dst = vdst) {
     BLOCKD *b = &xd->block[16 + 4 * i];
     int stride = b->dst_stride;
-    short *diff = b->diff;
+    int16_t *diff = b->diff;
 
     for (y = 0; y < 8; y++) {
       for (x = 0; x < 8; x++) {
@@ -130,7 +119,7 @@
 #if CONFIG_TX32X32
 void vp9_recon_sby_s_c(MACROBLOCKD *xd, uint8_t *dst) {
   int x, y, stride = xd->block[0].dst_stride;
-  short *diff = xd->sb_coeff_data.diff;
+  int16_t *diff = xd->sb_coeff_data.diff;
 
   for (y = 0; y < 32; y++) {
     for (x = 0; x < 32; x++) {
@@ -143,8 +132,8 @@
 
 void vp9_recon_sbuv_s_c(MACROBLOCKD *xd, uint8_t *udst, uint8_t *vdst) {
   int x, y, stride = xd->block[16].dst_stride;
-  short *udiff = xd->sb_coeff_data.diff + 1024;
-  short *vdiff = xd->sb_coeff_data.diff + 1280;
+  int16_t *udiff = xd->sb_coeff_data.diff + 1024;
+  int16_t *vdiff = xd->sb_coeff_data.diff + 1280;
 
   for (y = 0; y < 16; y++) {
     for (x = 0; x < 16; x++) {
--- a/vp9/common/vp9_reconinter.c
+++ b/vp9/common/vp9_reconinter.c
@@ -42,8 +42,7 @@
     xd->subpixel_predict_avg    = vp9_eighttap_predict_avg4x4_sharp;
     xd->subpixel_predict_avg8x8 = vp9_eighttap_predict_avg8x8_sharp;
     xd->subpixel_predict_avg16x16 = vp9_eighttap_predict_avg16x16_sharp_c;
-  }
-  else {
+  } else {
     xd->subpixel_predict        = vp9_bilinear_predict4x4;
     xd->subpixel_predict8x4     = vp9_bilinear_predict8x4;
     xd->subpixel_predict8x8     = vp9_bilinear_predict8x8;
@@ -54,9 +53,9 @@
   }
 }
 
-void vp9_copy_mem16x16_c(unsigned char *src,
+void vp9_copy_mem16x16_c(uint8_t *src,
                          int src_stride,
-                         unsigned char *dst,
+                         uint8_t *dst,
                          int dst_stride) {
   int r;
 
@@ -91,9 +90,9 @@
   }
 }
 
-void vp9_avg_mem16x16_c(unsigned char *src,
+void vp9_avg_mem16x16_c(uint8_t *src,
                         int src_stride,
-                        unsigned char *dst,
+                        uint8_t *dst,
                         int dst_stride) {
   int r;
 
@@ -109,9 +108,9 @@
   }
 }
 
-void vp9_copy_mem8x8_c(unsigned char *src,
+void vp9_copy_mem8x8_c(uint8_t *src,
                        int src_stride,
-                       unsigned char *dst,
+                       uint8_t *dst,
                        int dst_stride) {
   int r;
 
@@ -134,9 +133,9 @@
   }
 }
 
-void vp9_avg_mem8x8_c(unsigned char *src,
+void vp9_avg_mem8x8_c(uint8_t *src,
                       int src_stride,
-                      unsigned char *dst,
+                      uint8_t *dst,
                       int dst_stride) {
   int r;
 
@@ -152,9 +151,9 @@
   }
 }
 
-void vp9_copy_mem8x4_c(unsigned char *src,
+void vp9_copy_mem8x4_c(uint8_t *src,
                        int src_stride,
-                       unsigned char *dst,
+                       uint8_t *dst,
                        int dst_stride) {
   int r;
 
@@ -179,9 +178,9 @@
 
 void vp9_build_inter_predictors_b(BLOCKD *d, int pitch, vp9_subpix_fn_t sppf) {
   int r;
-  unsigned char *ptr_base;
-  unsigned char *ptr;
-  unsigned char *pred_ptr = d->predictor;
+  uint8_t *ptr_base;
+  uint8_t *ptr;
+  uint8_t *pred_ptr = d->predictor;
   int_mv mv;
 
   ptr_base = *(d->base_pre);
@@ -221,9 +220,9 @@
 void vp9_build_2nd_inter_predictors_b(BLOCKD *d, int pitch,
                                       vp9_subpix_fn_t sppf) {
   int r;
-  unsigned char *ptr_base;
-  unsigned char *ptr;
-  unsigned char *pred_ptr = d->predictor;
+  uint8_t *ptr_base;
+  uint8_t *ptr;
+  uint8_t *pred_ptr = d->predictor;
   int_mv mv;
 
   ptr_base = *(d->base_second_pre);
@@ -251,9 +250,9 @@
 }
 
 void vp9_build_inter_predictors4b(MACROBLOCKD *xd, BLOCKD *d, int pitch) {
-  unsigned char *ptr_base;
-  unsigned char *ptr;
-  unsigned char *pred_ptr = d->predictor;
+  uint8_t *ptr_base;
+  uint8_t *ptr;
+  uint8_t *pred_ptr = d->predictor;
   int_mv mv;
 
   ptr_base = *(d->base_pre);
@@ -277,9 +276,9 @@
  */
 void vp9_build_2nd_inter_predictors4b(MACROBLOCKD *xd,
                                       BLOCKD *d, int pitch) {
-  unsigned char *ptr_base;
-  unsigned char *ptr;
-  unsigned char *pred_ptr = d->predictor;
+  uint8_t *ptr_base;
+  uint8_t *ptr;
+  uint8_t *pred_ptr = d->predictor;
   int_mv mv;
 
   ptr_base = *(d->base_second_pre);
@@ -296,9 +295,9 @@
 }
 
 static void build_inter_predictors2b(MACROBLOCKD *xd, BLOCKD *d, int pitch) {
-  unsigned char *ptr_base;
-  unsigned char *ptr;
-  unsigned char *pred_ptr = d->predictor;
+  uint8_t *ptr_base;
+  uint8_t *ptr;
+  uint8_t *pred_ptr = d->predictor;
   int_mv mv;
 
   ptr_base = *(d->base_pre);
@@ -328,13 +327,13 @@
 // Alternative filter {1, 1, 4, 1, 1}
 
 #if !USE_THRESH_FILTER
-void filter_mb(unsigned char *src, int src_stride,
-               unsigned char *dst, int dst_stride,
+void filter_mb(uint8_t *src, int src_stride,
+               uint8_t *dst, int dst_stride,
                int width, int height) {
   int i, j, k;
   unsigned int temp[32 * 32];
   unsigned int  *pTmp = temp;
-  unsigned char *pSrc = src - (1 + src_stride) * (PRED_FILT_LEN / 2);
+  uint8_t *pSrc = src - (1 + src_stride) * (PRED_FILT_LEN / 2);
 
   // Horizontal
   for (i = 0; i < height + PRED_FILT_LEN - 1; i++) {
@@ -352,7 +351,7 @@
   // Vertical
   pTmp = temp;
   for (i = 0; i < width; i++) {
-    unsigned char *pDst = dst + i;
+    uint8_t *pDst = dst + i;
     for (j = 0; j < height; j++) {
       int sum = 0;
       for (k = 0; k < PRED_FILT_LEN; k++)
@@ -366,15 +365,15 @@
 }
 #else
 // Based on vp9_post_proc_down_and_across_c (vp9_postproc.c)
-void filter_mb(unsigned char *src, int src_stride,
-               unsigned char *dst, int dst_stride,
+void filter_mb(uint8_t *src, int src_stride,
+               uint8_t *dst, int dst_stride,
                int width, int height) {
-  unsigned char *pSrc, *pDst;
+  uint8_t *pSrc, *pDst;
   int row;
   int col;
   int i;
   int v;
-  unsigned char d[8];
+  uint8_t d[8];
 
   /* TODO flimit should be linked to the quantizer value */
   int flimit = 7;
@@ -573,11 +572,11 @@
 
 /*encoder only*/
 void vp9_build_1st_inter16x16_predictors_mby(MACROBLOCKD *xd,
-                                             unsigned char *dst_y,
+                                             uint8_t *dst_y,
                                              int dst_ystride,
                                              int clamp_mvs) {
-  unsigned char *ptr_base = xd->pre.y_buffer;
-  unsigned char *ptr;
+  uint8_t *ptr_base = xd->pre.y_buffer;
+  uint8_t *ptr;
   int pre_stride = xd->block[0].pre_stride;
   int_mv ymv;
 
@@ -593,8 +592,8 @@
     if ((ymv.as_mv.row | ymv.as_mv.col) & 7) {
       // Sub-pel filter needs extended input
       int len = 15 + (VP9_INTERP_EXTEND << 1);
-      unsigned char Temp[32 * 32]; // Data required by sub-pel filter
-      unsigned char *pTemp = Temp + (VP9_INTERP_EXTEND - 1) * (len + 1);
+      uint8_t Temp[32 * 32];  // Data required by sub-pel filter
+      uint8_t *pTemp = Temp + (VP9_INTERP_EXTEND - 1) * (len + 1);
 
       // Copy extended MB into Temp array, applying the spatial filter
       filter_mb(ptr - (VP9_INTERP_EXTEND - 1) * (pre_stride + 1), pre_stride,
@@ -622,11 +621,11 @@
 }
 
 void vp9_build_1st_inter16x16_predictors_mbuv(MACROBLOCKD *xd,
-                                              unsigned char *dst_u,
-                                              unsigned char *dst_v,
+                                              uint8_t *dst_u,
+                                              uint8_t *dst_v,
                                               int dst_uvstride) {
   int offset;
-  unsigned char *uptr, *vptr;
+  uint8_t *uptr, *vptr;
   int pre_stride = xd->block[0].pre_stride;
   int_mv _o16x16mv;
   int_mv _16x16mv;
@@ -662,11 +661,11 @@
 #if CONFIG_PRED_FILTER
   if (xd->mode_info_context->mbmi.pred_filter_enabled) {
     int i;
-    unsigned char *pSrc = uptr;
-    unsigned char *pDst = dst_u;
+    uint8_t *pSrc = uptr;
+    uint8_t *pDst = dst_u;
     int len = 7 + (VP9_INTERP_EXTEND << 1);
-    unsigned char Temp[32 * 32]; // Data required by the sub-pel filter
-    unsigned char *pTemp = Temp + (VP9_INTERP_EXTEND - 1) * (len + 1);
+    uint8_t Temp[32 * 32];  // Data required by the sub-pel filter
+    uint8_t *pTemp = Temp + (VP9_INTERP_EXTEND - 1) * (len + 1);
 
     // U & V
     for (i = 0; i < 2; i++) {
@@ -703,9 +702,9 @@
 
 
 void vp9_build_1st_inter16x16_predictors_mb(MACROBLOCKD *xd,
-                                            unsigned char *dst_y,
-                                            unsigned char *dst_u,
-                                            unsigned char *dst_v,
+                                            uint8_t *dst_y,
+                                            uint8_t *dst_u,
+                                            uint8_t *dst_v,
                                             int dst_ystride, int dst_uvstride) {
   vp9_build_1st_inter16x16_predictors_mby(xd, dst_y, dst_ystride,
       xd->mode_info_context->mbmi.need_to_clamp_mvs);
@@ -714,9 +713,9 @@
 
 #if CONFIG_SUPERBLOCKS
 void vp9_build_inter32x32_predictors_sb(MACROBLOCKD *x,
-                                        unsigned char *dst_y,
-                                        unsigned char *dst_u,
-                                        unsigned char *dst_v,
+                                        uint8_t *dst_y,
+                                        uint8_t *dst_u,
+                                        uint8_t *dst_v,
                                         int dst_ystride,
                                         int dst_uvstride) {
   uint8_t *y1 = x->pre.y_buffer, *u1 = x->pre.u_buffer, *v1 = x->pre.v_buffer;
@@ -798,15 +797,15 @@
  * single reference framer.
  */
 void vp9_build_2nd_inter16x16_predictors_mby(MACROBLOCKD *xd,
-                                             unsigned char *dst_y,
+                                             uint8_t *dst_y,
                                              int dst_ystride) {
-  unsigned char *ptr;
+  uint8_t *ptr;
 
   int_mv _16x16mv;
   int mv_row;
   int mv_col;
 
-  unsigned char *ptr_base = xd->second_pre.y_buffer;
+  uint8_t *ptr_base = xd->second_pre.y_buffer;
   int pre_stride = xd->block[0].pre_stride;
 
   _16x16mv.as_int = xd->mode_info_context->mbmi.mv[1].as_int;
@@ -824,8 +823,8 @@
     if ((mv_row | mv_col) & 7) {
       // Sub-pel filter needs extended input
       int len = 15 + (VP9_INTERP_EXTEND << 1);
-      unsigned char Temp[32 * 32]; // Data required by sub-pel filter
-      unsigned char *pTemp = Temp + (VP9_INTERP_EXTEND - 1) * (len + 1);
+      uint8_t Temp[32 * 32];  // Data required by sub-pel filter
+      uint8_t *pTemp = Temp + (VP9_INTERP_EXTEND - 1) * (len + 1);
 
       // Copy extended MB into Temp array, applying the spatial filter
       filter_mb(ptr - (VP9_INTERP_EXTEND - 1) * (pre_stride + 1), pre_stride,
@@ -852,11 +851,11 @@
 }
 
 void vp9_build_2nd_inter16x16_predictors_mbuv(MACROBLOCKD *xd,
-                                              unsigned char *dst_u,
-                                              unsigned char *dst_v,
+                                              uint8_t *dst_u,
+                                              uint8_t *dst_v,
                                               int dst_uvstride) {
   int offset;
-  unsigned char *uptr, *vptr;
+  uint8_t *uptr, *vptr;
 
   int_mv _16x16mv;
   int mv_row;
@@ -891,10 +890,10 @@
   if (xd->mode_info_context->mbmi.pred_filter_enabled) {
     int i;
     int len = 7 + (VP9_INTERP_EXTEND << 1);
-    unsigned char Temp[32 * 32]; // Data required by sub-pel filter
-    unsigned char *pTemp = Temp + (VP9_INTERP_EXTEND - 1) * (len + 1);
-    unsigned char *pSrc = uptr;
-    unsigned char *pDst = dst_u;
+    uint8_t Temp[32 * 32];  // Data required by sub-pel filter
+    uint8_t *pTemp = Temp + (VP9_INTERP_EXTEND - 1) * (len + 1);
+    uint8_t *pSrc = uptr;
+    uint8_t *pDst = dst_u;
 
     // U & V
     for (i = 0; i < 2; i++) {
@@ -930,9 +929,9 @@
 }
 
 void vp9_build_2nd_inter16x16_predictors_mb(MACROBLOCKD *xd,
-                                            unsigned char *dst_y,
-                                            unsigned char *dst_u,
-                                            unsigned char *dst_v,
+                                            uint8_t *dst_y,
+                                            uint8_t *dst_u,
+                                            uint8_t *dst_v,
                                             int dst_ystride,
                                             int dst_uvstride) {
   vp9_build_2nd_inter16x16_predictors_mby(xd, dst_y, dst_ystride);
--- a/vp9/common/vp9_reconinter.h
+++ b/vp9/common/vp9_reconinter.h
@@ -11,46 +11,47 @@
 #ifndef VP9_COMMON_VP9_RECONINTER_H_
 #define VP9_COMMON_VP9_RECONINTER_H_
 
+#include "vpx/vpx_integer.h"
 #include "vp9/common/vp9_onyxc_int.h"
 
 extern void vp9_build_1st_inter16x16_predictors_mby(MACROBLOCKD *xd,
-                                                    unsigned char *dst_y,
+                                                    uint8_t *dst_y,
                                                     int dst_ystride,
                                                     int clamp_mvs);
 
 extern void vp9_build_1st_inter16x16_predictors_mbuv(MACROBLOCKD *xd,
-                                                     unsigned char *dst_u,
-                                                     unsigned char *dst_v,
+                                                     uint8_t *dst_u,
+                                                     uint8_t *dst_v,
                                                      int dst_uvstride);
 
 extern void vp9_build_1st_inter16x16_predictors_mb(MACROBLOCKD *xd,
-                                                   unsigned char *dst_y,
-                                                   unsigned char *dst_u,
-                                                   unsigned char *dst_v,
+                                                   uint8_t *dst_y,
+                                                   uint8_t *dst_u,
+                                                   uint8_t *dst_v,
                                                    int dst_ystride,
                                                    int dst_uvstride);
 
 extern void vp9_build_2nd_inter16x16_predictors_mby(MACROBLOCKD *xd,
-                                                    unsigned char *dst_y,
+                                                    uint8_t *dst_y,
                                                     int dst_ystride);
 
 extern void vp9_build_2nd_inter16x16_predictors_mbuv(MACROBLOCKD *xd,
-                                                     unsigned char *dst_u,
-                                                     unsigned char *dst_v,
+                                                     uint8_t *dst_u,
+                                                     uint8_t *dst_v,
                                                      int dst_uvstride);
 
 extern void vp9_build_2nd_inter16x16_predictors_mb(MACROBLOCKD *xd,
-                                                   unsigned char *dst_y,
-                                                   unsigned char *dst_u,
-                                                   unsigned char *dst_v,
+                                                   uint8_t *dst_y,
+                                                   uint8_t *dst_u,
+                                                   uint8_t *dst_v,
                                                    int dst_ystride,
                                                    int dst_uvstride);
 
 #if CONFIG_SUPERBLOCKS
 extern void vp9_build_inter32x32_predictors_sb(MACROBLOCKD *x,
-                                               unsigned char *dst_y,
-                                               unsigned char *dst_u,
-                                               unsigned char *dst_v,
+                                               uint8_t *dst_y,
+                                               uint8_t *dst_u,
+                                               uint8_t *dst_v,
                                                int dst_ystride,
                                                int dst_uvstride);
 #endif
@@ -75,4 +76,4 @@
                                      INTERPOLATIONFILTERTYPE filter,
                                      VP9_COMMON *cm);
 
-#endif  // __INC_RECONINTER_H
+#endif  // VP9_COMMON_VP9_RECONINTER_H_
--- a/vp9/common/vp9_reconintra.c
+++ b/vp9/common/vp9_reconintra.c
@@ -198,9 +198,9 @@
   }
 }
 
-static void corner_predictor(unsigned char *ypred_ptr, int y_stride, int n,
-                             unsigned char *yabove_row,
-                             unsigned char *yleft_col) {
+static void corner_predictor(uint8_t *ypred_ptr, int y_stride, int n,
+                             uint8_t *yabove_row,
+                             uint8_t *yleft_col) {
   int mh, mv, maxgradh, maxgradv, x, y, nx, ny;
   int i, j;
   int top_left = yabove_row[-1];
@@ -248,14 +248,14 @@
   }
 }
 
-void vp9_build_intra_predictors_internal(unsigned char *src, int src_stride,
-                                         unsigned char *ypred_ptr,
+void vp9_build_intra_predictors_internal(uint8_t *src, int src_stride,
+                                         uint8_t *ypred_ptr,
                                          int y_stride, int mode, int bsize,
                                          int up_available, int left_available) {
 
-  unsigned char *yabove_row = src - src_stride;
-  unsigned char yleft_col[32];
-  unsigned char ytop_left = yabove_row[-1];
+  uint8_t *yabove_row = src - src_stride;
+  uint8_t yleft_col[32];
+  uint8_t ytop_left = yabove_row[-1];
   int r, c, i;
 
   for (i = 0; i < bsize; i++) {
@@ -368,9 +368,9 @@
 
 #if CONFIG_COMP_INTERINTRA_PRED
 static void combine_interintra(MB_PREDICTION_MODE mode,
-                               unsigned char *interpred,
+                               uint8_t *interpred,
                                int interstride,
-                               unsigned char *intrapred,
+                               uint8_t *intrapred,
                                int intrastride,
                                int size) {
   // TODO(debargha): Explore different ways of combining predictors
@@ -607,9 +607,9 @@
 }
 
 void vp9_build_interintra_16x16_predictors_mb(MACROBLOCKD *xd,
-                                              unsigned char *ypred,
-                                              unsigned char *upred,
-                                              unsigned char *vpred,
+                                              uint8_t *ypred,
+                                              uint8_t *upred,
+                                              uint8_t *vpred,
                                               int ystride, int uvstride) {
   vp9_build_interintra_16x16_predictors_mby(xd, ypred, ystride);
   vp9_build_interintra_16x16_predictors_mbuv(xd, upred, vpred, uvstride);
@@ -616,9 +616,9 @@
 }
 
 void vp9_build_interintra_16x16_predictors_mby(MACROBLOCKD *xd,
-                                               unsigned char *ypred,
+                                               uint8_t *ypred,
                                                int ystride) {
-  unsigned char intrapredictor[256];
+  uint8_t intrapredictor[256];
   vp9_build_intra_predictors_internal(
       xd->dst.y_buffer, xd->dst.y_stride,
       intrapredictor, 16,
@@ -629,11 +629,11 @@
 }
 
 void vp9_build_interintra_16x16_predictors_mbuv(MACROBLOCKD *xd,
-                                                unsigned char *upred,
-                                                unsigned char *vpred,
+                                                uint8_t *upred,
+                                                uint8_t *vpred,
                                                 int uvstride) {
-  unsigned char uintrapredictor[64];
-  unsigned char vintrapredictor[64];
+  uint8_t uintrapredictor[64];
+  uint8_t vintrapredictor[64];
   vp9_build_intra_predictors_internal(
       xd->dst.u_buffer, xd->dst.uv_stride,
       uintrapredictor, 8,
@@ -652,9 +652,9 @@
 
 #if CONFIG_SUPERBLOCKS
 void vp9_build_interintra_32x32_predictors_sby(MACROBLOCKD *xd,
-                                               unsigned char *ypred,
+                                               uint8_t *ypred,
                                                int ystride) {
-  unsigned char intrapredictor[1024];
+  uint8_t intrapredictor[1024];
   vp9_build_intra_predictors_internal(
       xd->dst.y_buffer, xd->dst.y_stride,
       intrapredictor, 32,
@@ -665,11 +665,11 @@
 }
 
 void vp9_build_interintra_32x32_predictors_sbuv(MACROBLOCKD *xd,
-                                                unsigned char *upred,
-                                                unsigned char *vpred,
+                                                uint8_t *upred,
+                                                uint8_t *vpred,
                                                 int uvstride) {
-  unsigned char uintrapredictor[256];
-  unsigned char vintrapredictor[256];
+  uint8_t uintrapredictor[256];
+  uint8_t vintrapredictor[256];
   vp9_build_intra_predictors_internal(
       xd->dst.u_buffer, xd->dst.uv_stride,
       uintrapredictor, 16,
@@ -687,9 +687,9 @@
 }
 
 void vp9_build_interintra_32x32_predictors_sb(MACROBLOCKD *xd,
-                                              unsigned char *ypred,
-                                              unsigned char *upred,
-                                              unsigned char *vpred,
+                                              uint8_t *ypred,
+                                              uint8_t *upred,
+                                              uint8_t *vpred,
                                               int ystride,
                                               int uvstride) {
   vp9_build_interintra_32x32_predictors_sby(xd, ypred, ystride);
@@ -723,7 +723,7 @@
 
 #if CONFIG_COMP_INTRA_PRED
 void vp9_build_comp_intra_predictors_mby(MACROBLOCKD *xd) {
-  unsigned char predictor[2][256];
+  uint8_t predictor[2][256];
   int i;
 
   vp9_build_intra_predictors_internal(xd->dst.y_buffer, xd->dst.y_stride,
@@ -744,8 +744,8 @@
 #endif
 
 void vp9_build_intra_predictors_mbuv_internal(MACROBLOCKD *xd,
-                                              unsigned char *upred_ptr,
-                                              unsigned char *vpred_ptr,
+                                              uint8_t *upred_ptr,
+                                              uint8_t *vpred_ptr,
                                               int uv_stride,
                                               int mode, int bsize) {
   vp9_build_intra_predictors_internal(xd->dst.u_buffer, xd->dst.uv_stride,
@@ -782,7 +782,7 @@
 
 #if CONFIG_COMP_INTRA_PRED
 void vp9_build_comp_intra_predictors_mbuv(MACROBLOCKD *xd) {
-  unsigned char predictor[2][2][64];
+  uint8_t predictor[2][2][64];
   int i;
 
   vp9_build_intra_predictors_mbuv_internal(
@@ -801,7 +801,7 @@
 
 void vp9_intra8x8_predict(BLOCKD *xd,
                           int mode,
-                          unsigned char *predictor) {
+                          uint8_t *predictor) {
   vp9_build_intra_predictors_internal(*(xd->base_dst) + xd->dst,
                                       xd->dst_stride, predictor, 16,
                                       mode, 8, 1, 1);
@@ -810,8 +810,8 @@
 #if CONFIG_COMP_INTRA_PRED
 void vp9_comp_intra8x8_predict(BLOCKD *xd,
                                int mode, int second_mode,
-                               unsigned char *out_predictor) {
-  unsigned char predictor[2][8 * 16];
+                               uint8_t *out_predictor) {
+  uint8_t predictor[2][8 * 16];
   int i, j;
 
   vp9_intra8x8_predict(xd, mode, predictor[0]);
@@ -827,7 +827,7 @@
 
 void vp9_intra_uv4x4_predict(BLOCKD *xd,
                              int mode,
-                             unsigned char *predictor) {
+                             uint8_t *predictor) {
   vp9_build_intra_predictors_internal(*(xd->base_dst) + xd->dst,
                                       xd->dst_stride, predictor, 8,
                                       mode, 4, 1, 1);
@@ -836,8 +836,8 @@
 #if CONFIG_COMP_INTRA_PRED
 void vp9_comp_intra_uv4x4_predict(BLOCKD *xd,
                                   int mode, int mode2,
-                                  unsigned char *out_predictor) {
-  unsigned char predictor[2][8 * 4];
+                                  uint8_t *out_predictor) {
+  uint8_t predictor[2][8 * 4];
   int i, j;
 
   vp9_intra_uv4x4_predict(xd, mode, predictor[0]);
--- a/vp9/common/vp9_reconintra.h
+++ b/vp9/common/vp9_reconintra.h
@@ -11,34 +11,36 @@
 #ifndef VP9_COMMON_VP9_RECONINTRA_H_
 #define VP9_COMMON_VP9_RECONINTRA_H_
 
+#include "vpx/vpx_integer.h"
 #include "vp9/common/vp9_blockd.h"
 
 extern void vp9_recon_intra_mbuv(MACROBLOCKD *xd);
-extern B_PREDICTION_MODE vp9_find_dominant_direction(unsigned char *ptr,
+extern B_PREDICTION_MODE vp9_find_dominant_direction(uint8_t *ptr,
                                                      int stride, int n);
 extern B_PREDICTION_MODE vp9_find_bpred_context(BLOCKD *x);
 #if CONFIG_COMP_INTERINTRA_PRED
 extern void vp9_build_interintra_16x16_predictors_mb(MACROBLOCKD *xd,
-                                                     unsigned char *ypred,
-                                                     unsigned char *upred,
-                                                     unsigned char *vpred,
+                                                     uint8_t *ypred,
+                                                     uint8_t *upred,
+                                                     uint8_t *vpred,
                                                      int ystride,
                                                      int uvstride);
 extern void vp9_build_interintra_16x16_predictors_mby(MACROBLOCKD *xd,
-                                                      unsigned char *ypred,
+                                                      uint8_t *ypred,
                                                       int ystride);
 extern void vp9_build_interintra_16x16_predictors_mbuv(MACROBLOCKD *xd,
-                                                       unsigned char *upred,
-                                                       unsigned char *vpred,
+                                                       uint8_t *upred,
+                                                       uint8_t *vpred,
                                                        int uvstride);
+#endif  // CONFIG_COMP_INTERINTRA_PRED
+
 #if CONFIG_SUPERBLOCKS
 extern void vp9_build_interintra_32x32_predictors_sb(MACROBLOCKD *xd,
-                                                     unsigned char *ypred,
-                                                     unsigned char *upred,
-                                                     unsigned char *vpred,
+                                                     uint8_t *ypred,
+                                                     uint8_t *upred,
+                                                     uint8_t *vpred,
                                                      int ystride,
                                                      int uvstride);
-#endif
-#endif
+#endif  // CONFIG_SUPERBLOCKS
 
-#endif  // __INC_RECONINTRA_H
+#endif  // VP9_COMMON_VP9_RECONINTRA_H_
--- a/vp9/common/vp9_reconintra4x4.c
+++ b/vp9/common/vp9_reconintra4x4.c
@@ -15,7 +15,7 @@
 #include "vp9_rtcd.h"
 
 #if CONFIG_NEWBINTRAMODES
-static int find_grad_measure(unsigned char *x, int stride, int n, int t,
+static int find_grad_measure(uint8_t *x, int stride, int n, int t,
                              int dx, int dy) {
   int i, j;
   int count = 0, gsum = 0, gdiv;
@@ -35,8 +35,8 @@
 }
 
 #if CONTEXT_PRED_REPLACEMENTS == 6
-B_PREDICTION_MODE vp9_find_dominant_direction(
-    unsigned char *ptr, int stride, int n) {
+B_PREDICTION_MODE vp9_find_dominant_direction(uint8_t *ptr,
+                                              int stride, int n) {
   int g[8], i, imin, imax;
   g[1] = find_grad_measure(ptr, stride, n, 4,  2, 1);
   g[2] = find_grad_measure(ptr, stride, n, 4,  1, 1);
@@ -72,8 +72,8 @@
   }
 }
 #elif CONTEXT_PRED_REPLACEMENTS == 4
-B_PREDICTION_MODE vp9_find_dominant_direction(
-    unsigned char *ptr, int stride, int n) {
+B_PREDICTION_MODE vp9_find_dominant_direction(uint8_t *ptr,
+                                              int stride, int n) {
   int g[8], i, imin, imax;
   g[1] = find_grad_measure(ptr, stride, n, 4,  2, 1);
   g[3] = find_grad_measure(ptr, stride, n, 4,  1, 2);
@@ -103,8 +103,8 @@
   }
 }
 #elif CONTEXT_PRED_REPLACEMENTS == 0
-B_PREDICTION_MODE vp9_find_dominant_direction(
-    unsigned char *ptr, int stride, int n) {
+B_PREDICTION_MODE vp9_find_dominant_direction(uint8_t *ptr,
+                                              int stride, int n) {
   int g[8], i, imin, imax;
   g[0] = find_grad_measure(ptr, stride, n, 4,  1, 0);
   g[1] = find_grad_measure(ptr, stride, n, 4,  2, 1);
@@ -145,7 +145,7 @@
 #endif
 
 B_PREDICTION_MODE vp9_find_bpred_context(BLOCKD *x) {
-  unsigned char *ptr = *(x->base_dst) + x->dst;
+  uint8_t *ptr = *(x->base_dst) + x->dst;
   int stride = x->dst_stride;
   return vp9_find_dominant_direction(ptr, stride, 4);
 }
@@ -153,12 +153,12 @@
 
 void vp9_intra4x4_predict(BLOCKD *x,
                           int b_mode,
-                          unsigned char *predictor) {
+                          uint8_t *predictor) {
   int i, r, c;
 
-  unsigned char *above = *(x->base_dst) + x->dst - x->dst_stride;
-  unsigned char left[4];
-  unsigned char top_left = above[-1];
+  uint8_t *above = *(x->base_dst) + x->dst - x->dst_stride;
+  uint8_t left[4];
+  uint8_t top_left = above[-1];
 
   left[0] = (*(x->base_dst))[x->dst - 1];
   left[1] = (*(x->base_dst))[x->dst - 1 + x->dst_stride];
@@ -203,8 +203,8 @@
     break;
 
     case B_VE_PRED: {
-
       unsigned int ap[4];
+
       ap[0] = above[0];
       ap[1] = above[1];
       ap[2] = above[2];
@@ -212,20 +212,17 @@
 
       for (r = 0; r < 4; r++) {
         for (c = 0; c < 4; c++) {
-
           predictor[c] = ap[c];
         }
 
         predictor += 16;
       }
-
     }
     break;
 
-
     case B_HE_PRED: {
-
       unsigned int lp[4];
+
       lp[0] = left[0];
       lp[1] = left[1];
       lp[2] = left[2];
@@ -241,7 +238,8 @@
     }
     break;
     case B_LD_PRED: {
-      unsigned char *ptr = above;
+      uint8_t *ptr = above;
+
       predictor[0 * 16 + 0] = (ptr[0] + ptr[1] * 2 + ptr[2] + 2) >> 2;
       predictor[0 * 16 + 1] =
         predictor[1 * 16 + 0] = (ptr[1] + ptr[2] * 2 + ptr[3] + 2) >> 2;
@@ -262,9 +260,8 @@
     }
     break;
     case B_RD_PRED: {
+      uint8_t pp[9];
 
-      unsigned char pp[9];
-
       pp[0] = left[3];
       pp[1] = left[2];
       pp[2] = left[1];
@@ -295,9 +292,8 @@
     }
     break;
     case B_VR_PRED: {
+      uint8_t pp[9];
 
-      unsigned char pp[9];
-
       pp[0] = left[3];
       pp[1] = left[2];
       pp[2] = left[1];
@@ -308,7 +304,6 @@
       pp[7] = above[2];
       pp[8] = above[3];
 
-
       predictor[3 * 16 + 0] = (pp[1] + pp[2] * 2 + pp[3] + 2) >> 2;
       predictor[2 * 16 + 0] = (pp[2] + pp[3] * 2 + pp[4] + 2) >> 2;
       predictor[3 * 16 + 1] =
@@ -329,9 +324,8 @@
     }
     break;
     case B_VL_PRED: {
+      uint8_t *pp = above;
 
-      unsigned char *pp = above;
-
       predictor[0 * 16 + 0] = (pp[0] + pp[1] + 1) >> 1;
       predictor[1 * 16 + 0] = (pp[0] + pp[1] * 2 + pp[2] + 2) >> 2;
       predictor[2 * 16 + 0] =
@@ -352,7 +346,8 @@
     break;
 
     case B_HD_PRED: {
-      unsigned char pp[9];
+      uint8_t pp[9];
+
       pp[0] = left[3];
       pp[1] = left[2];
       pp[2] = left[1];
@@ -385,7 +380,7 @@
 
 
     case B_HU_PRED: {
-      unsigned char *pp = left;
+      uint8_t *pp = left;
       predictor[0 * 16 + 0] = (pp[0] + pp[1] + 1) >> 1;
       predictor[0 * 16 + 1] = (pp[0] + pp[1] * 2 + pp[2] + 2) >> 2;
       predictor[0 * 16 + 2] =
@@ -419,9 +414,9 @@
 
 #if CONFIG_COMP_INTRA_PRED
 void vp9_comp_intra4x4_predict_c(BLOCKD *x,
-                               int b_mode, int b_mode2,
-                               unsigned char *out_predictor) {
-  unsigned char predictor[2][4 * 16];
+                                 int b_mode, int b_mode2,
+                                 uint8_t *out_predictor) {
+  uint8_t predictor[2][4 * 16];
   int i, j;
 
   vp9_intra4x4_predict(x, b_mode, predictor[0]);
@@ -440,18 +435,18 @@
  */
 void vp9_intra_prediction_down_copy(MACROBLOCKD *xd) {
   int extend_edge = (xd->mb_to_right_edge == 0 && xd->mb_index < 2);
-  unsigned char *above_right = *(xd->block[0].base_dst) + xd->block[0].dst -
+  uint8_t *above_right = *(xd->block[0].base_dst) + xd->block[0].dst -
                                xd->block[0].dst_stride + 16;
-  unsigned int *src_ptr = (unsigned int *)
+  uint32_t *src_ptr = (uint32_t *)
       (above_right - (xd->mb_index == 3 ? 16 * xd->block[0].dst_stride : 0));
 
-  unsigned int *dst_ptr0 = (unsigned int *)above_right;
-  unsigned int *dst_ptr1 =
-    (unsigned int *)(above_right + 4 * xd->block[0].dst_stride);
-  unsigned int *dst_ptr2 =
-    (unsigned int *)(above_right + 8 * xd->block[0].dst_stride);
-  unsigned int *dst_ptr3 =
-    (unsigned int *)(above_right + 12 * xd->block[0].dst_stride);
+  uint32_t *dst_ptr0 = (uint32_t *)above_right;
+  uint32_t *dst_ptr1 =
+    (uint32_t *)(above_right + 4 * xd->block[0].dst_stride);
+  uint32_t *dst_ptr2 =
+    (uint32_t *)(above_right + 8 * xd->block[0].dst_stride);
+  uint32_t *dst_ptr3 =
+    (uint32_t *)(above_right + 12 * xd->block[0].dst_stride);
 
   if (extend_edge) {
     *src_ptr = ((uint8_t *) src_ptr)[-1] * 0x01010101U;
--- a/vp9/common/vp9_reconintra4x4.h
+++ b/vp9/common/vp9_reconintra4x4.h
@@ -14,4 +14,4 @@
 
 extern void vp9_intra_prediction_down_copy(MACROBLOCKD *xd);
 
-#endif
+#endif  // VP9_COMMON_VP9_RECONINTRA4X4_H_
--- a/vp9/common/vp9_rtcd_defs.sh
+++ b/vp9/common/vp9_rtcd_defs.sh
@@ -4,6 +4,8 @@
  * VP9
  */
 
+#include "vpx/vpx_integer.h"
+
 struct loop_filter_info;
 struct blockd;
 struct macroblockd;
@@ -21,10 +23,10 @@
 }
 forward_decls vp9_common_forward_decls
 
-prototype void vp9_filter_block2d_4x4_8 "const unsigned char *src_ptr, const unsigned int src_stride, const short *HFilter_aligned16, const short *VFilter_aligned16, unsigned char *dst_ptr, unsigned int dst_stride"
-prototype void vp9_filter_block2d_8x4_8 "const unsigned char *src_ptr, const unsigned int src_stride, const short *HFilter_aligned16, const short *VFilter_aligned16, unsigned char *dst_ptr, unsigned int dst_stride"
-prototype void vp9_filter_block2d_8x8_8 "const unsigned char *src_ptr, const unsigned int src_stride, const short *HFilter_aligned16, const short *VFilter_aligned16, unsigned char *dst_ptr, unsigned int dst_stride"
-prototype void vp9_filter_block2d_16x16_8 "const unsigned char *src_ptr, const unsigned int src_stride, const short *HFilter_aligned16, const short *VFilter_aligned16, unsigned char *dst_ptr, unsigned int dst_stride"
+prototype void vp9_filter_block2d_4x4_8 "const uint8_t *src_ptr, const unsigned int src_stride, const int16_t *HFilter_aligned16, const int16_t *VFilter_aligned16, uint8_t *dst_ptr, unsigned int dst_stride"
+prototype void vp9_filter_block2d_8x4_8 "const uint8_t *src_ptr, const unsigned int src_stride, const int16_t *HFilter_aligned16, const int16_t *VFilter_aligned16, uint8_t *dst_ptr, unsigned int dst_stride"
+prototype void vp9_filter_block2d_8x8_8 "const uint8_t *src_ptr, const unsigned int src_stride, const int16_t *HFilter_aligned16, const int16_t *VFilter_aligned16, uint8_t *dst_ptr, unsigned int dst_stride"
+prototype void vp9_filter_block2d_16x16_8 "const uint8_t *src_ptr, const unsigned int src_stride, const int16_t *HFilter_aligned16, const int16_t *VFilter_aligned16, uint8_t *dst_ptr, unsigned int dst_stride"
 
 # At the very least, MSVC 2008 has compiler bug exhibited by this code; code
 # compiles warning free but a dissassembly of generated code show bugs. To be
@@ -45,70 +47,70 @@
 prototype void vp9_dequantize_b_2x2 "struct blockd *x"
 specialize vp9_dequantize_b_2x2
 
-prototype void vp9_dequant_dc_idct_add_y_block_8x8 "short *q, const short *dq, unsigned char *pre, unsigned char *dst, int stride, unsigned short *eobs, const short *dc, struct macroblockd *xd"
+prototype void vp9_dequant_dc_idct_add_y_block_8x8 "int16_t *q, const int16_t *dq, uint8_t *pre, uint8_t *dst, int stride, uint16_t *eobs, const int16_t *dc, struct macroblockd *xd"
 specialize vp9_dequant_dc_idct_add_y_block_8x8
 
-prototype void vp9_dequant_idct_add_y_block_8x8 "short *q, const short *dq, unsigned char *pre, unsigned char *dst, int stride, unsigned short *eobs, struct macroblockd *xd"
+prototype void vp9_dequant_idct_add_y_block_8x8 "int16_t *q, const int16_t *dq, uint8_t *pre, uint8_t *dst, int stride, uint16_t *eobs, struct macroblockd *xd"
 specialize vp9_dequant_idct_add_y_block_8x8
 
-prototype void vp9_dequant_idct_add_uv_block_8x8 "short *q, const short *dq, unsigned char *pre, unsigned char *dstu, unsigned char *dstv, int stride, unsigned short *eobs, struct macroblockd *xd"
+prototype void vp9_dequant_idct_add_uv_block_8x8 "int16_t *q, const int16_t *dq, uint8_t *pre, uint8_t *dstu, uint8_t *dstv, int stride, uint16_t *eobs, struct macroblockd *xd"
 specialize vp9_dequant_idct_add_uv_block_8x8
 
-prototype void vp9_dequant_idct_add_16x16 "short *input, const short *dq, unsigned char *pred, unsigned char *dest, int pitch, int stride, unsigned short eobs"
+prototype void vp9_dequant_idct_add_16x16 "int16_t *input, const int16_t *dq, uint8_t *pred, uint8_t *dest, int pitch, int stride, int eob"
 specialize vp9_dequant_idct_add_16x16
 
-prototype void vp9_dequant_idct_add_8x8 "short *input, const short *dq, unsigned char *pred, unsigned char *dest, int pitch, int stride, int dc, unsigned short eobs"
+prototype void vp9_dequant_idct_add_8x8 "int16_t *input, const int16_t *dq, uint8_t *pred, uint8_t *dest, int pitch, int stride, int dc, int eob"
 specialize vp9_dequant_idct_add_8x8
 
-prototype void vp9_dequant_idct_add "short *input, const short *dq, unsigned char *pred, unsigned char *dest, int pitch, int stride"
+prototype void vp9_dequant_idct_add "int16_t *input, const int16_t *dq, uint8_t *pred, uint8_t *dest, int pitch, int stride"
 specialize vp9_dequant_idct_add
 
-prototype void vp9_dequant_dc_idct_add "short *input, const short *dq, unsigned char *pred, unsigned char *dest, int pitch, int stride, int Dc"
+prototype void vp9_dequant_dc_idct_add "int16_t *input, const int16_t *dq, uint8_t *pred, uint8_t *dest, int pitch, int stride, int dc"
 specialize vp9_dequant_dc_idct_add
 
-prototype void vp9_dequant_dc_idct_add_y_block "short *q, const short *dq, unsigned char *pre, unsigned char *dst, int stride, unsigned short *eobs, const short *dc"
+prototype void vp9_dequant_dc_idct_add_y_block "int16_t *q, const int16_t *dq, uint8_t *pre, uint8_t *dst, int stride, uint16_t *eobs, const int16_t *dcs"
 specialize vp9_dequant_dc_idct_add_y_block mmx
 
-prototype void vp9_dequant_idct_add_y_block "short *q, const short *dq, unsigned char *pre, unsigned char *dst, int stride, unsigned short *eobs"
+prototype void vp9_dequant_idct_add_y_block "int16_t *q, const int16_t *dq, uint8_t *pre, uint8_t *dst, int stride, uint16_t *eobs"
 specialize vp9_dequant_idct_add_y_block mmx
 
-prototype void vp9_dequant_idct_add_uv_block "short *q, const short *dq, unsigned char *pre, unsigned char *dstu, unsigned char *dstv, int stride, unsigned short *eobs"
+prototype void vp9_dequant_idct_add_uv_block "int16_t *q, const int16_t *dq, uint8_t *pre, uint8_t *dstu, uint8_t *dstv, int stride, uint16_t *eobs"
 specialize vp9_dequant_idct_add_uv_block mmx
 
 #
 # RECON
 #
-prototype void vp9_copy_mem16x16 "unsigned char *src, int src_pitch, unsigned char *dst, int dst_pitch"
+prototype void vp9_copy_mem16x16 "uint8_t *src, int src_pitch, uint8_t *dst, int dst_pitch"
 specialize vp9_copy_mem16x16 mmx sse2 dspr2
 vp9_copy_mem16x16_dspr2=vp9_copy_mem16x16_dspr2
 
-prototype void vp9_copy_mem8x8 "unsigned char *src, int src_pitch, unsigned char *dst, int dst_pitch"
+prototype void vp9_copy_mem8x8 "uint8_t *src, int src_pitch, uint8_t *dst, int dst_pitch"
 specialize vp9_copy_mem8x8 mmx dspr2
 vp9_copy_mem8x8_dspr2=vp9_copy_mem8x8_dspr2
 
-prototype void vp9_copy_mem8x4 "unsigned char *src, int src_pitch, unsigned char *dst, int dst_pitch"
+prototype void vp9_copy_mem8x4 "uint8_t *src, int src_pitch, uint8_t *dst, int dst_pitch"
 specialize vp9_copy_mem8x4 mmx
 
-prototype void vp9_avg_mem16x16 "unsigned char *src, int src_pitch, unsigned char *dst, int dst_pitch"
+prototype void vp9_avg_mem16x16 "uint8_t *src, int src_pitch, uint8_t *dst, int dst_pitch"
 specialize vp9_avg_mem16x16
 
-prototype void vp9_avg_mem8x8 "unsigned char *src, int src_pitch, unsigned char *dst, int dst_pitch"
+prototype void vp9_avg_mem8x8 "uint8_t *src, int src_pitch, uint8_t *dst, int dst_pitch"
 specialize vp9_avg_mem8x8
 
-prototype void vp9_copy_mem8x4 "unsigned char *src, int src_pitch, unsigned char *dst, int dst_pitch"
+prototype void vp9_copy_mem8x4 "uint8_t *src, int src_pitch, uint8_t *dst, int dst_pitch"
 specialize vp9_copy_mem8x4 mmx dspr2
 vp9_copy_mem8x4_dspr2=vp9_copy_mem8x4_dspr2
 
-prototype void vp9_recon_b "unsigned char *pred_ptr, short *diff_ptr, unsigned char *dst_ptr, int stride"
+prototype void vp9_recon_b "uint8_t *pred_ptr, int16_t *diff_ptr, uint8_t *dst_ptr, int stride"
 specialize vp9_recon_b
 
-prototype void vp9_recon_uv_b "unsigned char *pred_ptr, short *diff_ptr, unsigned char *dst_ptr, int stride"
+prototype void vp9_recon_uv_b "uint8_t *pred_ptr, int16_t *diff_ptr, uint8_t *dst_ptr, int stride"
 specialize vp9_recon_uv_b
 
-prototype void vp9_recon2b "unsigned char *pred_ptr, short *diff_ptr, unsigned char *dst_ptr, int stride"
+prototype void vp9_recon2b "uint8_t *pred_ptr, int16_t *diff_ptr, uint8_t *dst_ptr, int stride"
 specialize vp9_recon2b sse2
 
-prototype void vp9_recon4b "unsigned char *pred_ptr, short *diff_ptr, unsigned char *dst_ptr, int stride"
+prototype void vp9_recon4b "uint8_t *pred_ptr, int16_t *diff_ptr, uint8_t *dst_ptr, int stride"
 specialize vp9_recon4b sse2
 
 prototype void vp9_recon_mb "struct macroblockd *x"
@@ -117,10 +119,10 @@
 prototype void vp9_recon_mby "struct macroblockd *x"
 specialize vp9_recon_mby
 
-prototype void vp9_recon_mby_s "struct macroblockd *x, unsigned char *dst"
+prototype void vp9_recon_mby_s "struct macroblockd *x, uint8_t *dst"
 specialize vp9_recon_mby_s
 
-prototype void vp9_recon_mbuv_s "struct macroblockd *x, unsigned char *udst, unsigned char *vdst"
+prototype void vp9_recon_mbuv_s "struct macroblockd *x, uint8_t *udst, uint8_t *vdst"
 specialize void vp9_recon_mbuv_s
 
 prototype void vp9_build_intra_predictors_mby_s "struct macroblockd *x"
@@ -150,64 +152,64 @@
 prototype void vp9_build_comp_intra_predictors_mbuv "struct macroblockd *x"
 specialize vp9_build_comp_intra_predictors_mbuv;
 
-prototype void vp9_intra4x4_predict "struct blockd *x, int b_mode, unsigned char *predictor"
+prototype void vp9_intra4x4_predict "struct blockd *x, int b_mode, uint8_t *predictor"
 specialize vp9_intra4x4_predict;
 
-prototype void vp9_comp_intra4x4_predict "struct blockd *x, int b_mode, int second_mode, unsigned char *predictor"
+prototype void vp9_comp_intra4x4_predict "struct blockd *x, int b_mode, int second_mode, uint8_t *predictor"
 specialize vp9_comp_intra4x4_predict;
 
-prototype void vp9_intra8x8_predict "struct blockd *x, int b_mode, unsigned char *predictor"
+prototype void vp9_intra8x8_predict "struct blockd *x, int b_mode, uint8_t *predictor"
 specialize vp9_intra8x8_predict;
 
-prototype void vp9_comp_intra8x8_predict "struct blockd *x, int b_mode, int second_mode, unsigned char *predictor"
+prototype void vp9_comp_intra8x8_predict "struct blockd *x, int b_mode, int second_mode, uint8_t *predictor"
 specialize vp9_comp_intra8x8_predict;
 
-prototype void vp9_intra_uv4x4_predict "struct blockd *x, int b_mode, unsigned char *predictor"
+prototype void vp9_intra_uv4x4_predict "struct blockd *x, int b_mode, uint8_t *predictor"
 specialize vp9_intra_uv4x4_predict;
 
-prototype void vp9_comp_intra_uv4x4_predict "struct blockd *x, int b_mode, int second_mode, unsigned char *predictor"
+prototype void vp9_comp_intra_uv4x4_predict "struct blockd *x, int b_mode, int second_mode, uint8_t *predictor"
 specialize vp9_comp_intra_uv4x4_predict;
 
 #
 # Loopfilter
 #
-prototype void vp9_loop_filter_mbv "unsigned char *y, unsigned char *u, unsigned char *v, int ystride, int uv_stride, struct loop_filter_info *lfi"
+prototype void vp9_loop_filter_mbv "uint8_t *y, uint8_t *u, uint8_t *v, int ystride, int uv_stride, struct loop_filter_info *lfi"
 specialize vp9_loop_filter_mbv sse2
 
-prototype void vp9_loop_filter_bv "unsigned char *y, unsigned char *u, unsigned char *v, int ystride, int uv_stride, struct loop_filter_info *lfi"
+prototype void vp9_loop_filter_bv "uint8_t *y, uint8_t *u, uint8_t *v, int ystride, int uv_stride, struct loop_filter_info *lfi"
 specialize vp9_loop_filter_bv sse2
 
-prototype void vp9_loop_filter_bv8x8 "unsigned char *y, unsigned char *u, unsigned char *v, int ystride, int uv_stride, struct loop_filter_info *lfi"
+prototype void vp9_loop_filter_bv8x8 "uint8_t *y, uint8_t *u, uint8_t *v, int ystride, int uv_stride, struct loop_filter_info *lfi"
 specialize vp9_loop_filter_bv8x8 sse2
 
-prototype void vp9_loop_filter_mbh "unsigned char *y, unsigned char *u, unsigned char *v, int ystride, int uv_stride, struct loop_filter_info *lfi"
+prototype void vp9_loop_filter_mbh "uint8_t *y, uint8_t *u, uint8_t *v, int ystride, int uv_stride, struct loop_filter_info *lfi"
 specialize vp9_loop_filter_mbh sse2
 
-prototype void vp9_loop_filter_bh "unsigned char *y, unsigned char *u, unsigned char *v, int ystride, int uv_stride, struct loop_filter_info *lfi"
+prototype void vp9_loop_filter_bh "uint8_t *y, uint8_t *u, uint8_t *v, int ystride, int uv_stride, struct loop_filter_info *lfi"
 specialize vp9_loop_filter_bh sse2
 
-prototype void vp9_loop_filter_bh8x8 "unsigned char *y, unsigned char *u, unsigned char *v, int ystride, int uv_stride, struct loop_filter_info *lfi"
+prototype void vp9_loop_filter_bh8x8 "uint8_t *y, uint8_t *u, uint8_t *v, int ystride, int uv_stride, struct loop_filter_info *lfi"
 specialize vp9_loop_filter_bh8x8 sse2
 
-prototype void vp9_loop_filter_simple_mbv "unsigned char *y, int ystride, const unsigned char *blimit"
+prototype void vp9_loop_filter_simple_mbv "uint8_t *y, int ystride, const uint8_t *blimit"
 specialize vp9_loop_filter_simple_mbv mmx sse2
 vp9_loop_filter_simple_mbv_c=vp9_loop_filter_simple_vertical_edge_c
 vp9_loop_filter_simple_mbv_mmx=vp9_loop_filter_simple_vertical_edge_mmx
 vp9_loop_filter_simple_mbv_sse2=vp9_loop_filter_simple_vertical_edge_sse2
 
-prototype void vp9_loop_filter_simple_mbh "unsigned char *y, int ystride, const unsigned char *blimit"
+prototype void vp9_loop_filter_simple_mbh "uint8_t *y, int ystride, const uint8_t *blimit"
 specialize vp9_loop_filter_simple_mbh mmx sse2
 vp9_loop_filter_simple_mbh_c=vp9_loop_filter_simple_horizontal_edge_c
 vp9_loop_filter_simple_mbh_mmx=vp9_loop_filter_simple_horizontal_edge_mmx
 vp9_loop_filter_simple_mbh_sse2=vp9_loop_filter_simple_horizontal_edge_sse2
 
-prototype void vp9_loop_filter_simple_bv "unsigned char *y, int ystride, const unsigned char *blimit"
+prototype void vp9_loop_filter_simple_bv "uint8_t *y, int ystride, const uint8_t *blimit"
 specialize vp9_loop_filter_simple_bv mmx sse2
 vp9_loop_filter_simple_bv_c=vp9_loop_filter_bvs_c
 vp9_loop_filter_simple_bv_mmx=vp9_loop_filter_bvs_mmx
 vp9_loop_filter_simple_bv_sse2=vp9_loop_filter_bvs_sse2
 
-prototype void vp9_loop_filter_simple_bh "unsigned char *y, int ystride, const unsigned char *blimit"
+prototype void vp9_loop_filter_simple_bh "uint8_t *y, int ystride, const uint8_t *blimit"
 specialize vp9_loop_filter_simple_bh mmx sse2
 vp9_loop_filter_simple_bh_c=vp9_loop_filter_bhs_c
 vp9_loop_filter_simple_bh_mmx=vp9_loop_filter_bhs_mmx
@@ -216,180 +218,180 @@
 #
 # post proc
 #
-prototype void vp9_mbpost_proc_down "unsigned char *dst, int pitch, int rows, int cols, int flimit"
+prototype void vp9_mbpost_proc_down "uint8_t *dst, int pitch, int rows, int cols, int flimit"
 specialize vp9_mbpost_proc_down mmx sse2
 vp9_mbpost_proc_down_sse2=vp9_mbpost_proc_down_xmm
 
-prototype void vp9_mbpost_proc_across_ip "unsigned char *src, int pitch, int rows, int cols, int flimit"
+prototype void vp9_mbpost_proc_across_ip "uint8_t *src, int pitch, int rows, int cols, int flimit"
 specialize vp9_mbpost_proc_across_ip sse2
 vp9_mbpost_proc_across_ip_sse2=vp9_mbpost_proc_across_ip_xmm
 
-prototype void vp9_post_proc_down_and_across "unsigned char *src_ptr, unsigned char *dst_ptr, int src_pixels_per_line, int dst_pixels_per_line, int rows, int cols, int flimit"
+prototype void vp9_post_proc_down_and_across "uint8_t *src_ptr, uint8_t *dst_ptr, int src_pixels_per_line, int dst_pixels_per_line, int rows, int cols, int flimit"
 specialize vp9_post_proc_down_and_across mmx sse2
 vp9_post_proc_down_and_across_sse2=vp9_post_proc_down_and_across_xmm
 
-prototype void vp9_plane_add_noise "unsigned char *Start, char *noise, char blackclamp[16], char whiteclamp[16], char bothclamp[16], unsigned int Width, unsigned int Height, int Pitch"
+prototype void vp9_plane_add_noise "uint8_t *Start, char *noise, char blackclamp[16], char whiteclamp[16], char bothclamp[16], unsigned int Width, unsigned int Height, int Pitch"
 specialize vp9_plane_add_noise mmx sse2
 vp9_plane_add_noise_sse2=vp9_plane_add_noise_wmt
 
-prototype void vp9_blend_mb_inner "unsigned char *y, unsigned char *u, unsigned char *v, int y1, int u1, int v1, int alpha, int stride"
+prototype void vp9_blend_mb_inner "uint8_t *y, uint8_t *u, uint8_t *v, int y1, int u1, int v1, int alpha, int stride"
 specialize vp9_blend_mb_inner
 
-prototype void vp9_blend_mb_outer "unsigned char *y, unsigned char *u, unsigned char *v, int y1, int u1, int v1, int alpha, int stride"
+prototype void vp9_blend_mb_outer "uint8_t *y, uint8_t *u, uint8_t *v, int y1, int u1, int v1, int alpha, int stride"
 specialize vp9_blend_mb_outer
 
-prototype void vp9_blend_b "unsigned char *y, unsigned char *u, unsigned char *v, int y1, int u1, int v1, int alpha, int stride"
+prototype void vp9_blend_b "uint8_t *y, uint8_t *u, uint8_t *v, int y1, int u1, int v1, int alpha, int stride"
 specialize vp9_blend_b
 
 #
 # sad 16x3, 3x16
 #
-prototype unsigned int vp9_sad16x3 "const unsigned char *src_ptr, int  src_stride, const unsigned char *ref_ptr, int ref_stride"
+prototype unsigned int vp9_sad16x3 "const uint8_t *src_ptr, int  src_stride, const uint8_t *ref_ptr, int ref_stride"
 specialize vp9_sad16x3 sse2
 
-prototype unsigned int vp9_sad3x16 "const unsigned char *src_ptr, int  src_stride, const unsigned char *ref_ptr, int ref_stride"
+prototype unsigned int vp9_sad3x16 "const uint8_t *src_ptr, int  src_stride, const uint8_t *ref_ptr, int ref_stride"
 specialize vp9_sad3x16 sse2
 
 #
 # Sub Pixel Filters
 #
-prototype void vp9_eighttap_predict16x16 "unsigned char *src_ptr, int  src_pixels_per_line, int  xoffset, int  yoffset, unsigned char *dst_ptr, int  dst_pitch"
+prototype void vp9_eighttap_predict16x16 "uint8_t *src_ptr, int  src_pixels_per_line, int  xoffset, int  yoffset, uint8_t *dst_ptr, int  dst_pitch"
 specialize vp9_eighttap_predict16x16
 
-prototype void vp9_eighttap_predict8x8 "unsigned char *src_ptr, int  src_pixels_per_line, int  xoffset, int  yoffset, unsigned char *dst_ptr, int  dst_pitch"
+prototype void vp9_eighttap_predict8x8 "uint8_t *src_ptr, int  src_pixels_per_line, int  xoffset, int  yoffset, uint8_t *dst_ptr, int  dst_pitch"
 specialize vp9_eighttap_predict8x8
 
-prototype void vp9_eighttap_predict_avg16x16 "unsigned char *src_ptr, int  src_pixels_per_line, int  xoffset, int  yoffset, unsigned char *dst_ptr, int  dst_pitch"
+prototype void vp9_eighttap_predict_avg16x16 "uint8_t *src_ptr, int  src_pixels_per_line, int  xoffset, int  yoffset, uint8_t *dst_ptr, int  dst_pitch"
 specialize vp9_eighttap_predict_avg16x16
 
-prototype void vp9_eighttap_predict_avg8x8 "unsigned char *src_ptr, int  src_pixels_per_line, int  xoffset, int  yoffset, unsigned char *dst_ptr, int  dst_pitch"
+prototype void vp9_eighttap_predict_avg8x8 "uint8_t *src_ptr, int  src_pixels_per_line, int  xoffset, int  yoffset, uint8_t *dst_ptr, int  dst_pitch"
 specialize vp9_eighttap_predict_avg8x8
 
-prototype void vp9_eighttap_predict_avg4x4 "unsigned char *src_ptr, int  src_pixels_per_line, int  xoffset, int  yoffset, unsigned char *dst_ptr, int  dst_pitch"
+prototype void vp9_eighttap_predict_avg4x4 "uint8_t *src_ptr, int  src_pixels_per_line, int  xoffset, int  yoffset, uint8_t *dst_ptr, int  dst_pitch"
 specialize vp9_eighttap_predict_avg4x4
 
-prototype void vp9_eighttap_predict8x4 "unsigned char *src_ptr, int  src_pixels_per_line, int  xoffset, int  yoffset, unsigned char *dst_ptr, int  dst_pitch"
+prototype void vp9_eighttap_predict8x4 "uint8_t *src_ptr, int  src_pixels_per_line, int  xoffset, int  yoffset, uint8_t *dst_ptr, int  dst_pitch"
 specialize vp9_eighttap_predict8x4
 
-prototype void vp9_eighttap_predict "unsigned char *src_ptr, int  src_pixels_per_line, int  xoffset, int  yoffset, unsigned char *dst_ptr, int  dst_pitch"
+prototype void vp9_eighttap_predict "uint8_t *src_ptr, int  src_pixels_per_line, int  xoffset, int  yoffset, uint8_t *dst_ptr, int  dst_pitch"
 specialize vp9_eighttap_predict
 
-prototype void vp9_eighttap_predict16x16_sharp "unsigned char *src_ptr, int  src_pixels_per_line, int  xoffset, int  yoffset, unsigned char *dst_ptr, int  dst_pitch"
+prototype void vp9_eighttap_predict16x16_sharp "uint8_t *src_ptr, int  src_pixels_per_line, int  xoffset, int  yoffset, uint8_t *dst_ptr, int  dst_pitch"
 specialize vp9_eighttap_predict16x16_sharp
 
-prototype void vp9_eighttap_predict8x8_sharp "unsigned char *src_ptr, int  src_pixels_per_line, int  xoffset, int  yoffset, unsigned char *dst_ptr, int  dst_pitch"
+prototype void vp9_eighttap_predict8x8_sharp "uint8_t *src_ptr, int  src_pixels_per_line, int  xoffset, int  yoffset, uint8_t *dst_ptr, int  dst_pitch"
 specialize vp9_eighttap_predict8x8_sharp
 
-prototype void vp9_eighttap_predict_avg16x16_sharp "unsigned char *src_ptr, int  src_pixels_per_line, int  xoffset, int  yoffset, unsigned char *dst_ptr, int  dst_pitch"
+prototype void vp9_eighttap_predict_avg16x16_sharp "uint8_t *src_ptr, int  src_pixels_per_line, int  xoffset, int  yoffset, uint8_t *dst_ptr, int  dst_pitch"
 specialize vp9_eighttap_predict_avg16x16_sharp
 
-prototype void vp9_eighttap_predict_avg8x8_sharp "unsigned char *src_ptr, int  src_pixels_per_line, int  xoffset, int  yoffset, unsigned char *dst_ptr, int  dst_pitch"
+prototype void vp9_eighttap_predict_avg8x8_sharp "uint8_t *src_ptr, int  src_pixels_per_line, int  xoffset, int  yoffset, uint8_t *dst_ptr, int  dst_pitch"
 specialize vp9_eighttap_predict_avg8x8_sharp
 
-prototype void vp9_eighttap_predict_avg4x4_sharp "unsigned char *src_ptr, int  src_pixels_per_line, int  xoffset, int  yoffset, unsigned char *dst_ptr, int  dst_pitch"
+prototype void vp9_eighttap_predict_avg4x4_sharp "uint8_t *src_ptr, int  src_pixels_per_line, int  xoffset, int  yoffset, uint8_t *dst_ptr, int  dst_pitch"
 specialize vp9_eighttap_predict_avg4x4_sharp
 
-prototype void vp9_eighttap_predict8x4_sharp "unsigned char *src_ptr, int  src_pixels_per_line, int  xoffset, int  yoffset, unsigned char *dst_ptr, int  dst_pitch"
+prototype void vp9_eighttap_predict8x4_sharp "uint8_t *src_ptr, int  src_pixels_per_line, int  xoffset, int  yoffset, uint8_t *dst_ptr, int  dst_pitch"
 specialize vp9_eighttap_predict8x4_sharp
 
-prototype void vp9_eighttap_predict_sharp "unsigned char *src_ptr, int  src_pixels_per_line, int  xoffset, int  yoffset, unsigned char *dst_ptr, int  dst_pitch"
+prototype void vp9_eighttap_predict_sharp "uint8_t *src_ptr, int  src_pixels_per_line, int  xoffset, int  yoffset, uint8_t *dst_ptr, int  dst_pitch"
 specialize vp9_eighttap_predict_sharp
 
-prototype void vp9_sixtap_predict16x16 "unsigned char *src_ptr, int  src_pixels_per_line, int  xoffset, int  yoffset, unsigned char *dst_ptr, int  dst_pitch"
+prototype void vp9_sixtap_predict16x16 "uint8_t *src_ptr, int  src_pixels_per_line, int  xoffset, int  yoffset, uint8_t *dst_ptr, int  dst_pitch"
 specialize vp9_sixtap_predict16x16
 
-prototype void vp9_sixtap_predict8x8 "unsigned char *src_ptr, int  src_pixels_per_line, int  xoffset, int  yoffset, unsigned char *dst_ptr, int  dst_pitch"
+prototype void vp9_sixtap_predict8x8 "uint8_t *src_ptr, int  src_pixels_per_line, int  xoffset, int  yoffset, uint8_t *dst_ptr, int  dst_pitch"
 specialize vp9_sixtap_predict8x8
 
-prototype void vp9_sixtap_predict_avg16x16 "unsigned char *src_ptr, int  src_pixels_per_line, int  xoffset, int  yoffset, unsigned char *dst_ptr, int  dst_pitch"
+prototype void vp9_sixtap_predict_avg16x16 "uint8_t *src_ptr, int  src_pixels_per_line, int  xoffset, int  yoffset, uint8_t *dst_ptr, int  dst_pitch"
 specialize vp9_sixtap_predict_avg16x16
 
-prototype void vp9_sixtap_predict_avg8x8 "unsigned char *src_ptr, int  src_pixels_per_line, int  xoffset, int  yoffset, unsigned char *dst_ptr, int  dst_pitch"
+prototype void vp9_sixtap_predict_avg8x8 "uint8_t *src_ptr, int  src_pixels_per_line, int  xoffset, int  yoffset, uint8_t *dst_ptr, int  dst_pitch"
 specialize vp9_sixtap_predict_avg8x8
 
-prototype void vp9_sixtap_predict8x4 "unsigned char *src_ptr, int  src_pixels_per_line, int  xoffset, int  yoffset, unsigned char *dst_ptr, int  dst_pitch"
+prototype void vp9_sixtap_predict8x4 "uint8_t *src_ptr, int  src_pixels_per_line, int  xoffset, int  yoffset, uint8_t *dst_ptr, int  dst_pitch"
 specialize vp9_sixtap_predict8x4
 
-prototype void vp9_sixtap_predict "unsigned char *src_ptr, int  src_pixels_per_line, int  xoffset, int  yoffset, unsigned char *dst_ptr, int  dst_pitch"
+prototype void vp9_sixtap_predict "uint8_t *src_ptr, int  src_pixels_per_line, int  xoffset, int  yoffset, uint8_t *dst_ptr, int  dst_pitch"
 specialize vp9_sixtap_predict
 
-prototype void vp9_sixtap_predict_avg "unsigned char *src_ptr, int  src_pixels_per_line, int  xoffset, int  yoffset, unsigned char *dst_ptr, int  dst_pitch"
+prototype void vp9_sixtap_predict_avg "uint8_t *src_ptr, int  src_pixels_per_line, int  xoffset, int  yoffset, uint8_t *dst_ptr, int  dst_pitch"
 specialize vp9_sixtap_predict_avg
 
-prototype void vp9_bilinear_predict16x16 "unsigned char *src_ptr, int  src_pixels_per_line, int  xoffset, int  yoffset, unsigned char *dst_ptr, int  dst_pitch"
+prototype void vp9_bilinear_predict16x16 "uint8_t *src_ptr, int  src_pixels_per_line, int  xoffset, int  yoffset, uint8_t *dst_ptr, int  dst_pitch"
 specialize vp9_bilinear_predict16x16 mmx sse2
 
-prototype void vp9_bilinear_predict8x8 "unsigned char *src_ptr, int  src_pixels_per_line, int  xoffset, int  yoffset, unsigned char *dst_ptr, int  dst_pitch"
+prototype void vp9_bilinear_predict8x8 "uint8_t *src_ptr, int  src_pixels_per_line, int  xoffset, int  yoffset, uint8_t *dst_ptr, int  dst_pitch"
 specialize vp9_bilinear_predict8x8 mmx sse2
 
-prototype void vp9_bilinear_predict_avg16x16 "unsigned char *src_ptr, int  src_pixels_per_line, int  xoffset, int  yoffset, unsigned char *dst_ptr, int  dst_pitch"
+prototype void vp9_bilinear_predict_avg16x16 "uint8_t *src_ptr, int  src_pixels_per_line, int  xoffset, int  yoffset, uint8_t *dst_ptr, int  dst_pitch"
 specialize vp9_bilinear_predict_avg16x16
 
-prototype void vp9_bilinear_predict_avg8x8 "unsigned char *src_ptr, int  src_pixels_per_line, int  xoffset, int  yoffset, unsigned char *dst_ptr, int  dst_pitch"
+prototype void vp9_bilinear_predict_avg8x8 "uint8_t *src_ptr, int  src_pixels_per_line, int  xoffset, int  yoffset, uint8_t *dst_ptr, int  dst_pitch"
 specialize vp9_bilinear_predict_avg8x8
 
-prototype void vp9_bilinear_predict8x4 "unsigned char *src_ptr, int  src_pixels_per_line, int  xoffset, int  yoffset, unsigned char *dst_ptr, int  dst_pitch"
+prototype void vp9_bilinear_predict8x4 "uint8_t *src_ptr, int  src_pixels_per_line, int  xoffset, int  yoffset, uint8_t *dst_ptr, int  dst_pitch"
 specialize vp9_bilinear_predict8x4 mmx
 
-prototype void vp9_bilinear_predict4x4 "unsigned char *src_ptr, int  src_pixels_per_line, int  xoffset, int  yoffset, unsigned char *dst_ptr, int  dst_pitch"
+prototype void vp9_bilinear_predict4x4 "uint8_t *src_ptr, int  src_pixels_per_line, int  xoffset, int  yoffset, uint8_t *dst_ptr, int  dst_pitch"
 specialize vp9_bilinear_predict4x4 mmx
 
-prototype void vp9_bilinear_predict_avg4x4 "unsigned char *src_ptr, int  src_pixels_per_line, int  xoffset, int  yoffset, unsigned char *dst_ptr, int  dst_pitch"
+prototype void vp9_bilinear_predict_avg4x4 "uint8_t *src_ptr, int  src_pixels_per_line, int  xoffset, int  yoffset, uint8_t *dst_ptr, int  dst_pitch"
 specialize vp9_bilinear_predict_avg4x4
 
 #
 # dct
 #
-prototype void vp9_short_idct4x4llm_1 "short *input, short *output, int pitch"
+prototype void vp9_short_idct4x4llm_1 "int16_t *input, int16_t *output, int pitch"
 specialize vp9_short_idct4x4llm_1 mmx
 
-prototype void vp9_short_idct4x4llm "short *input, short *output, int pitch"
+prototype void vp9_short_idct4x4llm "int16_t *input, int16_t *output, int pitch"
 specialize vp9_short_idct4x4llm mmx
 
-prototype void vp9_short_idct8x8 "short *input, short *output, int pitch"
+prototype void vp9_short_idct8x8 "int16_t *input, int16_t *output, int pitch"
 specialize vp9_short_idct8x8
 
-prototype void vp9_short_idct10_8x8 "short *input, short *output, int pitch"
+prototype void vp9_short_idct10_8x8 "int16_t *input, int16_t *output, int pitch"
 specialize vp9_short_idct10_8x8
 
-prototype void vp9_short_ihaar2x2 "short *input, short *output, int pitch"
+prototype void vp9_short_ihaar2x2 "int16_t *input, int16_t *output, int pitch"
 specialize vp9_short_ihaar2x2
 
-prototype void vp9_short_idct16x16 "short *input, short *output, int pitch"
+prototype void vp9_short_idct16x16 "int16_t *input, int16_t *output, int pitch"
 specialize vp9_short_idct16x16
 
-prototype void vp9_short_idct10_16x16 "short *input, short *output, int pitch"
+prototype void vp9_short_idct10_16x16 "int16_t *input, int16_t *output, int pitch"
 specialize vp9_short_idct10_16x16
 
-prototype void vp9_short_idct32x32 "short *input, short *output, int pitch"
+prototype void vp9_short_idct32x32 "int16_t *input, int16_t *output, int pitch"
 specialize vp9_short_idct32x32
 
-prototype void vp9_ihtllm "const short *input, short *output, int pitch, int tx_type, int tx_dim"
+prototype void vp9_ihtllm "const int16_t *input, int16_t *output, int pitch, int tx_type, int tx_dim"
 specialize vp9_ihtllm
 
 #
 # 2nd order
 #
-prototype void vp9_short_inv_walsh4x4_1 "short *in, short *out"
+prototype void vp9_short_inv_walsh4x4_1 "int16_t *in, int16_t *out"
 specialize vp9_short_inv_walsh4x4_1
 
-prototype void vp9_short_inv_walsh4x4 "short *in, short *out"
+prototype void vp9_short_inv_walsh4x4 "int16_t *in, int16_t *out"
 specialize vp9_short_inv_walsh4x4_
 
 
 # dct and add
-prototype void vp9_dc_only_idct_add_8x8 "short input_dc, unsigned char *pred_ptr, unsigned char *dst_ptr, int pitch, int stride"
+prototype void vp9_dc_only_idct_add_8x8 "int input_dc, uint8_t *pred_ptr, uint8_t *dst_ptr, int pitch, int stride"
 specialize vp9_dc_only_idct_add_8x8
 
-prototype void vp9_dc_only_idct_add "short input_dc, unsigned char *pred_ptr, unsigned char *dst_ptr, int pitch, int stride"
+prototype void vp9_dc_only_idct_add "int input_dc, uint8_t *pred_ptr, uint8_t *dst_ptr, int pitch, int stride"
 specialize vp9_dc_only_idct_add
 
 if [ "$CONFIG_LOSSLESS" = "yes" ]; then
-prototype void vp9_short_inv_walsh4x4_1_x8 "short *input, short *output, int pitch"
-prototype void vp9_short_inv_walsh4x4_x8 "short *input, short *output, int pitch"
-prototype void vp9_dc_only_inv_walsh_add "short input_dc, unsigned char *pred_ptr, unsigned char *dst_ptr, int pitch, int stride"
-prototype void vp9_short_inv_walsh4x4_1_lossless "short *in, short *out"
-prototype void vp9_short_inv_walsh4x4_lossless "short *in, short *out"
+prototype void vp9_short_inv_walsh4x4_1_x8 "int16_t *input, int16_t *output, int pitch"
+prototype void vp9_short_inv_walsh4x4_x8 "int16_t *input, int16_t *output, int pitch"
+prototype void vp9_dc_only_inv_walsh_add "int input_dc, uint8_t *pred_ptr, uint8_t *dst_ptr, int pitch, int stride"
+prototype void vp9_short_inv_walsh4x4_1_lossless "int16_t *in, int16_t *out"
+prototype void vp9_short_inv_walsh4x4_lossless "int16_t *in, int16_t *out"
 fi
 
 
@@ -396,10 +398,10 @@
 
 if [ "$CONFIG_SUPERBLOCKS" = "yes" ]; then
 
-prototype unsigned int vp9_sad32x3 "const unsigned char *src_ptr, int  src_stride, const unsigned char *ref_ptr, int ref_stride, int max_sad"
+prototype unsigned int vp9_sad32x3 "const uint8_t *src_ptr, int  src_stride, const uint8_t *ref_ptr, int ref_stride, int max_sad"
 specialize vp9_sad32x3
 
-prototype unsigned int vp9_sad3x32 "const unsigned char *src_ptr, int  src_stride, const unsigned char *ref_ptr, int ref_stride, int max_sad"
+prototype unsigned int vp9_sad3x32 "const uint8_t *src_ptr, int  src_stride, const uint8_t *ref_ptr, int ref_stride, int max_sad"
 specialize vp9_sad3x32
 
 fi
@@ -413,154 +415,154 @@
 # variance
 [ $arch = "x86_64" ] && mmx_x86_64=mmx && sse2_x86_64=sse2
 
-prototype unsigned int vp9_variance32x32 "const unsigned char *src_ptr, int source_stride, const unsigned char *ref_ptr, int ref_stride, unsigned int *sse"
+prototype unsigned int vp9_variance32x32 "const uint8_t *src_ptr, int source_stride, const uint8_t *ref_ptr, int ref_stride, unsigned int *sse"
 specialize vp9_variance32x32
 
-prototype unsigned int vp9_variance16x16 "const unsigned char *src_ptr, int source_stride, const unsigned char *ref_ptr, int ref_stride, unsigned int *sse"
+prototype unsigned int vp9_variance16x16 "const uint8_t *src_ptr, int source_stride, const uint8_t *ref_ptr, int ref_stride, unsigned int *sse"
 specialize vp9_variance16x16 mmx sse2
 vp9_variance16x16_sse2=vp9_variance16x16_wmt
 vp9_variance16x16_mmx=vp9_variance16x16_mmx
 
-prototype unsigned int vp9_variance16x8 "const unsigned char *src_ptr, int source_stride, const unsigned char *ref_ptr, int ref_stride, unsigned int *sse"
+prototype unsigned int vp9_variance16x8 "const uint8_t *src_ptr, int source_stride, const uint8_t *ref_ptr, int ref_stride, unsigned int *sse"
 specialize vp9_variance16x8 mmx sse2
 vp9_variance16x8_sse2=vp9_variance16x8_wmt
 vp9_variance16x8_mmx=vp9_variance16x8_mmx
 
-prototype unsigned int vp9_variance8x16 "const unsigned char *src_ptr, int source_stride, const unsigned char *ref_ptr, int ref_stride, unsigned int *sse"
+prototype unsigned int vp9_variance8x16 "const uint8_t *src_ptr, int source_stride, const uint8_t *ref_ptr, int ref_stride, unsigned int *sse"
 specialize vp9_variance8x16 mmx sse2
 vp9_variance8x16_sse2=vp9_variance8x16_wmt
 vp9_variance8x16_mmx=vp9_variance8x16_mmx
 
-prototype unsigned int vp9_variance8x8 "const unsigned char *src_ptr, int source_stride, const unsigned char *ref_ptr, int ref_stride, unsigned int *sse"
+prototype unsigned int vp9_variance8x8 "const uint8_t *src_ptr, int source_stride, const uint8_t *ref_ptr, int ref_stride, unsigned int *sse"
 specialize vp9_variance8x8 mmx sse2
 vp9_variance8x8_sse2=vp9_variance8x8_wmt
 vp9_variance8x8_mmx=vp9_variance8x8_mmx
 
-prototype unsigned int vp9_variance4x4 "const unsigned char *src_ptr, int source_stride, const unsigned char *ref_ptr, int ref_stride, unsigned int *sse"
+prototype unsigned int vp9_variance4x4 "const uint8_t *src_ptr, int source_stride, const uint8_t *ref_ptr, int ref_stride, unsigned int *sse"
 specialize vp9_variance4x4 mmx sse2
 vp9_variance4x4_sse2=vp9_variance4x4_wmt
 vp9_variance4x4_mmx=vp9_variance4x4_mmx
 
-prototype unsigned int vp9_sub_pixel_variance32x32 "const unsigned char *src_ptr, int source_stride, int xoffset, int  yoffset, const unsigned char *ref_ptr, int Refstride, unsigned int *sse"
+prototype unsigned int vp9_sub_pixel_variance32x32 "const uint8_t *src_ptr, int source_stride, int xoffset, int  yoffset, const uint8_t *ref_ptr, int Refstride, unsigned int *sse"
 specialize vp9_sub_pixel_variance32x32
 
-prototype unsigned int vp9_sub_pixel_variance16x16 "const unsigned char *src_ptr, int source_stride, int xoffset, int  yoffset, const unsigned char *ref_ptr, int Refstride, unsigned int *sse"
+prototype unsigned int vp9_sub_pixel_variance16x16 "const uint8_t *src_ptr, int source_stride, int xoffset, int  yoffset, const uint8_t *ref_ptr, int Refstride, unsigned int *sse"
 specialize vp9_sub_pixel_variance16x16 sse2 mmx ssse3
 vp9_sub_pixel_variance16x16_sse2=vp9_sub_pixel_variance16x16_wmt
 
-prototype unsigned int vp9_sub_pixel_variance8x16 "const unsigned char *src_ptr, int source_stride, int xoffset, int  yoffset, const unsigned char *ref_ptr, int Refstride, unsigned int *sse"
+prototype unsigned int vp9_sub_pixel_variance8x16 "const uint8_t *src_ptr, int source_stride, int xoffset, int  yoffset, const uint8_t *ref_ptr, int Refstride, unsigned int *sse"
 specialize vp9_sub_pixel_variance8x16 sse2 mmx
 vp9_sub_pixel_variance8x16_sse2=vp9_sub_pixel_variance8x16_wmt
 
-prototype unsigned int vp9_sub_pixel_variance16x8 "const unsigned char *src_ptr, int source_stride, int xoffset, int  yoffset, const unsigned char *ref_ptr, int Refstride, unsigned int *sse"
+prototype unsigned int vp9_sub_pixel_variance16x8 "const uint8_t *src_ptr, int source_stride, int xoffset, int  yoffset, const uint8_t *ref_ptr, int Refstride, unsigned int *sse"
 specialize vp9_sub_pixel_variance16x8 sse2 mmx ssse3
 vp9_sub_pixel_variance16x8_sse2=vp9_sub_pixel_variance16x8_ssse3;
 vp9_sub_pixel_variance16x8_sse2=vp9_sub_pixel_variance16x8_wmt
 
-prototype unsigned int vp9_sub_pixel_variance8x8 "const unsigned char *src_ptr, int source_stride, int xoffset, int  yoffset, const unsigned char *ref_ptr, int Refstride, unsigned int *sse"
+prototype unsigned int vp9_sub_pixel_variance8x8 "const uint8_t *src_ptr, int source_stride, int xoffset, int  yoffset, const uint8_t *ref_ptr, int Refstride, unsigned int *sse"
 specialize vp9_sub_pixel_variance8x8 sse2 mmx
 vp9_sub_pixel_variance8x8_sse2=vp9_sub_pixel_variance8x8_wmt
 
-prototype unsigned int vp9_sub_pixel_variance4x4 "const unsigned char *src_ptr, int source_stride, int xoffset, int  yoffset, const unsigned char *ref_ptr, int Refstride, unsigned int *sse"
+prototype unsigned int vp9_sub_pixel_variance4x4 "const uint8_t *src_ptr, int source_stride, int xoffset, int  yoffset, const uint8_t *ref_ptr, int Refstride, unsigned int *sse"
 specialize vp9_sub_pixel_variance4x4 sse2 mmx
 vp9_sub_pixel_variance4x4_sse2=vp9_sub_pixel_variance4x4_wmt
 
-prototype unsigned int vp9_sad32x32 "const unsigned char *src_ptr, int source_stride, const unsigned char *ref_ptr, int  ref_stride, unsigned int max_sad"
+prototype unsigned int vp9_sad32x32 "const uint8_t *src_ptr, int source_stride, const uint8_t *ref_ptr, int  ref_stride, unsigned int max_sad"
 specialize vp9_sad32x32
 
-prototype unsigned int vp9_sad16x16 "const unsigned char *src_ptr, int source_stride, const unsigned char *ref_ptr, int  ref_stride, unsigned int max_sad"
+prototype unsigned int vp9_sad16x16 "const uint8_t *src_ptr, int source_stride, const uint8_t *ref_ptr, int  ref_stride, unsigned int max_sad"
 specialize vp9_sad16x16 mmx sse2 sse3
 vp9_sad16x16_sse2=vp9_sad16x16_wmt
 
-prototype unsigned int vp9_sad16x8 "const unsigned char *src_ptr, int source_stride, const unsigned char *ref_ptr, int  ref_stride, unsigned int max_sad"
+prototype unsigned int vp9_sad16x8 "const uint8_t *src_ptr, int source_stride, const uint8_t *ref_ptr, int  ref_stride, unsigned int max_sad"
 specialize vp9_sad16x8 mmx sse2
 vp9_sad16x8_sse2=vp9_sad16x8_wmt
 
-prototype unsigned int vp9_sad8x16 "const unsigned char *src_ptr, int source_stride, const unsigned char *ref_ptr, int  ref_stride, unsigned int max_sad"
+prototype unsigned int vp9_sad8x16 "const uint8_t *src_ptr, int source_stride, const uint8_t *ref_ptr, int  ref_stride, unsigned int max_sad"
 specialize vp9_sad8x16 mmx sse2
 vp9_sad8x16_sse2=vp9_sad8x16_wmt
 
-prototype unsigned int vp9_sad8x8 "const unsigned char *src_ptr, int source_stride, const unsigned char *ref_ptr, int  ref_stride, unsigned int max_sad"
+prototype unsigned int vp9_sad8x8 "const uint8_t *src_ptr, int source_stride, const uint8_t *ref_ptr, int  ref_stride, unsigned int max_sad"
 specialize vp9_sad8x8 mmx sse2
 vp9_sad8x8_sse2=vp9_sad8x8_wmt
 
-prototype unsigned int vp9_sad4x4 "const unsigned char *src_ptr, int source_stride, const unsigned char *ref_ptr, int  ref_stride, unsigned int max_sad"
+prototype unsigned int vp9_sad4x4 "const uint8_t *src_ptr, int source_stride, const uint8_t *ref_ptr, int  ref_stride, unsigned int max_sad"
 specialize vp9_sad4x4 mmx sse2
 vp9_sad4x4_sse2=vp9_sad4x4_wmt
 
-prototype unsigned int vp9_variance_halfpixvar16x16_h "const unsigned char *src_ptr, int source_stride, const unsigned char *ref_ptr, int ref_stride, unsigned int *sse"
+prototype unsigned int vp9_variance_halfpixvar16x16_h "const uint8_t *src_ptr, int source_stride, const uint8_t *ref_ptr, int ref_stride, unsigned int *sse"
 specialize vp9_variance_halfpixvar16x16_h mmx sse2
 vp9_variance_halfpixvar16x16_h_sse2=vp9_variance_halfpixvar16x16_h_wmt
 
-prototype unsigned int vp9_variance_halfpixvar16x16_v "const unsigned char *src_ptr, int source_stride, const unsigned char *ref_ptr, int ref_stride, unsigned int *sse"
+prototype unsigned int vp9_variance_halfpixvar16x16_v "const uint8_t *src_ptr, int source_stride, const uint8_t *ref_ptr, int ref_stride, unsigned int *sse"
 specialize vp9_variance_halfpixvar16x16_v mmx sse2
 vp9_variance_halfpixvar16x16_v_sse2=vp9_variance_halfpixvar16x16_v_wmt
 
-prototype unsigned int vp9_variance_halfpixvar16x16_hv "const unsigned char *src_ptr, int source_stride, const unsigned char *ref_ptr, int ref_stride, unsigned int *sse"
+prototype unsigned int vp9_variance_halfpixvar16x16_hv "const uint8_t *src_ptr, int source_stride, const uint8_t *ref_ptr, int ref_stride, unsigned int *sse"
 specialize vp9_variance_halfpixvar16x16_hv mmx sse2
 vp9_variance_halfpixvar16x16_hv_sse2=vp9_variance_halfpixvar16x16_hv_wmt
 
-prototype unsigned int vp9_variance_halfpixvar32x32_h "const unsigned char *src_ptr, int source_stride, const unsigned char *ref_ptr, int ref_stride, unsigned int *sse"
+prototype unsigned int vp9_variance_halfpixvar32x32_h "const uint8_t *src_ptr, int source_stride, const uint8_t *ref_ptr, int ref_stride, unsigned int *sse"
 specialize vp9_variance_halfpixvar32x32_h
 
-prototype unsigned int vp9_variance_halfpixvar32x32_v "const unsigned char *src_ptr, int source_stride, const unsigned char *ref_ptr, int ref_stride, unsigned int *sse"
+prototype unsigned int vp9_variance_halfpixvar32x32_v "const uint8_t *src_ptr, int source_stride, const uint8_t *ref_ptr, int ref_stride, unsigned int *sse"
 specialize vp9_variance_halfpixvar32x32_v
 
-prototype unsigned int vp9_variance_halfpixvar32x32_hv "const unsigned char *src_ptr, int source_stride, const unsigned char *ref_ptr, int ref_stride, unsigned int *sse"
+prototype unsigned int vp9_variance_halfpixvar32x32_hv "const uint8_t *src_ptr, int source_stride, const uint8_t *ref_ptr, int ref_stride, unsigned int *sse"
 specialize vp9_variance_halfpixvar32x32_hv
 
-prototype void vp9_sad32x32x3 "const unsigned char *src_ptr, int source_stride, const unsigned char *ref_ptr, int  ref_stride, unsigned int *sad_array"
+prototype void vp9_sad32x32x3 "const uint8_t *src_ptr, int source_stride, const uint8_t *ref_ptr, int  ref_stride, unsigned int *sad_array"
 specialize vp9_sad32x32x3
 
-prototype void vp9_sad16x16x3 "const unsigned char *src_ptr, int source_stride, const unsigned char *ref_ptr, int  ref_stride, unsigned int *sad_array"
+prototype void vp9_sad16x16x3 "const uint8_t *src_ptr, int source_stride, const uint8_t *ref_ptr, int  ref_stride, unsigned int *sad_array"
 specialize vp9_sad16x16x3 sse3 ssse3
 
-prototype void vp9_sad16x8x3 "const unsigned char *src_ptr, int source_stride, const unsigned char *ref_ptr, int  ref_stride, unsigned int *sad_array"
+prototype void vp9_sad16x8x3 "const uint8_t *src_ptr, int source_stride, const uint8_t *ref_ptr, int  ref_stride, unsigned int *sad_array"
 specialize vp9_sad16x8x3 sse3 ssse3
 
-prototype void vp9_sad8x16x3 "const unsigned char *src_ptr, int source_stride, const unsigned char *ref_ptr, int  ref_stride, unsigned int *sad_array"
+prototype void vp9_sad8x16x3 "const uint8_t *src_ptr, int source_stride, const uint8_t *ref_ptr, int  ref_stride, unsigned int *sad_array"
 specialize vp9_sad8x16x3 sse3
 
-prototype void vp9_sad8x8x3 "const unsigned char *src_ptr, int source_stride, const unsigned char *ref_ptr, int  ref_stride, unsigned int *sad_array"
+prototype void vp9_sad8x8x3 "const uint8_t *src_ptr, int source_stride, const uint8_t *ref_ptr, int  ref_stride, unsigned int *sad_array"
 specialize vp9_sad8x8x3 sse3
 
-prototype void vp9_sad4x4x3 "const unsigned char *src_ptr, int source_stride, const unsigned char *ref_ptr, int  ref_stride, unsigned int *sad_array"
+prototype void vp9_sad4x4x3 "const uint8_t *src_ptr, int source_stride, const uint8_t *ref_ptr, int  ref_stride, unsigned int *sad_array"
 specialize vp9_sad4x4x3 sse3
 
-prototype void vp9_sad32x32x8 "const unsigned char *src_ptr, int  src_stride, const unsigned char *ref_ptr, int  ref_stride, unsigned short *sad_array"
+prototype void vp9_sad32x32x8 "const uint8_t *src_ptr, int  src_stride, const uint8_t *ref_ptr, int  ref_stride, uint16_t *sad_array"
 specialize vp9_sad32x32x8
 
-prototype void vp9_sad16x16x8 "const unsigned char *src_ptr, int  src_stride, const unsigned char *ref_ptr, int  ref_stride, unsigned short *sad_array"
+prototype void vp9_sad16x16x8 "const uint8_t *src_ptr, int  src_stride, const uint8_t *ref_ptr, int  ref_stride, uint16_t *sad_array"
 specialize vp9_sad16x16x8 sse4
 
-prototype void vp9_sad16x8x8 "const unsigned char *src_ptr, int  src_stride, const unsigned char *ref_ptr, int  ref_stride, unsigned short *sad_array"
+prototype void vp9_sad16x8x8 "const uint8_t *src_ptr, int  src_stride, const uint8_t *ref_ptr, int  ref_stride, uint16_t *sad_array"
 specialize vp9_sad16x8x8 sse4
 
-prototype void vp9_sad8x16x8 "const unsigned char *src_ptr, int  src_stride, const unsigned char *ref_ptr, int  ref_stride, unsigned short *sad_array"
+prototype void vp9_sad8x16x8 "const uint8_t *src_ptr, int  src_stride, const uint8_t *ref_ptr, int  ref_stride, uint16_t *sad_array"
 specialize vp9_sad8x16x8 sse4
 
-prototype void vp9_sad8x8x8 "const unsigned char *src_ptr, int  src_stride, const unsigned char *ref_ptr, int  ref_stride, unsigned short *sad_array"
+prototype void vp9_sad8x8x8 "const uint8_t *src_ptr, int  src_stride, const uint8_t *ref_ptr, int  ref_stride, uint16_t *sad_array"
 specialize vp9_sad8x8x8 sse4
 
-prototype void vp9_sad4x4x8 "const unsigned char *src_ptr, int  src_stride, const unsigned char *ref_ptr, int  ref_stride, unsigned short *sad_array"
+prototype void vp9_sad4x4x8 "const uint8_t *src_ptr, int  src_stride, const uint8_t *ref_ptr, int  ref_stride, uint16_t *sad_array"
 specialize vp9_sad4x4x8 sse4
 
-prototype void vp9_sad32x32x4d "const unsigned char *src_ptr, int  src_stride, const unsigned char **ref_ptr, int  ref_stride, unsigned int *sad_array"
+prototype void vp9_sad32x32x4d "const uint8_t *src_ptr, int  src_stride, const uint8_t **ref_ptr, int  ref_stride, unsigned int *sad_array"
 specialize vp9_sad32x32x4d
 
-prototype void vp9_sad16x16x4d "const unsigned char *src_ptr, int  src_stride, const unsigned char **ref_ptr, int  ref_stride, unsigned int *sad_array"
+prototype void vp9_sad16x16x4d "const uint8_t *src_ptr, int  src_stride, const uint8_t **ref_ptr, int  ref_stride, unsigned int *sad_array"
 specialize vp9_sad16x16x4d sse3
 
-prototype void vp9_sad16x8x4d "const unsigned char *src_ptr, int  src_stride, const unsigned char **ref_ptr, int  ref_stride, unsigned int *sad_array"
+prototype void vp9_sad16x8x4d "const uint8_t *src_ptr, int  src_stride, const uint8_t **ref_ptr, int  ref_stride, unsigned int *sad_array"
 specialize vp9_sad16x8x4d sse3
 
-prototype void vp9_sad8x16x4d "const unsigned char *src_ptr, int  src_stride, const unsigned char **ref_ptr, int  ref_stride, unsigned int *sad_array"
+prototype void vp9_sad8x16x4d "const uint8_t *src_ptr, int  src_stride, const uint8_t **ref_ptr, int  ref_stride, unsigned int *sad_array"
 specialize vp9_sad8x16x4d sse3
 
-prototype void vp9_sad8x8x4d "const unsigned char *src_ptr, int  src_stride, const unsigned char **ref_ptr, int  ref_stride, unsigned int *sad_array"
+prototype void vp9_sad8x8x4d "const uint8_t *src_ptr, int  src_stride, const uint8_t **ref_ptr, int  ref_stride, unsigned int *sad_array"
 specialize vp9_sad8x8x4d sse3
 
-prototype void vp9_sad4x4x4d "const unsigned char *src_ptr, int  src_stride, const unsigned char **ref_ptr, int  ref_stride, unsigned int *sad_array"
+prototype void vp9_sad4x4x4d "const uint8_t *src_ptr, int  src_stride, const uint8_t **ref_ptr, int  ref_stride, unsigned int *sad_array"
 specialize vp9_sad4x4x4d sse3
 
 #
@@ -568,23 +570,23 @@
 #
 case $arch in
     x86*)
-    prototype void vp9_copy32xn "const unsigned char *src_ptr, int source_stride, const unsigned char *ref_ptr, int ref_stride, int n"
+    prototype void vp9_copy32xn "const uint8_t *src_ptr, int source_stride, const uint8_t *ref_ptr, int ref_stride, int n"
     specialize vp9_copy32xn sse2 sse3
     ;;
 esac
 
-prototype unsigned int vp9_sub_pixel_mse16x16 "const unsigned char  *src_ptr, int  src_pixels_per_line, int  xoffset, int  yoffset, const unsigned char *dst_ptr, int dst_pixels_per_line, unsigned int *sse"
+prototype unsigned int vp9_sub_pixel_mse16x16 "const uint8_t *src_ptr, int  src_pixels_per_line, int  xoffset, int  yoffset, const uint8_t *dst_ptr, int dst_pixels_per_line, unsigned int *sse"
 specialize vp9_sub_pixel_mse16x16 sse2 mmx
 vp9_sub_pixel_mse16x16_sse2=vp9_sub_pixel_mse16x16_wmt
 
-prototype unsigned int vp9_mse16x16 "const unsigned char *src_ptr, int  source_stride, const unsigned char *ref_ptr, int  recon_stride, unsigned int *sse"
+prototype unsigned int vp9_mse16x16 "const uint8_t *src_ptr, int  source_stride, const uint8_t *ref_ptr, int  recon_stride, unsigned int *sse"
 specialize vp9_mse16x16 mmx sse2
 vp9_mse16x16_sse2=vp9_mse16x16_wmt
 
-prototype unsigned int vp9_sub_pixel_mse32x32 "const unsigned char  *src_ptr, int  source_stride, int  xoffset, int  yoffset, const unsigned char *ref_ptr, int Refstride, unsigned int *sse"
+prototype unsigned int vp9_sub_pixel_mse32x32 "const uint8_t *src_ptr, int  source_stride, int  xoffset, int  yoffset, const uint8_t *ref_ptr, int Refstride, unsigned int *sse"
 specialize vp9_sub_pixel_mse32x32
 
-prototype unsigned int vp9_get_mb_ss "const short *"
+prototype unsigned int vp9_get_mb_ss "const int16_t *"
 specialize vp9_get_mb_ss mmx sse2
 # ENCODEMB INVOKE
 prototype int vp9_mbblock_error "struct macroblock *mb, int dc"
@@ -591,7 +593,7 @@
 specialize vp9_mbblock_error mmx sse2
 vp9_mbblock_error_sse2=vp9_mbblock_error_xmm
 
-prototype int vp9_block_error "short *coeff, short *dqcoeff, int block_size"
+prototype int vp9_block_error "int16_t *coeff, int16_t *dqcoeff, int block_size"
 specialize vp9_block_error mmx sse2
 vp9_block_error_sse2=vp9_block_error_xmm
 
@@ -605,10 +607,10 @@
 prototype void vp9_subtract_b "struct block *be, struct blockd *bd, int pitch"
 specialize vp9_subtract_b mmx sse2
 
-prototype void vp9_subtract_mby "short *diff, unsigned char *src, unsigned char *pred, int stride"
+prototype void vp9_subtract_mby "int16_t *diff, uint8_t *src, uint8_t *pred, int stride"
 specialize vp9_subtract_mby mmx sse2
 
-prototype void vp9_subtract_mbuv "short *diff, unsigned char *usrc, unsigned char *vsrc, unsigned char *pred, int stride"
+prototype void vp9_subtract_mbuv "int16_t *diff, uint8_t *usrc, uint8_t *vsrc, uint8_t *pred, int stride"
 specialize vp9_subtract_mbuv mmx sse2
 
 #
@@ -617,45 +619,45 @@
 if [ "$CONFIG_INTERNAL_STATS" = "yes" ]; then
     [ $arch = "x86_64" ] && sse2_on_x86_64=sse2
 
-    prototype void vp9_ssim_parms_8x8 "unsigned char *s, int sp, unsigned char *r, int rp, unsigned long *sum_s, unsigned long *sum_r, unsigned long *sum_sq_s, unsigned long *sum_sq_r, unsigned long *sum_sxr"
+    prototype void vp9_ssim_parms_8x8 "uint8_t *s, int sp, uint8_t *r, int rp, unsigned long *sum_s, unsigned long *sum_r, unsigned long *sum_sq_s, unsigned long *sum_sq_r, unsigned long *sum_sxr"
     specialize vp9_ssim_parms_8x8 $sse2_on_x86_64
 
-    prototype void vp9_ssim_parms_16x16 "unsigned char *s, int sp, unsigned char *r, int rp, unsigned long *sum_s, unsigned long *sum_r, unsigned long *sum_sq_s, unsigned long *sum_sq_r, unsigned long *sum_sxr"
+    prototype void vp9_ssim_parms_16x16 "uint8_t *s, int sp, uint8_t *r, int rp, unsigned long *sum_s, unsigned long *sum_r, unsigned long *sum_sq_s, unsigned long *sum_sq_r, unsigned long *sum_sxr"
     specialize vp9_ssim_parms_16x16 $sse2_on_x86_64
 fi
 
 # fdct functions
-prototype void vp9_fht "const short *input, int pitch, short *output, int tx_type, int tx_dim"
+prototype void vp9_fht "const int16_t *input, int pitch, int16_t *output, int tx_type, int tx_dim"
 specialize vp9_fht
 
-prototype void vp9_short_fdct8x8 "short *InputData, short *OutputData, int pitch"
+prototype void vp9_short_fdct8x8 "int16_t *InputData, int16_t *OutputData, int pitch"
 specialize vp9_short_fdct8x8
 
-prototype void vp9_short_fhaar2x2 "short *InputData, short *OutputData, int pitch"
+prototype void vp9_short_fhaar2x2 "int16_t *InputData, int16_t *OutputData, int pitch"
 specialize vp9_short_fhaar2x2
 
-prototype void vp9_short_fdct4x4 "short *InputData, short *OutputData, int pitch"
+prototype void vp9_short_fdct4x4 "int16_t *InputData, int16_t *OutputData, int pitch"
 specialize vp9_short_fdct4x4
 
-prototype void vp9_short_fdct8x4 "short *InputData, short *OutputData, int pitch"
+prototype void vp9_short_fdct8x4 "int16_t *InputData, int16_t *OutputData, int pitch"
 specialize vp9_short_fdct8x4
 
-prototype void vp9_short_walsh4x4 "short *InputData, short *OutputData, int pitch"
+prototype void vp9_short_walsh4x4 "int16_t *InputData, int16_t *OutputData, int pitch"
 specialize vp9_short_walsh4x4
 
-prototype void vp9_short_fdct32x32 "short *InputData, short *OutputData, int pitch"
+prototype void vp9_short_fdct32x32 "int16_t *InputData, int16_t *OutputData, int pitch"
 specialize vp9_short_fdct32x32
 
-prototype void vp9_short_fdct16x16 "short *InputData, short *OutputData, int pitch"
+prototype void vp9_short_fdct16x16 "int16_t *InputData, int16_t *OutputData, int pitch"
 specialize vp9_short_fdct16x16
 
-prototype void vp9_short_walsh4x4_lossless "short *InputData, short *OutputData, int pitch"
+prototype void vp9_short_walsh4x4_lossless "int16_t *InputData, int16_t *OutputData, int pitch"
 specialize vp9_short_walsh4x4_lossless
 
-prototype void vp9_short_walsh4x4_x8 "short *InputData, short *OutputData, int pitch"
+prototype void vp9_short_walsh4x4_x8 "int16_t *InputData, int16_t *OutputData, int pitch"
 specialize vp9_short_walsh4x4_x8
 
-prototype void vp9_short_walsh8x4_x8 "short *InputData, short *OutputData, int pitch"
+prototype void vp9_short_walsh8x4_x8 "int16_t *InputData, int16_t *OutputData, int pitch"
 specialize vp9_short_walsh8x4_x8
 
 #
@@ -674,7 +676,7 @@
 specialize vp9_diamond_search_sad sse3
 vp9_diamond_search_sad_sse3=vp9_diamond_search_sadx4
 
-prototype void vp9_temporal_filter_apply "unsigned char *frame1, unsigned int stride, unsigned char *frame2, unsigned int block_size, int strength, int filter_weight, unsigned int *accumulator, unsigned short *count"
+prototype void vp9_temporal_filter_apply "uint8_t *frame1, unsigned int stride, uint8_t *frame2, unsigned int block_size, int strength, int filter_weight, unsigned int *accumulator, uint16_t *count"
 specialize vp9_temporal_filter_apply sse2
 
 prototype void vp9_yv12_copy_partial_frame "struct yv12_buffer_config *src_ybc, struct yv12_buffer_config *dst_ybc, int fraction"
--- a/vp9/common/vp9_sadmxn.h
+++ b/vp9/common/vp9_sadmxn.h
@@ -11,14 +11,14 @@
 #ifndef VP9_COMMON_VP9_SADMXN_H_
 #define VP9_COMMON_VP9_SADMXN_H_
 
-static __inline
-unsigned int sad_mx_n_c(
-  const unsigned char *src_ptr,
-  int  src_stride,
-  const unsigned char *ref_ptr,
-  int  ref_stride,
-  int m,
-  int n) {
+#include "vpx/vpx_integer.h"
+
+static __inline unsigned int sad_mx_n_c(const uint8_t *src_ptr,
+                                        int src_stride,
+                                        const uint8_t *ref_ptr,
+                                        int ref_stride,
+                                        int m,
+                                        int n) {
   int r, c;
   unsigned int sad = 0;
 
@@ -34,4 +34,4 @@
   return sad;
 }
 
-#endif
+#endif  // VP9_COMMON_VP9_SADMXN_H_
--- a/vp9/common/vp9_seg_common.h
+++ b/vp9/common/vp9_seg_common.h
@@ -59,5 +59,5 @@
 
 int vp9_get_seg_tx_type(MACROBLOCKD *xd, int segment_id);
 
-#endif /* __INC_SEG_COMMON_H__ */
+#endif  // VP9_COMMON_VP9_SEG_COMMON_H_
 
--- a/vp9/common/vp9_setupintrarecon.c
+++ b/vp9/common/vp9_setupintrarecon.c
@@ -18,14 +18,14 @@
   /* set up frame new frame for intra coded blocks */
   vpx_memset(ybf->y_buffer - 1 - ybf->y_stride, 127, ybf->y_width + 5);
   for (i = 0; i < ybf->y_height; i++)
-    ybf->y_buffer[ybf->y_stride * i - 1] = (unsigned char) 129;
+    ybf->y_buffer[ybf->y_stride * i - 1] = (uint8_t) 129;
 
   vpx_memset(ybf->u_buffer - 1 - ybf->uv_stride, 127, ybf->uv_width + 5);
   for (i = 0; i < ybf->uv_height; i++)
-    ybf->u_buffer[ybf->uv_stride * i - 1] = (unsigned char) 129;
+    ybf->u_buffer[ybf->uv_stride * i - 1] = (uint8_t) 129;
 
   vpx_memset(ybf->v_buffer - 1 - ybf->uv_stride, 127, ybf->uv_width + 5);
   for (i = 0; i < ybf->uv_height; i++)
-    ybf->v_buffer[ybf->uv_stride * i - 1] = (unsigned char) 129;
+    ybf->v_buffer[ybf->uv_stride * i - 1] = (uint8_t) 129;
 
 }
--- a/vp9/common/vp9_setupintrarecon.h
+++ b/vp9/common/vp9_setupintrarecon.h
@@ -8,6 +8,11 @@
  *  be found in the AUTHORS file in the root of the source tree.
  */
 
+#ifndef VP9_COMMON_VP9_SETUPINTRARECON_H_
+#define VP9_COMMON_VP9_SETUPINTRARECON_H_
 
 #include "vpx_scale/yv12config.h"
+
 extern void vp9_setup_intra_recon(YV12_BUFFER_CONFIG *ybf);
+
+#endif  // VP9_COMMON_VP9_SETUPINTRARECON_H_
--- a/vp9/common/vp9_subpelvar.h
+++ b/vp9/common/vp9_subpelvar.h
@@ -8,14 +8,14 @@
  *  be found in the AUTHORS file in the root of the source tree.
  */
 
+#ifndef VP9_COMMON_VP9_SUBPELVAR_H_
+#define VP9_COMMON_VP9_SUBPELVAR_H_
 
 #include "vp9/common/vp9_filter.h"
 
-
-
-static void variance(const unsigned char *src_ptr,
+static void variance(const uint8_t *src_ptr,
                      int  source_stride,
-                     const unsigned char *ref_ptr,
+                     const uint8_t *ref_ptr,
                      int  recon_stride,
                      int  w,
                      int  h,
@@ -67,13 +67,13 @@
  *                  to the next.
  *
  ****************************************************************************/
-static void var_filter_block2d_bil_first_pass(const unsigned char *src_ptr,
-                                              unsigned short *output_ptr,
+static void var_filter_block2d_bil_first_pass(const uint8_t *src_ptr,
+                                              uint16_t *output_ptr,
                                               unsigned int src_pixels_per_line,
                                               int pixel_step,
                                               unsigned int output_height,
                                               unsigned int output_width,
-                                              const short *vp9_filter) {
+                                              const int16_t *vp9_filter) {
   unsigned int i, j;
 
   for (i = 0; i < output_height; i++) {
@@ -119,13 +119,13 @@
  *                  to the next.
  *
  ****************************************************************************/
-static void var_filter_block2d_bil_second_pass(const unsigned short *src_ptr,
-                                               unsigned char *output_ptr,
+static void var_filter_block2d_bil_second_pass(const uint16_t *src_ptr,
+                                               uint8_t *output_ptr,
                                                unsigned int src_pixels_per_line,
                                                unsigned int pixel_step,
                                                unsigned int output_height,
                                                unsigned int output_width,
-                                               const short *vp9_filter) {
+                                               const int16_t *vp9_filter) {
   unsigned int  i, j;
   int  Temp;
 
@@ -145,3 +145,4 @@
   }
 }
 
+#endif  // VP9_COMMON_VP9_SUBPELVAR_H_
--- a/vp9/common/vp9_subpixel.h
+++ b/vp9/common/vp9_subpixel.h
@@ -8,14 +8,13 @@
  *  be found in the AUTHORS file in the root of the source tree.
  */
 
-
 #ifndef VP9_COMMON_VP9_SUBPIXEL_H_
 #define VP9_COMMON_VP9_SUBPIXEL_H_
 
 #define prototype_subpixel_predict(sym) \
-  void sym(unsigned char *src, int src_pitch, int xofst, int yofst, \
-           unsigned char *dst, int dst_pitch)
+  void sym(uint8_t *src, int src_pitch, int xofst, int yofst, \
+           uint8_t *dst, int dst_pitch)
 
 typedef prototype_subpixel_predict((*vp9_subpix_fn_t));
 
-#endif
+#endif  // VP9_COMMON_VP9_SUBPIXEL_H_
--- a/vp9/common/vp9_swapyv12buffer.c
+++ b/vp9/common/vp9_swapyv12buffer.c
@@ -12,7 +12,7 @@
 
 void vp9_swap_yv12_buffer(YV12_BUFFER_CONFIG *new_frame,
                           YV12_BUFFER_CONFIG *last_frame) {
-  unsigned char *temp;
+  uint8_t *temp;
 
   temp = last_frame->buffer_alloc;
   last_frame->buffer_alloc = new_frame->buffer_alloc;
--- a/vp9/common/vp9_swapyv12buffer.h
+++ b/vp9/common/vp9_swapyv12buffer.h
@@ -16,4 +16,4 @@
 void vp9_swap_yv12_buffer(YV12_BUFFER_CONFIG *new_frame,
                           YV12_BUFFER_CONFIG *last_frame);
 
-#endif  // __SWAPYV12_BUFFER_H
+#endif  // VP9_COMMON_VP9_SWAPYV12BUFFER_H_
--- a/vp9/common/vp9_systemdependent.h
+++ b/vp9/common/vp9_systemdependent.h
@@ -7,6 +7,7 @@
  *  in the file PATENTS.  All contributing project authors may
  *  be found in the AUTHORS file in the root of the source tree.
  */
+
 #ifndef VP9_COMMON_VP9_SYSTEMDEPENDENT_H_
 #define VP9_COMMON_VP9_SYSTEMDEPENDENT_H_
 
@@ -34,4 +35,5 @@
 
 struct VP9Common;
 void vp9_machine_specific_config(struct VP9Common *);
-#endif
+
+#endif  // VP9_COMMON_VP9_SYSTEMDEPENDENT_H_
--- a/vp9/common/vp9_textblit.h
+++ b/vp9/common/vp9_textblit.h
@@ -16,4 +16,4 @@
 extern void vp9_blit_line(int x0, int x1, int y0, int y1,
                           unsigned char *image, const int pitch);
 
-#endif  // __INC_TEXTBLIT_H
+#endif  // VP9_COMMON_VP9_TEXTBLIT_H_
--- a/vp9/common/vp9_treecoder.h
+++ b/vp9/common/vp9_treecoder.h
@@ -8,32 +8,19 @@
  *  be found in the AUTHORS file in the root of the source tree.
  */
 
-
 #ifndef VP9_COMMON_VP9_TREECODER_H_
 #define VP9_COMMON_VP9_TREECODER_H_
 
 #include "vpx/vpx_integer.h"
 
-typedef unsigned char vp9_prob;
+typedef uint8_t vp9_prob;
 
-#define vp9_prob_half ( (vp9_prob) 128)
+#define vp9_prob_half ((vp9_prob) 128)
 
-typedef signed char vp9_tree_index;
-struct bool_coder_spec;
+typedef int8_t vp9_tree_index;
 
-typedef struct bool_coder_spec bool_coder_spec;
-typedef struct bool_writer bool_writer;
-typedef struct bool_reader bool_reader;
+#define vp9_complement(x) (255 - x)
 
-typedef const bool_coder_spec c_bool_coder_spec;
-typedef const bool_writer c_bool_writer;
-typedef const bool_reader c_bool_reader;
-
-
-
-# define vp9_complement( x) (255 - x)
-
-
 /* We build coding trees compactly in arrays.
    Each node of the tree is a pair of vp9_tree_indices.
    Array index often references a corresponding probability table.
@@ -43,7 +30,6 @@
 
 typedef const vp9_tree_index vp9_tree[], *vp9_tree_p;
 
-
 typedef const struct vp9_token_struct {
   int value;
   int Len;
@@ -55,20 +41,17 @@
 void vp9_tokens_from_tree_offset(struct vp9_token_struct *, vp9_tree,
                                  int offset);
 
-
 /* Convert array of token occurrence counts into a table of probabilities
    for the associated binary encoding tree.  Also writes count of branches
    taken for each node on the tree; this facilitiates decisions as to
    probability updates. */
 
-void vp9_tree_probs_from_distribution(
-  int n,                      /* n = size of alphabet */
-  vp9_token tok               [ /* n */ ],
-  vp9_tree tree,
-  vp9_prob probs          [ /* n-1 */ ],
-  unsigned int branch_ct       [ /* n-1 */ ] [2],
-  const unsigned int num_events[ /* n */ ]
-);
+void vp9_tree_probs_from_distribution(int n,  /* n = size of alphabet */
+                                      vp9_token tok[ /* n */ ],
+                                      vp9_tree tree,
+                                      vp9_prob probs[ /* n - 1 */ ],
+                                      unsigned int branch_ct[ /* n - 1 */ ][2],
+                                      const unsigned int num_events[ /* n */ ]);
 
 static __inline vp9_prob clip_prob(int p) {
   return (p > 255) ? 255u : (p < 1) ? 1u : p;
@@ -87,4 +70,4 @@
   return (prob1 * (256 - factor) + prob2 * factor + 128) >> 8;
 }
 
-#endif
+#endif  // VP9_COMMON_VP9_TREECODER_H_
--- a/vp9/decoder/vp9_dboolhuff.h
+++ b/vp9/decoder/vp9_dboolhuff.h
@@ -8,9 +8,9 @@
  *  be found in the AUTHORS file in the root of the source tree.
  */
 
-
 #ifndef VP9_DECODER_VP9_DBOOLHUFF_H_
 #define VP9_DECODER_VP9_DBOOLHUFF_H_
+
 #include <stddef.h>
 #include <limits.h>
 #include "vpx_ports/config.h"
@@ -33,7 +33,7 @@
   unsigned int         range;
 } BOOL_DECODER;
 
-DECLARE_ALIGNED(16, extern const unsigned char, vp9_norm[256]);
+DECLARE_ALIGNED(16, extern const uint8_t, vp9_norm[256]);
 
 int vp9_start_decode(BOOL_DECODER *br,
                      const unsigned char *source,
@@ -152,4 +152,4 @@
 
 extern int vp9_decode_unsigned_max(BOOL_DECODER *br, int max);
 
-#endif
+#endif  // VP9_DECODER_VP9_DBOOLHUFF_H_
--- a/vp9/decoder/vp9_decodemv.h
+++ b/vp9/decoder/vp9_decodemv.h
@@ -8,6 +8,8 @@
  *  be found in the AUTHORS file in the root of the source tree.
  */
 
+#ifndef VP9_DECODER_VP9_DECODEMV_H_
+#define VP9_DECODER_VP9_DECODEMV_H_
 
 #include "vp9/decoder/vp9_onyxd_int.h"
 
@@ -17,3 +19,5 @@
                            int mb_col,
                            BOOL_DECODER* const bc);
 void vp9_decode_mode_mvs_init(VP9D_COMP* const pbi, BOOL_DECODER* const bc);
+
+#endif  // VP9_DECODER_VP9_DECODEMV_H_
--- a/vp9/decoder/vp9_decodframe.c
+++ b/vp9/decoder/vp9_decodframe.c
@@ -82,17 +82,17 @@
   VP9_COMMON *const pc = &pbi->common;
 
   for (Q = 0; Q < QINDEX_RANGE; Q++) {
-    pc->Y1dequant[Q][0] = (short)vp9_dc_quant(Q, pc->y1dc_delta_q);
-    pc->Y2dequant[Q][0] = (short)vp9_dc2quant(Q, pc->y2dc_delta_q);
-    pc->UVdequant[Q][0] = (short)vp9_dc_uv_quant(Q, pc->uvdc_delta_q);
+    pc->Y1dequant[Q][0] = (int16_t)vp9_dc_quant(Q, pc->y1dc_delta_q);
+    pc->Y2dequant[Q][0] = (int16_t)vp9_dc2quant(Q, pc->y2dc_delta_q);
+    pc->UVdequant[Q][0] = (int16_t)vp9_dc_uv_quant(Q, pc->uvdc_delta_q);
 
     /* all the ac values =; */
     for (i = 1; i < 16; i++) {
       int rc = vp9_default_zig_zag1d_4x4[i];
 
-      pc->Y1dequant[Q][rc] = (short)vp9_ac_yquant(Q);
-      pc->Y2dequant[Q][rc] = (short)vp9_ac2quant(Q, pc->y2ac_delta_q);
-      pc->UVdequant[Q][rc] = (short)vp9_ac_uv_quant(Q, pc->uvac_delta_q);
+      pc->Y1dequant[Q][rc] = (int16_t)vp9_ac_yquant(Q);
+      pc->Y2dequant[Q][rc] = (int16_t)vp9_ac2quant(Q, pc->y2ac_delta_q);
+      pc->UVdequant[Q][rc] = (int16_t)vp9_ac_uv_quant(Q, pc->uvac_delta_q);
     }
   }
 }
@@ -283,10 +283,10 @@
     for (i = 0; i < 4; i++) {
       int ib = vp9_i8x8_block[i];
       int idx = (ib & 0x02) ? (ib + 2) : ib;
-      short *q  = xd->block[idx].qcoeff;
-      short *dq = xd->block[0].dequant;
-      unsigned char *pre = xd->block[ib].predictor;
-      unsigned char *dst = *(xd->block[ib].base_dst) + xd->block[ib].dst;
+      int16_t *q  = xd->block[idx].qcoeff;
+      int16_t *dq = xd->block[0].dequant;
+      uint8_t *pre = xd->block[ib].predictor;
+      uint8_t *dst = *(xd->block[ib].base_dst) + xd->block[ib].dst;
       int stride = xd->dst.y_stride;
       BLOCKD *b = &xd->block[ib];
       if (xd->mode_info_context->mbmi.mode == I8X8_PRED) {
@@ -580,8 +580,8 @@
     for (i = 0; i < 4; i++) {
       int ib = vp9_i8x8_block[i];
       int idx = (ib & 0x02) ? (ib + 2) : ib;
-      short *q  = xd->block[idx].qcoeff;
-      short *dq = xd->block[0].dequant;
+      int16_t *q  = xd->block[idx].qcoeff;
+      int16_t *dq = xd->block[0].dequant;
       int stride = xd->dst.y_stride;
       BLOCKD *b = &xd->block[ib];
       tx_type = get_tx_type_8x8(xd, &xd->block[ib]);
--- a/vp9/decoder/vp9_decodframe.h
+++ b/vp9/decoder/vp9_decodframe.h
@@ -16,4 +16,4 @@
 
 extern void vp9_init_de_quantizer(struct VP9Decompressor *pbi);
 
-#endif  // __INC_DECODFRAME_H
+#endif  // VP9_DECODER_VP9_DECODFRAME_H_
--- a/vp9/decoder/vp9_dequantize.c
+++ b/vp9/decoder/vp9_dequantize.c
@@ -188,7 +188,7 @@
 
 void vp9_dequant_idct_add_8x8_c(int16_t *input, const int16_t *dq,
                                 uint8_t *pred, uint8_t *dest, int pitch,
-                                int stride, int dc, uint16_t eobs) {
+                                int stride, int dc, int eob) {
   int16_t output[64];
   int16_t *diff_ptr = output;
   int i;
@@ -204,10 +204,10 @@
    * TODO(yunqingwang): "eobs = 1" case is also handled in vp9_short_idct8x8_c.
    * Combine that with code here.
    */
-  if (eobs == 0) {
+  if (eob == 0) {
     /* All 0 DCT coefficient */
     vp9_copy_mem8x8(pred, pitch, dest, stride);
-  } else if (eobs == 1) {
+  } else if (eob == 1) {
     /* DC only DCT coefficient. */
     int16_t out;
 
@@ -220,7 +220,7 @@
     input[0] = 0;
 
     add_constant_residual(out, pred, pitch, dest, stride, 8, 8);
-  } else if (eobs <= 10) {
+  } else if (eob <= 10) {
     input[1] = input[1] * dq[1];
     input[2] = input[2] * dq[1];
     input[3] = input[3] * dq[1];
@@ -280,7 +280,7 @@
 
 void vp9_dequant_idct_add_16x16_c(int16_t *input, const int16_t *dq,
                                   uint8_t *pred, uint8_t *dest, int pitch,
-                                  int stride, uint16_t eobs) {
+                                  int stride, int eob) {
   int16_t output[256];
   int16_t *diff_ptr = output;
   int i;
@@ -287,10 +287,10 @@
 
   /* The calculation can be simplified if there are not many non-zero dct
    * coefficients. Use eobs to separate different cases. */
-  if (eobs == 0) {
+  if (eob == 0) {
     /* All 0 DCT coefficient */
     vp9_copy_mem16x16(pred, pitch, dest, stride);
-  } else if (eobs == 1) {
+  } else if (eob == 1) {
     /* DC only DCT coefficient. */
     int16_t out;
 
@@ -303,7 +303,7 @@
     input[0] = 0;
 
     add_constant_residual(out, pred, pitch, dest, stride, 16, 16);
-  } else if (eobs <= 10) {
+  } else if (eob <= 10) {
     input[0]= input[0] * dq[0];
     input[1] = input[1] * dq[1];
     input[2] = input[2] * dq[1];
@@ -343,8 +343,8 @@
 #if CONFIG_TX32X32 && CONFIG_SUPERBLOCKS
 void vp9_dequant_idct_add_32x32(int16_t *input, const int16_t *dq,
                                 uint8_t *pred, uint8_t *dest, int pitch,
-                                int stride, uint16_t eobs) {
-  short output[1024];
+                                int stride, int eob) {
+  int16_t output[1024];
   int i;
 
   input[0]= input[0] * dq[0] / 2;
@@ -356,11 +356,11 @@
   add_residual(output, pred, pitch, dest, stride, 32, 32);
 }
 
-void vp9_dequant_idct_add_uv_block_16x16_c(short *q, const short *dq,
-                                           unsigned char *dstu,
-                                           unsigned char *dstv,
+void vp9_dequant_idct_add_uv_block_16x16_c(int16_t *q, const int16_t *dq,
+                                           uint8_t *dstu,
+                                           uint8_t *dstv,
                                            int stride,
-                                           unsigned short *eobs) {
+                                           uint16_t *eobs) {
   vp9_dequant_idct_add_16x16_c(q, dq, dstu, dstu, stride, stride, eobs[0]);
   vp9_dequant_idct_add_16x16_c(q + 256, dq,
                                dstv, dstv, stride, stride, eobs[4]);
--- a/vp9/decoder/vp9_dequantize.h
+++ b/vp9/decoder/vp9_dequantize.h
@@ -11,92 +11,108 @@
 
 #ifndef VP9_DECODER_VP9_DEQUANTIZE_H_
 #define VP9_DECODER_VP9_DEQUANTIZE_H_
+
 #include "vp9/common/vp9_blockd.h"
 
 #if CONFIG_LOSSLESS
-extern void vp9_dequant_idct_add_lossless_c(short *input, const short *dq,
-                                            unsigned char *pred,
-                                            unsigned char *output,
+extern void vp9_dequant_idct_add_lossless_c(int16_t *input,
+                                            const int16_t *dq,
+                                            uint8_t *pred,
+                                            uint8_t *output,
                                             int pitch, int stride);
-extern void vp9_dequant_dc_idct_add_lossless_c(short *input, const short *dq,
-                                               unsigned char *pred,
-                                               unsigned char *output,
+extern void vp9_dequant_dc_idct_add_lossless_c(int16_t *input,
+                                               const int16_t *dq,
+                                               uint8_t *pred,
+                                               uint8_t *output,
                                                int pitch, int stride, int dc);
-extern void vp9_dequant_dc_idct_add_y_block_lossless_c(short *q,
-                                                       const short *dq,
-                                                       unsigned char *pre,
-                                                       unsigned char *dst,
+extern void vp9_dequant_dc_idct_add_y_block_lossless_c(int16_t *q,
+                                                       const int16_t *dq,
+                                                       uint8_t *pre,
+                                                       uint8_t *dst,
                                                        int stride,
-                                                       unsigned short *eobs,
-                                                       const short *dc);
-extern void vp9_dequant_idct_add_y_block_lossless_c(short *q, const short *dq,
-                                                    unsigned char *pre,
-                                                    unsigned char *dst,
+                                                       uint16_t *eobs,
+                                                       const int16_t *dc);
+extern void vp9_dequant_idct_add_y_block_lossless_c(int16_t *q,
+                                                    const int16_t *dq,
+                                                    uint8_t *pre,
+                                                    uint8_t *dst,
                                                     int stride,
-                                                    unsigned short *eobs);
-extern void vp9_dequant_idct_add_uv_block_lossless_c(short *q, const short *dq,
-                                                     unsigned char *pre,
-                                                     unsigned char *dst_u,
-                                                     unsigned char *dst_v,
+                                                    uint16_t *eobs);
+extern void vp9_dequant_idct_add_uv_block_lossless_c(int16_t *q,
+                                                     const int16_t *dq,
+                                                     uint8_t *pre,
+                                                     uint8_t *dst_u,
+                                                     uint8_t *dst_v,
                                                      int stride,
-                                                     unsigned short *eobs);
-#endif
+                                                     uint16_t *eobs);
+#endif  // CONFIG_LOSSLESS
 
-typedef void (*vp9_dequant_idct_add_fn_t)(short *input, const short *dq,
-    unsigned char *pred, unsigned char *output, int pitch, int stride);
-typedef void(*vp9_dequant_dc_idct_add_fn_t)(short *input, const short *dq,
-    unsigned char *pred, unsigned char *output, int pitch, int stride, int dc);
+typedef void (*vp9_dequant_idct_add_fn_t)(int16_t *input, const int16_t *dq,
+                                          uint8_t *pred, uint8_t *output,
+                                          int pitch, int stride);
+typedef void(*vp9_dequant_dc_idct_add_fn_t)(int16_t *input, const int16_t *dq,
+                                            uint8_t *pred, uint8_t *output,
+                                            int pitch, int stride, int dc);
 
-typedef void(*vp9_dequant_dc_idct_add_y_block_fn_t)(short *q, const short *dq,
-    unsigned char *pre, unsigned char *dst, int stride, unsigned short *eobs,
-    const short *dc);
-typedef void(*vp9_dequant_idct_add_y_block_fn_t)(short *q, const short *dq,
-    unsigned char *pre, unsigned char *dst, int stride, unsigned short *eobs);
-typedef void(*vp9_dequant_idct_add_uv_block_fn_t)(short *q, const short *dq,
-    unsigned char *pre, unsigned char *dst_u, unsigned char *dst_v, int stride,
-    unsigned short *eobs);
+typedef void(*vp9_dequant_dc_idct_add_y_block_fn_t)(int16_t *q,
+                                                    const int16_t *dq,
+                                                    uint8_t *pre, uint8_t *dst,
+                                                    int stride, uint16_t *eobs,
+                                                    const int16_t *dc);
+typedef void(*vp9_dequant_idct_add_y_block_fn_t)(int16_t *q, const int16_t *dq,
+                                                 uint8_t *pre, uint8_t *dst,
+                                                 int stride, uint16_t *eobs);
+typedef void(*vp9_dequant_idct_add_uv_block_fn_t)(int16_t *q, const int16_t *dq,
+                                                  uint8_t *pre, uint8_t *dst_u,
+                                                  uint8_t *dst_v, int stride,
+                                                  uint16_t *eobs);
 
-void vp9_ht_dequant_idct_add_c(TX_TYPE tx_type, short *input, const short *dq,
-                                    unsigned char *pred, unsigned char *dest,
-                                    int pitch, int stride);
+void vp9_ht_dequant_idct_add_c(TX_TYPE tx_type, int16_t *input,
+                               const int16_t *dq,
+                               uint8_t *pred, uint8_t *dest,
+                               int pitch, int stride);
 
-void vp9_ht_dequant_idct_add_8x8_c(TX_TYPE tx_type, short *input,
-                                   const short *dq, unsigned char *pred,
-                                   unsigned char *dest, int pitch, int stride);
+void vp9_ht_dequant_idct_add_8x8_c(TX_TYPE tx_type, int16_t *input,
+                                   const int16_t *dq, uint8_t *pred,
+                                   uint8_t *dest, int pitch, int stride);
 
-void vp9_ht_dequant_idct_add_16x16_c(TX_TYPE tx_type, short *input,
-                                     const short *dq, unsigned char *pred,
-                                     unsigned char *dest,
+void vp9_ht_dequant_idct_add_16x16_c(TX_TYPE tx_type, int16_t *input,
+                                     const int16_t *dq, uint8_t *pred,
+                                     uint8_t *dest,
                                      int pitch, int stride);
 
 #if CONFIG_SUPERBLOCKS
-void vp9_dequant_dc_idct_add_y_block_8x8_inplace_c(short *q, const short *dq,
-                                                   unsigned char *dst,
+void vp9_dequant_dc_idct_add_y_block_8x8_inplace_c(int16_t *q,
+                                                   const int16_t *dq,
+                                                   uint8_t *dst,
                                                    int stride,
-                                                   unsigned short *eobs,
-                                                   const short *dc,
+                                                   uint16_t *eobs,
+                                                   const int16_t *dc,
                                                    MACROBLOCKD *xd);
 
-void vp9_dequant_dc_idct_add_y_block_4x4_inplace_c(short *q, const short *dq,
-                                                   unsigned char *dst,
+void vp9_dequant_dc_idct_add_y_block_4x4_inplace_c(int16_t *q,
+                                                   const int16_t *dq,
+                                                   uint8_t *dst,
                                                    int stride,
-                                                   unsigned short *eobs,
-                                                   const short *dc,
+                                                   uint16_t *eobs,
+                                                   const int16_t *dc,
                                                    MACROBLOCKD *xd);
 
-void vp9_dequant_idct_add_uv_block_8x8_inplace_c(short *q, const short *dq,
-                                                 unsigned char *dstu,
-                                                 unsigned char *dstv,
+void vp9_dequant_idct_add_uv_block_8x8_inplace_c(int16_t *q,
+                                                 const int16_t *dq,
+                                                 uint8_t *dstu,
+                                                 uint8_t *dstv,
                                                  int stride,
-                                                 unsigned short *eobs,
+                                                 uint16_t *eobs,
                                                  MACROBLOCKD *xd);
 
-void vp9_dequant_idct_add_uv_block_4x4_inplace_c(short *q, const short *dq,
-                                                 unsigned char *dstu,
-                                                 unsigned char *dstv,
+void vp9_dequant_idct_add_uv_block_4x4_inplace_c(int16_t *q,
+                                                 const int16_t *dq,
+                                                 uint8_t *dstu,
+                                                 uint8_t *dstv,
                                                  int stride,
-                                                 unsigned short *eobs,
+                                                 uint16_t *eobs,
                                                  MACROBLOCKD *xd);
-#endif
+#endif  // CONFIG_SUPERBLOCKS
 
-#endif
+#endif  // VP9_DECODER_VP9_DEQUANTIZE_H_
--- a/vp9/decoder/vp9_detokenize.c
+++ b/vp9/decoder/vp9_detokenize.c
@@ -53,11 +53,11 @@
 #define CAT5_PROB3 157
 #define CAT5_PROB4 180
 
-static const unsigned char cat6_prob[15] = {
+static const vp9_prob cat6_prob[15] = {
   254, 254, 254, 252, 249, 243, 230, 196, 177, 153, 140, 133, 130, 129, 0
 };
 
-DECLARE_ALIGNED(16, extern const unsigned char, vp9_norm[256]);
+DECLARE_ALIGNED(16, extern const uint8_t, vp9_norm[256]);
 
 static int get_signed(BOOL_DECODER *br, int value_to_sign) {
   const int split = (br->range + 1) >> 1;
@@ -254,7 +254,7 @@
   ENTROPY_CONTEXT* const L = (ENTROPY_CONTEXT *)xd->left_context;
   ENTROPY_CONTEXT* const A1 = (ENTROPY_CONTEXT *)(&xd->above_context[1]);
   ENTROPY_CONTEXT* const L1 = (ENTROPY_CONTEXT *)(&xd->left_context[1]);
-  unsigned short* const eobs = xd->eobs;
+  uint16_t *const eobs = xd->eobs;
   const int segment_id = xd->mode_info_context->mbmi.segment_id;
   int c, i, eobtotal = 0, seg_eob;
 
@@ -320,7 +320,7 @@
                                       BOOL_DECODER* const bc) {
   ENTROPY_CONTEXT* const A = (ENTROPY_CONTEXT *)xd->above_context;
   ENTROPY_CONTEXT* const L = (ENTROPY_CONTEXT *)xd->left_context;
-  unsigned short* const eobs = xd->eobs;
+  uint16_t *const eobs = xd->eobs;
   const int segment_id = xd->mode_info_context->mbmi.segment_id;
   int c, i, eobtotal = 0, seg_eob;
   // Luma block
@@ -374,7 +374,7 @@
                                     BOOL_DECODER* const bc) {
   ENTROPY_CONTEXT *const A = (ENTROPY_CONTEXT *)xd->above_context;
   ENTROPY_CONTEXT *const L = (ENTROPY_CONTEXT *)xd->left_context;
-  unsigned short *const eobs = xd->eobs;
+  uint16_t *const eobs = xd->eobs;
   PLANE_TYPE type;
   int c, i, eobtotal = 0, seg_eob;
   const int segment_id = xd->mode_info_context->mbmi.segment_id;
@@ -471,7 +471,7 @@
   ENTROPY_CONTEXT *const L = (ENTROPY_CONTEXT *)xd->left_context;
   ENTROPY_CONTEXT *const a = A + vp9_block2above[TX_4X4][i];
   ENTROPY_CONTEXT *const l = L + vp9_block2left[TX_4X4][i];
-  unsigned short *const eobs = xd->eobs;
+  uint16_t *const eobs = xd->eobs;
   int c;
 
   c = decode_coefs(dx, xd, bc, a, l, type, tx_type, seg_eob,
--- a/vp9/decoder/vp9_detokenize.h
+++ b/vp9/decoder/vp9_detokenize.h
@@ -32,4 +32,4 @@
 int vp9_decode_mb_tokens_4x4_uv(VP9D_COMP* const dx, MACROBLOCKD* const xd,
                                 BOOL_DECODER* const bc);
 
-#endif /* DETOKENIZE_H */
+#endif  // VP9_DECODER_VP9_DETOKENIZE_H_
--- a/vp9/decoder/vp9_idct_blk.c
+++ b/vp9/decoder/vp9_idct_blk.c
@@ -14,11 +14,11 @@
 #include "vp9/decoder/vp9_dequantize.h"
 #endif
 
-void vp9_dequant_dc_idct_add_y_block_c(short *q, const short *dq,
-                                       unsigned char *pre,
-                                       unsigned char *dst,
-                                       int stride, unsigned short *eobs,
-                                       const short *dc) {
+void vp9_dequant_dc_idct_add_y_block_c(int16_t *q, const int16_t *dq,
+                                       uint8_t *pre,
+                                       uint8_t *dst,
+                                       int stride, uint16_t *eobs,
+                                       const int16_t *dc) {
   int i, j;
 
   for (i = 0; i < 4; i++) {
@@ -40,11 +40,12 @@
 }
 
 #if CONFIG_SUPERBLOCKS
-void vp9_dequant_dc_idct_add_y_block_4x4_inplace_c(short *q, const short *dq,
-                                                   unsigned char *dst,
+void vp9_dequant_dc_idct_add_y_block_4x4_inplace_c(int16_t *q,
+                                                   const int16_t *dq,
+                                                   uint8_t *dst,
                                                    int stride,
-                                                   unsigned short *eobs,
-                                                   const short *dc,
+                                                   uint16_t *eobs,
+                                                   const int16_t *dc,
                                                    MACROBLOCKD *xd) {
   int i, j;
 
@@ -65,10 +66,10 @@
 }
 #endif
 
-void vp9_dequant_idct_add_y_block_c(short *q, const short *dq,
-                                    unsigned char *pre,
-                                    unsigned char *dst,
-                                    int stride, unsigned short *eobs) {
+void vp9_dequant_idct_add_y_block_c(int16_t *q, const int16_t *dq,
+                                    uint8_t *pre,
+                                    uint8_t *dst,
+                                    int stride, uint16_t *eobs) {
   int i, j;
 
   for (i = 0; i < 4; i++) {
@@ -90,10 +91,10 @@
   }
 }
 
-void vp9_dequant_idct_add_uv_block_c(short *q, const short *dq,
-                                     unsigned char *pre, unsigned char *dstu,
-                                     unsigned char *dstv, int stride,
-                                     unsigned short *eobs) {
+void vp9_dequant_idct_add_uv_block_c(int16_t *q, const int16_t *dq,
+                                     uint8_t *pre, uint8_t *dstu,
+                                     uint8_t *dstv, int stride,
+                                     uint16_t *eobs) {
   int i, j;
 
   for (i = 0; i < 2; i++) {
@@ -134,11 +135,11 @@
 }
 
 #if CONFIG_SUPERBLOCKS
-void vp9_dequant_idct_add_uv_block_4x4_inplace_c(short *q, const short *dq,
-                                                 unsigned char *dstu,
-                                                 unsigned char *dstv,
+void vp9_dequant_idct_add_uv_block_4x4_inplace_c(int16_t *q, const int16_t *dq,
+                                                 uint8_t *dstu,
+                                                 uint8_t *dstv,
                                                  int stride,
-                                                 unsigned short *eobs,
+                                                 uint16_t *eobs,
                                                  MACROBLOCKD *xd) {
   int i, j;
 
@@ -176,11 +177,11 @@
 }
 #endif
 
-void vp9_dequant_dc_idct_add_y_block_8x8_c(short *q, const short *dq,
-                                           unsigned char *pre,
-                                           unsigned char *dst,
-                                           int stride, unsigned short *eobs,
-                                           const short *dc,
+void vp9_dequant_dc_idct_add_y_block_8x8_c(int16_t *q, const int16_t *dq,
+                                           uint8_t *pre,
+                                           uint8_t *dst,
+                                           int stride, uint16_t *eobs,
+                                           const int16_t *dc,
                                            MACROBLOCKD *xd) {
   q[0] = dc[0];
   vp9_dequant_idct_add_8x8_c(q, dq, pre, dst, 16, stride, 1, xd->eobs[0]);
@@ -200,11 +201,12 @@
 }
 
 #if CONFIG_SUPERBLOCKS
-void vp9_dequant_dc_idct_add_y_block_8x8_inplace_c(short *q, const short *dq,
-                                                   unsigned char *dst,
+void vp9_dequant_dc_idct_add_y_block_8x8_inplace_c(int16_t *q,
+                                                   const int16_t *dq,
+                                                   uint8_t *dst,
                                                    int stride,
-                                                   unsigned short *eobs,
-                                                   const short *dc,
+                                                   uint16_t *eobs,
+                                                   const int16_t *dc,
                                                    MACROBLOCKD *xd) {
   q[0] = dc[0];
   vp9_dequant_idct_add_8x8_c(q, dq, dst, dst, stride, stride, 1, xd->eobs[0]);
@@ -225,13 +227,13 @@
 }
 #endif
 
-void vp9_dequant_idct_add_y_block_8x8_c(short *q, const short *dq,
-                                        unsigned char *pre,
-                                        unsigned char *dst,
-                                        int stride, unsigned short *eobs,
+void vp9_dequant_idct_add_y_block_8x8_c(int16_t *q, const int16_t *dq,
+                                        uint8_t *pre,
+                                        uint8_t *dst,
+                                        int stride, uint16_t *eobs,
                                         MACROBLOCKD *xd) {
-  unsigned char *origdest = dst;
-  unsigned char *origpred = pre;
+  uint8_t *origdest = dst;
+  uint8_t *origpred = pre;
 
   vp9_dequant_idct_add_8x8_c(q, dq, pre, dst, 16, stride, 0, xd->eobs[0]);
   vp9_dequant_idct_add_8x8_c(&q[64], dq, origpred + 8,
@@ -243,11 +245,11 @@
                              xd->eobs[12]);
 }
 
-void vp9_dequant_idct_add_uv_block_8x8_c(short *q, const short *dq,
-                                         unsigned char *pre,
-                                         unsigned char *dstu,
-                                         unsigned char *dstv,
-                                         int stride, unsigned short *eobs,
+void vp9_dequant_idct_add_uv_block_8x8_c(int16_t *q, const int16_t *dq,
+                                         uint8_t *pre,
+                                         uint8_t *dstu,
+                                         uint8_t *dstv,
+                                         int stride, uint16_t *eobs,
                                          MACROBLOCKD *xd) {
   vp9_dequant_idct_add_8x8_c(q, dq, pre, dstu, 8, stride, 0, xd->eobs[16]);
 
@@ -258,11 +260,11 @@
 }
 
 #if CONFIG_SUPERBLOCKS
-void vp9_dequant_idct_add_uv_block_8x8_inplace_c(short *q, const short *dq,
-                                                 unsigned char *dstu,
-                                                 unsigned char *dstv,
+void vp9_dequant_idct_add_uv_block_8x8_inplace_c(int16_t *q, const int16_t *dq,
+                                                 uint8_t *dstu,
+                                                 uint8_t *dstv,
                                                  int stride,
-                                                 unsigned short *eobs,
+                                                 uint16_t *eobs,
                                                  MACROBLOCKD *xd) {
   vp9_dequant_idct_add_8x8_c(q, dq, dstu, dstu, stride, stride, 0,
                              xd->eobs[16]);
@@ -274,12 +276,12 @@
 #endif
 
 #if CONFIG_LOSSLESS
-void vp9_dequant_dc_idct_add_y_block_lossless_c(short *q, const short *dq,
-                                                unsigned char *pre,
-                                                unsigned char *dst,
+void vp9_dequant_dc_idct_add_y_block_lossless_c(int16_t *q, const int16_t *dq,
+                                                uint8_t *pre,
+                                                uint8_t *dst,
                                                 int stride,
-                                                unsigned short *eobs,
-                                                const short *dc) {
+                                                uint16_t *eobs,
+                                                const int16_t *dc) {
   int i, j;
 
   for (i = 0; i < 4; i++) {
@@ -300,10 +302,10 @@
   }
 }
 
-void vp9_dequant_idct_add_y_block_lossless_c(short *q, const short *dq,
-                                             unsigned char *pre,
-                                             unsigned char *dst,
-                                             int stride, unsigned short *eobs) {
+void vp9_dequant_idct_add_y_block_lossless_c(int16_t *q, const int16_t *dq,
+                                             uint8_t *pre,
+                                             uint8_t *dst,
+                                             int stride, uint16_t *eobs) {
   int i, j;
 
   for (i = 0; i < 4; i++) {
@@ -325,12 +327,12 @@
   }
 }
 
-void vp9_dequant_idct_add_uv_block_lossless_c(short *q, const short *dq,
-                                              unsigned char *pre,
-                                              unsigned char *dstu,
-                                              unsigned char *dstv,
+void vp9_dequant_idct_add_uv_block_lossless_c(int16_t *q, const int16_t *dq,
+                                              uint8_t *pre,
+                                              uint8_t *dstu,
+                                              uint8_t *dstv,
                                               int stride,
-                                              unsigned short *eobs) {
+                                              uint16_t *eobs) {
   int i, j;
 
   for (i = 0; i < 2; i++) {
--- /dev/null
+++ b/vp9/decoder/vp9_onyxd.h
@@ -1,0 +1,64 @@
+/*
+ *  Copyright (c) 2010 The WebM project authors. 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.
+ */
+
+#ifndef VP9_COMMON_VP9_ONYXD_H_
+#define VP9_COMMON_VP9_ONYXD_H_
+
+/* Create/destroy static data structures. */
+#ifdef __cplusplus
+extern "C" {
+#endif
+#include "vpx_scale/yv12config.h"
+#include "vp9/common/vp9_ppflags.h"
+#include "vpx_ports/mem.h"
+#include "vpx/vpx_codec.h"
+
+  typedef void   *VP9D_PTR;
+  typedef struct {
+    int     Width;
+    int     Height;
+    int     Version;
+    int     postprocess;
+    int     max_threads;
+    int     input_partition;
+  } VP9D_CONFIG;
+  typedef enum {
+    VP9_LAST_FLAG = 1,
+    VP9_GOLD_FLAG = 2,
+    VP9_ALT_FLAG = 4
+  } VP9_REFFRAME;
+
+  void vp9_initialize_dec(void);
+
+  int vp9_receive_compressed_data(VP9D_PTR comp, unsigned long size,
+                                  const unsigned char **dest,
+                                  int64_t time_stamp);
+
+  int vp9_get_raw_frame(VP9D_PTR comp, YV12_BUFFER_CONFIG *sd,
+                        int64_t *time_stamp, int64_t *time_end_stamp,
+                        vp9_ppflags_t *flags);
+
+  vpx_codec_err_t vp9_get_reference_dec(VP9D_PTR comp,
+                                        VP9_REFFRAME ref_frame_flag,
+                                        YV12_BUFFER_CONFIG *sd);
+
+  vpx_codec_err_t vp9_set_reference_dec(VP9D_PTR comp,
+                                        VP9_REFFRAME ref_frame_flag,
+                                        YV12_BUFFER_CONFIG *sd);
+
+  VP9D_PTR vp9_create_decompressor(VP9D_CONFIG *oxcf);
+
+  void vp9_remove_decompressor(VP9D_PTR comp);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif  // VP9_COMMON_VP9_ONYXD_H_
--- a/vp9/decoder/vp9_onyxd_if.c
+++ b/vp9/decoder/vp9_onyxd_if.c
@@ -13,7 +13,7 @@
 #if CONFIG_POSTPROC
 #include "vp9/common/vp9_postproc.h"
 #endif
-#include "vp9/common/vp9_onyxd.h"
+#include "vp9/decoder/vp9_onyxd.h"
 #include "vp9/decoder/vp9_onyxd_int.h"
 #include "vpx_mem/vpx_mem.h"
 #include "vp9/common/vp9_alloccommon.h"
@@ -37,7 +37,7 @@
 #if WRITE_RECON_BUFFER == 1
 static void recon_write_yuv_frame(char *name, YV12_BUFFER_CONFIG *s) {
   FILE *yuv_file = fopen((char *)name, "ab");
-  unsigned char *src = s->y_buffer;
+  uint8_t *src = s->y_buffer;
   int h = s->y_height;
 
   do {
--- a/vp9/decoder/vp9_onyxd_int.h
+++ b/vp9/decoder/vp9_onyxd_int.h
@@ -8,11 +8,11 @@
  *  be found in the AUTHORS file in the root of the source tree.
  */
 
-
 #ifndef VP9_DECODER_VP9_ONYXD_INT_H_
 #define VP9_DECODER_VP9_ONYXD_INT_H_
+
 #include "vpx_ports/config.h"
-#include "vp9/common/vp9_onyxd.h"
+#include "vp9/decoder/vp9_onyxd.h"
 #include "vp9/decoder/vp9_treereader.h"
 #include "vp9/common/vp9_onyxc_int.h"
 #include "vp9/decoder/vp9_dequantize.h"
@@ -103,4 +103,4 @@
   } while(0)
 #endif
 
-#endif  // __INC_ONYXD_INT_H
+#endif  // VP9_DECODER_VP9_TREEREADER_H_
--- a/vp9/decoder/vp9_reconintra_mt.h
+++ /dev/null
@@ -1,15 +1,0 @@
-/*
- *  Copyright (c) 2010 The WebM project authors. 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.
- */
-
-
-#ifndef VP9_DECODER_VP9_RECONINTRA_MT_H_
-#define VP9_DECODER_VP9_RECONINTRA_MT_H_
-
-#endif
--- a/vp9/decoder/vp9_treereader.h
+++ b/vp9/decoder/vp9_treereader.h
@@ -34,4 +34,4 @@
   return -i;
 }
 
-#endif /* tree_reader_h */
+#endif  // VP9_DECODER_VP9_TREEREADER_H_
--- a/vp9/encoder/vp9_bitstream.h
+++ b/vp9/encoder/vp9_bitstream.h
@@ -14,4 +14,4 @@
 
 void vp9_update_skip_probs(VP9_COMP *cpi);
 
-#endif
+#endif  // VP9_ENCODER_VP9_BITSTREAM_H_
--- a/vp9/encoder/vp9_block.h
+++ b/vp9/encoder/vp9_block.h
@@ -8,7 +8,6 @@
  *  be found in the AUTHORS file in the root of the source tree.
  */
 
-
 #ifndef VP9_ENCODER_VP9_BLOCK_H_
 #define VP9_ENCODER_VP9_BLOCK_H_
 
@@ -26,32 +25,32 @@
 
 typedef struct block {
   // 16 Y blocks, 4 U blocks, 4 V blocks each with 16 entries
-  short *src_diff;
-  short *coeff;
+  int16_t *src_diff;
+  int16_t *coeff;
 
   // 16 Y blocks, 4 U blocks, 4 V blocks each with 16 entries
-  short *quant;
-  short *quant_fast;      // fast quant deprecated for now
-  unsigned char *quant_shift;
-  short *zbin;
-  short *zbin_8x8;
-  short *zbin_16x16;
+  int16_t *quant;
+  int16_t *quant_fast;      // fast quant deprecated for now
+  uint8_t *quant_shift;
+  int16_t *zbin;
+  int16_t *zbin_8x8;
+  int16_t *zbin_16x16;
 #if CONFIG_TX32X32 && CONFIG_SUPERBLOCKS
-  short *zbin_32x32;
+  int16_t *zbin_32x32;
 #endif
-  short *zrun_zbin_boost;
-  short *zrun_zbin_boost_8x8;
-  short *zrun_zbin_boost_16x16;
+  int16_t *zrun_zbin_boost;
+  int16_t *zrun_zbin_boost_8x8;
+  int16_t *zrun_zbin_boost_16x16;
 #if CONFIG_TX32X32 && CONFIG_SUPERBLOCKS
-  short *zrun_zbin_boost_32x32;
+  int16_t *zrun_zbin_boost_32x32;
 #endif
-  short *round;
+  int16_t *round;
 
   // Zbin Over Quant value
   short zbin_extra;
 
-  unsigned char **base_src;
-  unsigned char **base_second_src;
+  uint8_t **base_src;
+  uint8_t **base_second_src;
   int src;
   int src_stride;
 
@@ -94,16 +93,16 @@
 
 #if CONFIG_SUPERBLOCKS && CONFIG_TX32X32
 typedef struct superblock {
-  DECLARE_ALIGNED(16, short, src_diff[32*32+16*16*2]);
-  DECLARE_ALIGNED(16, short, coeff[32*32+16*16*2]);
+  DECLARE_ALIGNED(16, int16_t, src_diff[32*32+16*16*2]);
+  DECLARE_ALIGNED(16, int16_t, coeff[32*32+16*16*2]);
 } SUPERBLOCK;
 #endif
 
 typedef struct macroblock {
-  DECLARE_ALIGNED(16, short, src_diff[400]);  // 16x16 Y 8x8 U 8x8 V 4x4 2nd Y
-  DECLARE_ALIGNED(16, short, coeff[400]);     // 16x16 Y 8x8 U 8x8 V 4x4 2nd Y
+  DECLARE_ALIGNED(16, int16_t, src_diff[400]);  // 16x16 Y 8x8 U 8x8 V 4x4 2nd Y
+  DECLARE_ALIGNED(16, int16_t, coeff[400]);     // 16x16 Y 8x8 U 8x8 V 4x4 2nd Y
 #if !CONFIG_SUPERBLOCKS
-  DECLARE_ALIGNED(16, unsigned char, thismb[256]);    // 16x16 Y
+  DECLARE_ALIGNED(16, uint8_t, thismb[256]);    // 16x16 Y
 
   unsigned char *thismb_ptr;
 #endif
@@ -188,19 +187,17 @@
   PICK_MODE_CONTEXT sb_context[4];
 #endif
 
-  void (*vp9_short_fdct4x4)(short *input, short *output, int pitch);
-  void (*vp9_short_fdct8x4)(short *input, short *output, int pitch);
-  void (*short_walsh4x4)(short *input, short *output, int pitch);
+  void (*vp9_short_fdct4x4)(int16_t *input, int16_t *output, int pitch);
+  void (*vp9_short_fdct8x4)(int16_t *input, int16_t *output, int pitch);
+  void (*short_walsh4x4)(int16_t *input, int16_t *output, int pitch);
   void (*quantize_b_4x4)(BLOCK *b, BLOCKD *d);
   void (*quantize_b_4x4_pair)(BLOCK *b1, BLOCK *b2, BLOCKD *d0, BLOCKD *d1);
-  void (*vp9_short_fdct8x8)(short *input, short *output, int pitch);
-  void (*vp9_short_fdct16x16)(short *input, short *output, int pitch);
-  void (*short_fhaar2x2)(short *input, short *output, int pitch);
+  void (*vp9_short_fdct8x8)(int16_t *input, int16_t *output, int pitch);
+  void (*vp9_short_fdct16x16)(int16_t *input, int16_t *output, int pitch);
+  void (*short_fhaar2x2)(int16_t *input, int16_t *output, int pitch);
   void (*quantize_b_16x16)(BLOCK *b, BLOCKD *d);
   void (*quantize_b_8x8)(BLOCK *b, BLOCKD *d);
   void (*quantize_b_2x2)(BLOCK *b, BLOCKD *d);
-
 } MACROBLOCK;
 
-
-#endif
+#endif  // VP9_ENCODER_VP9_BLOCK_H_
--- a/vp9/encoder/vp9_boolhuff.h
+++ b/vp9/encoder/vp9_boolhuff.h
@@ -109,4 +109,4 @@
   br->range = range;
 }
 
-#endif
+#endif  // VP9_ENCODER_VP9_BOOLHUFF_H_
--- a/vp9/encoder/vp9_encodeframe.c
+++ b/vp9/encoder/vp9_encodeframe.c
@@ -80,7 +80,7 @@
  * Eventually this should be replaced by custom no-reference routines,
  *  which will be faster.
  */
-static const unsigned char VP9_VAR_OFFS[16] = {
+static const uint8_t VP9_VAR_OFFS[16] = {
   128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128
 };
 
@@ -1263,9 +1263,9 @@
     MODE_INFO *mic = xd->mode_info_context;
     PARTITION_INFO *pi = x->partition_info;
     signed char  *gfa = x->gf_active_ptr;
-    unsigned char *yb = x->src.y_buffer;
-    unsigned char *ub = x->src.u_buffer;
-    unsigned char *vb = x->src.v_buffer;
+    uint8_t *yb = x->src.y_buffer;
+    uint8_t *ub = x->src.u_buffer;
+    uint8_t *vb = x->src.v_buffer;
 #endif
 
 #if CONFIG_SUPERBLOCKS
--- a/vp9/encoder/vp9_encodeframe.h
+++ b/vp9/encoder/vp9_encodeframe.h
@@ -18,4 +18,4 @@
 
 extern void vp9_setup_block_ptrs(struct macroblock *x);
 
-#endif  // __INC_ENCODEFRAME_H
+#endif  // VP9_ENCODER_VP9_ENCODEFRAME_H_
--- a/vp9/encoder/vp9_encodeintra.h
+++ b/vp9/encoder/vp9_encodeintra.h
@@ -22,4 +22,4 @@
 void vp9_encode_intra8x8mbuv(MACROBLOCK *x);
 void vp9_encode_intra8x8(MACROBLOCK *x, int ib);
 
-#endif  // __ENCODEINTRA_H_
+#endif  // VP9_ENCODER_VP9_ENCODEINTRA_H_
--- a/vp9/encoder/vp9_encodemb.c
+++ b/vp9/encoder/vp9_encodemb.c
@@ -21,9 +21,9 @@
 #include "vp9_rtcd.h"
 
 void vp9_subtract_b_c(BLOCK *be, BLOCKD *bd, int pitch) {
-  unsigned char *src_ptr = (*(be->base_src) + be->src);
-  short *diff_ptr = be->src_diff;
-  unsigned char *pred_ptr = bd->predictor;
+  uint8_t *src_ptr = (*(be->base_src) + be->src);
+  int16_t *diff_ptr = be->src_diff;
+  uint8_t *pred_ptr = bd->predictor;
   int src_stride = be->src_stride;
 
   int r, c;
@@ -40,9 +40,9 @@
 }
 
 void vp9_subtract_4b_c(BLOCK *be, BLOCKD *bd, int pitch) {
-  unsigned char *src_ptr = (*(be->base_src) + be->src);
-  short *diff_ptr = be->src_diff;
-  unsigned char *pred_ptr = bd->predictor;
+  uint8_t *src_ptr = (*(be->base_src) + be->src);
+  int16_t *diff_ptr = be->src_diff;
+  uint8_t *pred_ptr = bd->predictor;
   int src_stride = be->src_stride;
   int r, c;
 
@@ -56,12 +56,12 @@
   }
 }
 
-void vp9_subtract_mbuv_s_c(short *diff, const unsigned char *usrc,
-                           const unsigned char *vsrc, int src_stride,
-                           const unsigned char *upred,
-                           const unsigned char *vpred, int dst_stride) {
-  short *udiff = diff + 256;
-  short *vdiff = diff + 320;
+void vp9_subtract_mbuv_s_c(int16_t *diff, const uint8_t *usrc,
+                           const uint8_t *vsrc, int src_stride,
+                           const uint8_t *upred,
+                           const uint8_t *vpred, int dst_stride) {
+  int16_t *udiff = diff + 256;
+  int16_t *vdiff = diff + 320;
   int r, c;
 
   for (r = 0; r < 8; r++) {
@@ -85,16 +85,16 @@
   }
 }
 
-void vp9_subtract_mbuv_c(short *diff, unsigned char *usrc,
-                         unsigned char *vsrc, unsigned char *pred, int stride) {
-  unsigned char *upred = pred + 256;
-  unsigned char *vpred = pred + 320;
+void vp9_subtract_mbuv_c(int16_t *diff, uint8_t *usrc,
+                         uint8_t *vsrc, uint8_t *pred, int stride) {
+  uint8_t *upred = pred + 256;
+  uint8_t *vpred = pred + 320;
 
   vp9_subtract_mbuv_s_c(diff, usrc, vsrc, stride, upred, vpred, 8);
 }
 
-void vp9_subtract_mby_s_c(short *diff, const unsigned char *src, int src_stride,
-                          const unsigned char *pred, int dst_stride) {
+void vp9_subtract_mby_s_c(int16_t *diff, const uint8_t *src, int src_stride,
+                          const uint8_t *pred, int dst_stride) {
   int r, c;
 
   for (r = 0; r < 16; r++) {
@@ -109,8 +109,8 @@
 }
 
 #if CONFIG_TX32X32 && CONFIG_SUPERBLOCKS
-void vp9_subtract_sby_s_c(short *diff, const unsigned char *src, int src_stride,
-                          const unsigned char *pred, int dst_stride) {
+void vp9_subtract_sby_s_c(int16_t *diff, const uint8_t *src, int src_stride,
+                          const uint8_t *pred, int dst_stride) {
   int r, c;
 
   for (r = 0; r < 32; r++) {
@@ -124,12 +124,12 @@
   }
 }
 
-void vp9_subtract_sbuv_s_c(short *diff, const unsigned char *usrc,
-                           const unsigned char *vsrc, int src_stride,
-                           const unsigned char *upred,
-                           const unsigned char *vpred, int dst_stride) {
-  short *udiff = diff + 1024;
-  short *vdiff = diff + 1024 + 256;
+void vp9_subtract_sbuv_s_c(int16_t *diff, const uint8_t *usrc,
+                           const uint8_t *vsrc, int src_stride,
+                           const uint8_t *upred,
+                           const uint8_t *vpred, int dst_stride) {
+  int16_t *udiff = diff + 1024;
+  int16_t *vdiff = diff + 1024 + 256;
   int r, c;
 
   for (r = 0; r < 16; r++) {
@@ -154,8 +154,8 @@
 }
 #endif
 
-void vp9_subtract_mby_c(short *diff, unsigned char *src,
-                        unsigned char *pred, int stride) {
+void vp9_subtract_mby_c(int16_t *diff, uint8_t *src,
+                        uint8_t *pred, int stride) {
   vp9_subtract_mby_s_c(diff, src, stride, pred, 16);
 }
 
@@ -169,7 +169,7 @@
 }
 
 static void build_dcblock_4x4(MACROBLOCK *x) {
-  short *src_diff_ptr = &x->src_diff[384];
+  int16_t *src_diff_ptr = &x->src_diff[384];
   int i;
 
   for (i = 0; i < 16; i++) {
@@ -368,9 +368,9 @@
   BLOCKD *d = &mb->e_mbd.block[i];
   vp9_token_state tokens[257][2];
   unsigned best_index[257][2];
-  const short *dequant_ptr = d->dequant, *coeff_ptr = b->coeff;
-  short *qcoeff_ptr = d->qcoeff;
-  short *dqcoeff_ptr = d->dqcoeff;
+  const int16_t *dequant_ptr = d->dequant, *coeff_ptr = b->coeff;
+  int16_t *qcoeff_ptr = d->qcoeff;
+  int16_t *dqcoeff_ptr = d->dqcoeff;
   int eob = d->eob, final_eob, sz = 0;
   int i0 = (type == PLANE_TYPE_Y_NO_DC);
   int rc, x, next;
--- a/vp9/encoder/vp9_encodemb.h
+++ b/vp9/encoder/vp9_encodemb.h
@@ -8,7 +8,6 @@
  *  be found in the AUTHORS file in the root of the source tree.
  */
 
-
 #ifndef VP9_ENCODER_VP9_ENCODEMB_H_
 #define VP9_ENCODER_VP9_ENCODEMB_H_
 
@@ -57,21 +56,21 @@
 void vp9_subtract_4b_c(BLOCK *be, BLOCKD *bd, int pitch);
 
 #if CONFIG_SUPERBLOCKS
-void vp9_subtract_mbuv_s_c(short *diff, const unsigned char *usrc,
-                           const unsigned char *vsrc, int src_stride,
-                           const unsigned char *upred,
-                           const unsigned char *vpred, int dst_stride);
-void vp9_subtract_mby_s_c(short *diff, const unsigned char *src,
-                          int src_stride, const unsigned char *pred,
+void vp9_subtract_mbuv_s_c(int16_t *diff, const uint8_t *usrc,
+                           const uint8_t *vsrc, int src_stride,
+                           const uint8_t *upred,
+                           const uint8_t *vpred, int dst_stride);
+void vp9_subtract_mby_s_c(int16_t *diff, const uint8_t *src,
+                          int src_stride, const uint8_t *pred,
                           int dst_stride);
 #if CONFIG_TX32X32
-void vp9_subtract_sby_s_c(short *diff, const unsigned char *src, int src_stride,
-                          const unsigned char *pred, int dst_stride);
-void vp9_subtract_sbuv_s_c(short *diff, const unsigned char *usrc,
-                           const unsigned char *vsrc, int src_stride,
-                           const unsigned char *upred,
-                           const unsigned char *vpred, int dst_stride);
-#endif
-#endif
+void vp9_subtract_sby_s_c(int16_t *diff, const uint8_t *src, int src_stride,
+                          const uint8_t *pred, int dst_stride);
+void vp9_subtract_sbuv_s_c(int16_t *diff, const uint8_t *usrc,
+                           const uint8_t *vsrc, int src_stride,
+                           const uint8_t *upred,
+                           const uint8_t *vpred, int dst_stride);
+#endif  // CONFIG_TX32X32
+#endif  // CONFIG_SUPERBLOCKS
 
-#endif
+#endif  // VP9_ENCODER_VP9_ENCODEMB_H_
--- a/vp9/encoder/vp9_encodemv.h
+++ b/vp9/encoder/vp9_encodemv.h
@@ -30,4 +30,5 @@
                           int_mv *best_ref_mv, int_mv *second_best_ref_mv);
 
 void print_nmvcounts(nmv_context_counts tnmvcounts);
-#endif
+
+#endif  // VP9_ENCODER_VP9_ENCODEMV_H_
--- a/vp9/encoder/vp9_firstpass.c
+++ b/vp9/encoder/vp9_firstpass.c
@@ -295,7 +295,7 @@
 static double simple_weight(YV12_BUFFER_CONFIG *source) {
   int i, j;
 
-  unsigned char *src = source->y_buffer;
+  uint8_t *src = source->y_buffer;
   double sum_weights = 0.0;
 
   // Loop throught the Y plane raw examining levels and creating a weight for the image
@@ -344,15 +344,15 @@
   BLOCK *b = &x->block[0];
   BLOCKD *d = &x->e_mbd.block[0];
 
-  unsigned char *src_ptr = (*(b->base_src) + b->src);
+  uint8_t *src_ptr = (*(b->base_src) + b->src);
   int src_stride = b->src_stride;
-  unsigned char *ref_ptr;
+  uint8_t *ref_ptr;
   int ref_stride = d->pre_stride;
 
   // Set up pointers for this macro block recon buffer
   xd->pre.y_buffer = recon_buffer->y_buffer + recon_yoffset;
 
-  ref_ptr = (unsigned char *)(*(d->base_pre) + d->pre);
+  ref_ptr = (uint8_t *)(*(d->base_pre) + d->pre);
 
   vp9_mse16x16(src_ptr, src_stride, ref_ptr, ref_stride,
                (unsigned int *)(best_motion_err));
--- a/vp9/encoder/vp9_firstpass.h
+++ b/vp9/encoder/vp9_firstpass.h
@@ -8,8 +8,7 @@
  *  be found in the AUTHORS file in the root of the source tree.
  */
 
-
-#if !defined __INC_FIRSTPASS_H
+#ifndef VP9_ENCODER_VP9_FIRSTPASS_H_
 #define VP9_ENCODER_VP9_FIRSTPASS_H_
 
 extern void vp9_init_first_pass(VP9_COMP *cpi);
@@ -20,4 +19,4 @@
 extern void vp9_second_pass(VP9_COMP *cpi);
 extern void vp9_end_second_pass(VP9_COMP *cpi);
 
-#endif
+#endif  // VP9_ENCODER_VP9_FIRSTPASS_H_
--- a/vp9/encoder/vp9_lookahead.h
+++ b/vp9/encoder/vp9_lookahead.h
@@ -7,8 +7,10 @@
  *  in the file PATENTS.  All contributing project authors may
  *  be found in the AUTHORS file in the root of the source tree.
  */
+
 #ifndef VP9_ENCODER_VP9_LOOKAHEAD_H_
 #define VP9_ENCODER_VP9_LOOKAHEAD_H_
+
 #include "vpx_scale/yv12config.h"
 #include "vpx/vpx_integer.h"
 
@@ -101,5 +103,4 @@
 unsigned int
 vp9_lookahead_depth(struct lookahead_ctx *ctx);
 
-
-#endif
+#endif  // VP9_ENCODER_VP9_LOOKAHEAD_H_
--- a/vp9/encoder/vp9_mbgraph.h
+++ b/vp9/encoder/vp9_mbgraph.h
@@ -13,4 +13,4 @@
 
 extern void vp9_update_mbgraph_stats(VP9_COMP *cpi);
 
-#endif /* __INC_MBGRAPH_H__ */
+#endif  // VP9_ENCODER_VP9_MBGRAPH_H_
--- a/vp9/encoder/vp9_mcomp.c
+++ b/vp9/encoder/vp9_mcomp.c
@@ -251,7 +251,7 @@
                                              int *mvjcost, int *mvcost[2],
                                              int *distortion,
                                              unsigned int *sse1) {
-  unsigned char *z = (*(b->base_src) + b->src);
+  uint8_t *z = (*(b->base_src) + b->src);
   MACROBLOCKD *xd = &x->e_mbd;
 
   int rr, rc, br, bc, hstep;
@@ -270,8 +270,9 @@
   int usehp = xd->allow_high_precision_mv;
 
 #if !CONFIG_SUPERBLOCKS && (ARCH_X86 || ARCH_X86_64)
-  unsigned char *y0 = *(d->base_pre) + d->pre + (bestmv->as_mv.row) * d->pre_stride + bestmv->as_mv.col;
-  unsigned char *y;
+  uint8_t *y0 = *(d->base_pre) + d->pre +
+                (bestmv->as_mv.row) * d->pre_stride + bestmv->as_mv.col;
+  uint8_t *y;
   int buf_r1, buf_r2, buf_c1, buf_c2;
 
   // Clamping to avoid out-of-range data access
@@ -289,7 +290,8 @@
   vfp->copymem(y0 - buf_c1 - d->pre_stride * buf_r1, d->pre_stride, xd->y_buf, y_stride, 16 + buf_r1 + buf_r2);
   y = xd->y_buf + y_stride * buf_r1 + buf_c1;
 #else
-  unsigned char *y = *(d->base_pre) + d->pre + (bestmv->as_mv.row) * d->pre_stride + bestmv->as_mv.col;
+  uint8_t *y = *(d->base_pre) + d->pre +
+               (bestmv->as_mv.row) * d->pre_stride + bestmv->as_mv.col;
   y_stride = d->pre_stride;
 #endif
 
@@ -454,7 +456,7 @@
   int_mv this_mv;
   int_mv orig_mv;
   int yrow_movedback = 0, ycol_movedback = 0;
-  unsigned char *z = (*(b->base_src) + b->src);
+  uint8_t *z = (*(b->base_src) + b->src);
   int left, right, up, down, diag;
   unsigned int sse;
   int whichdir;
@@ -464,8 +466,9 @@
   int usehp = xd->allow_high_precision_mv;
 
 #if !CONFIG_SUPERBLOCKS && (ARCH_X86 || ARCH_X86_64)
-  unsigned char *y0 = *(d->base_pre) + d->pre + (bestmv->as_mv.row) * d->pre_stride + bestmv->as_mv.col;
-  unsigned char *y;
+  uint8_t *y0 = *(d->base_pre) + d->pre +
+                (bestmv->as_mv.row) * d->pre_stride + bestmv->as_mv.col;
+  uint8_t *y;
 
   y_stride = 32;
   /* Copy 18 rows x 32 cols area to intermediate buffer before searching. */
@@ -472,7 +475,8 @@
   vfp->copymem(y0 - 1 - d->pre_stride, d->pre_stride, xd->y_buf, y_stride, 18);
   y = xd->y_buf + y_stride + 1;
 #else
-  unsigned char *y = *(d->base_pre) + d->pre + (bestmv->as_mv.row) * d->pre_stride + bestmv->as_mv.col;
+  uint8_t *y = *(d->base_pre) + d->pre +
+               (bestmv->as_mv.row) * d->pre_stride + bestmv->as_mv.col;
   y_stride = d->pre_stride;
 #endif
 
@@ -933,7 +937,7 @@
   int bestmse = INT_MAX;
   int_mv startmv;
   int_mv this_mv;
-  unsigned char *z = (*(b->base_src) + b->src);
+  uint8_t *z = (*(b->base_src) + b->src);
   int left, right, up, down, diag;
   unsigned int sse;
   int whichdir;
@@ -942,9 +946,9 @@
   MACROBLOCKD *xd = &x->e_mbd;
 
 #if !CONFIG_SUPERBLOCKS && (ARCH_X86 || ARCH_X86_64)
-  unsigned char *y0 = *(d->base_pre) + d->pre +
+  uint8_t *y0 = *(d->base_pre) + d->pre +
       (bestmv->as_mv.row) * d->pre_stride + bestmv->as_mv.col;
-  unsigned char *y;
+  uint8_t *y;
 
   y_stride = 32;
   /* Copy 18 rows x 32 cols area to intermediate buffer before searching. */
@@ -951,7 +955,7 @@
   vfp->copymem(y0 - 1 - d->pre_stride, d->pre_stride, xd->y_buf, y_stride, 18);
   y = xd->y_buf + y_stride + 1;
 #else
-  unsigned char *y = *(d->base_pre) + d->pre +
+  uint8_t *y = *(d->base_pre) + d->pre +
       (bestmv->as_mv.row) * d->pre_stride + bestmv->as_mv.col;
   y_stride = d->pre_stride;
 #endif
@@ -1118,7 +1122,7 @@
   MV neighbors[4] = {{0, -1}, { -1, 0}, {1, 0}, {0, 1}};
   int i, j;
 
-  unsigned char *what = (*(b->base_src) + b->src);
+  uint8_t *what = (*(b->base_src) + b->src);
   int what_stride = b->src_stride;
   int in_what_stride = d->pre_stride;
   int br, bc;
@@ -1125,8 +1129,8 @@
   int_mv this_mv;
   unsigned int bestsad = 0x7fffffff;
   unsigned int thissad;
-  unsigned char *base_offset;
-  unsigned char *this_offset;
+  uint8_t *base_offset;
+  uint8_t *this_offset;
   int k = -1;
   int all_in;
   int best_site = -1;
@@ -1141,7 +1145,7 @@
   bc = ref_mv->as_mv.col;
 
   // Work out the start point for the search
-  base_offset = (unsigned char *)(*(d->base_pre) + d->pre);
+  base_offset = (uint8_t *)(*(d->base_pre) + d->pre);
   this_offset = base_offset + (br * (d->pre_stride)) + bc;
   this_mv.as_mv.row = br;
   this_mv.as_mv.col = bc;
@@ -1264,11 +1268,11 @@
                              int *mvcost[2], int_mv *center_mv) {
   int i, j, step;
 
-  unsigned char *what = (*(b->base_src) + b->src);
+  uint8_t *what = (*(b->base_src) + b->src);
   int what_stride = b->src_stride;
-  unsigned char *in_what;
+  uint8_t *in_what;
   int in_what_stride = d->pre_stride;
-  unsigned char *best_address;
+  uint8_t *best_address;
 
   int tot_steps;
   int_mv this_mv;
@@ -1281,7 +1285,7 @@
   int this_row_offset, this_col_offset;
   search_site *ss;
 
-  unsigned char *check_here;
+  uint8_t *check_here;
   int thissad;
   MACROBLOCKD *xd = &x->e_mbd;
   int_mv fcenter_mv;
@@ -1300,7 +1304,8 @@
   best_mv->as_mv.col = ref_col;
 
   // Work out the start point for the search
-  in_what = (unsigned char *)(*(d->base_pre) + d->pre + (ref_row * (d->pre_stride)) + ref_col);
+  in_what = (uint8_t *)(*(d->base_pre) + d->pre +
+                        (ref_row * (d->pre_stride)) + ref_col);
   best_address = in_what;
 
   // Check the starting position
@@ -1374,11 +1379,11 @@
                              int *mvjcost, int *mvcost[2], int_mv *center_mv) {
   int i, j, step;
 
-  unsigned char *what = (*(b->base_src) + b->src);
+  uint8_t *what = (*(b->base_src) + b->src);
   int what_stride = b->src_stride;
-  unsigned char *in_what;
+  uint8_t *in_what;
   int in_what_stride = d->pre_stride;
-  unsigned char *best_address;
+  uint8_t *best_address;
 
   int tot_steps;
   int_mv this_mv;
@@ -1393,7 +1398,7 @@
   int this_col_offset;
   search_site *ss;
 
-  unsigned char *check_here;
+  uint8_t *check_here;
   unsigned int thissad;
   MACROBLOCKD *xd = &x->e_mbd;
   int_mv fcenter_mv;
@@ -1412,7 +1417,8 @@
   best_mv->as_mv.col = ref_col;
 
   // Work out the start point for the search
-  in_what = (unsigned char *)(*(d->base_pre) + d->pre + (ref_row * (d->pre_stride)) + ref_col);
+  in_what = (uint8_t *)(*(d->base_pre) + d->pre +
+                        (ref_row * (d->pre_stride)) + ref_col);
   best_address = in_what;
 
   // Check the starting position
@@ -1580,18 +1586,18 @@
                           vp9_variance_fn_ptr_t *fn_ptr, int *mvjcost,
                           int *mvcost[2],
                           int_mv *center_mv) {
-  unsigned char *what = (*(b->base_src) + b->src);
+  uint8_t *what = (*(b->base_src) + b->src);
   int what_stride = b->src_stride;
-  unsigned char *in_what;
+  uint8_t *in_what;
   int in_what_stride = d->pre_stride;
   int mv_stride = d->pre_stride;
-  unsigned char *bestaddress;
+  uint8_t *bestaddress;
   int_mv *best_mv = &d->bmi.as_mv.first;
   int_mv this_mv;
   int bestsad = INT_MAX;
   int r, c;
 
-  unsigned char *check_here;
+  uint8_t *check_here;
   int thissad;
   MACROBLOCKD *xd = &x->e_mbd;
 
@@ -1675,18 +1681,18 @@
                           int sad_per_bit, int distance,
                           vp9_variance_fn_ptr_t *fn_ptr, int *mvjcost,
                           int *mvcost[2], int_mv *center_mv) {
-  unsigned char *what = (*(b->base_src) + b->src);
+  uint8_t *what = (*(b->base_src) + b->src);
   int what_stride = b->src_stride;
-  unsigned char *in_what;
+  uint8_t *in_what;
   int in_what_stride = d->pre_stride;
   int mv_stride = d->pre_stride;
-  unsigned char *bestaddress;
+  uint8_t *bestaddress;
   int_mv *best_mv = &d->bmi.as_mv.first;
   int_mv this_mv;
   unsigned int bestsad = INT_MAX;
   int r, c;
 
-  unsigned char *check_here;
+  uint8_t *check_here;
   unsigned int thissad;
   MACROBLOCKD *xd = &x->e_mbd;
 
@@ -1804,18 +1810,18 @@
                           vp9_variance_fn_ptr_t *fn_ptr,
                           int *mvjcost, int *mvcost[2],
                           int_mv *center_mv) {
-  unsigned char *what = (*(b->base_src) + b->src);
+  uint8_t *what = (*(b->base_src) + b->src);
   int what_stride = b->src_stride;
-  unsigned char *in_what;
+  uint8_t *in_what;
   int in_what_stride = d->pre_stride;
   int mv_stride = d->pre_stride;
-  unsigned char *bestaddress;
+  uint8_t *bestaddress;
   int_mv *best_mv = &d->bmi.as_mv.first;
   int_mv this_mv;
   unsigned int bestsad = INT_MAX;
   int r, c;
 
-  unsigned char *check_here;
+  uint8_t *check_here;
   unsigned int thissad;
   MACROBLOCKD *xd = &x->e_mbd;
 
@@ -1827,7 +1833,7 @@
   int col_min = ref_col - distance;
   int col_max = ref_col + distance;
 
-  DECLARE_ALIGNED_ARRAY(16, unsigned short, sad_array8, 8);
+  DECLARE_ALIGNED_ARRAY(16, uint16_t, sad_array8, 8);
   unsigned int sad_array[3];
   int_mv fcenter_mv;
 
@@ -1959,14 +1965,15 @@
                               int *mvjcost, int *mvcost[2], int_mv *center_mv) {
   MV neighbors[4] = {{ -1, 0}, {0, -1}, {0, 1}, {1, 0}};
   int i, j;
-  short this_row_offset, this_col_offset;
+  int this_row_offset, this_col_offset;
 
   int what_stride = b->src_stride;
   int in_what_stride = d->pre_stride;
-  unsigned char *what = (*(b->base_src) + b->src);
-  unsigned char *best_address = (unsigned char *)(*(d->base_pre) + d->pre +
-                                                  (ref_mv->as_mv.row * (d->pre_stride)) + ref_mv->as_mv.col);
-  unsigned char *check_here;
+  uint8_t *what = (*(b->base_src) + b->src);
+  uint8_t *best_address = (uint8_t *)(*(d->base_pre) + d->pre +
+                                      (ref_mv->as_mv.row * (d->pre_stride)) +
+                                      ref_mv->as_mv.col);
+  uint8_t *check_here;
   unsigned int thissad;
   int_mv this_mv;
   unsigned int bestsad = INT_MAX;
@@ -2036,14 +2043,15 @@
                               int *mvjcost, int *mvcost[2], int_mv *center_mv) {
   MV neighbors[4] = {{ -1, 0}, {0, -1}, {0, 1}, {1, 0}};
   int i, j;
-  short this_row_offset, this_col_offset;
+  int this_row_offset, this_col_offset;
 
   int what_stride = b->src_stride;
   int in_what_stride = d->pre_stride;
-  unsigned char *what = (*(b->base_src) + b->src);
-  unsigned char *best_address = (unsigned char *)(*(d->base_pre) + d->pre +
-                                                  (ref_mv->as_mv.row * (d->pre_stride)) + ref_mv->as_mv.col);
-  unsigned char *check_here;
+  uint8_t *what = (*(b->base_src) + b->src);
+  uint8_t *best_address = (uint8_t *)(*(d->base_pre) + d->pre +
+                                      (ref_mv->as_mv.row * (d->pre_stride)) +
+                                      ref_mv->as_mv.col);
+  uint8_t *check_here;
   unsigned int thissad;
   int_mv this_mv;
   unsigned int bestsad = INT_MAX;
--- a/vp9/encoder/vp9_mcomp.h
+++ b/vp9/encoder/vp9_mcomp.h
@@ -83,4 +83,4 @@
                                        int_mv *center_mv);
 
 
-#endif
+#endif  // VP9_ENCODER_VP9_MCOMP_H_
--- a/vp9/encoder/vp9_modecosts.h
+++ b/vp9/encoder/vp9_modecosts.h
@@ -14,4 +14,4 @@
 
 void vp9_init_mode_costs(VP9_COMP *x);
 
-#endif
+#endif  // VP9_ENCODER_VP9_MODECOSTS_H_
--- a/vp9/encoder/vp9_onyx_if.c
+++ b/vp9/encoder/vp9_onyx_if.c
@@ -2294,8 +2294,8 @@
 }
 
 
-static uint64_t calc_plane_error(unsigned char *orig, int orig_stride,
-                                 unsigned char *recon, int recon_stride,
+static uint64_t calc_plane_error(uint8_t *orig, int orig_stride,
+                                 uint8_t *recon, int recon_stride,
                                  unsigned int cols, unsigned int rows) {
   unsigned int row, col;
   uint64_t total_sse = 0;
@@ -2311,9 +2311,9 @@
 
     /* Handle odd-sized width */
     if (col < cols) {
-      unsigned int   border_row, border_col;
-      unsigned char *border_orig = orig;
-      unsigned char *border_recon = recon;
+      unsigned int border_row, border_col;
+      uint8_t *border_orig = orig;
+      uint8_t *border_recon = recon;
 
       for (border_row = 0; border_row < 16; border_row++) {
         for (border_col = col; border_col < cols; border_col++) {
@@ -2472,7 +2472,7 @@
 
 #ifdef OUTPUT_YUV_SRC
 void vp9_write_yuv_frame(YV12_BUFFER_CONFIG *s) {
-  unsigned char *src = s->y_buffer;
+  uint8_t *src = s->y_buffer;
   int h = s->y_height;
 
   do {
@@ -2501,7 +2501,7 @@
 #ifdef OUTPUT_YUV_REC
 void vp9_write_yuv_rec_frame(VP9_COMMON *cm) {
   YV12_BUFFER_CONFIG *s = cm->frame_to_show;
-  unsigned char *src = s->y_buffer;
+  uint8_t *src = s->y_buffer;
   int h = cm->Height;
 
   do {
@@ -2674,9 +2674,9 @@
   int i, j;
   int num_edge_pels = 0;
   int num_pels = (frame->y_height - 2) * (frame->y_width - 2);
-  unsigned char *prev = frame->y_buffer + 1;
-  unsigned char *curr = frame->y_buffer + 1 + frame->y_stride;
-  unsigned char *next = frame->y_buffer + 1 + 2 * frame->y_stride;
+  uint8_t *prev = frame->y_buffer + 1;
+  uint8_t *curr = frame->y_buffer + 1 + frame->y_stride;
+  uint8_t *next = frame->y_buffer + 1 + 2 * frame->y_stride;
   for (i = 1; i < frame->y_height - 1; i++) {
     for (j = 1; j < frame->y_width - 1; j++) {
       /* Sobel hor and ver gradients */
@@ -2887,13 +2887,10 @@
 }
 #endif
 
-static void encode_frame_to_data_rate
-(
-  VP9_COMP *cpi,
-  unsigned long *size,
-  unsigned char *dest,
-  unsigned int *frame_flags
-) {
+static void encode_frame_to_data_rate(VP9_COMP *cpi,
+                                      unsigned long *size,
+                                      unsigned char *dest,
+                                      unsigned int *frame_flags) {
   VP9_COMMON *cm = &cpi->common;
   MACROBLOCKD *xd = &cpi->mb.e_mbd;
 
@@ -3189,7 +3186,7 @@
 #if CONFIG_POSTPROC
 
   if (cpi->oxcf.noise_sensitivity > 0) {
-    unsigned char *src;
+    uint8_t *src;
     int l = 0;
 
     switch (cpi->oxcf.noise_sensitivity) {
@@ -4473,8 +4470,8 @@
   int i, j;
   int Total = 0;
 
-  unsigned char *src = source->y_buffer;
-  unsigned char *dst = dest->y_buffer;
+  uint8_t *src = source->y_buffer;
+  uint8_t *dst = dest->y_buffer;
 
   // Loop through the Y plane raw and reconstruction data summing (square differences)
   for (i = 0; i < source->y_height; i += 16) {
--- a/vp9/encoder/vp9_onyx_int.h
+++ b/vp9/encoder/vp9_onyx_int.h
@@ -835,4 +835,5 @@
                          "Failed to allocate "#lval);\
   } while(0)
 #endif
-#endif  // __INC_ONYX_INT_H
+
+#endif  // VP9_ENCODER_VP9_ONYX_INT_H_
--- a/vp9/encoder/vp9_picklpf.c
+++ b/vp9/encoder/vp9_picklpf.c
@@ -21,7 +21,7 @@
 
 void vp9_yv12_copy_partial_frame_c(YV12_BUFFER_CONFIG *src_ybc,
                                    YV12_BUFFER_CONFIG *dst_ybc, int Fraction) {
-  unsigned char *src_y, *dst_y;
+  uint8_t *src_y, *dst_y;
   int yheight;
   int ystride;
   int border;
@@ -51,8 +51,8 @@
   int i, j;
   int Total = 0;
   int srcoffset, dstoffset;
-  unsigned char *src = source->y_buffer;
-  unsigned char *dst = dest->y_buffer;
+  uint8_t *src = source->y_buffer;
+  uint8_t *dst = dest->y_buffer;
 
   int linestocopy = (source->y_height >> (Fraction + 4));
 
--- a/vp9/encoder/vp9_picklpf.h
+++ b/vp9/encoder/vp9_picklpf.h
@@ -23,4 +23,4 @@
 extern void vp9_pick_filter_level(struct yv12_buffer_config *sd,
                                   struct VP9_COMP *cpi);
 
-#endif  // __INC_PICKLPF_H
+#endif  // VP9_ENCODER_VP9_PICKLPF_H_
--- a/vp9/encoder/vp9_psnr.h
+++ b/vp9/encoder/vp9_psnr.h
@@ -14,4 +14,4 @@
 
 extern double vp9_mse2psnr(double Samples, double Peak, double Mse);
 
-#endif
+#endif  // VP9_ENCODER_VP9_PSNR_H_
--- a/vp9/encoder/vp9_quantize.c
+++ b/vp9/encoder/vp9_quantize.c
@@ -25,29 +25,29 @@
   int i, rc, eob;
   int zbin;
   int x, y, z, sz;
-  short *zbin_boost_ptr  = b->zrun_zbin_boost;
-  short *coeff_ptr       = b->coeff;
-  short *zbin_ptr        = b->zbin;
-  short *round_ptr       = b->round;
-  short *quant_ptr       = b->quant;
-  unsigned char *quant_shift_ptr = b->quant_shift;
-  short *qcoeff_ptr      = d->qcoeff;
-  short *dqcoeff_ptr     = d->dqcoeff;
-  short *dequant_ptr     = d->dequant;
-  short zbin_oq_value    = b->zbin_extra;
+  int16_t *zbin_boost_ptr  = b->zrun_zbin_boost;
+  int16_t *coeff_ptr       = b->coeff;
+  int16_t *zbin_ptr        = b->zbin;
+  int16_t *round_ptr       = b->round;
+  int16_t *quant_ptr       = b->quant;
+  uint8_t *quant_shift_ptr = b->quant_shift;
+  int16_t *qcoeff_ptr      = d->qcoeff;
+  int16_t *dqcoeff_ptr     = d->dqcoeff;
+  int16_t *dequant_ptr     = d->dequant;
+  int zbin_oq_value        = b->zbin_extra;
 
   int const *pt_scan ;
 
   switch (tx_type) {
-    case ADST_DCT :
+    case ADST_DCT:
       pt_scan = vp9_row_scan_4x4;
       break;
 
-    case DCT_ADST :
+    case DCT_ADST:
       pt_scan = vp9_col_scan_4x4;
       break;
 
-    default :
+    default:
       pt_scan = vp9_default_zig_zag1d_4x4;
       break;
   }
@@ -89,16 +89,16 @@
   int i, rc, eob;
   int zbin;
   int x, y, z, sz;
-  short *zbin_boost_ptr  = b->zrun_zbin_boost;
-  short *coeff_ptr       = b->coeff;
-  short *zbin_ptr        = b->zbin;
-  short *round_ptr       = b->round;
-  short *quant_ptr       = b->quant;
-  unsigned char *quant_shift_ptr = b->quant_shift;
-  short *qcoeff_ptr      = d->qcoeff;
-  short *dqcoeff_ptr     = d->dqcoeff;
-  short *dequant_ptr     = d->dequant;
-  short zbin_oq_value    = b->zbin_extra;
+  int16_t *zbin_boost_ptr  = b->zrun_zbin_boost;
+  int16_t *coeff_ptr       = b->coeff;
+  int16_t *zbin_ptr        = b->zbin;
+  int16_t *round_ptr       = b->round;
+  int16_t *quant_ptr       = b->quant;
+  uint8_t *quant_shift_ptr = b->quant_shift;
+  int16_t *qcoeff_ptr      = d->qcoeff;
+  int16_t *dqcoeff_ptr     = d->dqcoeff;
+  int16_t *dequant_ptr     = d->dequant;
+  int zbin_oq_value        = b->zbin_extra;
 
   vpx_memset(qcoeff_ptr, 0, 32);
   vpx_memset(dqcoeff_ptr, 0, 32);
@@ -174,17 +174,17 @@
   int i, rc, eob;
   int zbin;
   int x, y, z, sz;
-  short *zbin_boost_ptr = b->zrun_zbin_boost;
+  int16_t *zbin_boost_ptr = b->zrun_zbin_boost;
   int zbin_zrun_index = 0;
-  short *coeff_ptr  = b->coeff;
-  short *zbin_ptr   = b->zbin;
-  short *round_ptr  = b->round;
-  short *quant_ptr  = b->quant;
-  unsigned char *quant_shift_ptr = b->quant_shift;
-  short *qcoeff_ptr = d->qcoeff;
-  short *dqcoeff_ptr = d->dqcoeff;
-  short *dequant_ptr = d->dequant;
-  short zbin_oq_value = b->zbin_extra;
+  int16_t *coeff_ptr  = b->coeff;
+  int16_t *zbin_ptr   = b->zbin;
+  int16_t *round_ptr  = b->round;
+  int16_t *quant_ptr  = b->quant;
+  uint8_t *quant_shift_ptr = b->quant_shift;
+  int16_t *qcoeff_ptr = d->qcoeff;
+  int16_t *dqcoeff_ptr = d->dqcoeff;
+  int16_t *dequant_ptr = d->dequant;
+  int zbin_oq_value    = b->zbin_extra;
   // double q2nd = 4;
   vpx_memset(qcoeff_ptr, 0, 32);
   vpx_memset(dqcoeff_ptr, 0, 32);
@@ -224,19 +224,19 @@
   int i, rc, eob;
   int zbin;
   int x, y, z, sz;
-  short *zbin_boost_ptr = b->zrun_zbin_boost_8x8;
-  short *coeff_ptr  = b->coeff;
-  short *zbin_ptr   = b->zbin_8x8;
-  short *round_ptr  = b->round;
-  short *quant_ptr  = b->quant;
-  unsigned char *quant_shift_ptr = b->quant_shift;
-  short *qcoeff_ptr = d->qcoeff;
-  short *dqcoeff_ptr = d->dqcoeff;
-  short *dequant_ptr = d->dequant;
-  short zbin_oq_value = b->zbin_extra;
+  int16_t *zbin_boost_ptr = b->zrun_zbin_boost_8x8;
+  int16_t *coeff_ptr  = b->coeff;
+  int16_t *zbin_ptr   = b->zbin_8x8;
+  int16_t *round_ptr  = b->round;
+  int16_t *quant_ptr  = b->quant;
+  uint8_t *quant_shift_ptr = b->quant_shift;
+  int16_t *qcoeff_ptr = d->qcoeff;
+  int16_t *dqcoeff_ptr = d->dqcoeff;
+  int16_t *dequant_ptr = d->dequant;
+  int zbin_oq_value = b->zbin_extra;
 
-  vpx_memset(qcoeff_ptr, 0, 64 * sizeof(short));
-  vpx_memset(dqcoeff_ptr, 0, 64 * sizeof(short));
+  vpx_memset(qcoeff_ptr, 0, 64 * sizeof(int16_t));
+  vpx_memset(dqcoeff_ptr, 0, 64 * sizeof(int16_t));
 
   eob = -1;
 
@@ -323,20 +323,20 @@
   vp9_quantize_mbuv_8x8(x);
 }
 
-static void quantize(short *zbin_boost_orig_ptr,
-                     short *coeff_ptr, int n_coeffs, int max_coeffs,
-                     short *zbin_ptr, short *round_ptr, short *quant_ptr,
-                     unsigned char *quant_shift_ptr,
-                     short *qcoeff_ptr, short *dqcoeff_ptr,
-                     short *dequant_ptr, short zbin_oq_value,
+static void quantize(int16_t *zbin_boost_orig_ptr,
+                     int16_t *coeff_ptr, int n_coeffs, int max_coeffs,
+                     int16_t *zbin_ptr, int16_t *round_ptr, int16_t *quant_ptr,
+                     uint8_t *quant_shift_ptr,
+                     int16_t *qcoeff_ptr, int16_t *dqcoeff_ptr,
+                     int16_t *dequant_ptr, int zbin_oq_value,
                      int *eob_ptr, const int *scan, int mul) {
   int i, rc, eob;
   int zbin;
   int x, y, z, sz;
-  short *zbin_boost_ptr = zbin_boost_orig_ptr;
+  int16_t *zbin_boost_ptr = zbin_boost_orig_ptr;
 
-  vpx_memset(qcoeff_ptr, 0, n_coeffs*sizeof(short));
-  vpx_memset(dqcoeff_ptr, 0, n_coeffs*sizeof(short));
+  vpx_memset(qcoeff_ptr, 0, n_coeffs*sizeof(int16_t));
+  vpx_memset(dqcoeff_ptr, 0, n_coeffs*sizeof(int16_t));
 
   eob = -1;
   for (i = 0; i < max_coeffs; i++) {
@@ -425,8 +425,8 @@
   vp9_regular_quantize_b_4x4(b2, d2);
 }
 
-static void invert_quant(short *quant,
-                         unsigned char *shift, short d) {
+static void invert_quant(int16_t *quant,
+                         uint8_t *shift, int d) {
   unsigned t;
   int l;
   t = d;
@@ -433,7 +433,7 @@
   for (l = 0; t > 1; l++)
     t >>= 1;
   t = 1 + (1 << (16 + l)) / d;
-  *quant = (short)(t - (1 << 16));
+  *quant = (int16_t)(t - (1 << 16));
   *shift = l;
 }
 
@@ -738,7 +738,7 @@
 #if CONFIG_TX32X32 && CONFIG_SUPERBLOCKS
     x->block[i].zrun_zbin_boost_32x32 = cpi->zrun_zbin_boost_y1_32x32[QIndex];
 #endif
-    x->block[i].zbin_extra = (short)zbin_extra;
+    x->block[i].zbin_extra = (int16_t)zbin_extra;
 
     // Segment max eob offset feature.
     if (vp9_segfeature_active(xd, segment_id, SEG_LVL_EOB)) {
@@ -780,7 +780,7 @@
     x->block[i].zrun_zbin_boost_8x8 = cpi->zrun_zbin_boost_uv_8x8[QIndex];
     x->block[i].zrun_zbin_boost_16x16 = cpi->zrun_zbin_boost_uv_16x16[QIndex];
 
-    x->block[i].zbin_extra = (short)zbin_extra;
+    x->block[i].zbin_extra = (int16_t)zbin_extra;
 
     // Segment max eob offset feature.
     if (vp9_segfeature_active(xd, segment_id, SEG_LVL_EOB)) {
@@ -813,7 +813,7 @@
   x->block[24].zrun_zbin_boost = cpi->zrun_zbin_boost_y2[QIndex];
   x->block[24].zrun_zbin_boost_8x8 = cpi->zrun_zbin_boost_y2_8x8[QIndex];
   x->block[24].zrun_zbin_boost_16x16 = cpi->zrun_zbin_boost_y2_16x16[QIndex];
-  x->block[24].zbin_extra = (short)zbin_extra;
+  x->block[24].zbin_extra = (int16_t)zbin_extra;
 
   // TBD perhaps not use for Y2
   // Segment max eob offset feature.
@@ -842,7 +842,7 @@
                  cpi->zbin_mode_boost +
                  x->act_zbin_adj)) >> 7;
   for (i = 0; i < 16; i++) {
-    x->block[i].zbin_extra = (short)zbin_extra;
+    x->block[i].zbin_extra = (int16_t)zbin_extra;
   }
 
   // UV
@@ -852,7 +852,7 @@
                  x->act_zbin_adj)) >> 7;
 
   for (i = 16; i < 24; i++) {
-    x->block[i].zbin_extra = (short)zbin_extra;
+    x->block[i].zbin_extra = (int16_t)zbin_extra;
   }
 
   // Y2
@@ -861,7 +861,7 @@
                  cpi->zbin_mode_boost +
                  x->act_zbin_adj)) >> 7;
 
-  x->block[24].zbin_extra = (short)zbin_extra;
+  x->block[24].zbin_extra = (int16_t)zbin_extra;
 }
 
 void vp9_frame_init_quantizer(VP9_COMP *cpi) {
--- a/vp9/encoder/vp9_quantize.h
+++ b/vp9/encoder/vp9_quantize.h
@@ -95,4 +95,4 @@
 
 extern void vp9_init_quantizer(struct VP9_COMP *cpi);
 
-#endif
+#endif  // VP9_ENCODER_VP9_QUANTIZE_H_
--- a/vp9/encoder/vp9_ratectrl.h
+++ b/vp9/encoder/vp9_ratectrl.h
@@ -35,4 +35,4 @@
 extern int vp9_bits_per_mb(FRAME_TYPE frame_type, int qindex);
 void vp9_setup_inter_frame(VP9_COMP *cpi);
 
-#endif
+#endif  // VP9_ENCODER_VP9_RATECTRL_H_
--- a/vp9/encoder/vp9_rdopt.c
+++ b/vp9/encoder/vp9_rdopt.c
@@ -403,7 +403,7 @@
   }
 }
 
-int vp9_block_error_c(short *coeff, short *dqcoeff, int block_size) {
+int vp9_block_error_c(int16_t *coeff, int16_t *dqcoeff, int block_size) {
   int i, error = 0;
 
   for (i = 0; i < block_size; i++) {
@@ -469,9 +469,9 @@
 }
 
 int vp9_uvsse(MACROBLOCK *x) {
-  unsigned char *uptr, *vptr;
-  unsigned char *upred_ptr = (*(x->block[16].base_src) + x->block[16].src);
-  unsigned char *vpred_ptr = (*(x->block[20].base_src) + x->block[20].src);
+  uint8_t *uptr, *vptr;
+  uint8_t *upred_ptr = (*(x->block[16].base_src) + x->block[16].src);
+  uint8_t *vpred_ptr = (*(x->block[20].base_src) + x->block[20].src);
   int uv_stride = x->block[16].src_stride;
 
   unsigned int sse1 = 0;
@@ -520,7 +520,7 @@
   int eob = b->eob;
   int pt;    /* surrounding block/prev coef predictor */
   int cost = 0;
-  short *qcoeff_ptr = b->qcoeff;
+  int16_t *qcoeff_ptr = b->qcoeff;
 
   VP9_COMBINEENTROPYCONTEXTS(pt, *a, *l);
   assert(eob <= 4);
@@ -550,7 +550,7 @@
   int cost = 0, default_eob, seg_eob;
   int pt;                     /* surrounding block/prev coef predictor */
   int const *scan, *band;
-  short *qcoeff_ptr = b->qcoeff;
+  int16_t *qcoeff_ptr = b->qcoeff;
   MACROBLOCKD *xd = &mb->e_mbd;
   MB_MODE_INFO *mbmi = &mb->e_mbd.mode_info_context->mbmi;
   TX_TYPE tx_type = DCT_DCT;
@@ -928,7 +928,7 @@
                            txfm_cache, TX_16X16);
 }
 
-static void copy_predictor(unsigned char *dst, const unsigned char *predictor) {
+static void copy_predictor(uint8_t *dst, const uint8_t *predictor) {
   const unsigned int *p = (const unsigned int *)predictor;
   unsigned int *d = (unsigned int *)dst;
   d[0] = p[0];
@@ -951,7 +951,8 @@
   return cost_coeffs(x, xd->block, PLANE_TYPE_Y_WITH_DC, ta, tl, TX_32X32);
 }
 
-static int vp9_sb_block_error_c(short *coeff, short *dqcoeff, int block_size) {
+static int vp9_sb_block_error_c(int16_t *coeff, int16_t *dqcoeff,
+                                int block_size) {
   int i;
   int64_t error = 0;
 
@@ -970,7 +971,7 @@
   MACROBLOCKD * const xd = &x->e_mbd;
   SUPERBLOCKD * const xd_sb = &xd->sb_coeff_data;
 #if DEBUG_ERROR || CONFIG_DWT32X32HYBRID
-  short out[1024];
+  int16_t out[1024];
 #endif
 
   vp9_transform_sby_32x32(x);
@@ -1079,7 +1080,7 @@
 }
 #endif
 
-static void copy_predictor_8x8(unsigned char *dst, const unsigned char *predictor) {
+static void copy_predictor_8x8(uint8_t *dst, const uint8_t *predictor) {
   const unsigned int *p = (const unsigned int *)predictor;
   unsigned int *d = (unsigned int *)dst;
   d[0] = p[0];
@@ -1129,8 +1130,8 @@
    * a temp buffer that meets the stride requirements, but we are only
    * interested in the left 4x4 block
    * */
-  DECLARE_ALIGNED_ARRAY(16, unsigned char,  best_predictor, 16 * 4);
-  DECLARE_ALIGNED_ARRAY(16, short, best_dqcoeff, 16);
+  DECLARE_ALIGNED_ARRAY(16, uint8_t, best_predictor, 16 * 4);
+  DECLARE_ALIGNED_ARRAY(16, int16_t, best_dqcoeff, 16);
 
 #if CONFIG_NEWBINTRAMODES
   b->bmi.as_mode.context = vp9_find_bpred_context(b);
@@ -1488,8 +1489,8 @@
    * a temp buffer that meets the stride requirements, but we are only
    * interested in the left 8x8 block
    * */
-  DECLARE_ALIGNED_ARRAY(16, unsigned char,  best_predictor, 16 * 8);
-  DECLARE_ALIGNED_ARRAY(16, short, best_dqcoeff, 16 * 4);
+  DECLARE_ALIGNED_ARRAY(16, uint8_t, best_predictor, 16 * 8);
+  DECLARE_ALIGNED_ARRAY(16, int16_t, best_dqcoeff, 16 * 4);
 
   // perform transformation of dimension 8x8
   // note the input and output index mapping
@@ -2921,7 +2922,7 @@
 }
 
 static void mv_pred(VP9_COMP *cpi, MACROBLOCK *x,
-                    unsigned char *ref_y_buffer, int ref_y_stride,
+                    uint8_t *ref_y_buffer, int ref_y_stride,
                     int ref_frame, enum BlockSize block_size ) {
   MACROBLOCKD *xd = &x->e_mbd;
   MB_MODE_INFO *mbmi = &xd->mode_info_context->mbmi;
@@ -2933,8 +2934,8 @@
   int this_sad = INT_MAX;
 
   BLOCK *b = &x->block[0];
-  unsigned char *src_y_ptr = *(b->base_src);
-  unsigned char *ref_y_ptr;
+  uint8_t *src_y_ptr = *(b->base_src);
+  uint8_t *ref_y_ptr;
   int row_offset, col_offset;
 
   // Get the sad for each candidate reference mv
@@ -3182,9 +3183,9 @@
                                int_mv frame_nearest_mv[MAX_REF_FRAMES],
                                int_mv frame_near_mv[MAX_REF_FRAMES],
                                int frame_mdcounts[4][4],
-                               unsigned char *y_buffer[4],
-                               unsigned char *u_buffer[4],
-                               unsigned char *v_buffer[4]) {
+                               uint8_t *y_buffer[4],
+                               uint8_t *u_buffer[4],
+                               uint8_t *v_buffer[4]) {
   YV12_BUFFER_CONFIG *yv12 = &cpi->common.yv12_fb[idx];
   MACROBLOCKD *const xd = &x->e_mbd;
   MB_MODE_INFO *const mbmi = &xd->mode_info_context->mbmi;
@@ -3557,7 +3558,7 @@
 
   int_mv frame_mv[MB_MODE_COUNT][MAX_REF_FRAMES];
   int frame_mdcounts[4][4];
-  unsigned char *y_buffer[4], *u_buffer[4], *v_buffer[4];
+  uint8_t *y_buffer[4], *u_buffer[4], *v_buffer[4];
 
   unsigned int ref_costs[MAX_REF_FRAMES];
   int_mv seg_mvs[NB_PARTITIONINGS][16 /* n_blocks */][MAX_REF_FRAMES - 1];
@@ -4501,9 +4502,9 @@
   int comp_pred, i;
   int_mv frame_mv[MB_MODE_COUNT][MAX_REF_FRAMES];
   int frame_mdcounts[4][4];
-  unsigned char *y_buffer[4];
-  unsigned char *u_buffer[4];
-  unsigned char *v_buffer[4];
+  uint8_t *y_buffer[4];
+  uint8_t *u_buffer[4];
+  uint8_t *v_buffer[4];
   static const int flag_list[4] = { 0, VP9_LAST_FLAG, VP9_GOLD_FLAG,
                                     VP9_ALT_FLAG };
   int idx_list[4] = { 0, cpi->common.lst_fb_idx, cpi->common.gld_fb_idx,
--- a/vp9/encoder/vp9_rdopt.h
+++ b/vp9/encoder/vp9_rdopt.h
@@ -38,4 +38,4 @@
 extern void vp9_set_mbmode_and_mvs(MACROBLOCK *x,
                                    MB_PREDICTION_MODE mb, int_mv *mv);
 
-#endif
+#endif  // VP9_ENCODER_VP9_RDOPT_H_
--- a/vp9/encoder/vp9_sad_c.c
+++ b/vp9/encoder/vp9_sad_c.c
@@ -14,25 +14,25 @@
 #include "vpx_ports/config.h"
 #include "vpx/vpx_integer.h"
 
-unsigned int vp9_sad32x32_c(const unsigned char *src_ptr,
+unsigned int vp9_sad32x32_c(const uint8_t *src_ptr,
                             int  src_stride,
-                            const unsigned char *ref_ptr,
+                            const uint8_t *ref_ptr,
                             int  ref_stride,
                             int max_sad) {
   return sad_mx_n_c(src_ptr, src_stride, ref_ptr, ref_stride, 32, 32);
 }
 
-unsigned int vp9_sad16x16_c(const unsigned char *src_ptr,
+unsigned int vp9_sad16x16_c(const uint8_t *src_ptr,
                             int  src_stride,
-                            const unsigned char *ref_ptr,
+                            const uint8_t *ref_ptr,
                             int  ref_stride,
                             int max_sad) {
   return sad_mx_n_c(src_ptr, src_stride, ref_ptr, ref_stride, 16, 16);
 }
 
-unsigned int vp9_sad8x8_c(const unsigned char *src_ptr,
+unsigned int vp9_sad8x8_c(const uint8_t *src_ptr,
                           int  src_stride,
-                          const unsigned char *ref_ptr,
+                          const uint8_t *ref_ptr,
                           int  ref_stride,
                           int max_sad) {
   return sad_mx_n_c(src_ptr, src_stride, ref_ptr, ref_stride, 8, 8);
@@ -39,17 +39,17 @@
 }
 
 
-unsigned int vp9_sad16x8_c(const unsigned char *src_ptr,
+unsigned int vp9_sad16x8_c(const uint8_t *src_ptr,
                            int  src_stride,
-                           const unsigned char *ref_ptr,
+                           const uint8_t *ref_ptr,
                            int  ref_stride,
                            int max_sad) {
   return sad_mx_n_c(src_ptr, src_stride, ref_ptr, ref_stride, 16, 8);
 }
 
-unsigned int vp9_sad8x16_c(const unsigned char *src_ptr,
+unsigned int vp9_sad8x16_c(const uint8_t *src_ptr,
                            int  src_stride,
-                           const unsigned char *ref_ptr,
+                           const uint8_t *ref_ptr,
                            int  ref_stride,
                            int max_sad) {
   return sad_mx_n_c(src_ptr, src_stride, ref_ptr, ref_stride, 8, 16);
@@ -56,20 +56,19 @@
 }
 
 
-unsigned int vp9_sad4x4_c(const unsigned char *src_ptr,
+unsigned int vp9_sad4x4_c(const uint8_t *src_ptr,
                           int  src_stride,
-                          const unsigned char *ref_ptr,
+                          const uint8_t *ref_ptr,
                           int  ref_stride,
                           int max_sad) {
   return sad_mx_n_c(src_ptr, src_stride, ref_ptr, ref_stride, 4, 4);
 }
 
-void vp9_sad32x32x3_c(const unsigned char *src_ptr,
+void vp9_sad32x32x3_c(const uint8_t *src_ptr,
                       int  src_stride,
-                      const unsigned char *ref_ptr,
+                      const uint8_t *ref_ptr,
                       int  ref_stride,
-                      unsigned int *sad_array
-                      ) {
+                      unsigned int *sad_array) {
   sad_array[0] = vp9_sad32x32_c(src_ptr, src_stride,
                                 ref_ptr, ref_stride, 0x7fffffff);
   sad_array[1] = vp9_sad32x32_c(src_ptr, src_stride,
@@ -78,41 +77,40 @@
                                 ref_ptr + 2, ref_stride, 0x7fffffff);
 }
 
-void vp9_sad32x32x8_c(const unsigned char *src_ptr,
+void vp9_sad32x32x8_c(const uint8_t *src_ptr,
                       int  src_stride,
-                      const unsigned char *ref_ptr,
+                      const uint8_t *ref_ptr,
                       int  ref_stride,
-                      unsigned short *sad_array
-                      ) {
-  sad_array[0] = (unsigned short)vp9_sad32x32_c(src_ptr, src_stride,
-                                                ref_ptr, ref_stride,
-                                                0x7fffffff);
-  sad_array[1] = (unsigned short)vp9_sad32x32_c(src_ptr, src_stride,
-                                                ref_ptr + 1, ref_stride,
-                                                0x7fffffff);
-  sad_array[2] = (unsigned short)vp9_sad32x32_c(src_ptr, src_stride,
-                                                ref_ptr + 2, ref_stride,
-                                                0x7fffffff);
-  sad_array[3] = (unsigned short)vp9_sad32x32_c(src_ptr, src_stride,
-                                                ref_ptr + 3, ref_stride,
-                                                0x7fffffff);
-  sad_array[4] = (unsigned short)vp9_sad32x32_c(src_ptr, src_stride,
-                                                ref_ptr + 4, ref_stride,
-                                                0x7fffffff);
-  sad_array[5] = (unsigned short)vp9_sad32x32_c(src_ptr, src_stride,
-                                                ref_ptr + 5, ref_stride,
-                                                0x7fffffff);
-  sad_array[6] = (unsigned short)vp9_sad32x32_c(src_ptr, src_stride,
-                                                ref_ptr + 6, ref_stride,
-                                                0x7fffffff);
-  sad_array[7] = (unsigned short)vp9_sad32x32_c(src_ptr, src_stride,
-                                                ref_ptr + 7, ref_stride,
-                                                0x7fffffff);
+                      uint16_t *sad_array) {
+  sad_array[0] = (uint16_t)vp9_sad32x32_c(src_ptr, src_stride,
+                                          ref_ptr, ref_stride,
+                                          0x7fffffff);
+  sad_array[1] = (uint16_t)vp9_sad32x32_c(src_ptr, src_stride,
+                                          ref_ptr + 1, ref_stride,
+                                          0x7fffffff);
+  sad_array[2] = (uint16_t)vp9_sad32x32_c(src_ptr, src_stride,
+                                          ref_ptr + 2, ref_stride,
+                                          0x7fffffff);
+  sad_array[3] = (uint16_t)vp9_sad32x32_c(src_ptr, src_stride,
+                                          ref_ptr + 3, ref_stride,
+                                          0x7fffffff);
+  sad_array[4] = (uint16_t)vp9_sad32x32_c(src_ptr, src_stride,
+                                          ref_ptr + 4, ref_stride,
+                                          0x7fffffff);
+  sad_array[5] = (uint16_t)vp9_sad32x32_c(src_ptr, src_stride,
+                                          ref_ptr + 5, ref_stride,
+                                          0x7fffffff);
+  sad_array[6] = (uint16_t)vp9_sad32x32_c(src_ptr, src_stride,
+                                          ref_ptr + 6, ref_stride,
+                                          0x7fffffff);
+  sad_array[7] = (uint16_t)vp9_sad32x32_c(src_ptr, src_stride,
+                                          ref_ptr + 7, ref_stride,
+                                          0x7fffffff);
 }
 
-void vp9_sad16x16x3_c(const unsigned char *src_ptr,
+void vp9_sad16x16x3_c(const uint8_t *src_ptr,
                       int  src_stride,
-                      const unsigned char *ref_ptr,
+                      const uint8_t *ref_ptr,
                       int  ref_stride,
                       unsigned int *sad_array) {
   sad_array[0] = vp9_sad16x16_c(src_ptr, src_stride,
@@ -123,40 +121,40 @@
                                 ref_ptr + 2, ref_stride, 0x7fffffff);
 }
 
-void vp9_sad16x16x8_c(const unsigned char *src_ptr,
+void vp9_sad16x16x8_c(const uint8_t *src_ptr,
                       int  src_stride,
-                      const unsigned char *ref_ptr,
+                      const uint8_t *ref_ptr,
                       int  ref_stride,
-                      unsigned short *sad_array) {
-  sad_array[0] = (unsigned short)vp9_sad16x16_c(src_ptr, src_stride,
-                                                ref_ptr, ref_stride,
-                                                0x7fffffff);
-  sad_array[1] = (unsigned short)vp9_sad16x16_c(src_ptr, src_stride,
-                                                ref_ptr + 1, ref_stride,
-                                                0x7fffffff);
-  sad_array[2] = (unsigned short)vp9_sad16x16_c(src_ptr, src_stride,
-                                                ref_ptr + 2, ref_stride,
-                                                0x7fffffff);
-  sad_array[3] = (unsigned short)vp9_sad16x16_c(src_ptr, src_stride,
-                                                ref_ptr + 3, ref_stride,
-                                                0x7fffffff);
-  sad_array[4] = (unsigned short)vp9_sad16x16_c(src_ptr, src_stride,
-                                                ref_ptr + 4, ref_stride,
-                                                0x7fffffff);
-  sad_array[5] = (unsigned short)vp9_sad16x16_c(src_ptr, src_stride,
-                                                ref_ptr + 5, ref_stride,
-                                                0x7fffffff);
-  sad_array[6] = (unsigned short)vp9_sad16x16_c(src_ptr, src_stride,
-                                                ref_ptr + 6, ref_stride,
-                                                0x7fffffff);
-  sad_array[7] = (unsigned short)vp9_sad16x16_c(src_ptr, src_stride,
-                                                ref_ptr + 7, ref_stride,
-                                                0x7fffffff);
+                      uint16_t *sad_array) {
+  sad_array[0] = (uint16_t)vp9_sad16x16_c(src_ptr, src_stride,
+                                          ref_ptr, ref_stride,
+                                          0x7fffffff);
+  sad_array[1] = (uint16_t)vp9_sad16x16_c(src_ptr, src_stride,
+                                          ref_ptr + 1, ref_stride,
+                                          0x7fffffff);
+  sad_array[2] = (uint16_t)vp9_sad16x16_c(src_ptr, src_stride,
+                                          ref_ptr + 2, ref_stride,
+                                          0x7fffffff);
+  sad_array[3] = (uint16_t)vp9_sad16x16_c(src_ptr, src_stride,
+                                          ref_ptr + 3, ref_stride,
+                                          0x7fffffff);
+  sad_array[4] = (uint16_t)vp9_sad16x16_c(src_ptr, src_stride,
+                                          ref_ptr + 4, ref_stride,
+                                          0x7fffffff);
+  sad_array[5] = (uint16_t)vp9_sad16x16_c(src_ptr, src_stride,
+                                          ref_ptr + 5, ref_stride,
+                                          0x7fffffff);
+  sad_array[6] = (uint16_t)vp9_sad16x16_c(src_ptr, src_stride,
+                                          ref_ptr + 6, ref_stride,
+                                          0x7fffffff);
+  sad_array[7] = (uint16_t)vp9_sad16x16_c(src_ptr, src_stride,
+                                          ref_ptr + 7, ref_stride,
+                                          0x7fffffff);
 }
 
-void vp9_sad16x8x3_c(const unsigned char *src_ptr,
+void vp9_sad16x8x3_c(const uint8_t *src_ptr,
                      int  src_stride,
-                     const unsigned char *ref_ptr,
+                     const uint8_t *ref_ptr,
                      int  ref_stride,
                      unsigned int *sad_array) {
   sad_array[0] = vp9_sad16x8_c(src_ptr, src_stride,
@@ -167,40 +165,40 @@
                                ref_ptr + 2, ref_stride, 0x7fffffff);
 }
 
-void vp9_sad16x8x8_c(const unsigned char *src_ptr,
+void vp9_sad16x8x8_c(const uint8_t *src_ptr,
                      int  src_stride,
-                     const unsigned char *ref_ptr,
+                     const uint8_t *ref_ptr,
                      int  ref_stride,
-                     unsigned short *sad_array) {
-  sad_array[0] = (unsigned short)vp9_sad16x8_c(src_ptr, src_stride,
-                                               ref_ptr, ref_stride,
-                                               0x7fffffff);
-  sad_array[1] = (unsigned short)vp9_sad16x8_c(src_ptr, src_stride,
-                                               ref_ptr + 1, ref_stride,
-                                               0x7fffffff);
-  sad_array[2] = (unsigned short)vp9_sad16x8_c(src_ptr, src_stride,
-                                               ref_ptr + 2, ref_stride,
-                                               0x7fffffff);
-  sad_array[3] = (unsigned short)vp9_sad16x8_c(src_ptr, src_stride,
-                                               ref_ptr + 3, ref_stride,
-                                               0x7fffffff);
-  sad_array[4] = (unsigned short)vp9_sad16x8_c(src_ptr, src_stride,
-                                               ref_ptr + 4, ref_stride,
-                                               0x7fffffff);
-  sad_array[5] = (unsigned short)vp9_sad16x8_c(src_ptr, src_stride,
-                                               ref_ptr + 5, ref_stride,
-                                               0x7fffffff);
-  sad_array[6] = (unsigned short)vp9_sad16x8_c(src_ptr, src_stride,
-                                               ref_ptr + 6, ref_stride,
-                                               0x7fffffff);
-  sad_array[7] = (unsigned short)vp9_sad16x8_c(src_ptr, src_stride,
-                                               ref_ptr + 7, ref_stride,
-                                               0x7fffffff);
+                     uint16_t *sad_array) {
+  sad_array[0] = (uint16_t)vp9_sad16x8_c(src_ptr, src_stride,
+                                         ref_ptr, ref_stride,
+                                         0x7fffffff);
+  sad_array[1] = (uint16_t)vp9_sad16x8_c(src_ptr, src_stride,
+                                         ref_ptr + 1, ref_stride,
+                                         0x7fffffff);
+  sad_array[2] = (uint16_t)vp9_sad16x8_c(src_ptr, src_stride,
+                                         ref_ptr + 2, ref_stride,
+                                         0x7fffffff);
+  sad_array[3] = (uint16_t)vp9_sad16x8_c(src_ptr, src_stride,
+                                         ref_ptr + 3, ref_stride,
+                                         0x7fffffff);
+  sad_array[4] = (uint16_t)vp9_sad16x8_c(src_ptr, src_stride,
+                                         ref_ptr + 4, ref_stride,
+                                         0x7fffffff);
+  sad_array[5] = (uint16_t)vp9_sad16x8_c(src_ptr, src_stride,
+                                         ref_ptr + 5, ref_stride,
+                                         0x7fffffff);
+  sad_array[6] = (uint16_t)vp9_sad16x8_c(src_ptr, src_stride,
+                                         ref_ptr + 6, ref_stride,
+                                         0x7fffffff);
+  sad_array[7] = (uint16_t)vp9_sad16x8_c(src_ptr, src_stride,
+                                         ref_ptr + 7, ref_stride,
+                                         0x7fffffff);
 }
 
-void vp9_sad8x8x3_c(const unsigned char *src_ptr,
+void vp9_sad8x8x3_c(const uint8_t *src_ptr,
                     int  src_stride,
-                    const unsigned char *ref_ptr,
+                    const uint8_t *ref_ptr,
                     int  ref_stride,
                     unsigned int *sad_array) {
   sad_array[0] = vp9_sad8x8_c(src_ptr, src_stride,
@@ -211,40 +209,40 @@
                               ref_ptr + 2, ref_stride, 0x7fffffff);
 }
 
-void vp9_sad8x8x8_c(const unsigned char *src_ptr,
+void vp9_sad8x8x8_c(const uint8_t *src_ptr,
                     int  src_stride,
-                    const unsigned char *ref_ptr,
+                    const uint8_t *ref_ptr,
                     int  ref_stride,
-                    unsigned short *sad_array) {
-  sad_array[0] = (unsigned short)vp9_sad8x8_c(src_ptr, src_stride,
-                                              ref_ptr, ref_stride,
-                                              0x7fffffff);
-  sad_array[1] = (unsigned short)vp9_sad8x8_c(src_ptr, src_stride,
-                                              ref_ptr + 1, ref_stride,
-                                              0x7fffffff);
-  sad_array[2] = (unsigned short)vp9_sad8x8_c(src_ptr, src_stride,
-                                              ref_ptr + 2, ref_stride,
-                                              0x7fffffff);
-  sad_array[3] = (unsigned short)vp9_sad8x8_c(src_ptr, src_stride,
-                                              ref_ptr + 3, ref_stride,
-                                              0x7fffffff);
-  sad_array[4] = (unsigned short)vp9_sad8x8_c(src_ptr, src_stride,
-                                              ref_ptr + 4, ref_stride,
-                                              0x7fffffff);
-  sad_array[5] = (unsigned short)vp9_sad8x8_c(src_ptr, src_stride,
-                                              ref_ptr + 5, ref_stride,
-                                              0x7fffffff);
-  sad_array[6] = (unsigned short)vp9_sad8x8_c(src_ptr, src_stride,
-                                              ref_ptr + 6, ref_stride,
-                                              0x7fffffff);
-  sad_array[7] = (unsigned short)vp9_sad8x8_c(src_ptr, src_stride,
-                                              ref_ptr + 7, ref_stride,
-                                              0x7fffffff);
+                    uint16_t *sad_array) {
+  sad_array[0] = (uint16_t)vp9_sad8x8_c(src_ptr, src_stride,
+                                        ref_ptr, ref_stride,
+                                        0x7fffffff);
+  sad_array[1] = (uint16_t)vp9_sad8x8_c(src_ptr, src_stride,
+                                        ref_ptr + 1, ref_stride,
+                                        0x7fffffff);
+  sad_array[2] = (uint16_t)vp9_sad8x8_c(src_ptr, src_stride,
+                                        ref_ptr + 2, ref_stride,
+                                        0x7fffffff);
+  sad_array[3] = (uint16_t)vp9_sad8x8_c(src_ptr, src_stride,
+                                        ref_ptr + 3, ref_stride,
+                                        0x7fffffff);
+  sad_array[4] = (uint16_t)vp9_sad8x8_c(src_ptr, src_stride,
+                                        ref_ptr + 4, ref_stride,
+                                        0x7fffffff);
+  sad_array[5] = (uint16_t)vp9_sad8x8_c(src_ptr, src_stride,
+                                        ref_ptr + 5, ref_stride,
+                                        0x7fffffff);
+  sad_array[6] = (uint16_t)vp9_sad8x8_c(src_ptr, src_stride,
+                                        ref_ptr + 6, ref_stride,
+                                        0x7fffffff);
+  sad_array[7] = (uint16_t)vp9_sad8x8_c(src_ptr, src_stride,
+                                        ref_ptr + 7, ref_stride,
+                                        0x7fffffff);
 }
 
-void vp9_sad8x16x3_c(const unsigned char *src_ptr,
+void vp9_sad8x16x3_c(const uint8_t *src_ptr,
                      int  src_stride,
-                     const unsigned char *ref_ptr,
+                     const uint8_t *ref_ptr,
                      int  ref_stride,
                      unsigned int *sad_array) {
   sad_array[0] = vp9_sad8x16_c(src_ptr, src_stride,
@@ -255,40 +253,40 @@
                                ref_ptr + 2, ref_stride, 0x7fffffff);
 }
 
-void vp9_sad8x16x8_c(const unsigned char *src_ptr,
+void vp9_sad8x16x8_c(const uint8_t *src_ptr,
                      int  src_stride,
-                     const unsigned char *ref_ptr,
+                     const uint8_t *ref_ptr,
                      int  ref_stride,
-                     unsigned short *sad_array) {
-  sad_array[0] = (unsigned short)vp9_sad8x16_c(src_ptr, src_stride,
-                                               ref_ptr, ref_stride,
-                                               0x7fffffff);
-  sad_array[1] = (unsigned short)vp9_sad8x16_c(src_ptr, src_stride,
-                                               ref_ptr + 1, ref_stride,
-                                               0x7fffffff);
-  sad_array[2] = (unsigned short)vp9_sad8x16_c(src_ptr, src_stride,
-                                               ref_ptr + 2, ref_stride,
-                                               0x7fffffff);
-  sad_array[3] = (unsigned short)vp9_sad8x16_c(src_ptr, src_stride,
-                                               ref_ptr + 3, ref_stride,
-                                               0x7fffffff);
-  sad_array[4] = (unsigned short)vp9_sad8x16_c(src_ptr, src_stride,
-                                               ref_ptr + 4, ref_stride,
-                                               0x7fffffff);
-  sad_array[5] = (unsigned short)vp9_sad8x16_c(src_ptr, src_stride,
-                                               ref_ptr + 5, ref_stride,
-                                               0x7fffffff);
-  sad_array[6] = (unsigned short)vp9_sad8x16_c(src_ptr, src_stride,
-                                               ref_ptr + 6, ref_stride,
-                                               0x7fffffff);
-  sad_array[7] = (unsigned short)vp9_sad8x16_c(src_ptr, src_stride,
-                                               ref_ptr + 7, ref_stride,
-                                               0x7fffffff);
+                     uint16_t *sad_array) {
+  sad_array[0] = (uint16_t)vp9_sad8x16_c(src_ptr, src_stride,
+                                         ref_ptr, ref_stride,
+                                         0x7fffffff);
+  sad_array[1] = (uint16_t)vp9_sad8x16_c(src_ptr, src_stride,
+                                         ref_ptr + 1, ref_stride,
+                                         0x7fffffff);
+  sad_array[2] = (uint16_t)vp9_sad8x16_c(src_ptr, src_stride,
+                                         ref_ptr + 2, ref_stride,
+                                         0x7fffffff);
+  sad_array[3] = (uint16_t)vp9_sad8x16_c(src_ptr, src_stride,
+                                         ref_ptr + 3, ref_stride,
+                                         0x7fffffff);
+  sad_array[4] = (uint16_t)vp9_sad8x16_c(src_ptr, src_stride,
+                                         ref_ptr + 4, ref_stride,
+                                         0x7fffffff);
+  sad_array[5] = (uint16_t)vp9_sad8x16_c(src_ptr, src_stride,
+                                         ref_ptr + 5, ref_stride,
+                                         0x7fffffff);
+  sad_array[6] = (uint16_t)vp9_sad8x16_c(src_ptr, src_stride,
+                                         ref_ptr + 6, ref_stride,
+                                         0x7fffffff);
+  sad_array[7] = (uint16_t)vp9_sad8x16_c(src_ptr, src_stride,
+                                         ref_ptr + 7, ref_stride,
+                                         0x7fffffff);
 }
 
-void vp9_sad4x4x3_c(const unsigned char *src_ptr,
+void vp9_sad4x4x3_c(const uint8_t *src_ptr,
                     int  src_stride,
-                    const unsigned char *ref_ptr,
+                    const uint8_t *ref_ptr,
                     int  ref_stride,
                     unsigned int *sad_array) {
   sad_array[0] = vp9_sad4x4_c(src_ptr, src_stride,
@@ -299,43 +297,42 @@
                               ref_ptr + 2, ref_stride, 0x7fffffff);
 }
 
-void vp9_sad4x4x8_c(const unsigned char *src_ptr,
+void vp9_sad4x4x8_c(const uint8_t *src_ptr,
                     int  src_stride,
-                    const unsigned char *ref_ptr,
+                    const uint8_t *ref_ptr,
                     int  ref_stride,
-                    unsigned short *sad_array) {
-  sad_array[0] = (unsigned short)vp9_sad4x4_c(src_ptr, src_stride,
-                                              ref_ptr, ref_stride,
-                                              0x7fffffff);
-  sad_array[1] = (unsigned short)vp9_sad4x4_c(src_ptr, src_stride,
-                                              ref_ptr + 1, ref_stride,
-                                              0x7fffffff);
-  sad_array[2] = (unsigned short)vp9_sad4x4_c(src_ptr, src_stride,
-                                              ref_ptr + 2, ref_stride,
-                                              0x7fffffff);
-  sad_array[3] = (unsigned short)vp9_sad4x4_c(src_ptr, src_stride,
-                                              ref_ptr + 3, ref_stride,
-                                              0x7fffffff);
-  sad_array[4] = (unsigned short)vp9_sad4x4_c(src_ptr, src_stride,
-                                              ref_ptr + 4, ref_stride,
-                                              0x7fffffff);
-  sad_array[5] = (unsigned short)vp9_sad4x4_c(src_ptr, src_stride,
-                                              ref_ptr + 5, ref_stride,
-                                              0x7fffffff);
-  sad_array[6] = (unsigned short)vp9_sad4x4_c(src_ptr, src_stride,
-                                              ref_ptr + 6, ref_stride,
-                                              0x7fffffff);
-  sad_array[7] = (unsigned short)vp9_sad4x4_c(src_ptr, src_stride,
-                                              ref_ptr + 7, ref_stride,
-                                              0x7fffffff);
+                    uint16_t *sad_array) {
+  sad_array[0] = (uint16_t)vp9_sad4x4_c(src_ptr, src_stride,
+                                        ref_ptr, ref_stride,
+                                        0x7fffffff);
+  sad_array[1] = (uint16_t)vp9_sad4x4_c(src_ptr, src_stride,
+                                        ref_ptr + 1, ref_stride,
+                                        0x7fffffff);
+  sad_array[2] = (uint16_t)vp9_sad4x4_c(src_ptr, src_stride,
+                                        ref_ptr + 2, ref_stride,
+                                        0x7fffffff);
+  sad_array[3] = (uint16_t)vp9_sad4x4_c(src_ptr, src_stride,
+                                        ref_ptr + 3, ref_stride,
+                                        0x7fffffff);
+  sad_array[4] = (uint16_t)vp9_sad4x4_c(src_ptr, src_stride,
+                                        ref_ptr + 4, ref_stride,
+                                        0x7fffffff);
+  sad_array[5] = (uint16_t)vp9_sad4x4_c(src_ptr, src_stride,
+                                        ref_ptr + 5, ref_stride,
+                                        0x7fffffff);
+  sad_array[6] = (uint16_t)vp9_sad4x4_c(src_ptr, src_stride,
+                                        ref_ptr + 6, ref_stride,
+                                        0x7fffffff);
+  sad_array[7] = (uint16_t)vp9_sad4x4_c(src_ptr, src_stride,
+                                        ref_ptr + 7, ref_stride,
+                                        0x7fffffff);
 }
 
-void vp9_sad32x32x4d_c(const unsigned char *src_ptr,
+void vp9_sad32x32x4d_c(const uint8_t *src_ptr,
                        int  src_stride,
-                       unsigned char *ref_ptr[],
+                       uint8_t *ref_ptr[],
                        int  ref_stride,
-                       unsigned int *sad_array
-                       ) {
+                       unsigned int *sad_array) {
   sad_array[0] = vp9_sad32x32_c(src_ptr, src_stride,
                                 ref_ptr[0], ref_stride, 0x7fffffff);
   sad_array[1] = vp9_sad32x32_c(src_ptr, src_stride,
@@ -346,9 +343,9 @@
                                 ref_ptr[3], ref_stride, 0x7fffffff);
 }
 
-void vp9_sad16x16x4d_c(const unsigned char *src_ptr,
+void vp9_sad16x16x4d_c(const uint8_t *src_ptr,
                        int  src_stride,
-                       unsigned char *ref_ptr[],
+                       uint8_t *ref_ptr[],
                        int  ref_stride,
                        unsigned int *sad_array) {
   sad_array[0] = vp9_sad16x16_c(src_ptr, src_stride,
@@ -361,9 +358,9 @@
                                 ref_ptr[3], ref_stride, 0x7fffffff);
 }
 
-void vp9_sad16x8x4d_c(const unsigned char *src_ptr,
+void vp9_sad16x8x4d_c(const uint8_t *src_ptr,
                       int  src_stride,
-                      unsigned char *ref_ptr[],
+                      uint8_t *ref_ptr[],
                       int  ref_stride,
                       unsigned int *sad_array) {
   sad_array[0] = vp9_sad16x8_c(src_ptr, src_stride,
@@ -376,9 +373,9 @@
                                ref_ptr[3], ref_stride, 0x7fffffff);
 }
 
-void vp9_sad8x8x4d_c(const unsigned char *src_ptr,
+void vp9_sad8x8x4d_c(const uint8_t *src_ptr,
                      int  src_stride,
-                     unsigned char *ref_ptr[],
+                     uint8_t *ref_ptr[],
                      int  ref_stride,
                      unsigned int *sad_array) {
   sad_array[0] = vp9_sad8x8_c(src_ptr, src_stride,
@@ -391,9 +388,9 @@
                               ref_ptr[3], ref_stride, 0x7fffffff);
 }
 
-void vp9_sad8x16x4d_c(const unsigned char *src_ptr,
+void vp9_sad8x16x4d_c(const uint8_t *src_ptr,
                       int  src_stride,
-                      unsigned char *ref_ptr[],
+                      uint8_t *ref_ptr[],
                       int  ref_stride,
                       unsigned int *sad_array) {
   sad_array[0] = vp9_sad8x16_c(src_ptr, src_stride,
@@ -406,9 +403,9 @@
                                ref_ptr[3], ref_stride, 0x7fffffff);
 }
 
-void vp9_sad4x4x4d_c(const unsigned char *src_ptr,
+void vp9_sad4x4x4d_c(const uint8_t *src_ptr,
                      int  src_stride,
-                     unsigned char *ref_ptr[],
+                     uint8_t *ref_ptr[],
                      int  ref_stride,
                      unsigned int *sad_array) {
   sad_array[0] = vp9_sad4x4_c(src_ptr, src_stride,
@@ -422,9 +419,9 @@
 }
 
 /* Copy 2 macroblocks to a buffer */
-void vp9_copy32xn_c(unsigned char *src_ptr,
+void vp9_copy32xn_c(uint8_t *src_ptr,
                     int  src_stride,
-                    unsigned char *dst_ptr,
+                    uint8_t *dst_ptr,
                     int  dst_stride,
                     int height) {
   int r;
--- a/vp9/encoder/vp9_satd_c.c
+++ b/vp9/encoder/vp9_satd_c.c
@@ -11,16 +11,17 @@
 #include <stdlib.h>
 #include "vpx_ports/mem.h"
 #include "./vp9_rtcd.h"
-unsigned int vp9_satd16x16_c(const unsigned char *src_ptr,
+
+unsigned int vp9_satd16x16_c(const uint8_t *src_ptr,
                              int  src_stride,
-                             const unsigned char *ref_ptr,
+                             const uint8_t *ref_ptr,
                              int  ref_stride,
                              unsigned int *psatd) {
   int r, c, i;
   unsigned int satd = 0;
-  DECLARE_ALIGNED(16, short, diff_in[256]);
-  DECLARE_ALIGNED(16, short, diff_out[16]);
-  short *in;
+  DECLARE_ALIGNED(16, int16_t, diff_in[256]);
+  DECLARE_ALIGNED(16, int16_t, diff_out[16]);
+  int16_t *in;
 
   for (r = 0; r < 16; r++) {
     for (c = 0; c < 16; c++) {
--- a/vp9/encoder/vp9_segmentation.h
+++ b/vp9/encoder/vp9_segmentation.h
@@ -43,4 +43,4 @@
 
 extern void vp9_choose_segmap_coding_method(VP9_COMP *cpi);
 
-#endif /* __INC_SEGMENTATION_H__ */
+#endif  // VP9_ENCODER_VP9_SEGMENTATION_H_
--- a/vp9/encoder/vp9_ssim.c
+++ b/vp9/encoder/vp9_ssim.c
@@ -11,7 +11,7 @@
 
 #include "vp9/encoder/vp9_onyx_int.h"
 
-void vp9_ssim_parms_16x16_c(unsigned char *s, int sp, unsigned char *r,
+void vp9_ssim_parms_16x16_c(uint8_t *s, int sp, uint8_t *r,
                             int rp, unsigned long *sum_s, unsigned long *sum_r,
                             unsigned long *sum_sq_s, unsigned long *sum_sq_r,
                             unsigned long *sum_sxr) {
@@ -26,7 +26,7 @@
     }
   }
 }
-void vp9_ssim_parms_8x8_c(unsigned char *s, int sp, unsigned char *r, int rp,
+void vp9_ssim_parms_8x8_c(uint8_t *s, int sp, uint8_t *r, int rp,
                           unsigned long *sum_s, unsigned long *sum_r,
                           unsigned long *sum_sq_s, unsigned long *sum_sq_r,
                           unsigned long *sum_sxr) {
@@ -65,13 +65,13 @@
   return ssim_n * 1.0 / ssim_d;
 }
 
-static double ssim_16x16(unsigned char *s, int sp, unsigned char *r, int rp) {
+static double ssim_16x16(uint8_t *s, int sp, uint8_t *r, int rp) {
   unsigned long sum_s = 0, sum_r = 0, sum_sq_s = 0, sum_sq_r = 0, sum_sxr = 0;
   vp9_ssim_parms_16x16(s, sp, r, rp, &sum_s, &sum_r, &sum_sq_s, &sum_sq_r,
                        &sum_sxr);
   return similarity(sum_s, sum_r, sum_sq_s, sum_sq_r, sum_sxr, 256);
 }
-static double ssim_8x8(unsigned char *s, int sp, unsigned char *r, int rp) {
+static double ssim_8x8(uint8_t *s, int sp, uint8_t *r, int rp) {
   unsigned long sum_s = 0, sum_r = 0, sum_sq_s = 0, sum_sq_r = 0, sum_sxr = 0;
   vp9_ssim_parms_8x8(s, sp, r, rp, &sum_s, &sum_r, &sum_sq_s, &sum_sq_r,
                      &sum_sxr);
@@ -81,7 +81,7 @@
 // We are using a 8x8 moving window with starting location of each 8x8 window
 // on the 4x4 pixel grid. Such arrangement allows the windows to overlap
 // block boundaries to penalize blocking artifacts.
-double vp9_ssim2(unsigned char *img1, unsigned char *img2, int stride_img1,
+double vp9_ssim2(uint8_t *img1, uint8_t *img2, int stride_img1,
                  int stride_img2, int width, int height) {
   int i, j;
   int samples = 0;
--- a/vp9/encoder/vp9_temporal_filter.c
+++ b/vp9/encoder/vp9_temporal_filter.c
@@ -35,19 +35,16 @@
 #if VP9_TEMPORAL_ALT_REF
 
 
-static void temporal_filter_predictors_mb_c
-(
-  MACROBLOCKD *xd,
-  unsigned char *y_mb_ptr,
-  unsigned char *u_mb_ptr,
-  unsigned char *v_mb_ptr,
-  int stride,
-  int mv_row,
-  int mv_col,
-  unsigned char *pred
-) {
+static void temporal_filter_predictors_mb_c(MACROBLOCKD *xd,
+                                            uint8_t *y_mb_ptr,
+                                            uint8_t *u_mb_ptr,
+                                            uint8_t *v_mb_ptr,
+                                            int stride,
+                                            int mv_row,
+                                            int mv_col,
+                                            uint8_t *pred) {
   int offset;
-  unsigned char *yptr, *uptr, *vptr;
+  uint8_t *yptr, *uptr, *vptr;
   int omv_row, omv_col;
 
   // Y
@@ -75,23 +72,20 @@
                            (omv_col & 15), (omv_row & 15), &pred[256], 8);
     xd->subpixel_predict8x8(vptr, stride,
                            (omv_col & 15), (omv_row & 15), &pred[320], 8);
-  }
-  else {
+  } else {
     vp9_copy_mem8x8(uptr, stride, &pred[256], 8);
     vp9_copy_mem8x8(vptr, stride, &pred[320], 8);
   }
 }
-void vp9_temporal_filter_apply_c
-(
-  unsigned char *frame1,
-  unsigned int stride,
-  unsigned char *frame2,
-  unsigned int block_size,
-  int strength,
-  int filter_weight,
-  unsigned int *accumulator,
-  unsigned short *count
-) {
+
+void vp9_temporal_filter_apply_c(uint8_t *frame1,
+                                 unsigned int stride,
+                                 uint8_t *frame2,
+                                 unsigned int block_size,
+                                 int strength,
+                                 int filter_weight,
+                                 unsigned int *accumulator,
+                                 uint16_t *count) {
   unsigned int i, j, k;
   int modifier;
   int byte = 0;
@@ -129,14 +123,11 @@
 
 #if ALT_REF_MC_ENABLED
 
-static int temporal_filter_find_matching_mb_c
-(
-  VP9_COMP *cpi,
-  YV12_BUFFER_CONFIG *arf_frame,
-  YV12_BUFFER_CONFIG *frame_ptr,
-  int mb_offset,
-  int error_thresh
-) {
+static int temporal_filter_find_matching_mb_c(VP9_COMP *cpi,
+                                              YV12_BUFFER_CONFIG *arf_frame,
+                                              YV12_BUFFER_CONFIG *frame_ptr,
+                                              int mb_offset,
+                                              int error_thresh) {
   MACROBLOCK *x = &cpi->mb;
   int step_param;
   int further_steps;
@@ -149,10 +140,10 @@
   int_mv best_ref_mv1_full; /* full-pixel value of best_ref_mv1 */
 
   // Save input state
-  unsigned char **base_src = b->base_src;
+  uint8_t **base_src = b->base_src;
   int src = b->src;
   int src_stride = b->src_stride;
-  unsigned char **base_pre = d->base_pre;
+  uint8_t **base_pre = d->base_pre;
   int pre = d->pre;
   int pre_stride = d->pre_stride;
 
@@ -216,13 +207,10 @@
 }
 #endif
 
-static void temporal_filter_iterate_c
-(
-  VP9_COMP *cpi,
-  int frame_count,
-  int alt_ref_index,
-  int strength
-) {
+static void temporal_filter_iterate_c(VP9_COMP *cpi,
+                                      int frame_count,
+                                      int alt_ref_index,
+                                      int strength) {
   int byte;
   int frame;
   int mb_col, mb_row;
@@ -232,16 +220,16 @@
   int mb_y_offset = 0;
   int mb_uv_offset = 0;
   DECLARE_ALIGNED_ARRAY(16, unsigned int, accumulator, 16 * 16 + 8 * 8 + 8 * 8);
-  DECLARE_ALIGNED_ARRAY(16, unsigned short, count, 16 * 16 + 8 * 8 + 8 * 8);
+  DECLARE_ALIGNED_ARRAY(16, uint16_t, count, 16 * 16 + 8 * 8 + 8 * 8);
   MACROBLOCKD *mbd = &cpi->mb.e_mbd;
   YV12_BUFFER_CONFIG *f = cpi->frames[alt_ref_index];
-  unsigned char *dst1, *dst2;
-  DECLARE_ALIGNED_ARRAY(16, unsigned char,  predictor, 16 * 16 + 8 * 8 + 8 * 8);
+  uint8_t *dst1, *dst2;
+  DECLARE_ALIGNED_ARRAY(16, uint8_t,  predictor, 16 * 16 + 8 * 8 + 8 * 8);
 
   // Save input state
-  unsigned char *y_buffer = mbd->pre.y_buffer;
-  unsigned char *u_buffer = mbd->pre.u_buffer;
-  unsigned char *v_buffer = mbd->pre.v_buffer;
+  uint8_t *y_buffer = mbd->pre.y_buffer;
+  uint8_t *u_buffer = mbd->pre.u_buffer;
+  uint8_t *v_buffer = mbd->pre.v_buffer;
 
   for (mb_row = 0; mb_row < mb_rows; mb_row++) {
 #if ALT_REF_MC_ENABLED
@@ -266,7 +254,7 @@
       int stride;
 
       vpx_memset(accumulator, 0, 384 * sizeof(unsigned int));
-      vpx_memset(count, 0, 384 * sizeof(unsigned short));
+      vpx_memset(count, 0, 384 * sizeof(uint16_t));
 
 #if ALT_REF_MC_ENABLED
       cpi->mb.mv_col_min = -((mb_col * 16) + (17 - 2 * VP9_INTERP_EXTEND));
@@ -341,7 +329,7 @@
           pval *= cpi->fixed_divide[count[k]];
           pval >>= 19;
 
-          dst1[byte] = (unsigned char)pval;
+          dst1[byte] = (uint8_t)pval;
 
           // move to next pixel
           byte++;
@@ -362,13 +350,13 @@
           unsigned int pval = accumulator[k] + (count[k] >> 1);
           pval *= cpi->fixed_divide[count[k]];
           pval >>= 19;
-          dst1[byte] = (unsigned char)pval;
+          dst1[byte] = (uint8_t)pval;
 
           // V
           pval = accumulator[m] + (count[m] >> 1);
           pval *= cpi->fixed_divide[count[m]];
           pval >>= 19;
-          dst2[byte] = (unsigned char)pval;
+          dst2[byte] = (uint8_t)pval;
 
           // move to next pixel
           byte++;
--- a/vp9/encoder/vp9_temporal_filter.h
+++ b/vp9/encoder/vp9_temporal_filter.h
@@ -13,4 +13,4 @@
 
 extern void vp9_temporal_filter_prepare(VP9_COMP *cpi, int distance);
 
-#endif
+#endif  // VP9_ENCODER_VP9_TEMPORAL_FILTER_H_
--- a/vp9/encoder/vp9_tokenize.h
+++ b/vp9/encoder/vp9_tokenize.h
@@ -8,7 +8,6 @@
  *  be found in the AUTHORS file in the root of the source tree.
  */
 
-
 #ifndef VP9_ENCODER_VP9_TOKENIZE_H_
 #define VP9_ENCODER_VP9_TOKENIZE_H_
 
@@ -18,15 +17,15 @@
 void vp9_tokenize_initialize();
 
 typedef struct {
-  short Token;
-  short Extra;
+  int16_t Token;
+  int16_t Extra;
 } TOKENVALUE;
 
 typedef struct {
   const vp9_prob *context_tree;
-  short           Extra;
-  unsigned char   Token;
-  unsigned char   skip_eob_node;
+  int16_t         Extra;
+  uint8_t         Token;
+  uint8_t         skip_eob_node;
 } TOKENEXTRA;
 
 typedef int64_t vp9_coeff_accum[COEF_BANDS][PREV_COEF_CONTEXTS]
@@ -80,4 +79,4 @@
  */
 extern const TOKENVALUE *vp9_dct_value_tokens_ptr;
 
-#endif  /* tokenize_h */
+#endif  // VP9_ENCODER_VP9_TOKENIZE_H_
--- a/vp9/encoder/vp9_treewriter.h
+++ b/vp9/encoder/vp9_treewriter.h
@@ -105,4 +105,4 @@
 
 void vp9_cost_tokens_skip(int *c, const vp9_prob *p, vp9_tree t);
 
-#endif
+#endif  // VP9_ENCODER_VP9_TREEWRITER_H_
--- a/vp9/encoder/vp9_variance.h
+++ b/vp9/encoder/vp9_variance.h
@@ -8,54 +8,55 @@
  *  be found in the AUTHORS file in the root of the source tree.
  */
 
-
 #ifndef VP9_ENCODER_VP9_VARIANCE_H_
 #define VP9_ENCODER_VP9_VARIANCE_H_
 
-typedef unsigned int(*vp9_sad_fn_t)(const unsigned char *src_ptr,
+#include "vpx/vpx_integer.h"
+
+typedef unsigned int(*vp9_sad_fn_t)(const uint8_t *src_ptr,
                                     int source_stride,
-                                    const unsigned char *ref_ptr,
+                                    const uint8_t *ref_ptr,
                                     int ref_stride,
                                     unsigned int max_sad);
 
-typedef void (*vp9_copy32xn_fn_t)(const unsigned char *src_ptr,
+typedef void (*vp9_copy32xn_fn_t)(const uint8_t *src_ptr,
                                   int source_stride,
-                                  const unsigned char *ref_ptr,
+                                  const uint8_t *ref_ptr,
                                   int ref_stride,
                                   int n);
 
-typedef void (*vp9_sad_multi_fn_t)(const unsigned char *src_ptr,
+typedef void (*vp9_sad_multi_fn_t)(const uint8_t *src_ptr,
                                    int source_stride,
-                                   const unsigned char *ref_ptr,
+                                   const uint8_t *ref_ptr,
                                    int  ref_stride,
                                    unsigned int *sad_array);
 
-typedef void (*vp9_sad_multi1_fn_t)(const unsigned char *src_ptr,
+typedef void (*vp9_sad_multi1_fn_t)(const uint8_t *src_ptr,
                                     int source_stride,
-                                    const unsigned char *ref_ptr,
+                                    const uint8_t *ref_ptr,
                                     int  ref_stride,
                                     unsigned short *sad_array);
 
-typedef void (*vp9_sad_multi_d_fn_t)(const unsigned char *src_ptr,
+typedef void (*vp9_sad_multi_d_fn_t)(const uint8_t *src_ptr,
                                      int source_stride,
-                                     const unsigned char ** ref_ptr,
+                                     const uint8_t ** ref_ptr,
                                      int  ref_stride, unsigned int *sad_array);
 
-typedef unsigned int (*vp9_variance_fn_t)(const unsigned char *src_ptr,
+typedef unsigned int (*vp9_variance_fn_t)(const uint8_t *src_ptr,
                                           int source_stride,
-                                          const unsigned char *ref_ptr,
+                                          const uint8_t *ref_ptr,
                                           int ref_stride,
                                           unsigned int *sse);
 
-typedef unsigned int (*vp9_subpixvariance_fn_t)(const unsigned char  *src_ptr,
+typedef unsigned int (*vp9_subpixvariance_fn_t)(const uint8_t *src_ptr,
                                                 int source_stride,
                                                 int xoffset,
                                                 int yoffset,
-                                                const unsigned char *ref_ptr,
+                                                const uint8_t *ref_ptr,
                                                 int Refstride,
                                                 unsigned int *sse);
 
-typedef void (*vp9_ssimpf_fn_t)(unsigned char *s, int sp, unsigned char *r,
+typedef void (*vp9_ssimpf_fn_t)(uint8_t *s, int sp, uint8_t *r,
                                 int rp, unsigned long *sum_s,
                                 unsigned long *sum_r, unsigned long *sum_sq_s,
                                 unsigned long *sum_sq_r,
@@ -63,9 +64,9 @@
 
 typedef unsigned int (*vp9_getmbss_fn_t)(const short *);
 
-typedef unsigned int (*vp9_get16x16prederror_fn_t)(const unsigned char *src_ptr,
+typedef unsigned int (*vp9_get16x16prederror_fn_t)(const uint8_t *src_ptr,
                                                    int source_stride,
-                                                   const unsigned char *ref_ptr,
+                                                   const uint8_t *ref_ptr,
                                                    int  ref_stride);
 
 typedef struct variance_vtable {
@@ -81,4 +82,4 @@
     vp9_copy32xn_fn_t       copymem;
 } vp9_variance_fn_ptr_t;
 
-#endif
+#endif  // VP9_ENCODER_VP9_VARIANCE_H_
--- a/vp9/encoder/vp9_variance_c.c
+++ b/vp9/encoder/vp9_variance_c.c
@@ -14,7 +14,7 @@
 #include "vp9/common/vp9_subpelvar.h"
 #include "vpx/vpx_integer.h"
 
-unsigned int vp9_get_mb_ss_c(const short *src_ptr) {
+unsigned int vp9_get_mb_ss_c(const int16_t *src_ptr) {
   unsigned int i, sum = 0;
 
   for (i = 0; i < 256; i++) {
@@ -24,12 +24,10 @@
   return sum;
 }
 
-
-
 #if CONFIG_SUPERBLOCKS
-unsigned int vp9_variance32x32_c(const unsigned char *src_ptr,
+unsigned int vp9_variance32x32_c(const uint8_t *src_ptr,
                                  int  source_stride,
-                                 const unsigned char *ref_ptr,
+                                 const uint8_t *ref_ptr,
                                  int  recon_stride,
                                  unsigned int *sse) {
   unsigned int var;
@@ -41,9 +39,9 @@
 }
 #endif
 
-unsigned int vp9_variance16x16_c(const unsigned char *src_ptr,
+unsigned int vp9_variance16x16_c(const uint8_t *src_ptr,
                                  int  source_stride,
-                                 const unsigned char *ref_ptr,
+                                 const uint8_t *ref_ptr,
                                  int  recon_stride,
                                  unsigned int *sse) {
   unsigned int var;
@@ -54,9 +52,9 @@
   return (var - (((unsigned int)avg * avg) >> 8));
 }
 
-unsigned int vp9_variance8x16_c(const unsigned char *src_ptr,
+unsigned int vp9_variance8x16_c(const uint8_t *src_ptr,
                                 int  source_stride,
-                                const unsigned char *ref_ptr,
+                                const uint8_t *ref_ptr,
                                 int  recon_stride,
                                 unsigned int *sse) {
   unsigned int var;
@@ -67,9 +65,9 @@
   return (var - (((unsigned int)avg * avg) >> 7));
 }
 
-unsigned int vp9_variance16x8_c(const unsigned char *src_ptr,
+unsigned int vp9_variance16x8_c(const uint8_t *src_ptr,
                                 int  source_stride,
-                                const unsigned char *ref_ptr,
+                                const uint8_t *ref_ptr,
                                 int  recon_stride,
                                 unsigned int *sse) {
   unsigned int var;
@@ -81,9 +79,9 @@
 }
 
 
-unsigned int vp9_variance8x8_c(const unsigned char *src_ptr,
+unsigned int vp9_variance8x8_c(const uint8_t *src_ptr,
                                int  source_stride,
-                               const unsigned char *ref_ptr,
+                               const uint8_t *ref_ptr,
                                int  recon_stride,
                                unsigned int *sse) {
   unsigned int var;
@@ -94,9 +92,9 @@
   return (var - (((unsigned int)avg * avg) >> 6));
 }
 
-unsigned int vp9_variance4x4_c(const unsigned char *src_ptr,
+unsigned int vp9_variance4x4_c(const uint8_t *src_ptr,
                                int  source_stride,
-                               const unsigned char *ref_ptr,
+                               const uint8_t *ref_ptr,
                                int  recon_stride,
                                unsigned int *sse) {
   unsigned int var;
@@ -108,9 +106,9 @@
 }
 
 
-unsigned int vp9_mse16x16_c(const unsigned char *src_ptr,
+unsigned int vp9_mse16x16_c(const uint8_t *src_ptr,
                             int  source_stride,
-                            const unsigned char *ref_ptr,
+                            const uint8_t *ref_ptr,
                             int  recon_stride,
                             unsigned int *sse) {
   unsigned int var;
@@ -122,16 +120,16 @@
 }
 
 
-unsigned int vp9_sub_pixel_variance4x4_c(const unsigned char  *src_ptr,
+unsigned int vp9_sub_pixel_variance4x4_c(const uint8_t *src_ptr,
                                          int  src_pixels_per_line,
                                          int  xoffset,
                                          int  yoffset,
-                                         const unsigned char *dst_ptr,
+                                         const uint8_t *dst_ptr,
                                          int dst_pixels_per_line,
                                          unsigned int *sse) {
-  unsigned char  temp2[20 * 16];
-  const short *HFilter, *VFilter;
-  unsigned short FData3[5 * 4]; // Temp data bufffer used in filtering
+  uint8_t temp2[20 * 16];
+  const int16_t *HFilter, *VFilter;
+  uint16_t FData3[5 * 4];  // Temp data bufffer used in filtering
 
   HFilter = vp9_bilinear_filters[xoffset];
   VFilter = vp9_bilinear_filters[yoffset];
@@ -146,16 +144,16 @@
 }
 
 
-unsigned int vp9_sub_pixel_variance8x8_c(const unsigned char  *src_ptr,
+unsigned int vp9_sub_pixel_variance8x8_c(const uint8_t *src_ptr,
                                          int  src_pixels_per_line,
                                          int  xoffset,
                                          int  yoffset,
-                                         const unsigned char *dst_ptr,
+                                         const uint8_t *dst_ptr,
                                          int dst_pixels_per_line,
                                          unsigned int *sse) {
-  unsigned short FData3[9 * 8]; // Temp data bufffer used in filtering
-  unsigned char  temp2[20 * 16];
-  const short *HFilter, *VFilter;
+  uint16_t FData3[9 * 8];  // Temp data bufffer used in filtering
+  uint8_t temp2[20 * 16];
+  const int16_t *HFilter, *VFilter;
 
   HFilter = vp9_bilinear_filters[xoffset];
   VFilter = vp9_bilinear_filters[yoffset];
@@ -166,16 +164,16 @@
   return vp9_variance8x8_c(temp2, 8, dst_ptr, dst_pixels_per_line, sse);
 }
 
-unsigned int vp9_sub_pixel_variance16x16_c(const unsigned char  *src_ptr,
+unsigned int vp9_sub_pixel_variance16x16_c(const uint8_t *src_ptr,
                                            int  src_pixels_per_line,
                                            int  xoffset,
                                            int  yoffset,
-                                           const unsigned char *dst_ptr,
+                                           const uint8_t *dst_ptr,
                                            int dst_pixels_per_line,
                                            unsigned int *sse) {
-  unsigned short FData3[17 * 16]; // Temp data bufffer used in filtering
-  unsigned char  temp2[20 * 16];
-  const short *HFilter, *VFilter;
+  uint16_t FData3[17 * 16];  // Temp data bufffer used in filtering
+  uint8_t temp2[20 * 16];
+  const int16_t *HFilter, *VFilter;
 
   HFilter = vp9_bilinear_filters[xoffset];
   VFilter = vp9_bilinear_filters[yoffset];
@@ -187,16 +185,16 @@
 }
 
 #if CONFIG_SUPERBLOCKS
-unsigned int vp9_sub_pixel_variance32x32_c(const unsigned char  *src_ptr,
+unsigned int vp9_sub_pixel_variance32x32_c(const uint8_t *src_ptr,
                                            int  src_pixels_per_line,
                                            int  xoffset,
                                            int  yoffset,
-                                           const unsigned char *dst_ptr,
+                                           const uint8_t *dst_ptr,
                                            int dst_pixels_per_line,
                                            unsigned int *sse) {
-  unsigned short FData3[33 * 32]; // Temp data bufffer used in filtering
-  unsigned char  temp2[36 * 32];
-  const short *HFilter, *VFilter;
+  uint16_t FData3[33 * 32];  // Temp data bufffer used in filtering
+  uint8_t temp2[36 * 32];
+  const int16_t *HFilter, *VFilter;
 
   HFilter = vp9_bilinear_filters[xoffset];
   VFilter = vp9_bilinear_filters[yoffset];
@@ -208,9 +206,9 @@
 }
 #endif
 
-unsigned int vp9_variance_halfpixvar16x16_h_c(const unsigned char *src_ptr,
+unsigned int vp9_variance_halfpixvar16x16_h_c(const uint8_t *src_ptr,
                                               int  source_stride,
-                                              const unsigned char *ref_ptr,
+                                              const uint8_t *ref_ptr,
                                               int  recon_stride,
                                               unsigned int *sse) {
   return vp9_sub_pixel_variance16x16_c(src_ptr, source_stride, 8, 0,
@@ -218,9 +216,9 @@
 }
 
 #if CONFIG_SUPERBLOCKS
-unsigned int vp9_variance_halfpixvar32x32_h_c(const unsigned char *src_ptr,
+unsigned int vp9_variance_halfpixvar32x32_h_c(const uint8_t *src_ptr,
                                               int  source_stride,
-                                              const unsigned char *ref_ptr,
+                                              const uint8_t *ref_ptr,
                                               int  recon_stride,
                                               unsigned int *sse) {
   return vp9_sub_pixel_variance32x32_c(src_ptr, source_stride, 8, 0,
@@ -229,9 +227,9 @@
 #endif
 
 
-unsigned int vp9_variance_halfpixvar16x16_v_c(const unsigned char *src_ptr,
+unsigned int vp9_variance_halfpixvar16x16_v_c(const uint8_t *src_ptr,
                                               int  source_stride,
-                                              const unsigned char *ref_ptr,
+                                              const uint8_t *ref_ptr,
                                               int  recon_stride,
                                               unsigned int *sse) {
   return vp9_sub_pixel_variance16x16_c(src_ptr, source_stride, 0, 8,
@@ -239,9 +237,9 @@
 }
 
 #if CONFIG_SUPERBLOCKS
-unsigned int vp9_variance_halfpixvar32x32_v_c(const unsigned char *src_ptr,
+unsigned int vp9_variance_halfpixvar32x32_v_c(const uint8_t *src_ptr,
                                               int  source_stride,
-                                              const unsigned char *ref_ptr,
+                                              const uint8_t *ref_ptr,
                                               int  recon_stride,
                                               unsigned int *sse) {
   return vp9_sub_pixel_variance32x32_c(src_ptr, source_stride, 0, 8,
@@ -249,9 +247,9 @@
 }
 #endif
 
-unsigned int vp9_variance_halfpixvar16x16_hv_c(const unsigned char *src_ptr,
+unsigned int vp9_variance_halfpixvar16x16_hv_c(const uint8_t *src_ptr,
                                                int  source_stride,
-                                               const unsigned char *ref_ptr,
+                                               const uint8_t *ref_ptr,
                                                int  recon_stride,
                                                unsigned int *sse) {
   return vp9_sub_pixel_variance16x16_c(src_ptr, source_stride, 8, 8,
@@ -259,9 +257,9 @@
 }
 
 #if CONFIG_SUPERBLOCKS
-unsigned int vp9_variance_halfpixvar32x32_hv_c(const unsigned char *src_ptr,
+unsigned int vp9_variance_halfpixvar32x32_hv_c(const uint8_t *src_ptr,
                                                int  source_stride,
-                                               const unsigned char *ref_ptr,
+                                               const uint8_t *ref_ptr,
                                                int  recon_stride,
                                                unsigned int *sse) {
   return vp9_sub_pixel_variance32x32_c(src_ptr, source_stride, 8, 8,
@@ -269,11 +267,11 @@
 }
 #endif
 
-unsigned int vp9_sub_pixel_mse16x16_c(const unsigned char  *src_ptr,
+unsigned int vp9_sub_pixel_mse16x16_c(const uint8_t *src_ptr,
                                       int  src_pixels_per_line,
                                       int  xoffset,
                                       int  yoffset,
-                                      const unsigned char *dst_ptr,
+                                      const uint8_t *dst_ptr,
                                       int dst_pixels_per_line,
                                       unsigned int *sse) {
   vp9_sub_pixel_variance16x16_c(src_ptr, src_pixels_per_line,
@@ -283,11 +281,11 @@
 }
 
 #if CONFIG_SUPERBLOCKS
-unsigned int vp9_sub_pixel_mse32x32_c(const unsigned char  *src_ptr,
+unsigned int vp9_sub_pixel_mse32x32_c(const uint8_t *src_ptr,
                                       int  src_pixels_per_line,
                                       int  xoffset,
                                       int  yoffset,
-                                      const unsigned char *dst_ptr,
+                                      const uint8_t *dst_ptr,
                                       int dst_pixels_per_line,
                                       unsigned int *sse) {
   vp9_sub_pixel_variance32x32_c(src_ptr, src_pixels_per_line,
@@ -297,16 +295,16 @@
 }
 #endif
 
-unsigned int vp9_sub_pixel_variance16x8_c(const unsigned char  *src_ptr,
+unsigned int vp9_sub_pixel_variance16x8_c(const uint8_t *src_ptr,
                                           int  src_pixels_per_line,
                                           int  xoffset,
                                           int  yoffset,
-                                          const unsigned char *dst_ptr,
+                                          const uint8_t *dst_ptr,
                                           int dst_pixels_per_line,
                                           unsigned int *sse) {
-  unsigned short FData3[16 * 9];  // Temp data bufffer used in filtering
-  unsigned char  temp2[20 * 16];
-  const short *HFilter, *VFilter;
+  uint16_t FData3[16 * 9];  // Temp data bufffer used in filtering
+  uint8_t temp2[20 * 16];
+  const int16_t *HFilter, *VFilter;
 
   HFilter = vp9_bilinear_filters[xoffset];
   VFilter = vp9_bilinear_filters[yoffset];
@@ -317,16 +315,16 @@
   return vp9_variance16x8_c(temp2, 16, dst_ptr, dst_pixels_per_line, sse);
 }
 
-unsigned int vp9_sub_pixel_variance8x16_c(const unsigned char  *src_ptr,
+unsigned int vp9_sub_pixel_variance8x16_c(const uint8_t *src_ptr,
                                           int  src_pixels_per_line,
                                           int  xoffset,
                                           int  yoffset,
-                                          const unsigned char *dst_ptr,
+                                          const uint8_t *dst_ptr,
                                           int dst_pixels_per_line,
                                           unsigned int *sse) {
-  unsigned short FData3[9 * 16];  // Temp data bufffer used in filtering
-  unsigned char  temp2[20 * 16];
-  const short *HFilter, *VFilter;
+  uint16_t FData3[9 * 16];  // Temp data bufffer used in filtering
+  uint8_t temp2[20 * 16];
+  const int16_t *HFilter, *VFilter;
 
   HFilter = vp9_bilinear_filters[xoffset];
   VFilter = vp9_bilinear_filters[yoffset];
--- a/vp9/vp9_common.mk
+++ b/vp9/vp9_common.mk
@@ -30,7 +30,6 @@
 VP9_COMMON_SRCS-yes += common/vp9_alloccommon.h
 VP9_COMMON_SRCS-yes += common/vp9_blockd.h
 VP9_COMMON_SRCS-yes += common/vp9_common.h
-VP9_COMMON_SRCS-yes += common/vp9_common_types.h
 VP9_COMMON_SRCS-yes += common/vp9_entropy.h
 VP9_COMMON_SRCS-yes += common/vp9_entropymode.h
 VP9_COMMON_SRCS-yes += common/vp9_entropymv.h
--- a/vp9/vp9_dx_iface.c
+++ b/vp9/vp9_dx_iface.c
@@ -15,7 +15,7 @@
 #include "vpx/vp8dx.h"
 #include "vpx/internal/vpx_codec_internal.h"
 #include "vpx_version.h"
-#include "common/vp9_onyxd.h"
+#include "decoder/vp9_onyxd.h"
 #include "decoder/vp9_onyxd_int.h"
 
 #define VP8_CAP_POSTPROC (CONFIG_POSTPROC ? VPX_CODEC_CAP_POSTPROC : 0)
--- a/vpx_scale/yv12config.h
+++ b/vpx_scale/yv12config.h
@@ -8,14 +8,15 @@
  *  be found in the AUTHORS file in the root of the source tree.
  */
 
-
 #ifndef YV12_CONFIG_H
 #define YV12_CONFIG_H
+
 #ifdef __cplusplus
-extern "C"
-{
+extern "C" {
 #endif
 
+#include "vpx/vpx_integer.h"
+
 #define VP8BORDERINPIXELS       32
 #define VP9BORDERINPIXELS       64
 #define VP9_INTERP_EXTEND        4
@@ -49,11 +50,11 @@
     int   uv_stride;
     /*    int   uvinternal_width; */
 
-    unsigned char *y_buffer;
-    unsigned char *u_buffer;
-    unsigned char *v_buffer;
+    uint8_t *y_buffer;
+    uint8_t *u_buffer;
+    uint8_t *v_buffer;
 
-    unsigned char *buffer_alloc;
+    uint8_t *buffer_alloc;
     int border;
     int frame_size;
     YUV_TYPE clrtype;
@@ -62,7 +63,8 @@
     int flags;
   } YV12_BUFFER_CONFIG;
 
-  int vp8_yv12_alloc_frame_buffer(YV12_BUFFER_CONFIG *ybf, int width, int height, int border);
+  int vp8_yv12_alloc_frame_buffer(YV12_BUFFER_CONFIG *ybf,
+                                  int width, int height, int border);
   int vp8_yv12_de_alloc_frame_buffer(YV12_BUFFER_CONFIG *ybf);
 
 #ifdef __cplusplus
@@ -69,5 +71,4 @@
 }
 #endif
 
-
-#endif /*YV12_CONFIG_H*/
+#endif  // YV12_CONFIG_H