Remove vp8 in local symbols.

For non-static functions, change the prefix to vp9_. For static functions,
remove the prefix. Also fix some comments, remove unused code or unused
function prototypes.

Change-Id: I1f8be05362f66060fe421c3d4c9a906fdf835de5
diff --git a/vp8/common/alloccommon.c b/vp8/common/alloccommon.c
index 3330bd2..5f36326 100644
--- a/vp8/common/alloccommon.c
+++ b/vp8/common/alloccommon.c
@@ -19,8 +19,6 @@
 #include "systemdependent.h"
 
 
-extern  void vp8_init_scan_order_mask();
-
 void vp9_update_mode_info_border(VP9_COMMON *cpi, MODE_INFO *mi_base) {
   int stride = cpi->mode_info_stride;
   int i;
diff --git a/vp8/common/arm/arm_systemdependent.c b/vp8/common/arm/arm_systemdependent.c
index 8026670..03afd66 100644
--- a/vp8/common/arm/arm_systemdependent.c
+++ b/vp8/common/arm/arm_systemdependent.c
@@ -19,7 +19,7 @@
 #include "vp8/common/idct.h"
 #include "vp8/common/onyxc_int.h"
 
-void vp8_arch_arm_common_init(VP9_COMMON *ctx) {
+void vp9_arch_arm_common_init(VP9_COMMON *ctx) {
 #if CONFIG_RUNTIME_CPU_DETECT
   VP9_COMMON_RTCD *rtcd = &ctx->rtcd;
   int flags = arm_cpu_caps();
diff --git a/vp8/common/arm/armv6/bilinearfilter_v6.asm b/vp8/common/arm/armv6/bilinearfilter_v6.asm
index 9704b42..36e391e 100644
--- a/vp8/common/arm/armv6/bilinearfilter_v6.asm
+++ b/vp8/common/arm/armv6/bilinearfilter_v6.asm
@@ -9,8 +9,8 @@
 ;
 
 
-    EXPORT  |vp8_filter_block2d_bil_first_pass_armv6|
-    EXPORT  |vp8_filter_block2d_bil_second_pass_armv6|
+    EXPORT  |vp9_filter_block2d_bil_first_pass_armv6|
+    EXPORT  |vp9_filter_block2d_bil_second_pass_armv6|
 
     AREA    |.text|, CODE, READONLY  ; name this block of code
 
@@ -20,13 +20,13 @@
 ; r2    unsigned int    src_pitch,
 ; r3    unsigned int    height,
 ; stack unsigned int    width,
-; stack const short    *vp8_filter
+; stack const short    *vp9_filter
 ;-------------------------------------
 ; The output is transposed stroed in output array to make it easy for second pass filtering.
-|vp8_filter_block2d_bil_first_pass_armv6| PROC
+|vp9_filter_block2d_bil_first_pass_armv6| PROC
     stmdb   sp!, {r4 - r11, lr}
 
-    ldr     r11, [sp, #40]                  ; vp8_filter address
+    ldr     r11, [sp, #40]                  ; vp9_filter address
     ldr     r4, [sp, #36]                   ; width
 
     mov     r12, r3                         ; outer-loop counter
@@ -134,7 +134,7 @@
 
     ldmia   sp!, {r4 - r11, pc}
 
-    ENDP  ; |vp8_filter_block2d_bil_first_pass_armv6|
+    ENDP  ; |vp9_filter_block2d_bil_first_pass_armv6|
 
 
 ;---------------------------------
@@ -143,12 +143,12 @@
 ; r2    int             dst_pitch,
 ; r3    unsigned int    height,
 ; stack unsigned int    width,
-; stack const short    *vp8_filter
+; stack const short    *vp9_filter
 ;---------------------------------
-|vp8_filter_block2d_bil_second_pass_armv6| PROC
+|vp9_filter_block2d_bil_second_pass_armv6| PROC
     stmdb   sp!, {r4 - r11, lr}
 
-    ldr     r11, [sp, #40]                  ; vp8_filter address
+    ldr     r11, [sp, #40]                  ; vp9_filter address
     ldr     r4, [sp, #36]                   ; width
 
     ldr     r5, [r11]                       ; load up filter coefficients
@@ -232,6 +232,6 @@
     bne     bil_height_loop_null_2nd
 
     ldmia   sp!, {r4 - r11, pc}
-    ENDP  ; |vp8_filter_block2d_second_pass_armv6|
+    ENDP  ; |vp9_filter_block2d_second_pass_armv6|
 
     END
diff --git a/vp8/common/arm/armv6/copymem16x16_v6.asm b/vp8/common/arm/armv6/copymem16x16_v6.asm
index abf048c..44c3c49 100644
--- a/vp8/common/arm/armv6/copymem16x16_v6.asm
+++ b/vp8/common/arm/armv6/copymem16x16_v6.asm
@@ -9,7 +9,7 @@
 ;
 
 
-    EXPORT  |vp8_copy_mem16x16_v6|
+    EXPORT  |vp9_copy_mem16x16_v6|
     ; ARM
     ; REQUIRE8
     ; PRESERVE8
@@ -17,7 +17,7 @@
     AREA    Block, CODE, READONLY ; name this block of code
 ;void copy_mem16x16_v6( unsigned char *src, int src_stride, unsigned char *dst, int dst_stride)
 ;-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
-|vp8_copy_mem16x16_v6| PROC
+|vp9_copy_mem16x16_v6| PROC
     stmdb       sp!, {r4 - r7}
     ;push   {r4-r7}
 
@@ -181,6 +181,6 @@
     ;pop        {r4-r7}
     mov     pc, lr
 
-    ENDP  ; |vp8_copy_mem16x16_v6|
+    ENDP  ; |vp9_copy_mem16x16_v6|
 
     END
diff --git a/vp8/common/arm/armv6/copymem8x4_v6.asm b/vp8/common/arm/armv6/copymem8x4_v6.asm
index d8362ef..45b9043 100644
--- a/vp8/common/arm/armv6/copymem8x4_v6.asm
+++ b/vp8/common/arm/armv6/copymem8x4_v6.asm
@@ -9,15 +9,15 @@
 ;
 
 
-    EXPORT  |vp8_copy_mem8x4_v6|
+    EXPORT  |vp9_copy_mem8x4_v6|
     ; ARM
     ; REQUIRE8
     ; PRESERVE8
 
     AREA    Block, CODE, READONLY ; name this block of code
-;void vp8_copy_mem8x4_v6( unsigned char *src, int src_stride, unsigned char *dst, int dst_stride)
+;void vp9_copy_mem8x4_v6( unsigned char *src, int src_stride, unsigned char *dst, int dst_stride)
 ;-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
-|vp8_copy_mem8x4_v6| PROC
+|vp9_copy_mem8x4_v6| PROC
     ;push   {r4-r5}
     stmdb  sp!, {r4-r5}
 
@@ -123,6 +123,6 @@
     ;pop        {r4-r5}
     mov     pc, lr
 
-    ENDP  ; |vp8_copy_mem8x4_v6|
+    ENDP  ; |vp9_copy_mem8x4_v6|
 
     END
diff --git a/vp8/common/arm/armv6/copymem8x8_v6.asm b/vp8/common/arm/armv6/copymem8x8_v6.asm
index c6a60c6..0dd971b 100644
--- a/vp8/common/arm/armv6/copymem8x8_v6.asm
+++ b/vp8/common/arm/armv6/copymem8x8_v6.asm
@@ -9,7 +9,7 @@
 ;
 
 
-    EXPORT  |vp8_copy_mem8x8_v6|
+    EXPORT  |vp9_copy_mem8x8_v6|
     ; ARM
     ; REQUIRE8
     ; PRESERVE8
@@ -17,7 +17,7 @@
     AREA    Block, CODE, READONLY ; name this block of code
 ;void copy_mem8x8_v6( unsigned char *src, int src_stride, unsigned char *dst, int dst_stride)
 ;-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
-|vp8_copy_mem8x8_v6| PROC
+|vp9_copy_mem8x8_v6| PROC
     ;push   {r4-r5}
     stmdb  sp!, {r4-r5}
 
@@ -123,6 +123,6 @@
     ;pop        {r4-r5}
     mov     pc, lr
 
-    ENDP  ; |vp8_copy_mem8x8_v6|
+    ENDP  ; |vp9_copy_mem8x8_v6|
 
     END
diff --git a/vp8/common/arm/armv6/filter_v6.asm b/vp8/common/arm/armv6/filter_v6.asm
index 1ba91dd..16b321e 100644
--- a/vp8/common/arm/armv6/filter_v6.asm
+++ b/vp8/common/arm/armv6/filter_v6.asm
@@ -9,13 +9,13 @@
 ;
 
 
-    EXPORT  |vp8_filter_block2d_first_pass_armv6|
-    EXPORT  |vp8_filter_block2d_first_pass_16x16_armv6|
-    EXPORT  |vp8_filter_block2d_first_pass_8x8_armv6|
-    EXPORT  |vp8_filter_block2d_second_pass_armv6|
-    EXPORT  |vp8_filter4_block2d_second_pass_armv6|
-    EXPORT  |vp8_filter_block2d_first_pass_only_armv6|
-    EXPORT  |vp8_filter_block2d_second_pass_only_armv6|
+    EXPORT  |vp9_filter_block2d_first_pass_armv6|
+    EXPORT  |vp9_filter_block2d_first_pass_16x16_armv6|
+    EXPORT  |vp9_filter_block2d_first_pass_8x8_armv6|
+    EXPORT  |vp9_filter_block2d_second_pass_armv6|
+    EXPORT  |vp9_filter4_block2d_second_pass_armv6|
+    EXPORT  |vp9_filter_block2d_first_pass_only_armv6|
+    EXPORT  |vp9_filter_block2d_second_pass_only_armv6|
 
     AREA    |.text|, CODE, READONLY  ; name this block of code
 ;-------------------------------------
@@ -24,14 +24,14 @@
 ; r2    unsigned int src_pixels_per_line
 ; r3    unsigned int output_width
 ; stack unsigned int output_height
-; stack const short *vp8_filter
+; stack const short *vp9_filter
 ;-------------------------------------
-; vp8_filter the input and put in the output array.  Apply the 6 tap FIR filter with
+; vp9_filter the input and put in the output array.  Apply the 6 tap FIR filter with
 ; the output being a 2 byte value and the intput being a 1 byte value.
-|vp8_filter_block2d_first_pass_armv6| PROC
+|vp9_filter_block2d_first_pass_armv6| PROC
     stmdb   sp!, {r4 - r11, lr}
 
-    ldr     r11, [sp, #40]                  ; vp8_filter address
+    ldr     r11, [sp, #40]                  ; vp9_filter address
     ldr     r7, [sp, #36]                   ; output height
 
     sub     r2, r2, r3                      ; inside loop increments input array,
@@ -115,10 +115,10 @@
 ; --------------------------
 ; 16x16 version
 ; -----------------------------
-|vp8_filter_block2d_first_pass_16x16_armv6| PROC
+|vp9_filter_block2d_first_pass_16x16_armv6| PROC
     stmdb   sp!, {r4 - r11, lr}
 
-    ldr     r11, [sp, #40]                  ; vp8_filter address
+    ldr     r11, [sp, #40]                  ; vp9_filter address
     ldr     r7, [sp, #36]                   ; output height
 
     add     r4, r2, #18                     ; preload next low
@@ -208,10 +208,10 @@
 ; --------------------------
 ; 8x8 version
 ; -----------------------------
-|vp8_filter_block2d_first_pass_8x8_armv6| PROC
+|vp9_filter_block2d_first_pass_8x8_armv6| PROC
     stmdb   sp!, {r4 - r11, lr}
 
-    ldr     r11, [sp, #40]                  ; vp8_filter address
+    ldr     r11, [sp, #40]                  ; vp9_filter address
     ldr     r7, [sp, #36]                   ; output height
 
     add     r4, r2, #10                     ; preload next low
@@ -303,12 +303,12 @@
 ; r1    unsigned char *output_ptr,
 ; r2    unsigned int output_pitch,
 ; r3    unsigned int cnt,
-; stack const short *vp8_filter
+; stack const short *vp9_filter
 ;---------------------------------
-|vp8_filter_block2d_second_pass_armv6| PROC
+|vp9_filter_block2d_second_pass_armv6| PROC
     stmdb   sp!, {r4 - r11, lr}
 
-    ldr     r11, [sp, #36]                  ; vp8_filter address
+    ldr     r11, [sp, #36]                  ; vp9_filter address
     sub     sp, sp, #4
     mov     r7, r3, lsl #16                 ; height is top part of counter
     str     r1, [sp]                        ; push destination to stack
@@ -376,12 +376,12 @@
 ; r1    unsigned char *output_ptr,
 ; r2    unsigned int output_pitch,
 ; r3    unsigned int cnt,
-; stack const short *vp8_filter
+; stack const short *vp9_filter
 ;---------------------------------
-|vp8_filter4_block2d_second_pass_armv6| PROC
+|vp9_filter4_block2d_second_pass_armv6| PROC
     stmdb   sp!, {r4 - r11, lr}
 
-    ldr     r11, [sp, #36]                  ; vp8_filter address
+    ldr     r11, [sp, #36]                  ; vp9_filter address
     mov     r7, r3, lsl #16                 ; height is top part of counter
 
     ldr     r4, [r11]                       ; load up packed filter coefficients
@@ -435,9 +435,9 @@
 ; r2    unsigned int src_pixels_per_line
 ; r3    unsigned int cnt,
 ; stack unsigned int output_pitch,
-; stack const short *vp8_filter
+; stack const short *vp9_filter
 ;------------------------------------
-|vp8_filter_block2d_first_pass_only_armv6| PROC
+|vp9_filter_block2d_first_pass_only_armv6| PROC
     stmdb   sp!, {r4 - r11, lr}
 
     add     r7, r2, r3                      ; preload next low
@@ -527,7 +527,7 @@
 
     add     sp, sp, #8
     ldmia   sp!, {r4 - r11, pc}
-    ENDP  ; |vp8_filter_block2d_first_pass_only_armv6|
+    ENDP  ; |vp9_filter_block2d_first_pass_only_armv6|
 
 
 ;------------------------------------
@@ -536,9 +536,9 @@
 ; r2    unsigned int src_pixels_per_line
 ; r3    unsigned int cnt,
 ; stack unsigned int output_pitch,
-; stack const short *vp8_filter
+; stack const short *vp9_filter
 ;------------------------------------
-|vp8_filter_block2d_second_pass_only_armv6| PROC
+|vp9_filter_block2d_second_pass_only_armv6| PROC
     stmdb   sp!, {r4 - r11, lr}
 
     ldr     r11, [sp, #40]                  ; VFilter address
@@ -619,6 +619,6 @@
     add     sp, sp, #8
 
     ldmia   sp!, {r4 - r11, pc}
-    ENDP  ; |vp8_filter_block2d_second_pass_only_armv6|
+    ENDP  ; |vp9_filter_block2d_second_pass_only_armv6|
 
     END
diff --git a/vp8/common/arm/armv6/loopfilter_v6.asm b/vp8/common/arm/armv6/loopfilter_v6.asm
index 1cbbbcd..37b54a3 100644
--- a/vp8/common/arm/armv6/loopfilter_v6.asm
+++ b/vp8/common/arm/armv6/loopfilter_v6.asm
@@ -9,10 +9,10 @@
 ;
 
 
-    EXPORT |vp8_loop_filter_horizontal_edge_armv6|
-    EXPORT |vp8_mbloop_filter_horizontal_edge_armv6|
-    EXPORT |vp8_loop_filter_vertical_edge_armv6|
-    EXPORT |vp8_mbloop_filter_vertical_edge_armv6|
+    EXPORT |vp9_loop_filter_horizontal_edge_armv6|
+    EXPORT |vp9_mbloop_filter_horizontal_edge_armv6|
+    EXPORT |vp9_loop_filter_vertical_edge_armv6|
+    EXPORT |vp9_mbloop_filter_vertical_edge_armv6|
 
     AREA    |.text|, CODE, READONLY  ; name this block of code
 
@@ -59,7 +59,7 @@
 ;stack  int  count
 
 ;-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
-|vp8_loop_filter_horizontal_edge_armv6| PROC
+|vp9_loop_filter_horizontal_edge_armv6| PROC
 ;-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
     stmdb       sp!, {r4 - r11, lr}
 
@@ -83,7 +83,7 @@
     orr         r3, r3, r3, lsl #16
 
 |Hnext8|
-    ; vp8_filter_mask() function
+    ; vp9_filter_mask() function
     ; calculate breakout conditions
     ldr         r12, [src], pstep           ; p0
 
@@ -94,7 +94,7 @@
 
     orr         r6, r6, r7                  ; abs (p3-p2)
     orr         r8, r8, r10                 ; abs (p2-p1)
-    uqsub8      lr, r6, r2                  ; compare to limit. lr: vp8_filter_mask
+    uqsub8      lr, r6, r2                  ; compare to limit. lr: vp9_filter_mask
     uqsub8      r8, r8, r2                  ; compare to limit
     uqsub8      r6, r11, r12                ; p1 - p0
     orr         lr, lr, r8
@@ -163,7 +163,7 @@
     usub8       r10, r12, r10               ; use usub8 instead of ssub8
     sel         r6, r12, r11                ; obtain vp8_hevmask: r6
 
-    ;vp8_filter() function
+    ;vp9_filter() function
     ldr         r8, [src], pstep            ; p0
     ldr         r12, c0x80808080
     ldr         r9, [src], pstep            ; q0
@@ -179,10 +179,10 @@
     str         r10, [sp, #8]               ; store qs1 temporarily
     str         r7, [sp, #12]               ; store ps1 temporarily
 
-    qsub8       r7, r7, r10                 ; vp8_signed_char_clamp(ps1-qs1)
-    qsub8       r8, r9, r8                  ; vp8_signed_char_clamp(vp8_filter + 3 * ( qs0 - ps0))
+    qsub8       r7, r7, r10                 ; vp9_signed_char_clamp(ps1-qs1)
+    qsub8       r8, r9, r8                  ; vp9_signed_char_clamp(vp9_filter + 3 * ( qs0 - ps0))
 
-    and         r7, r7, r6                  ; vp8_filter (r7) &= hev
+    and         r7, r7, r6                  ; vp9_filter (r7) &= hev
 
     qadd8       r7, r7, r8
     ldr         r9, c0x03030303             ; r9 = 3 --modified for vp8
@@ -191,15 +191,15 @@
     ldr         r10, c0x04040404
 
     qadd8       r7, r7, r8
-    and         r7, r7, lr                  ; vp8_filter &= mask;
+    and         r7, r7, lr                  ; vp9_filter &= mask;
 
-    ;modify code for vp8 -- Filter1 = vp8_filter (r7)
-    qadd8       r8 , r7 , r9                ; Filter2 (r8) = vp8_signed_char_clamp(vp8_filter+3)
-    qadd8       r7 , r7 , r10               ; vp8_filter = vp8_signed_char_clamp(vp8_filter+4)
+    ;modify code for vp8 -- Filter1 = vp9_filter (r7)
+    qadd8       r8 , r7 , r9                ; Filter2 (r8) = vp9_signed_char_clamp(vp9_filter+3)
+    qadd8       r7 , r7 , r10               ; vp9_filter = vp9_signed_char_clamp(vp9_filter+4)
 
     mov         r9, #0
     shadd8      r8 , r8 , r9                ; Filter2 >>= 3
-    shadd8      r7 , r7 , r9                ; vp8_filter >>= 3
+    shadd8      r7 , r7 , r9                ; vp9_filter >>= 3
     shadd8      r8 , r8 , r9
     shadd8      r7 , r7 , r9
     shadd8      lr , r8 , r9                ; lr: Filter2
@@ -212,30 +212,30 @@
     ;and        r8, r8, lr                  ; -1 for each element that equals 4
 
     ;calculate output
-    ;qadd8      lr, r8, r7                  ; u = vp8_signed_char_clamp(s + vp8_filter)
+    ;qadd8      lr, r8, r7                  ; u = vp9_signed_char_clamp(s + vp9_filter)
 
     ldr         r8, [sp]                    ; load qs0
     ldr         r9, [sp, #4]                ; load ps0
 
     ldr         r10, c0x01010101
 
-    qsub8       r8 ,r8, r7                  ; u = vp8_signed_char_clamp(qs0 - vp8_filter)
-    qadd8       r9, r9, lr                  ; u = vp8_signed_char_clamp(ps0 + Filter2)
+    qsub8       r8 ,r8, r7                  ; u = vp9_signed_char_clamp(qs0 - vp9_filter)
+    qadd8       r9, r9, lr                  ; u = vp9_signed_char_clamp(ps0 + Filter2)
 
     ;end of modification for vp8
 
     mov         lr, #0
-    sadd8       r7, r7 , r10                ; vp8_filter += 1
-    shadd8      r7, r7, lr                  ; vp8_filter >>= 1
+    sadd8       r7, r7 , r10                ; vp9_filter += 1
+    shadd8      r7, r7, lr                  ; vp9_filter >>= 1
 
     ldr         r11, [sp, #12]              ; load ps1
     ldr         r10, [sp, #8]               ; load qs1
 
-    bic         r7, r7, r6                  ; vp8_filter &= ~hev
+    bic         r7, r7, r6                  ; vp9_filter &= ~hev
     sub         src, src, pstep, lsl #2
 
-    qadd8       r11, r11, r7                ; u = vp8_signed_char_clamp(ps1 + vp8_filter)
-    qsub8       r10, r10,r7                 ; u = vp8_signed_char_clamp(qs1 - vp8_filter)
+    qadd8       r11, r11, r7                ; u = vp9_signed_char_clamp(ps1 + vp9_filter)
+    qsub8       r10, r10,r7                 ; u = vp9_signed_char_clamp(qs1 - vp9_filter)
 
     eor         r11, r11, r12               ; *op1 = u^0x80
     str         r11, [src], pstep           ; store op1
@@ -262,7 +262,7 @@
 
     add         sp, sp, #16
     ldmia       sp!, {r4 - r11, pc}
-    ENDP        ; |vp8_loop_filter_horizontal_edge_armv6|
+    ENDP        ; |vp9_loop_filter_horizontal_edge_armv6|
 
 
 ;-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
@@ -291,7 +291,7 @@
 
 |MBHnext8|
 
-    ; vp8_filter_mask() function
+    ; vp9_filter_mask() function
     ; calculate breakout conditions
     ldr         r12, [src], pstep           ; p0
 
@@ -302,7 +302,7 @@
 
     orr         r6, r6, r7                  ; abs (p3-p2)
     orr         r8, r8, r10                 ; abs (p2-p1)
-    uqsub8      lr, r6, r2                  ; compare to limit. lr: vp8_filter_mask
+    uqsub8      lr, r6, r2                  ; compare to limit. lr: vp9_filter_mask
     uqsub8      r8, r8, r2                  ; compare to limit
 
     uqsub8      r6, r11, r12                ; p1 - p0
@@ -385,28 +385,28 @@
     eor         r9, r9, r12                 ; qs0
     eor         r10, r10, r12               ; qs1
 
-    qsub8       r12, r9, r8                 ; vp8_signed_char_clamp(vp8_filter + 3 * ( qs0 - ps0))
+    qsub8       r12, r9, r8                 ; vp9_signed_char_clamp(vp9_filter + 3 * ( qs0 - ps0))
     str         r7, [sp, #12]               ; store ps1 temporarily
-    qsub8       r7, r7, r10                 ; vp8_signed_char_clamp(ps1-qs1)
+    qsub8       r7, r7, r10                 ; vp9_signed_char_clamp(ps1-qs1)
     str         r10, [sp, #8]               ; store qs1 temporarily
     qadd8       r7, r7, r12
     str         r9, [sp]                    ; store qs0 temporarily
     qadd8       r7, r7, r12
     str         r8, [sp, #4]                ; store ps0 temporarily
-    qadd8       r7, r7, r12                 ; vp8_filter: r7
+    qadd8       r7, r7, r12                 ; vp9_filter: r7
 
     ldr         r10, c0x03030303            ; r10 = 3 --modified for vp8
     ldr         r9, c0x04040404
 
-    and         r7, r7, lr                  ; vp8_filter &= mask (lr is free)
+    and         r7, r7, lr                  ; vp9_filter &= mask (lr is free)
 
     mov         r12, r7                     ; Filter2: r12
     and         r12, r12, r6                ; Filter2 &= hev
 
     ;modify code for vp8
     ;save bottom 3 bits so that we round one side +4 and the other +3
-    qadd8       r8 , r12 , r9               ; Filter1 (r8) = vp8_signed_char_clamp(Filter2+4)
-    qadd8       r12 , r12 , r10             ; Filter2 (r12) = vp8_signed_char_clamp(Filter2+3)
+    qadd8       r8 , r12 , r9               ; Filter1 (r8) = vp9_signed_char_clamp(Filter2+4)
+    qadd8       r12 , r12 , r10             ; Filter2 (r12) = vp9_signed_char_clamp(Filter2+3)
 
     mov         r10, #0
     shadd8      r8 , r8 , r10               ; Filter1 >>= 3
@@ -419,12 +419,12 @@
     ldr         r9, [sp]                    ; load qs0
     ldr         r11, [sp, #4]               ; load ps0
 
-    qsub8       r9 , r9, r8                 ; qs0 = vp8_signed_char_clamp(qs0 - Filter1)
-    qadd8       r11, r11, r12               ; ps0 = vp8_signed_char_clamp(ps0 + Filter2)
+    qsub8       r9 , r9, r8                 ; qs0 = vp9_signed_char_clamp(qs0 - Filter1)
+    qadd8       r11, r11, r12               ; ps0 = vp9_signed_char_clamp(ps0 + Filter2)
 
     ;save bottom 3 bits so that we round one side +4 and the other +3
     ;and            r8, r12, r10                ; s = Filter2 & 7 (s: r8)
-    ;qadd8      r12 , r12 , r9              ; Filter2 = vp8_signed_char_clamp(Filter2+4)
+    ;qadd8      r12 , r12 , r9              ; Filter2 = vp9_signed_char_clamp(Filter2+4)
     ;mov            r10, #0
     ;shadd8     r12 , r12 , r10             ; Filter2 >>= 3
     ;usub8      lr, r8, r9                  ; s = (s==4)*-1
@@ -436,13 +436,13 @@
     ;ldr            r11, [sp, #4]               ; load ps0
     ;shadd8     r12 , r12 , r10
     ;and            r8, r8, lr                  ; -1 for each element that equals 4
-    ;qadd8      r10, r8, r12                ; u = vp8_signed_char_clamp(s + Filter2)
-    ;qsub8      r9 , r9, r12                ; qs0 = vp8_signed_char_clamp(qs0 - Filter2)
-    ;qadd8      r11, r11, r10               ; ps0 = vp8_signed_char_clamp(ps0 + u)
+    ;qadd8      r10, r8, r12                ; u = vp9_signed_char_clamp(s + Filter2)
+    ;qsub8      r9 , r9, r12                ; qs0 = vp9_signed_char_clamp(qs0 - Filter2)
+    ;qadd8      r11, r11, r10               ; ps0 = vp9_signed_char_clamp(ps0 + u)
 
     ;end of modification for vp8
 
-    bic         r12, r7, r6                 ; vp8_filter &= ~hev    ( r6 is free)
+    bic         r12, r7, r6                 ; vp9_filter &= ~hev    ( r6 is free)
     ;mov        r12, r7
 
     ;roughly 3/7th difference across boundary
@@ -470,10 +470,10 @@
 
     sub         src, src, pstep
 
-    orr         r10, r6, r10, lsl #8        ; u = vp8_signed_char_clamp((63 + Filter2 * 27)>>7)
+    orr         r10, r6, r10, lsl #8        ; u = vp9_signed_char_clamp((63 + Filter2 * 27)>>7)
 
-    qsub8       r8, r9, r10                 ; s = vp8_signed_char_clamp(qs0 - u)
-    qadd8       r10, r11, r10               ; s = vp8_signed_char_clamp(ps0 + u)
+    qsub8       r8, r9, r10                 ; s = vp9_signed_char_clamp(qs0 - u)
+    qadd8       r10, r11, r10               ; s = vp9_signed_char_clamp(ps0 + u)
     eor         r8, r8, lr                  ; *oq0 = s^0x80
     str         r8, [src]                   ; store *oq0
     sub         src, src, pstep
@@ -508,10 +508,10 @@
 
     sub         src, src, pstep
 
-    orr         r10, r6, r10, lsl #8        ; u = vp8_signed_char_clamp((63 + Filter2 * 18)>>7)
+    orr         r10, r6, r10, lsl #8        ; u = vp9_signed_char_clamp((63 + Filter2 * 18)>>7)
 
-    qadd8       r11, r11, r10               ; s = vp8_signed_char_clamp(ps1 + u)
-    qsub8       r8, r9, r10                 ; s = vp8_signed_char_clamp(qs1 - u)
+    qadd8       r11, r11, r10               ; s = vp9_signed_char_clamp(ps1 + u)
+    qsub8       r8, r9, r10                 ; s = vp9_signed_char_clamp(qs1 - u)
     eor         r11, r11, lr                ; *op1 = s^0x80
     str         r11, [src], pstep           ; store *op1
     eor         r8, r8, lr                  ; *oq1 = s^0x80
@@ -552,10 +552,10 @@
     eor         r9, r9, lr
     eor         r11, r11, lr
 
-    orr         r10, r6, r10, lsl #8        ; u = vp8_signed_char_clamp((63 + Filter2 * 9)>>7)
+    orr         r10, r6, r10, lsl #8        ; u = vp9_signed_char_clamp((63 + Filter2 * 9)>>7)
 
-    qadd8       r8, r11, r10                ; s = vp8_signed_char_clamp(ps2 + u)
-    qsub8       r10, r9, r10                ; s = vp8_signed_char_clamp(qs2 - u)
+    qadd8       r8, r11, r10                ; s = vp9_signed_char_clamp(ps2 + u)
+    qsub8       r10, r9, r10                ; s = vp9_signed_char_clamp(qs2 - u)
     eor         r8, r8, lr                  ; *op2 = s^0x80
     str         r8, [src], pstep, lsl #2    ; store *op2
     add         src, src, pstep
@@ -579,7 +579,7 @@
 
 
 ;-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
-|vp8_loop_filter_vertical_edge_armv6| PROC
+|vp9_loop_filter_vertical_edge_armv6| PROC
 ;-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
     stmdb       sp!, {r4 - r11, lr}
 
@@ -605,7 +605,7 @@
 
 |Vnext8|
 
-    ; vp8_filter_mask() function
+    ; vp9_filter_mask() function
     ; calculate breakout conditions
     ; transpose the source data for 4-in-parallel operation
     TRANSPOSE_MATRIX r6, r7, r8, lr, r9, r10, r11, r12
@@ -616,7 +616,7 @@
     uqsub8      r10, r11, r10               ; p1 - p2
     orr         r7, r7, r8                  ; abs (p3-p2)
     orr         r10, r9, r10                ; abs (p2-p1)
-    uqsub8      lr, r7, r2                  ; compare to limit. lr: vp8_filter_mask
+    uqsub8      lr, r7, r2                  ; compare to limit. lr: vp9_filter_mask
     uqsub8      r10, r10, r2                ; compare to limit
 
     sub         src, src, pstep, lsl #2     ; move src pointer down by 4 lines
@@ -702,7 +702,7 @@
     usub8       r9, r12, r9
     sel         r6, r12, r11                ; hev mask: r6
 
-    ;vp8_filter() function
+    ;vp9_filter() function
     ; load soure data to r6, r11, r12, lr
     ldrh        r9, [src, #-2]
     ldrh        r10, [src], pstep
@@ -742,10 +742,10 @@
     str         r10, [sp, #8]               ; store qs1 temporarily
     str         r7, [sp, #12]               ; store ps1 temporarily
 
-    qsub8       r7, r7, r10                 ; vp8_signed_char_clamp(ps1-qs1)
-    qsub8       r8, r9, r8                  ; vp8_signed_char_clamp(vp8_filter + 3 * ( qs0 - ps0))
+    qsub8       r7, r7, r10                 ; vp9_signed_char_clamp(ps1-qs1)
+    qsub8       r8, r9, r8                  ; vp9_signed_char_clamp(vp9_filter + 3 * ( qs0 - ps0))
 
-    and         r7, r7, r6                  ;  vp8_filter (r7) &= hev (r7 : filter)
+    and         r7, r7, r6                  ;  vp9_filter (r7) &= hev (r7 : filter)
 
     qadd8       r7, r7, r8
     ldr         r9, c0x03030303             ; r9 = 3 --modified for vp8
@@ -756,15 +756,15 @@
     qadd8       r7, r7, r8
     ;mvn         r11, #0                     ; r11 == -1
 
-    and         r7, r7, lr                  ; vp8_filter &= mask
+    and         r7, r7, lr                  ; vp9_filter &= mask
 
-    ;modify code for vp8 -- Filter1 = vp8_filter (r7)
-    qadd8       r8 , r7 , r9                ; Filter2 (r8) = vp8_signed_char_clamp(vp8_filter+3)
-    qadd8       r7 , r7 , r10               ; vp8_filter = vp8_signed_char_clamp(vp8_filter+4)
+    ;modify code for vp8 -- Filter1 = vp9_filter (r7)
+    qadd8       r8 , r7 , r9                ; Filter2 (r8) = vp9_signed_char_clamp(vp9_filter+3)
+    qadd8       r7 , r7 , r10               ; vp9_filter = vp9_signed_char_clamp(vp9_filter+4)
 
     mov         r9, #0
     shadd8      r8 , r8 , r9                ; Filter2 >>= 3
-    shadd8      r7 , r7 , r9                ; vp8_filter >>= 3
+    shadd8      r7 , r7 , r9                ; vp9_filter >>= 3
     shadd8      r8 , r8 , r9
     shadd8      r7 , r7 , r9
     shadd8      lr , r8 , r9                ; lr: filter2
@@ -777,15 +777,15 @@
     ;and            r8, r8, lr                  ; -1 for each element that equals 4 -- r8: s
 
     ;calculate output
-    ;qadd8      lr, r8, r7                  ; u = vp8_signed_char_clamp(s + vp8_filter)
+    ;qadd8      lr, r8, r7                  ; u = vp9_signed_char_clamp(s + vp9_filter)
 
     ldr         r8, [sp]                    ; load qs0
     ldr         r9, [sp, #4]                ; load ps0
 
     ldr         r10, c0x01010101
 
-    qsub8       r8, r8, r7                  ; u = vp8_signed_char_clamp(qs0 - vp8_filter)
-    qadd8       r9, r9, lr                  ; u = vp8_signed_char_clamp(ps0 + Filter2)
+    qsub8       r8, r8, r7                  ; u = vp9_signed_char_clamp(qs0 - vp9_filter)
+    qadd8       r9, r9, lr                  ; u = vp9_signed_char_clamp(ps0 + Filter2)
     ;end of modification for vp8
 
     eor         r8, r8, r12
@@ -799,10 +799,10 @@
     ldr         r10, [sp, #8]               ; load qs1
     ldr         r11, [sp, #12]              ; load ps1
 
-    bic         r7, r7, r6                  ; r7: vp8_filter
+    bic         r7, r7, r6                  ; r7: vp9_filter
 
-    qsub8       r10 , r10, r7               ; u = vp8_signed_char_clamp(qs1 - vp8_filter)
-    qadd8       r11, r11, r7                ; u = vp8_signed_char_clamp(ps1 + vp8_filter)
+    qsub8       r10 , r10, r7               ; u = vp9_signed_char_clamp(qs1 - vp9_filter)
+    qadd8       r11, r11, r7                ; u = vp9_signed_char_clamp(ps1 + vp9_filter)
     eor         r10, r10, r12
     eor         r11, r11, r12
 
@@ -848,7 +848,7 @@
     add         sp, sp, #16
 
     ldmia       sp!, {r4 - r11, pc}
-    ENDP        ; |vp8_loop_filter_vertical_edge_armv6|
+    ENDP        ; |vp9_loop_filter_vertical_edge_armv6|
 
 
 
@@ -882,7 +882,7 @@
     orr         r3, r3, r3, lsl #16
 
 |MBVnext8|
-    ; vp8_filter_mask() function
+    ; vp9_filter_mask() function
     ; calculate breakout conditions
     ; transpose the source data for 4-in-parallel operation
     TRANSPOSE_MATRIX r6, r7, r8, lr, r9, r10, r11, r12
@@ -893,7 +893,7 @@
     uqsub8      r10, r11, r10               ; p1 - p2
     orr         r7, r7, r8                  ; abs (p3-p2)
     orr         r10, r9, r10                ; abs (p2-p1)
-    uqsub8      lr, r7, r2                  ; compare to limit. lr: vp8_filter_mask
+    uqsub8      lr, r7, r2                  ; compare to limit. lr: vp9_filter_mask
     uqsub8      r10, r10, r2                ; compare to limit
 
     sub         src, src, pstep, lsl #2     ; move src pointer down by 4 lines
@@ -1019,29 +1019,29 @@
     eor         r9, r9, r12                 ; qs0
     eor         r10, r10, r12               ; qs1
 
-    qsub8       r12, r9, r8                 ; vp8_signed_char_clamp(vp8_filter + 3 * ( qs0 - ps0))
+    qsub8       r12, r9, r8                 ; vp9_signed_char_clamp(vp9_filter + 3 * ( qs0 - ps0))
     str         r7, [sp, #12]               ; store ps1 temporarily
-    qsub8       r7, r7, r10                 ; vp8_signed_char_clamp(ps1-qs1)
+    qsub8       r7, r7, r10                 ; vp9_signed_char_clamp(ps1-qs1)
     str         r10, [sp, #8]               ; store qs1 temporarily
     qadd8       r7, r7, r12
     str         r9, [sp]                    ; store qs0 temporarily
     qadd8       r7, r7, r12
     str         r8, [sp, #4]                ; store ps0 temporarily
-    qadd8       r7, r7, r12                 ; vp8_filter: r7
+    qadd8       r7, r7, r12                 ; vp9_filter: r7
 
     ldr         r10, c0x03030303            ; r10 = 3 --modified for vp8
     ldr         r9, c0x04040404
     ;mvn         r11, #0                     ; r11 == -1
 
-    and         r7, r7, lr                  ; vp8_filter &= mask (lr is free)
+    and         r7, r7, lr                  ; vp9_filter &= mask (lr is free)
 
     mov         r12, r7                     ; Filter2: r12
     and         r12, r12, r6                ; Filter2 &= hev
 
     ;modify code for vp8
     ;save bottom 3 bits so that we round one side +4 and the other +3
-    qadd8       r8 , r12 , r9               ; Filter1 (r8) = vp8_signed_char_clamp(Filter2+4)
-    qadd8       r12 , r12 , r10             ; Filter2 (r12) = vp8_signed_char_clamp(Filter2+3)
+    qadd8       r8 , r12 , r9               ; Filter1 (r8) = vp9_signed_char_clamp(Filter2+4)
+    qadd8       r12 , r12 , r10             ; Filter2 (r12) = vp9_signed_char_clamp(Filter2+3)
 
     mov         r10, #0
     shadd8      r8 , r8 , r10               ; Filter1 >>= 3
@@ -1054,12 +1054,12 @@
     ldr         r9, [sp]                    ; load qs0
     ldr         r11, [sp, #4]               ; load ps0
 
-    qsub8       r9 , r9, r8                 ; qs0 = vp8_signed_char_clamp(qs0 - Filter1)
-    qadd8       r11, r11, r12               ; ps0 = vp8_signed_char_clamp(ps0 + Filter2)
+    qsub8       r9 , r9, r8                 ; qs0 = vp9_signed_char_clamp(qs0 - Filter1)
+    qadd8       r11, r11, r12               ; ps0 = vp9_signed_char_clamp(ps0 + Filter2)
 
     ;save bottom 3 bits so that we round one side +4 and the other +3
     ;and            r8, r12, r10                ; s = Filter2 & 7 (s: r8)
-    ;qadd8      r12 , r12 , r9              ; Filter2 = vp8_signed_char_clamp(Filter2+4)
+    ;qadd8      r12 , r12 , r9              ; Filter2 = vp9_signed_char_clamp(Filter2+4)
     ;mov            r10, #0
     ;shadd8     r12 , r12 , r10             ; Filter2 >>= 3
     ;usub8      lr, r8, r9                  ; s = (s==4)*-1
@@ -1071,13 +1071,13 @@
     ;ldr            r11, [sp, #4]               ; load ps0
     ;shadd8     r12 , r12 , r10
     ;and            r8, r8, lr                  ; -1 for each element that equals 4
-    ;qadd8      r10, r8, r12                ; u = vp8_signed_char_clamp(s + Filter2)
-    ;qsub8      r9 , r9, r12                ; qs0 = vp8_signed_char_clamp(qs0 - Filter2)
-    ;qadd8      r11, r11, r10               ; ps0 = vp8_signed_char_clamp(ps0 + u)
+    ;qadd8      r10, r8, r12                ; u = vp9_signed_char_clamp(s + Filter2)
+    ;qsub8      r9 , r9, r12                ; qs0 = vp9_signed_char_clamp(qs0 - Filter2)
+    ;qadd8      r11, r11, r10               ; ps0 = vp9_signed_char_clamp(ps0 + u)
 
     ;end of modification for vp8
 
-    bic         r12, r7, r6                 ;vp8_filter &= ~hev    ( r6 is free)
+    bic         r12, r7, r6                 ;vp9_filter &= ~hev    ( r6 is free)
     ;mov            r12, r7
 
     ;roughly 3/7th difference across boundary
@@ -1105,10 +1105,10 @@
 
     sub         src, src, pstep, lsl #2     ; move src pointer down by 4 lines
 
-    orr         r10, r6, r10, lsl #8        ; u = vp8_signed_char_clamp((63 + Filter2 * 27)>>7)
+    orr         r10, r6, r10, lsl #8        ; u = vp9_signed_char_clamp((63 + Filter2 * 27)>>7)
 
-    qsub8       r8, r9, r10                 ; s = vp8_signed_char_clamp(qs0 - u)
-    qadd8       r10, r11, r10               ; s = vp8_signed_char_clamp(ps0 + u)
+    qsub8       r8, r9, r10                 ; s = vp9_signed_char_clamp(qs0 - u)
+    qadd8       r10, r11, r10               ; s = vp9_signed_char_clamp(ps0 + u)
     eor         r8, r8, lr                  ; *oq0 = s^0x80
     eor         r10, r10, lr                ; *op0 = s^0x80
 
@@ -1157,10 +1157,10 @@
 
     add         src, src, #2
 
-    orr         r10, r6, r10, lsl #8        ; u = vp8_signed_char_clamp((63 + Filter2 * 18)>>7)
+    orr         r10, r6, r10, lsl #8        ; u = vp9_signed_char_clamp((63 + Filter2 * 18)>>7)
 
-    qsub8       r8, r9, r10                 ; s = vp8_signed_char_clamp(qs1 - u)
-    qadd8       r10, r11, r10               ; s = vp8_signed_char_clamp(ps1 + u)
+    qsub8       r8, r9, r10                 ; s = vp9_signed_char_clamp(qs1 - u)
+    qadd8       r10, r11, r10               ; s = vp9_signed_char_clamp(ps1 + u)
     eor         r8, r8, lr                  ; *oq1 = s^0x80
     eor         r10, r10, lr                ; *op1 = s^0x80
 
@@ -1227,10 +1227,10 @@
 
     ldr         lr, c0x80808080
 
-    orr         r10, r6, r10, lsl #8        ; u = vp8_signed_char_clamp((63 + Filter2 * 9)>>7)
+    orr         r10, r6, r10, lsl #8        ; u = vp9_signed_char_clamp((63 + Filter2 * 9)>>7)
 
-    qadd8       r8, r11, r10                ; s = vp8_signed_char_clamp(ps2 + u)
-    qsub8       r10, r9, r10                ; s = vp8_signed_char_clamp(qs2 - u)
+    qadd8       r8, r11, r10                ; s = vp9_signed_char_clamp(ps2 + u)
+    qsub8       r10, r9, r10                ; s = vp9_signed_char_clamp(qs2 - u)
     eor         r8, r8, lr                  ; *op2 = s^0x80
     eor         r10, r10, lr                ; *oq2 = s^0x80
 
diff --git a/vp8/common/arm/armv6/simpleloopfilter_v6.asm b/vp8/common/arm/armv6/simpleloopfilter_v6.asm
index 5e00cf0..8306912 100644
--- a/vp8/common/arm/armv6/simpleloopfilter_v6.asm
+++ b/vp8/common/arm/armv6/simpleloopfilter_v6.asm
@@ -9,8 +9,8 @@
 ;
 
 
-    EXPORT |vp8_loop_filter_simple_horizontal_edge_armv6|
-    EXPORT |vp8_loop_filter_simple_vertical_edge_armv6|
+    EXPORT |vp9_loop_filter_simple_horizontal_edge_armv6|
+    EXPORT |vp9_loop_filter_simple_vertical_edge_armv6|
 
     AREA    |.text|, CODE, READONLY  ; name this block of code
 
@@ -54,7 +54,7 @@
 ;r2     const char *blimit
 
 ;-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
-|vp8_loop_filter_simple_horizontal_edge_armv6| PROC
+|vp9_loop_filter_simple_horizontal_edge_armv6| PROC
 ;-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
     stmdb       sp!, {r4 - r11, lr}
 
@@ -94,18 +94,18 @@
     eor         r4, r4, r2                  ; p0 offset to convert to a signed value
     eor         r5, r5, r2                  ; q0 offset to convert to a signed value
 
-    qsub8       r3, r3, r6                  ; vp8_filter = p1 - q1
+    qsub8       r3, r3, r6                  ; vp9_filter = p1 - q1
     qsub8       r6, r5, r4                  ; q0 - p0
     qadd8       r3, r3, r6                  ; += q0 - p0
     ldr         r7, c0x04040404
     qadd8       r3, r3, r6                  ; += q0 - p0
     ldr         r8, c0x03030303
-    qadd8       r3, r3, r6                  ; vp8_filter = p1-q1 + 3*(q0-p0))
+    qadd8       r3, r3, r6                  ; vp9_filter = p1-q1 + 3*(q0-p0))
     ;STALL
-    and         r3, r3, r10                 ; vp8_filter &= mask
+    and         r3, r3, r10                 ; vp9_filter &= mask
 
-    qadd8       r7 , r3 , r7                ; Filter1 = vp8_filter + 4
-    qadd8       r8 , r3 , r8                ; Filter2 = vp8_filter + 3
+    qadd8       r7 , r3 , r7                ; Filter1 = vp9_filter + 4
+    qadd8       r8 , r3 , r8                ; Filter2 = vp9_filter + 3
 
     shadd8      r7 , r7 , lr
     shadd8      r8 , r8 , lr
@@ -133,11 +133,11 @@
     bne         simple_hnext8
 
     ldmia       sp!, {r4 - r11, pc}
-    ENDP        ; |vp8_loop_filter_simple_horizontal_edge_armv6|
+    ENDP        ; |vp9_loop_filter_simple_horizontal_edge_armv6|
 
 
 ;-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
-|vp8_loop_filter_simple_vertical_edge_armv6| PROC
+|vp9_loop_filter_simple_vertical_edge_armv6| PROC
 ;-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
     stmdb       sp!, {r4 - r11, lr}
 
@@ -200,21 +200,21 @@
     eor         r4, r4, r2                  ; p0 offset to convert to a signed value
     eor         r5, r5, r2                  ; q0 offset to convert to a signed value
 
-    qsub8       r3, r3, r6                  ; vp8_filter = p1 - q1
+    qsub8       r3, r3, r6                  ; vp9_filter = p1 - q1
     qsub8       r6, r5, r4                  ; q0 - p0
 
-    qadd8       r3, r3, r6                  ; vp8_filter += q0 - p0
+    qadd8       r3, r3, r6                  ; vp9_filter += q0 - p0
     ldr         r9, c0x03030303             ; r9 = 3
 
-    qadd8       r3, r3, r6                  ; vp8_filter += q0 - p0
+    qadd8       r3, r3, r6                  ; vp9_filter += q0 - p0
     ldr         r7, c0x04040404
 
-    qadd8       r3, r3, r6                  ; vp8_filter = p1-q1 + 3*(q0-p0))
+    qadd8       r3, r3, r6                  ; vp9_filter = p1-q1 + 3*(q0-p0))
     ;STALL
-    and         r3, r3, lr                  ; vp8_filter &= mask
+    and         r3, r3, lr                  ; vp9_filter &= mask
 
-    qadd8       r9 , r3 , r9                ; Filter2 = vp8_filter + 3
-    qadd8       r3 , r3 , r7                ; Filter1 = vp8_filter + 4
+    qadd8       r9 , r3 , r9                ; Filter2 = vp9_filter + 3
+    qadd8       r3 , r3 , r7                ; Filter1 = vp9_filter + 4
 
     shadd8      r9 , r9 , r8
     shadd8      r3 , r3 , r8
@@ -276,7 +276,7 @@
     bne         simple_vnext8
 
     ldmia       sp!, {r4 - r11, pc}
-    ENDP        ; |vp8_loop_filter_simple_vertical_edge_armv6|
+    ENDP        ; |vp9_loop_filter_simple_vertical_edge_armv6|
 
 ; Constant Pool
 c0x80808080 DCD     0x80808080
diff --git a/vp8/common/arm/armv6/sixtappredict8x4_v6.asm b/vp8/common/arm/armv6/sixtappredict8x4_v6.asm
index e81aef5..5bf94e0 100644
--- a/vp8/common/arm/armv6/sixtappredict8x4_v6.asm
+++ b/vp8/common/arm/armv6/sixtappredict8x4_v6.asm
@@ -65,18 +65,18 @@
     pkhbt       r9, r9, r10, lsl #16        ; r10 | r9
 
 |first_pass_wloop_v6|
-    smuad       r11, r6, r3                 ; vp8_filter[0], vp8_filter[1]
+    smuad       r11, r6, r3                 ; vp9_filter[0], vp9_filter[1]
     smuad       r12, r7, r3
 
     ldrb        r6, [r0], #1
 
-    smlad       r11, r8, r4, r11            ; vp8_filter[2], vp8_filter[3]
+    smlad       r11, r8, r4, r11            ; vp9_filter[2], vp9_filter[3]
     ldrb        r7, [r0], #1
     smlad       r12, r9, r4, r12
 
     pkhbt       r10, r10, r6, lsl #16       ; r10 | r9
     pkhbt       r6, r6, r7, lsl #16         ; r11 | r10
-    smlad       r11, r10, r5, r11           ; vp8_filter[4], vp8_filter[5]
+    smlad       r11, r10, r5, r11           ; vp9_filter[4], vp9_filter[5]
     smlad       r12, r6, r5, r12
 
     sub         r2, r2, #1
diff --git a/vp8/common/arm/bilinearfilter_arm.c b/vp8/common/arm/bilinearfilter_arm.c
index d96eaa7..237952d 100644
--- a/vp8/common/arm/bilinearfilter_arm.c
+++ b/vp8/common/arm/bilinearfilter_arm.c
@@ -14,7 +14,7 @@
 #include "vp8/common/subpixel.h"
 #include "bilinearfilter_arm.h"
 
-void vp8_filter_block2d_bil_armv6
+void vp9_filter_block2d_bil_armv6
 (
   unsigned char *src_ptr,
   unsigned char *dst_ptr,
@@ -28,10 +28,10 @@
   unsigned short FData[36 * 16]; /* Temp data buffer used in filtering */
 
   /* First filter 1-D horizontally... */
-  vp8_filter_block2d_bil_first_pass_armv6(src_ptr, FData, src_pitch, Height + 1, Width, HFilter);
+  vp9_filter_block2d_bil_first_pass_armv6(src_ptr, FData, src_pitch, Height + 1, Width, HFilter);
 
   /* then 1-D vertically... */
-  vp8_filter_block2d_bil_second_pass_armv6(FData, dst_ptr, dst_pitch, Height, Width, VFilter);
+  vp9_filter_block2d_bil_second_pass_armv6(FData, dst_ptr, dst_pitch, Height, Width, VFilter);
 }
 
 
@@ -50,7 +50,7 @@
   HFilter = vp8_bilinear_filters[xoffset];
   VFilter = vp8_bilinear_filters[yoffset];
 
-  vp8_filter_block2d_bil_armv6(src_ptr, dst_ptr, src_pixels_per_line, dst_pitch, HFilter, VFilter, 4, 4);
+  vp9_filter_block2d_bil_armv6(src_ptr, dst_ptr, src_pixels_per_line, dst_pitch, HFilter, VFilter, 4, 4);
 }
 
 void vp9_bilinear_predict8x8_armv6
@@ -68,7 +68,7 @@
   HFilter = vp8_bilinear_filters[xoffset];
   VFilter = vp8_bilinear_filters[yoffset];
 
-  vp8_filter_block2d_bil_armv6(src_ptr, dst_ptr, src_pixels_per_line, dst_pitch, HFilter, VFilter, 8, 8);
+  vp9_filter_block2d_bil_armv6(src_ptr, dst_ptr, src_pixels_per_line, dst_pitch, HFilter, VFilter, 8, 8);
 }
 
 void vp9_bilinear_predict8x4_armv6
@@ -86,7 +86,7 @@
   HFilter = vp8_bilinear_filters[xoffset];
   VFilter = vp8_bilinear_filters[yoffset];
 
-  vp8_filter_block2d_bil_armv6(src_ptr, dst_ptr, src_pixels_per_line, dst_pitch, HFilter, VFilter, 8, 4);
+  vp9_filter_block2d_bil_armv6(src_ptr, dst_ptr, src_pixels_per_line, dst_pitch, HFilter, VFilter, 8, 4);
 }
 
 void vp9_bilinear_predict16x16_armv6
@@ -104,5 +104,5 @@
   HFilter = vp8_bilinear_filters[xoffset];
   VFilter = vp8_bilinear_filters[yoffset];
 
-  vp8_filter_block2d_bil_armv6(src_ptr, dst_ptr, src_pixels_per_line, dst_pitch, HFilter, VFilter, 16, 16);
+  vp9_filter_block2d_bil_armv6(src_ptr, dst_ptr, src_pixels_per_line, dst_pitch, HFilter, VFilter, 16, 16);
 }
diff --git a/vp8/common/arm/bilinearfilter_arm.h b/vp8/common/arm/bilinearfilter_arm.h
index 1e0d6d2..b6d9cfc 100644
--- a/vp8/common/arm/bilinearfilter_arm.h
+++ b/vp8/common/arm/bilinearfilter_arm.h
@@ -12,24 +12,24 @@
 #ifndef BILINEARFILTER_ARM_H
 #define BILINEARFILTER_ARM_H
 
-extern void vp8_filter_block2d_bil_first_pass_armv6
+extern void vp9_filter_block2d_bil_first_pass_armv6
 (
   const unsigned char  *src_ptr,
   unsigned short       *dst_ptr,
   unsigned int          src_pitch,
   unsigned int          height,
   unsigned int          width,
-  const short          *vp8_filter
+  const short          *vp9_filter
 );
 
-extern void vp8_filter_block2d_bil_second_pass_armv6
+extern void vp9_filter_block2d_bil_second_pass_armv6
 (
   const unsigned short *src_ptr,
   unsigned char        *dst_ptr,
   int                   dst_pitch,
   unsigned int          height,
   unsigned int          width,
-  const short         *vp8_filter
+  const short         *vp9_filter
 );
 
 #endif /* BILINEARFILTER_ARM_H */
diff --git a/vp8/common/arm/filter_arm.c b/vp8/common/arm/filter_arm.c
index f905143..37a2a74 100644
--- a/vp8/common/arm/filter_arm.c
+++ b/vp8/common/arm/filter_arm.c
@@ -15,75 +15,75 @@
 #include "vp8/common/subpixel.h"
 #include "vpx_ports/mem.h"
 
-extern void vp8_filter_block2d_first_pass_armv6
+extern void vp9_filter_block2d_first_pass_armv6
 (
   unsigned char *src_ptr,
   short         *output_ptr,
   unsigned int src_pixels_per_line,
   unsigned int output_width,
   unsigned int output_height,
-  const short *vp8_filter
+  const short *vp9_filter
 );
 
 // 8x8
-extern void vp8_filter_block2d_first_pass_8x8_armv6
+extern void vp9_filter_block2d_first_pass_8x8_armv6
 (
   unsigned char *src_ptr,
   short         *output_ptr,
   unsigned int src_pixels_per_line,
   unsigned int output_width,
   unsigned int output_height,
-  const short *vp8_filter
+  const short *vp9_filter
 );
 
 // 16x16
-extern void vp8_filter_block2d_first_pass_16x16_armv6
+extern void vp9_filter_block2d_first_pass_16x16_armv6
 (
   unsigned char *src_ptr,
   short         *output_ptr,
   unsigned int src_pixels_per_line,
   unsigned int output_width,
   unsigned int output_height,
-  const short *vp8_filter
+  const short *vp9_filter
 );
 
-extern void vp8_filter_block2d_second_pass_armv6
+extern void vp9_filter_block2d_second_pass_armv6
 (
   short         *src_ptr,
   unsigned char *output_ptr,
   unsigned int output_pitch,
   unsigned int cnt,
-  const short *vp8_filter
+  const short *vp9_filter
 );
 
-extern void vp8_filter4_block2d_second_pass_armv6
+extern void vp9_filter4_block2d_second_pass_armv6
 (
   short         *src_ptr,
   unsigned char *output_ptr,
   unsigned int output_pitch,
   unsigned int cnt,
-  const short *vp8_filter
+  const short *vp9_filter
 );
 
-extern void vp8_filter_block2d_first_pass_only_armv6
+extern void vp9_filter_block2d_first_pass_only_armv6
 (
   unsigned char *src_ptr,
   unsigned char *output_ptr,
   unsigned int src_pixels_per_line,
   unsigned int cnt,
   unsigned int output_pitch,
-  const short *vp8_filter
+  const short *vp9_filter
 );
 
 
-extern void vp8_filter_block2d_second_pass_only_armv6
+extern void vp9_filter_block2d_second_pass_only_armv6
 (
   unsigned char *src_ptr,
   unsigned char *output_ptr,
   unsigned int src_pixels_per_line,
   unsigned int cnt,
   unsigned int output_pitch,
-  const short *vp8_filter
+  const short *vp9_filter
 );
 
 #if HAVE_ARMV6
@@ -106,24 +106,24 @@
 
   /* Vfilter is null. First pass only */
   if (xoffset && !yoffset) {
-    /*vp8_filter_block2d_first_pass_armv6 ( src_ptr, FData+2, src_pixels_per_line, 4, 4, HFilter );
-    vp8_filter_block2d_second_pass_armv6 ( FData+2, dst_ptr, dst_pitch, 4, VFilter );*/
+    /*vp9_filter_block2d_first_pass_armv6 ( src_ptr, FData+2, src_pixels_per_line, 4, 4, HFilter );
+    vp9_filter_block2d_second_pass_armv6 ( FData+2, dst_ptr, dst_pitch, 4, VFilter );*/
 
-    vp8_filter_block2d_first_pass_only_armv6(src_ptr, dst_ptr, src_pixels_per_line, 4, dst_pitch, HFilter);
+    vp9_filter_block2d_first_pass_only_armv6(src_ptr, dst_ptr, src_pixels_per_line, 4, dst_pitch, HFilter);
   }
   /* Hfilter is null. Second pass only */
   else if (!xoffset && yoffset) {
-    vp8_filter_block2d_second_pass_only_armv6(src_ptr, dst_ptr, src_pixels_per_line, 4, dst_pitch, VFilter);
+    vp9_filter_block2d_second_pass_only_armv6(src_ptr, dst_ptr, src_pixels_per_line, 4, dst_pitch, VFilter);
   } else {
     /* Vfilter is a 4 tap filter */
     if (yoffset & 0x1) {
-      vp8_filter_block2d_first_pass_armv6(src_ptr - src_pixels_per_line, FData + 1, src_pixels_per_line, 4, 7, HFilter);
-      vp8_filter4_block2d_second_pass_armv6(FData + 2, dst_ptr, dst_pitch, 4, VFilter);
+      vp9_filter_block2d_first_pass_armv6(src_ptr - src_pixels_per_line, FData + 1, src_pixels_per_line, 4, 7, HFilter);
+      vp9_filter4_block2d_second_pass_armv6(FData + 2, dst_ptr, dst_pitch, 4, VFilter);
     }
     /* Vfilter is 6 tap filter */
     else {
-      vp8_filter_block2d_first_pass_armv6(src_ptr - (2 * src_pixels_per_line), FData, src_pixels_per_line, 4, 9, HFilter);
-      vp8_filter_block2d_second_pass_armv6(FData + 2, dst_ptr, dst_pitch, 4, VFilter);
+      vp9_filter_block2d_first_pass_armv6(src_ptr - (2 * src_pixels_per_line), FData, src_pixels_per_line, 4, 9, HFilter);
+      vp9_filter_block2d_second_pass_armv6(FData + 2, dst_ptr, dst_pitch, 4, VFilter);
     }
   }
 }
@@ -145,18 +145,18 @@
   VFilter = vp8_sub_pel_filters[yoffset];   /* 6 tap */
 
   if (xoffset && !yoffset) {
-    vp8_filter_block2d_first_pass_only_armv6(src_ptr, dst_ptr, src_pixels_per_line, 8, dst_pitch, HFilter);
+    vp9_filter_block2d_first_pass_only_armv6(src_ptr, dst_ptr, src_pixels_per_line, 8, dst_pitch, HFilter);
   }
   /* Hfilter is null. Second pass only */
   else if (!xoffset && yoffset) {
-    vp8_filter_block2d_second_pass_only_armv6(src_ptr, dst_ptr, src_pixels_per_line, 8, dst_pitch, VFilter);
+    vp9_filter_block2d_second_pass_only_armv6(src_ptr, dst_ptr, src_pixels_per_line, 8, dst_pitch, VFilter);
   } else {
     if (yoffset & 0x1) {
-      vp8_filter_block2d_first_pass_8x8_armv6(src_ptr - src_pixels_per_line, FData + 1, src_pixels_per_line, 8, 11, HFilter);
-      vp8_filter4_block2d_second_pass_armv6(FData + 2, dst_ptr, dst_pitch, 8, VFilter);
+      vp9_filter_block2d_first_pass_8x8_armv6(src_ptr - src_pixels_per_line, FData + 1, src_pixels_per_line, 8, 11, HFilter);
+      vp9_filter4_block2d_second_pass_armv6(FData + 2, dst_ptr, dst_pitch, 8, VFilter);
     } else {
-      vp8_filter_block2d_first_pass_8x8_armv6(src_ptr - (2 * src_pixels_per_line), FData, src_pixels_per_line, 8, 13, HFilter);
-      vp8_filter_block2d_second_pass_armv6(FData + 2, dst_ptr, dst_pitch, 8, VFilter);
+      vp9_filter_block2d_first_pass_8x8_armv6(src_ptr - (2 * src_pixels_per_line), FData, src_pixels_per_line, 8, 13, HFilter);
+      vp9_filter_block2d_second_pass_armv6(FData + 2, dst_ptr, dst_pitch, 8, VFilter);
     }
   }
 }
@@ -179,18 +179,18 @@
   VFilter = vp8_sub_pel_filters[yoffset];   /* 6 tap */
 
   if (xoffset && !yoffset) {
-    vp8_filter_block2d_first_pass_only_armv6(src_ptr, dst_ptr, src_pixels_per_line, 16, dst_pitch, HFilter);
+    vp9_filter_block2d_first_pass_only_armv6(src_ptr, dst_ptr, src_pixels_per_line, 16, dst_pitch, HFilter);
   }
   /* Hfilter is null. Second pass only */
   else if (!xoffset && yoffset) {
-    vp8_filter_block2d_second_pass_only_armv6(src_ptr, dst_ptr, src_pixels_per_line, 16, dst_pitch, VFilter);
+    vp9_filter_block2d_second_pass_only_armv6(src_ptr, dst_ptr, src_pixels_per_line, 16, dst_pitch, VFilter);
   } else {
     if (yoffset & 0x1) {
-      vp8_filter_block2d_first_pass_16x16_armv6(src_ptr - src_pixels_per_line, FData + 1, src_pixels_per_line, 16, 19, HFilter);
-      vp8_filter4_block2d_second_pass_armv6(FData + 2, dst_ptr, dst_pitch, 16, VFilter);
+      vp9_filter_block2d_first_pass_16x16_armv6(src_ptr - src_pixels_per_line, FData + 1, src_pixels_per_line, 16, 19, HFilter);
+      vp9_filter4_block2d_second_pass_armv6(FData + 2, dst_ptr, dst_pitch, 16, VFilter);
     } else {
-      vp8_filter_block2d_first_pass_16x16_armv6(src_ptr - (2 * src_pixels_per_line), FData, src_pixels_per_line, 16, 21, HFilter);
-      vp8_filter_block2d_second_pass_armv6(FData + 2, dst_ptr, dst_pitch, 16, VFilter);
+      vp9_filter_block2d_first_pass_16x16_armv6(src_ptr - (2 * src_pixels_per_line), FData, src_pixels_per_line, 16, 21, HFilter);
+      vp9_filter_block2d_second_pass_armv6(FData + 2, dst_ptr, dst_pitch, 16, VFilter);
     }
   }
 
diff --git a/vp8/common/arm/idct_arm.h b/vp8/common/arm/idct_arm.h
index 787252b..2fc4cf7 100644
--- a/vp8/common/arm/idct_arm.h
+++ b/vp8/common/arm/idct_arm.h
@@ -20,14 +20,14 @@
 extern prototype_second_order(vp9_short_inv_walsh4x4_v6);
 
 #if !CONFIG_RUNTIME_CPU_DETECT
-#undef  vp8_idct_idct1
-#define vp8_idct_idct1 vp9_short_idct4x4llm_1_v6
+#undef  vp9_idct_idct1
+#define vp9_idct_idct1 vp9_short_idct4x4llm_1_v6
 
-#undef  vp8_idct_idct16
-#define vp8_idct_idct16 vp9_short_idct4x4llm_v6_dual
+#undef  vp9_idct_idct16
+#define vp9_idct_idct16 vp9_short_idct4x4llm_v6_dual
 
-#undef  vp8_idct_idct1_scalar_add
-#define vp8_idct_idct1_scalar_add vp9_dc_only_idct_add_v6
+#undef  vp9_idct_idct1_scalar_add
+#define vp9_idct_idct1_scalar_add vp9_dc_only_idct_add_v6
 
 #undef  vp8_idct_iwalsh1
 #define vp8_idct_iwalsh1 vp9_short_inv_walsh4x4_1_v6
@@ -45,14 +45,14 @@
 extern prototype_second_order(vp9_short_inv_walsh4x4_neon);
 
 #if !CONFIG_RUNTIME_CPU_DETECT
-#undef  vp8_idct_idct1
-#define vp8_idct_idct1 vp9_short_idct4x4llm_1_neon
+#undef  vp9_idct_idct1
+#define vp9_idct_idct1 vp9_short_idct4x4llm_1_neon
 
-#undef  vp8_idct_idct16
-#define vp8_idct_idct16 vp9_short_idct4x4llm_neon
+#undef  vp9_idct_idct16
+#define vp9_idct_idct16 vp9_short_idct4x4llm_neon
 
-#undef  vp8_idct_idct1_scalar_add
-#define vp8_idct_idct1_scalar_add vp9_dc_only_idct_add_neon
+#undef  vp9_idct_idct1_scalar_add
+#define vp9_idct_idct1_scalar_add vp9_dc_only_idct_add_neon
 
 #undef  vp8_idct_iwalsh1
 #define vp8_idct_iwalsh1 vp9_short_inv_walsh4x4_1_neon
diff --git a/vp8/common/arm/neon/bilinearpredict16x16_neon.asm b/vp8/common/arm/neon/bilinearpredict16x16_neon.asm
index e392786..2528be7 100644
--- a/vp8/common/arm/neon/bilinearpredict16x16_neon.asm
+++ b/vp8/common/arm/neon/bilinearpredict16x16_neon.asm
@@ -59,7 +59,7 @@
     pld             [r0, r1]
     pld             [r0, r1, lsl #1]
 
-    vmull.u8        q7, d2, d0              ;(src_ptr[0] * vp8_filter[0])
+    vmull.u8        q7, d2, d0              ;(src_ptr[0] * vp9_filter[0])
     vmull.u8        q8, d3, d0
     vmull.u8        q9, d5, d0
     vmull.u8        q10, d6, d0
@@ -73,7 +73,7 @@
     vext.8          d8, d8, d9, #1
     vext.8          d11, d11, d12, #1
 
-    vmlal.u8        q7, d2, d1              ;(src_ptr[0] * vp8_filter[1])
+    vmlal.u8        q7, d2, d1              ;(src_ptr[0] * vp9_filter[1])
     vmlal.u8        q9, d5, d1
     vmlal.u8        q11, d8, d1
     vmlal.u8        q13, d11, d1
@@ -83,7 +83,7 @@
     vext.8          d9, d9, d10, #1
     vext.8          d12, d12, d13, #1
 
-    vmlal.u8        q8, d3, d1              ;(src_ptr[0] * vp8_filter[1])
+    vmlal.u8        q8, d3, d1              ;(src_ptr[0] * vp9_filter[1])
     vmlal.u8        q10, d6, d1
     vmlal.u8        q12, d9, d1
     vmlal.u8        q14, d12, d1
@@ -112,7 +112,7 @@
 ;First-pass filtering for rest 5 lines
     vld1.u8         {d14, d15, d16}, [r0], r1
 
-    vmull.u8        q9, d2, d0              ;(src_ptr[0] * vp8_filter[0])
+    vmull.u8        q9, d2, d0              ;(src_ptr[0] * vp9_filter[0])
     vmull.u8        q10, d3, d0
     vmull.u8        q11, d5, d0
     vmull.u8        q12, d6, d0
@@ -123,7 +123,7 @@
     vext.8          d5, d5, d6, #1
     vext.8          d8, d8, d9, #1
 
-    vmlal.u8        q9, d2, d1              ;(src_ptr[0] * vp8_filter[1])
+    vmlal.u8        q9, d2, d1              ;(src_ptr[0] * vp9_filter[1])
     vmlal.u8        q11, d5, d1
     vmlal.u8        q13, d8, d1
 
@@ -131,7 +131,7 @@
     vext.8          d6, d6, d7, #1
     vext.8          d9, d9, d10, #1
 
-    vmlal.u8        q10, d3, d1             ;(src_ptr[0] * vp8_filter[1])
+    vmlal.u8        q10, d3, d1             ;(src_ptr[0] * vp9_filter[1])
     vmlal.u8        q12, d6, d1
     vmlal.u8        q14, d9, d1
 
@@ -143,13 +143,13 @@
     vext.8          d11, d11, d12, #1       ;construct src_ptr[1]
     vext.8          d14, d14, d15, #1
 
-    vmlal.u8        q1, d11, d1             ;(src_ptr[0] * vp8_filter[1])
+    vmlal.u8        q1, d11, d1             ;(src_ptr[0] * vp9_filter[1])
     vmlal.u8        q3, d14, d1
 
     vext.8          d12, d12, d13, #1
     vext.8          d15, d15, d16, #1
 
-    vmlal.u8        q2, d12, d1             ;(src_ptr[0] * vp8_filter[1])
+    vmlal.u8        q2, d12, d1             ;(src_ptr[0] * vp9_filter[1])
     vmlal.u8        q4, d15, d1
 
     vqrshrn.u16    d10, q9, #7              ;shift/round/saturate to u8
@@ -182,7 +182,7 @@
 
 filt_blk2d_sp16x16_loop_neon
     vld1.u8         {d24, d25}, [lr]!
-    vmull.u8        q1, d22, d0             ;(src_ptr[0] * vp8_filter[0])
+    vmull.u8        q1, d22, d0             ;(src_ptr[0] * vp9_filter[0])
     vld1.u8         {d26, d27}, [lr]!
     vmull.u8        q2, d23, d0
     vld1.u8         {d28, d29}, [lr]!
@@ -195,7 +195,7 @@
     vmull.u8        q7, d28, d0
     vmull.u8        q8, d29, d0
 
-    vmlal.u8        q1, d24, d1             ;(src_ptr[pixel_step] * vp8_filter[1])
+    vmlal.u8        q1, d24, d1             ;(src_ptr[pixel_step] * vp9_filter[1])
     vmlal.u8        q2, d25, d1
     vmlal.u8        q3, d26, d1
     vmlal.u8        q4, d27, d1
@@ -244,7 +244,7 @@
     pld             [r0, r1]
     pld             [r0, r1, lsl #1]
 
-    vmull.u8        q7, d2, d0              ;(src_ptr[0] * vp8_filter[0])
+    vmull.u8        q7, d2, d0              ;(src_ptr[0] * vp9_filter[0])
     vmull.u8        q8, d3, d0
     vmull.u8        q9, d5, d0
     vmull.u8        q10, d6, d0
@@ -258,7 +258,7 @@
     vext.8          d8, d8, d9, #1
     vext.8          d11, d11, d12, #1
 
-    vmlal.u8        q7, d2, d1              ;(src_ptr[0] * vp8_filter[1])
+    vmlal.u8        q7, d2, d1              ;(src_ptr[0] * vp9_filter[1])
     vmlal.u8        q9, d5, d1
     vmlal.u8        q11, d8, d1
     vmlal.u8        q13, d11, d1
@@ -268,7 +268,7 @@
     vext.8          d9, d9, d10, #1
     vext.8          d12, d12, d13, #1
 
-    vmlal.u8        q8, d3, d1              ;(src_ptr[0] * vp8_filter[1])
+    vmlal.u8        q8, d3, d1              ;(src_ptr[0] * vp9_filter[1])
     vmlal.u8        q10, d6, d1
     vmlal.u8        q12, d9, d1
     vmlal.u8        q14, d12, d1
@@ -306,7 +306,7 @@
 
 filt_blk2d_spo16x16_loop_neon
     vld1.u8         {d24, d25}, [r0], r1
-    vmull.u8        q1, d22, d0             ;(src_ptr[0] * vp8_filter[0])
+    vmull.u8        q1, d22, d0             ;(src_ptr[0] * vp9_filter[0])
     vld1.u8         {d26, d27}, [r0], r1
     vmull.u8        q2, d23, d0
     vld1.u8         {d28, d29}, [r0], r1
@@ -319,7 +319,7 @@
     vmull.u8        q7, d28, d0
     vmull.u8        q8, d29, d0
 
-    vmlal.u8        q1, d24, d1             ;(src_ptr[pixel_step] * vp8_filter[1])
+    vmlal.u8        q1, d24, d1             ;(src_ptr[pixel_step] * vp9_filter[1])
     vmlal.u8        q2, d25, d1
     vmlal.u8        q3, d26, d1
     vmlal.u8        q4, d27, d1
diff --git a/vp8/common/arm/neon/bilinearpredict4x4_neon.asm b/vp8/common/arm/neon/bilinearpredict4x4_neon.asm
index 0ac6243..01eedf8 100644
--- a/vp8/common/arm/neon/bilinearpredict4x4_neon.asm
+++ b/vp8/common/arm/neon/bilinearpredict4x4_neon.asm
@@ -54,11 +54,11 @@
     vzip.32         d8, d9                  ;put 2-line data in 1 register (src_ptr[1])
     vzip.32         d10, d11
 
-    vmull.u8        q7, d2, d0              ;(src_ptr[0] * vp8_filter[0])
+    vmull.u8        q7, d2, d0              ;(src_ptr[0] * vp9_filter[0])
     vmull.u8        q8, d4, d0
     vmull.u8        q9, d6, d0
 
-    vmlal.u8        q7, d8, d1              ;(src_ptr[1] * vp8_filter[1])
+    vmlal.u8        q7, d8, d1              ;(src_ptr[1] * vp9_filter[1])
     vmlal.u8        q8, d10, d1
     vmlal.u8        q9, d12, d1
 
diff --git a/vp8/common/arm/neon/bilinearpredict8x4_neon.asm b/vp8/common/arm/neon/bilinearpredict8x4_neon.asm
index 41f5c45..8f49345 100644
--- a/vp8/common/arm/neon/bilinearpredict8x4_neon.asm
+++ b/vp8/common/arm/neon/bilinearpredict8x4_neon.asm
@@ -43,7 +43,7 @@
     vdup.8          d1, d31[4]
     vld1.u8         {q4}, [r0], r1
 
-    vmull.u8        q6, d2, d0              ;(src_ptr[0] * vp8_filter[0])
+    vmull.u8        q6, d2, d0              ;(src_ptr[0] * vp9_filter[0])
     vld1.u8         {q5}, [r0], r1
     vmull.u8        q7, d4, d0
     vmull.u8        q8, d6, d0
@@ -56,7 +56,7 @@
     vext.8          d9, d8, d9, #1
     vext.8          d11, d10, d11, #1
 
-    vmlal.u8        q6, d3, d1              ;(src_ptr[1] * vp8_filter[1])
+    vmlal.u8        q6, d3, d1              ;(src_ptr[1] * vp9_filter[1])
     vmlal.u8        q7, d5, d1
     vmlal.u8        q8, d7, d1
     vmlal.u8        q9, d9, d1
@@ -82,12 +82,12 @@
     vdup.8          d0, d31[0]              ;second_pass filter parameters (d0 d1)
     vdup.8          d1, d31[4]
 
-    vmull.u8        q1, d22, d0             ;(src_ptr[0] * vp8_filter[0])
+    vmull.u8        q1, d22, d0             ;(src_ptr[0] * vp9_filter[0])
     vmull.u8        q2, d23, d0
     vmull.u8        q3, d24, d0
     vmull.u8        q4, d25, d0
 
-    vmlal.u8        q1, d23, d1             ;(src_ptr[pixel_step] * vp8_filter[1])
+    vmlal.u8        q1, d23, d1             ;(src_ptr[pixel_step] * vp9_filter[1])
     vmlal.u8        q2, d24, d1
     vmlal.u8        q3, d25, d1
     vmlal.u8        q4, d26, d1
diff --git a/vp8/common/arm/neon/bilinearpredict8x8_neon.asm b/vp8/common/arm/neon/bilinearpredict8x8_neon.asm
index c4711bc..6967f19 100644
--- a/vp8/common/arm/neon/bilinearpredict8x8_neon.asm
+++ b/vp8/common/arm/neon/bilinearpredict8x8_neon.asm
@@ -43,7 +43,7 @@
     vdup.8          d1, d31[4]
     vld1.u8         {q4}, [r0], r1
 
-    vmull.u8        q6, d2, d0              ;(src_ptr[0] * vp8_filter[0])
+    vmull.u8        q6, d2, d0              ;(src_ptr[0] * vp9_filter[0])
     vmull.u8        q7, d4, d0
     vmull.u8        q8, d6, d0
     vmull.u8        q9, d8, d0
@@ -53,7 +53,7 @@
     vext.8          d7, d6, d7, #1
     vext.8          d9, d8, d9, #1
 
-    vmlal.u8        q6, d3, d1              ;(src_ptr[1] * vp8_filter[1])
+    vmlal.u8        q6, d3, d1              ;(src_ptr[1] * vp9_filter[1])
     vmlal.u8        q7, d5, d1
     vmlal.u8        q8, d7, d1
     vmlal.u8        q9, d9, d1
@@ -70,7 +70,7 @@
     ;first_pass filtering on the rest 5-line data
     vld1.u8         {q5}, [r0], r1
 
-    vmull.u8        q6, d2, d0              ;(src_ptr[0] * vp8_filter[0])
+    vmull.u8        q6, d2, d0              ;(src_ptr[0] * vp9_filter[0])
     vmull.u8        q7, d4, d0
     vmull.u8        q8, d6, d0
     vmull.u8        q9, d8, d0
@@ -82,7 +82,7 @@
     vext.8          d9, d8, d9, #1
     vext.8          d11, d10, d11, #1
 
-    vmlal.u8        q6, d3, d1              ;(src_ptr[1] * vp8_filter[1])
+    vmlal.u8        q6, d3, d1              ;(src_ptr[1] * vp9_filter[1])
     vmlal.u8        q7, d5, d1
     vmlal.u8        q8, d7, d1
     vmlal.u8        q9, d9, d1
@@ -108,7 +108,7 @@
     vdup.8          d0, d31[0]              ;second_pass filter parameters (d0 d1)
     vdup.8          d1, d31[4]
 
-    vmull.u8        q1, d22, d0             ;(src_ptr[0] * vp8_filter[0])
+    vmull.u8        q1, d22, d0             ;(src_ptr[0] * vp9_filter[0])
     vmull.u8        q2, d23, d0
     vmull.u8        q3, d24, d0
     vmull.u8        q4, d25, d0
@@ -117,7 +117,7 @@
     vmull.u8        q7, d28, d0
     vmull.u8        q8, d29, d0
 
-    vmlal.u8        q1, d23, d1             ;(src_ptr[pixel_step] * vp8_filter[1])
+    vmlal.u8        q1, d23, d1             ;(src_ptr[pixel_step] * vp9_filter[1])
     vmlal.u8        q2, d24, d1
     vmlal.u8        q3, d25, d1
     vmlal.u8        q4, d26, d1
diff --git a/vp8/common/arm/neon/copymem16x16_neon.asm b/vp8/common/arm/neon/copymem16x16_neon.asm
index bda4b96..bff8156 100644
--- a/vp8/common/arm/neon/copymem16x16_neon.asm
+++ b/vp8/common/arm/neon/copymem16x16_neon.asm
@@ -9,7 +9,7 @@
 ;
 
 
-    EXPORT  |vp8_copy_mem16x16_neon|
+    EXPORT  |vp9_copy_mem16x16_neon|
     ; ARM
     ; REQUIRE8
     ; PRESERVE8
@@ -17,7 +17,7 @@
     AREA    Block, CODE, READONLY ; name this block of code
 ;void copy_mem16x16_neon( unsigned char *src, int src_stride, unsigned char *dst, int dst_stride)
 ;-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
-|vp8_copy_mem16x16_neon| PROC
+|vp9_copy_mem16x16_neon| PROC
 
     vld1.u8     {q0}, [r0], r1
     vld1.u8     {q1}, [r0], r1
@@ -54,6 +54,6 @@
 
     mov     pc, lr
 
-    ENDP  ; |vp8_copy_mem16x16_neon|
+    ENDP  ; |vp9_copy_mem16x16_neon|
 
     END
diff --git a/vp8/common/arm/neon/copymem8x4_neon.asm b/vp8/common/arm/neon/copymem8x4_neon.asm
index 35c0f67..ffd2df8 100644
--- a/vp8/common/arm/neon/copymem8x4_neon.asm
+++ b/vp8/common/arm/neon/copymem8x4_neon.asm
@@ -9,7 +9,7 @@
 ;
 
 
-    EXPORT  |vp8_copy_mem8x4_neon|
+    EXPORT  |vp9_copy_mem8x4_neon|
     ; ARM
     ; REQUIRE8
     ; PRESERVE8
@@ -17,7 +17,7 @@
     AREA    Block, CODE, READONLY ; name this block of code
 ;void copy_mem8x4_neon( unsigned char *src, int src_stride, unsigned char *dst, int dst_stride)
 ;-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
-|vp8_copy_mem8x4_neon| PROC
+|vp9_copy_mem8x4_neon| PROC
     vld1.u8     {d0}, [r0], r1
     vld1.u8     {d1}, [r0], r1
     vst1.u8     {d0}, [r2], r3
@@ -29,6 +29,6 @@
 
     mov     pc, lr
 
-    ENDP  ; |vp8_copy_mem8x4_neon|
+    ENDP  ; |vp9_copy_mem8x4_neon|
 
     END
diff --git a/vp8/common/arm/neon/copymem8x8_neon.asm b/vp8/common/arm/neon/copymem8x8_neon.asm
index 1f5b941..2d394c0 100644
--- a/vp8/common/arm/neon/copymem8x8_neon.asm
+++ b/vp8/common/arm/neon/copymem8x8_neon.asm
@@ -9,7 +9,7 @@
 ;
 
 
-    EXPORT  |vp8_copy_mem8x8_neon|
+    EXPORT  |vp9_copy_mem8x8_neon|
     ; ARM
     ; REQUIRE8
     ; PRESERVE8
@@ -17,7 +17,7 @@
     AREA    Block, CODE, READONLY ; name this block of code
 ;void copy_mem8x8_neon( unsigned char *src, int src_stride, unsigned char *dst, int dst_stride)
 ;-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
-|vp8_copy_mem8x8_neon| PROC
+|vp9_copy_mem8x8_neon| PROC
 
     vld1.u8     {d0}, [r0], r1
     vld1.u8     {d1}, [r0], r1
@@ -38,6 +38,6 @@
 
     mov     pc, lr
 
-    ENDP  ; |vp8_copy_mem8x8_neon|
+    ENDP  ; |vp9_copy_mem8x8_neon|
 
     END
diff --git a/vp8/common/arm/neon/loopfilter_neon.asm b/vp8/common/arm/neon/loopfilter_neon.asm
index e44be0a..bc66167 100644
--- a/vp8/common/arm/neon/loopfilter_neon.asm
+++ b/vp8/common/arm/neon/loopfilter_neon.asm
@@ -9,10 +9,10 @@
 ;
 
 
-    EXPORT  |vp8_loop_filter_horizontal_edge_y_neon|
-    EXPORT  |vp8_loop_filter_horizontal_edge_uv_neon|
-    EXPORT  |vp8_loop_filter_vertical_edge_y_neon|
-    EXPORT  |vp8_loop_filter_vertical_edge_uv_neon|
+    EXPORT  |vp9_loop_filter_horizontal_edge_y_neon|
+    EXPORT  |vp9_loop_filter_horizontal_edge_uv_neon|
+    EXPORT  |vp9_loop_filter_vertical_edge_y_neon|
+    EXPORT  |vp9_loop_filter_vertical_edge_uv_neon|
     ARM
 
     AREA ||.text||, CODE, READONLY, ALIGN=2
@@ -22,7 +22,7 @@
 ; r2    unsigned char blimit
 ; r3    unsigned char limit
 ; sp    unsigned char thresh,
-|vp8_loop_filter_horizontal_edge_y_neon| PROC
+|vp9_loop_filter_horizontal_edge_y_neon| PROC
     push        {lr}
     vdup.u8     q0, r2                     ; duplicate blimit
     vdup.u8     q1, r3                     ; duplicate limit
@@ -45,7 +45,7 @@
     sub         r2, r2, r1, lsl #1
     sub         r12, r12, r1, lsl #1
 
-    bl          vp8_loop_filter_neon
+    bl          vp9_loop_filter_neon
 
     vst1.u8     {q5}, [r2@128], r1              ; store op1
     vst1.u8     {q6}, [r12@128], r1             ; store op0
@@ -53,7 +53,7 @@
     vst1.u8     {q8}, [r12@128], r1             ; store oq1
 
     pop         {pc}
-    ENDP        ; |vp8_loop_filter_horizontal_edge_y_neon|
+    ENDP        ; |vp9_loop_filter_horizontal_edge_y_neon|
 
 
 ; r0    unsigned char *u,
@@ -62,7 +62,7 @@
 ; r3    unsigned char limit
 ; sp    unsigned char thresh,
 ; sp+4  unsigned char *v
-|vp8_loop_filter_horizontal_edge_uv_neon| PROC
+|vp9_loop_filter_horizontal_edge_uv_neon| PROC
     push        {lr}
     vdup.u8     q0, r2                      ; duplicate blimit
     vdup.u8     q1, r3                      ; duplicate limit
@@ -90,7 +90,7 @@
     vld1.u8     {d20}, [r3@64]                 ; q3
     vld1.u8     {d21}, [r12@64]                ; q3
 
-    bl          vp8_loop_filter_neon
+    bl          vp9_loop_filter_neon
 
     sub         r0, r0, r1, lsl #1
     sub         r2, r2, r1, lsl #1
@@ -105,9 +105,9 @@
     vst1.u8     {d17}, [r2@64]                 ; store v oq1
 
     pop         {pc}
-    ENDP        ; |vp8_loop_filter_horizontal_edge_uv_neon|
+    ENDP        ; |vp9_loop_filter_horizontal_edge_uv_neon|
 
-; void vp8_loop_filter_vertical_edge_y_neon(unsigned char *src, int pitch,
+; void vp9_loop_filter_vertical_edge_y_neon(unsigned char *src, int pitch,
 ;                                           const signed char *flimit,
 ;                                           const signed char *limit,
 ;                                           const signed char *thresh,
@@ -118,7 +118,7 @@
 ; r3    unsigned char limit
 ; sp    unsigned char thresh,
 
-|vp8_loop_filter_vertical_edge_y_neon| PROC
+|vp9_loop_filter_vertical_edge_y_neon| PROC
     push        {lr}
     vdup.u8     q0, r2                     ; duplicate blimit
     vdup.u8     q1, r3                     ; duplicate limit
@@ -163,7 +163,7 @@
     vtrn.8      q7, q8
     vtrn.8      q9, q10
 
-    bl          vp8_loop_filter_neon
+    bl          vp9_loop_filter_neon
 
     vswp        d12, d11
     vswp        d16, d13
@@ -195,9 +195,9 @@
     vst4.8      {d14[7], d15[7], d16[7], d17[7]}, [r12]
 
     pop         {pc}
-    ENDP        ; |vp8_loop_filter_vertical_edge_y_neon|
+    ENDP        ; |vp9_loop_filter_vertical_edge_y_neon|
 
-; void vp8_loop_filter_vertical_edge_uv_neon(unsigned char *u, int pitch
+; void vp9_loop_filter_vertical_edge_uv_neon(unsigned char *u, int pitch
 ;                                            const signed char *flimit,
 ;                                            const signed char *limit,
 ;                                            const signed char *thresh,
@@ -208,7 +208,7 @@
 ; r3    unsigned char limit
 ; sp    unsigned char thresh,
 ; sp+4  unsigned char *v
-|vp8_loop_filter_vertical_edge_uv_neon| PROC
+|vp9_loop_filter_vertical_edge_uv_neon| PROC
     push        {lr}
     vdup.u8     q0, r2                      ; duplicate blimit
     sub         r12, r0, #4                 ; move u pointer down by 4 columns
@@ -253,7 +253,7 @@
     vtrn.8      q7, q8
     vtrn.8      q9, q10
 
-    bl          vp8_loop_filter_neon
+    bl          vp9_loop_filter_neon
 
     vswp        d12, d11
     vswp        d16, d13
@@ -282,9 +282,9 @@
     vst4.8      {d14[7], d15[7], d16[7], d17[7]}, [r2]
 
     pop         {pc}
-    ENDP        ; |vp8_loop_filter_vertical_edge_uv_neon|
+    ENDP        ; |vp9_loop_filter_vertical_edge_uv_neon|
 
-; void vp8_loop_filter_neon();
+; void vp9_loop_filter_neon();
 ; This is a helper function for the loopfilters. The invidual functions do the
 ; necessary load, transpose (if necessary) and store.
 
@@ -300,9 +300,9 @@
 ; q8    q1
 ; q9    q2
 ; q10   q3
-|vp8_loop_filter_neon| PROC
+|vp9_loop_filter_neon| PROC
 
-    ; vp8_filter_mask
+    ; vp9_filter_mask
     vabd.u8     q11, q3, q4                 ; abs(p3 - p2)
     vabd.u8     q12, q4, q5                 ; abs(p2 - p1)
     vabd.u8     q13, q5, q6                 ; abs(p1 - p0)
@@ -329,7 +329,7 @@
 
     vcge.u8     q15, q1, q15
 
-    ; vp8_filter() function
+    ; vp9_filter() function
     ; convert to signed
     veor        q7, q7, q10                 ; qs0
     vshr.u8     q2, q2, #1                  ; a = a / 2
@@ -349,27 +349,27 @@
 
     vmovl.u8    q4, d20
 
-    vqsub.s8    q1, q5, q8                  ; vp8_filter = clamp(ps1-qs1)
+    vqsub.s8    q1, q5, q8                  ; vp9_filter = clamp(ps1-qs1)
     vorr        q14, q13, q14               ; vp8_hevmask
 
     vmul.i16    q2, q2, q4                  ; 3 * ( qs0 - ps0)
     vmul.i16    q11, q11, q4
 
-    vand        q1, q1, q14                 ; vp8_filter &= hev
-    vand        q15, q15, q9                ; vp8_filter_mask
+    vand        q1, q1, q14                 ; vp9_filter &= hev
+    vand        q15, q15, q9                ; vp9_filter_mask
 
     vaddw.s8    q2, q2, d2
     vaddw.s8    q11, q11, d3
 
     vmov.u8     q9, #4                      ; #4
 
-    ; vp8_filter = clamp(vp8_filter + 3 * ( qs0 - ps0))
+    ; vp9_filter = clamp(vp9_filter + 3 * ( qs0 - ps0))
     vqmovn.s16  d2, q2
     vqmovn.s16  d3, q11
-    vand        q1, q1, q15                 ; vp8_filter &= mask
+    vand        q1, q1, q15                 ; vp9_filter &= mask
 
-    vqadd.s8    q2, q1, q10                 ; Filter2 = clamp(vp8_filter+3)
-    vqadd.s8    q1, q1, q9                  ; Filter1 = clamp(vp8_filter+4)
+    vqadd.s8    q2, q1, q10                 ; Filter2 = clamp(vp9_filter+3)
+    vqadd.s8    q1, q1, q9                  ; Filter1 = clamp(vp9_filter+4)
     vshr.s8     q2, q2, #3                  ; Filter2 >>= 3
     vshr.s8     q1, q1, #3                  ; Filter1 >>= 3
 
@@ -377,12 +377,12 @@
     vqadd.s8    q11, q6, q2                 ; u = clamp(ps0 + Filter2)
     vqsub.s8    q10, q7, q1                 ; u = clamp(qs0 - Filter1)
 
-    ; outer tap adjustments: ++vp8_filter >> 1
+    ; outer tap adjustments: ++vp9_filter >> 1
     vrshr.s8    q1, q1, #1
-    vbic        q1, q1, q14                 ; vp8_filter &= ~hev
+    vbic        q1, q1, q14                 ; vp9_filter &= ~hev
     vmov.u8     q0, #0x80                   ; 0x80
-    vqadd.s8    q13, q5, q1                 ; u = clamp(ps1 + vp8_filter)
-    vqsub.s8    q12, q8, q1                 ; u = clamp(qs1 - vp8_filter)
+    vqadd.s8    q13, q5, q1                 ; u = clamp(ps1 + vp9_filter)
+    vqsub.s8    q12, q8, q1                 ; u = clamp(qs1 - vp9_filter)
 
     veor        q6, q11, q0                 ; *op0 = u^0x80
     veor        q7, q10, q0                 ; *oq0 = u^0x80
@@ -390,7 +390,7 @@
     veor        q8, q12, q0                 ; *oq1 = u^0x80
 
     bx          lr
-    ENDP        ; |vp8_loop_filter_horizontal_edge_y_neon|
+    ENDP        ; |vp9_loop_filter_horizontal_edge_y_neon|
 
 ;-----------------
 
diff --git a/vp8/common/arm/neon/loopfiltersimplehorizontaledge_neon.asm b/vp8/common/arm/neon/loopfiltersimplehorizontaledge_neon.asm
index adf848b..eb07ce0 100644
--- a/vp8/common/arm/neon/loopfiltersimplehorizontaledge_neon.asm
+++ b/vp8/common/arm/neon/loopfiltersimplehorizontaledge_neon.asm
@@ -9,9 +9,9 @@
 ;
 
 
-    ;EXPORT  |vp8_loop_filter_simple_horizontal_edge_neon|
-    EXPORT  |vp8_loop_filter_bhs_neon|
-    EXPORT  |vp8_loop_filter_mbhs_neon|
+    ;EXPORT  |vp9_loop_filter_simple_horizontal_edge_neon|
+    EXPORT  |vp9_loop_filter_bhs_neon|
+    EXPORT  |vp9_loop_filter_mbhs_neon|
     ARM
     PRESERVE8
 
@@ -21,7 +21,7 @@
 ; r1    int p, PRESERVE
 ; q1    limit, PRESERVE
 
-|vp8_loop_filter_simple_horizontal_edge_neon| PROC
+|vp9_loop_filter_simple_horizontal_edge_neon| PROC
 
     sub         r3, r0, r1, lsl #1          ; move src pointer down by 2 lines
 
@@ -49,7 +49,7 @@
     vsubl.s8    q2, d14, d12                ; ( qs0 - ps0)
     vsubl.s8    q3, d15, d13
 
-    vqsub.s8    q4, q5, q8                  ; q4: vp8_filter = vp8_signed_char_clamp(ps1-qs1)
+    vqsub.s8    q4, q5, q8                  ; q4: vp9_filter = vp9_signed_char_clamp(ps1-qs1)
 
     vmul.s16    q2, q2, q13                 ;  3 * ( qs0 - ps0)
     vmul.s16    q3, q3, q13
@@ -57,24 +57,24 @@
     vmov.u8     q10, #0x03                  ; 0x03
     vmov.u8     q9, #0x04                   ; 0x04
 
-    vaddw.s8    q2, q2, d8                  ; vp8_filter + 3 * ( qs0 - ps0)
+    vaddw.s8    q2, q2, d8                  ; vp9_filter + 3 * ( qs0 - ps0)
     vaddw.s8    q3, q3, d9
 
-    vqmovn.s16  d8, q2                      ; vp8_filter = vp8_signed_char_clamp(vp8_filter + 3 * ( qs0 - ps0))
+    vqmovn.s16  d8, q2                      ; vp9_filter = vp9_signed_char_clamp(vp9_filter + 3 * ( qs0 - ps0))
     vqmovn.s16  d9, q3
 
-    vand        q14, q4, q15                ; vp8_filter &= mask
+    vand        q14, q4, q15                ; vp9_filter &= mask
 
-    vqadd.s8    q2, q14, q10                ; Filter2 = vp8_signed_char_clamp(vp8_filter+3)
-    vqadd.s8    q3, q14, q9                 ; Filter1 = vp8_signed_char_clamp(vp8_filter+4)
+    vqadd.s8    q2, q14, q10                ; Filter2 = vp9_signed_char_clamp(vp9_filter+3)
+    vqadd.s8    q3, q14, q9                 ; Filter1 = vp9_signed_char_clamp(vp9_filter+4)
     vshr.s8     q2, q2, #3                  ; Filter2 >>= 3
     vshr.s8     q4, q3, #3                  ; Filter1 >>= 3
 
     sub         r0, r0, r1
 
     ;calculate output
-    vqadd.s8    q11, q6, q2                 ; u = vp8_signed_char_clamp(ps0 + Filter2)
-    vqsub.s8    q10, q7, q4                 ; u = vp8_signed_char_clamp(qs0 - Filter1)
+    vqadd.s8    q11, q6, q2                 ; u = vp9_signed_char_clamp(ps0 + Filter2)
+    vqsub.s8    q10, q7, q4                 ; u = vp9_signed_char_clamp(qs0 - Filter1)
 
     veor        q6, q11, q0                 ; *op0 = u^0x80
     veor        q7, q10, q0                 ; *oq0 = u^0x80
@@ -83,35 +83,35 @@
     vst1.u8     {q7}, [r0@128]              ; store oq0
 
     bx          lr
-    ENDP        ; |vp8_loop_filter_simple_horizontal_edge_neon|
+    ENDP        ; |vp9_loop_filter_simple_horizontal_edge_neon|
 
 ; r0    unsigned char *y
 ; r1    int ystride
 ; r2    const unsigned char *blimit
 
-|vp8_loop_filter_bhs_neon| PROC
+|vp9_loop_filter_bhs_neon| PROC
     push        {r4, lr}
     ldrb        r3, [r2]                    ; load blim from mem
     vdup.s8     q1, r3                      ; duplicate blim
 
     add         r0, r0, r1, lsl #2          ; src = y_ptr + 4 * y_stride
-    bl          vp8_loop_filter_simple_horizontal_edge_neon
-    ; vp8_loop_filter_simple_horizontal_edge_neon preserves r0, r1 and q1
+    bl          vp9_loop_filter_simple_horizontal_edge_neon
+    ; vp9_loop_filter_simple_horizontal_edge_neon preserves r0, r1 and q1
     add         r0, r0, r1, lsl #2          ; src = y_ptr + 8* y_stride
-    bl          vp8_loop_filter_simple_horizontal_edge_neon
+    bl          vp9_loop_filter_simple_horizontal_edge_neon
     add         r0, r0, r1, lsl #2          ; src = y_ptr + 12 * y_stride
     pop         {r4, lr}
-    b           vp8_loop_filter_simple_horizontal_edge_neon
-    ENDP        ;|vp8_loop_filter_bhs_neon|
+    b           vp9_loop_filter_simple_horizontal_edge_neon
+    ENDP        ;|vp9_loop_filter_bhs_neon|
 
 ; r0    unsigned char *y
 ; r1    int ystride
 ; r2    const unsigned char *blimit
 
-|vp8_loop_filter_mbhs_neon| PROC
+|vp9_loop_filter_mbhs_neon| PROC
     ldrb        r3, [r2]                   ; load blim from mem
     vdup.s8     q1, r3                     ; duplicate mblim
-    b           vp8_loop_filter_simple_horizontal_edge_neon
-    ENDP        ;|vp8_loop_filter_bhs_neon|
+    b           vp9_loop_filter_simple_horizontal_edge_neon
+    ENDP        ;|vp9_loop_filter_bhs_neon|
 
     END
diff --git a/vp8/common/arm/neon/loopfiltersimpleverticaledge_neon.asm b/vp8/common/arm/neon/loopfiltersimpleverticaledge_neon.asm
index e690df2..d5cf8c2 100644
--- a/vp8/common/arm/neon/loopfiltersimpleverticaledge_neon.asm
+++ b/vp8/common/arm/neon/loopfiltersimpleverticaledge_neon.asm
@@ -9,9 +9,9 @@
 ;
 
 
-    ;EXPORT  |vp8_loop_filter_simple_vertical_edge_neon|
-    EXPORT |vp8_loop_filter_bvs_neon|
-    EXPORT |vp8_loop_filter_mbvs_neon|
+    ;EXPORT  |vp9_loop_filter_simple_vertical_edge_neon|
+    EXPORT |vp9_loop_filter_bvs_neon|
+    EXPORT |vp9_loop_filter_mbvs_neon|
     ARM
     PRESERVE8
 
@@ -21,7 +21,7 @@
 ; r1    int p, PRESERVE
 ; q1    limit, PRESERVE
 
-|vp8_loop_filter_simple_vertical_edge_neon| PROC
+|vp9_loop_filter_simple_vertical_edge_neon| PROC
     sub         r0, r0, #2                  ; move src pointer down by 2 columns
     add         r12, r1, r1
     add         r3, r0, r1
@@ -47,7 +47,7 @@
     vswp        d7, d10
     vswp        d12, d9
 
-    ;vp8_filter_mask() function
+    ;vp9_filter_mask() function
     ;vp8_hevmask() function
     sub         r0, r0, r1, lsl #4
     vabd.u8     q15, q5, q4                 ; abs(p0 - q0)
@@ -69,7 +69,7 @@
     vsubl.s8    q2, d8, d10                 ; ( qs0 - ps0)
     vsubl.s8    q13, d9, d11
 
-    vqsub.s8    q14, q3, q6                  ; vp8_filter = vp8_signed_char_clamp(ps1-qs1)
+    vqsub.s8    q14, q3, q6                  ; vp9_filter = vp9_signed_char_clamp(ps1-qs1)
 
     vmul.s16    q2, q2, q11                 ;  3 * ( qs0 - ps0)
     vmul.s16    q13, q13, q11
@@ -77,25 +77,25 @@
     vmov.u8     q11, #0x03                  ; 0x03
     vmov.u8     q12, #0x04                  ; 0x04
 
-    vaddw.s8    q2, q2, d28                  ; vp8_filter + 3 * ( qs0 - ps0)
+    vaddw.s8    q2, q2, d28                  ; vp9_filter + 3 * ( qs0 - ps0)
     vaddw.s8    q13, q13, d29
 
-    vqmovn.s16  d28, q2                      ; vp8_filter = vp8_signed_char_clamp(vp8_filter + 3 * ( qs0 - ps0))
+    vqmovn.s16  d28, q2                      ; vp9_filter = vp9_signed_char_clamp(vp9_filter + 3 * ( qs0 - ps0))
     vqmovn.s16  d29, q13
 
     add         r0, r0, #1
     add         r3, r0, r1
 
-    vand        q14, q14, q15                 ; vp8_filter &= mask
+    vand        q14, q14, q15                 ; vp9_filter &= mask
 
-    vqadd.s8    q2, q14, q11                 ; Filter2 = vp8_signed_char_clamp(vp8_filter+3)
-    vqadd.s8    q3, q14, q12                 ; Filter1 = vp8_signed_char_clamp(vp8_filter+4)
+    vqadd.s8    q2, q14, q11                 ; Filter2 = vp9_signed_char_clamp(vp9_filter+3)
+    vqadd.s8    q3, q14, q12                 ; Filter1 = vp9_signed_char_clamp(vp9_filter+4)
     vshr.s8     q2, q2, #3                  ; Filter2 >>= 3
     vshr.s8     q14, q3, #3                  ; Filter1 >>= 3
 
     ;calculate output
-    vqadd.s8    q11, q5, q2                 ; u = vp8_signed_char_clamp(ps0 + Filter2)
-    vqsub.s8    q10, q4, q14                 ; u = vp8_signed_char_clamp(qs0 - Filter1)
+    vqadd.s8    q11, q5, q2                 ; u = vp9_signed_char_clamp(ps0 + Filter2)
+    vqsub.s8    q10, q4, q14                 ; u = vp9_signed_char_clamp(qs0 - Filter1)
 
     veor        q6, q11, q0                 ; *op0 = u^0x80
     veor        q7, q10, q0                 ; *oq0 = u^0x80
@@ -121,34 +121,34 @@
     vst2.8      {d14[7], d15[7]}, [r3]
 
     bx          lr
-    ENDP        ; |vp8_loop_filter_simple_vertical_edge_neon|
+    ENDP        ; |vp9_loop_filter_simple_vertical_edge_neon|
 
 ; r0    unsigned char *y
 ; r1    int ystride
 ; r2    const unsigned char *blimit
 
-|vp8_loop_filter_bvs_neon| PROC
+|vp9_loop_filter_bvs_neon| PROC
     push        {r4, lr}
     ldrb        r3, [r2]                   ; load blim from mem
     mov         r4, r0
     add         r0, r0, #4
     vdup.s8     q1, r3                     ; duplicate blim
-    bl          vp8_loop_filter_simple_vertical_edge_neon
-    ; vp8_loop_filter_simple_vertical_edge_neon preserves  r1 and q1
+    bl          vp9_loop_filter_simple_vertical_edge_neon
+    ; vp9_loop_filter_simple_vertical_edge_neon preserves  r1 and q1
     add         r0, r4, #8
-    bl          vp8_loop_filter_simple_vertical_edge_neon
+    bl          vp9_loop_filter_simple_vertical_edge_neon
     add         r0, r4, #12
     pop         {r4, lr}
-    b           vp8_loop_filter_simple_vertical_edge_neon
-    ENDP        ;|vp8_loop_filter_bvs_neon|
+    b           vp9_loop_filter_simple_vertical_edge_neon
+    ENDP        ;|vp9_loop_filter_bvs_neon|
 
 ; r0    unsigned char *y
 ; r1    int ystride
 ; r2    const unsigned char *blimit
 
-|vp8_loop_filter_mbvs_neon| PROC
+|vp9_loop_filter_mbvs_neon| PROC
     ldrb        r3, [r2]                   ; load mblim from mem
     vdup.s8     q1, r3                     ; duplicate mblim
-    b           vp8_loop_filter_simple_vertical_edge_neon
-    ENDP        ;|vp8_loop_filter_bvs_neon|
+    b           vp9_loop_filter_simple_vertical_edge_neon
+    ENDP        ;|vp9_loop_filter_bvs_neon|
     END
diff --git a/vp8/common/arm/neon/mbloopfilter_neon.asm b/vp8/common/arm/neon/mbloopfilter_neon.asm
index f41c156..19b67f4 100644
--- a/vp8/common/arm/neon/mbloopfilter_neon.asm
+++ b/vp8/common/arm/neon/mbloopfilter_neon.asm
@@ -327,7 +327,7 @@
 
 |vp8_mbloop_filter_neon| PROC
 
-    ; vp8_filter_mask
+    ; vp9_filter_mask
     vabd.u8     q11, q3, q4                 ; abs(p3 - p2)
     vabd.u8     q12, q4, q5                 ; abs(p2 - p1)
     vabd.u8     q13, q5, q6                 ; abs(p1 - p0)
@@ -358,7 +358,7 @@
     vqadd.u8    q12, q12, q12               ; b = abs(p0 - q0) * 2
     vmov.u16    q11, #3                     ; #3
 
-    ; vp8_filter
+    ; vp9_filter
     ; convert to signed
     veor        q7, q7, q0                  ; qs0
     vshr.u8     q1, q1, #1                  ; a = a / 2
@@ -378,26 +378,26 @@
     vsubl.s8    q2, d14, d12                ; qs0 - ps0
     vsubl.s8    q13, d15, d13
 
-    vqsub.s8    q1, q5, q8                  ; vp8_filter = clamp(ps1-qs1)
+    vqsub.s8    q1, q5, q8                  ; vp9_filter = clamp(ps1-qs1)
 
     vmul.i16    q2, q2, q11                 ; 3 * ( qs0 - ps0)
 
-    vand        q15, q15, q12               ; vp8_filter_mask
+    vand        q15, q15, q12               ; vp9_filter_mask
 
     vmul.i16    q13, q13, q11
 
     vmov.u8     q12, #3                     ; #3
 
-    vaddw.s8    q2, q2, d2                  ; vp8_filter + 3 * ( qs0 - ps0)
+    vaddw.s8    q2, q2, d2                  ; vp9_filter + 3 * ( qs0 - ps0)
     vaddw.s8    q13, q13, d3
 
     vmov.u8     q11, #4                     ; #4
 
-    ; vp8_filter = clamp(vp8_filter + 3 * ( qs0 - ps0))
+    ; vp9_filter = clamp(vp9_filter + 3 * ( qs0 - ps0))
     vqmovn.s16  d2, q2
     vqmovn.s16  d3, q13
 
-    vand        q1, q1, q15                 ; vp8_filter &= mask
+    vand        q1, q1, q15                 ; vp9_filter &= mask
 
     vmov.u16    q15, #63                    ; #63
 
@@ -418,7 +418,7 @@
 
     vqadd.s8    q6, q6, q13                 ; ps0 = clamp(ps0 + Filter2)
 
-    vbic        q1, q1, q14                 ; vp8_filter &= ~hev
+    vbic        q1, q1, q14                 ; vp9_filter &= ~hev
 
     ; roughly 1/7th difference across boundary
     ; roughly 2/7th difference across boundary
diff --git a/vp8/common/arm/neon/save_neon_reg.asm b/vp8/common/arm/neon/save_neon_reg.asm
index fd7002e..71c3e70 100644
--- a/vp8/common/arm/neon/save_neon_reg.asm
+++ b/vp8/common/arm/neon/save_neon_reg.asm
@@ -9,8 +9,8 @@
 ;
 
 
-    EXPORT  |vp8_push_neon|
-    EXPORT  |vp8_pop_neon|
+    EXPORT  |vp9_push_neon|
+    EXPORT  |vp9_pop_neon|
 
     ARM
     REQUIRE8
@@ -18,14 +18,14 @@
 
     AREA ||.text||, CODE, READONLY, ALIGN=2
 
-|vp8_push_neon| PROC
+|vp9_push_neon| PROC
     vst1.i64            {d8, d9, d10, d11}, [r0]!
     vst1.i64            {d12, d13, d14, d15}, [r0]!
     bx              lr
 
     ENDP
 
-|vp8_pop_neon| PROC
+|vp9_pop_neon| PROC
     vld1.i64            {d8, d9, d10, d11}, [r0]!
     vld1.i64            {d12, d13, d14, d15}, [r0]!
     bx              lr
diff --git a/vp8/common/arm/neon/sixtappredict16x16_neon.asm b/vp8/common/arm/neon/sixtappredict16x16_neon.asm
index 9fdafd3..5e83f49 100644
--- a/vp8/common/arm/neon/sixtappredict16x16_neon.asm
+++ b/vp8/common/arm/neon/sixtappredict16x16_neon.asm
@@ -86,7 +86,7 @@
     pld             [r0, r1]
     pld             [r0, r1, lsl #1]
 
-    vmull.u8        q8, d6, d0              ;(src_ptr[-2] * vp8_filter[0])
+    vmull.u8        q8, d6, d0              ;(src_ptr[-2] * vp9_filter[0])
     vmull.u8        q9, d7, d0
     vmull.u8        q10, d9, d0
     vmull.u8        q11, d10, d0
@@ -97,7 +97,7 @@
     vext.8          d29, d9, d10, #1
     vext.8          d30, d12, d13, #1
 
-    vmlsl.u8        q8, d28, d1             ;-(src_ptr[-1] * vp8_filter[1])
+    vmlsl.u8        q8, d28, d1             ;-(src_ptr[-1] * vp9_filter[1])
     vmlsl.u8        q10, d29, d1
     vmlsl.u8        q12, d30, d1
 
@@ -105,7 +105,7 @@
     vext.8          d29, d10, d11, #1
     vext.8          d30, d13, d14, #1
 
-    vmlsl.u8        q9, d28, d1             ;-(src_ptr[-1] * vp8_filter[1])
+    vmlsl.u8        q9, d28, d1             ;-(src_ptr[-1] * vp9_filter[1])
     vmlsl.u8        q11, d29, d1
     vmlsl.u8        q13, d30, d1
 
@@ -113,7 +113,7 @@
     vext.8          d29, d9, d10, #4
     vext.8          d30, d12, d13, #4
 
-    vmlsl.u8        q8, d28, d4             ;-(src_ptr[2] * vp8_filter[4])
+    vmlsl.u8        q8, d28, d4             ;-(src_ptr[2] * vp9_filter[4])
     vmlsl.u8        q10, d29, d4
     vmlsl.u8        q12, d30, d4
 
@@ -121,7 +121,7 @@
     vext.8          d29, d10, d11, #4
     vext.8          d30, d13, d14, #4
 
-    vmlsl.u8        q9, d28, d4             ;-(src_ptr[2] * vp8_filter[4])
+    vmlsl.u8        q9, d28, d4             ;-(src_ptr[2] * vp9_filter[4])
     vmlsl.u8        q11, d29, d4
     vmlsl.u8        q13, d30, d4
 
@@ -129,7 +129,7 @@
     vext.8          d29, d9, d10, #5
     vext.8          d30, d12, d13, #5
 
-    vmlal.u8        q8, d28, d5             ;(src_ptr[3] * vp8_filter[5])
+    vmlal.u8        q8, d28, d5             ;(src_ptr[3] * vp9_filter[5])
     vmlal.u8        q10, d29, d5
     vmlal.u8        q12, d30, d5
 
@@ -137,7 +137,7 @@
     vext.8          d29, d10, d11, #5
     vext.8          d30, d13, d14, #5
 
-    vmlal.u8        q9, d28, d5             ;(src_ptr[3] * vp8_filter[5])
+    vmlal.u8        q9, d28, d5             ;(src_ptr[3] * vp9_filter[5])
     vmlal.u8        q11, d29, d5
     vmlal.u8        q13, d30, d5
 
@@ -145,7 +145,7 @@
     vext.8          d29, d9, d10, #2
     vext.8          d30, d12, d13, #2
 
-    vmlal.u8        q8, d28, d2             ;(src_ptr[0] * vp8_filter[2])
+    vmlal.u8        q8, d28, d2             ;(src_ptr[0] * vp9_filter[2])
     vmlal.u8        q10, d29, d2
     vmlal.u8        q12, d30, d2
 
@@ -153,7 +153,7 @@
     vext.8          d29, d10, d11, #2
     vext.8          d30, d13, d14, #2
 
-    vmlal.u8        q9, d28, d2             ;(src_ptr[0] * vp8_filter[2])
+    vmlal.u8        q9, d28, d2             ;(src_ptr[0] * vp9_filter[2])
     vmlal.u8        q11, d29, d2
     vmlal.u8        q13, d30, d2
 
@@ -165,7 +165,7 @@
     vext.8          d31, d10, d11, #3
     vext.8          d6, d13, d14, #3
 
-    vmull.u8        q4, d28, d3             ;(src_ptr[1] * vp8_filter[3])
+    vmull.u8        q4, d28, d3             ;(src_ptr[1] * vp9_filter[3])
     vmull.u8        q5, d29, d3
     vmull.u8        q6, d30, d3
 
@@ -173,7 +173,7 @@
     vqadd.s16       q10, q5
     vqadd.s16       q12, q6
 
-    vmull.u8        q6, d15, d3             ;(src_ptr[1] * vp8_filter[3])
+    vmull.u8        q6, d15, d3             ;(src_ptr[1] * vp9_filter[3])
     vmull.u8        q7, d31, d3
     vmull.u8        q3, d6, d3
 
@@ -229,32 +229,32 @@
     vld1.u8         {d25}, [lr], r2
     vld1.u8         {d26}, [lr], r2
 
-    vmull.u8        q3, d18, d0             ;(src_ptr[-2] * vp8_filter[0])
+    vmull.u8        q3, d18, d0             ;(src_ptr[-2] * vp9_filter[0])
     vmull.u8        q4, d19, d0
     vmull.u8        q5, d20, d0
     vmull.u8        q6, d21, d0
 
-    vmlsl.u8        q3, d19, d1             ;-(src_ptr[-1] * vp8_filter[1])
+    vmlsl.u8        q3, d19, d1             ;-(src_ptr[-1] * vp9_filter[1])
     vmlsl.u8        q4, d20, d1
     vmlsl.u8        q5, d21, d1
     vmlsl.u8        q6, d22, d1
 
-    vmlsl.u8        q3, d22, d4             ;-(src_ptr[2] * vp8_filter[4])
+    vmlsl.u8        q3, d22, d4             ;-(src_ptr[2] * vp9_filter[4])
     vmlsl.u8        q4, d23, d4
     vmlsl.u8        q5, d24, d4
     vmlsl.u8        q6, d25, d4
 
-    vmlal.u8        q3, d20, d2             ;(src_ptr[0] * vp8_filter[2])
+    vmlal.u8        q3, d20, d2             ;(src_ptr[0] * vp9_filter[2])
     vmlal.u8        q4, d21, d2
     vmlal.u8        q5, d22, d2
     vmlal.u8        q6, d23, d2
 
-    vmlal.u8        q3, d23, d5             ;(src_ptr[3] * vp8_filter[5])
+    vmlal.u8        q3, d23, d5             ;(src_ptr[3] * vp9_filter[5])
     vmlal.u8        q4, d24, d5
     vmlal.u8        q5, d25, d5
     vmlal.u8        q6, d26, d5
 
-    vmull.u8        q7, d21, d3             ;(src_ptr[1] * vp8_filter[3])
+    vmull.u8        q7, d21, d3             ;(src_ptr[1] * vp9_filter[3])
     vmull.u8        q8, d22, d3
     vmull.u8        q9, d23, d3
     vmull.u8        q10, d24, d3
@@ -316,7 +316,7 @@
     pld             [r0]
     pld             [r0, r1]
 
-    vmull.u8        q6, d6, d0              ;(src_ptr[-2] * vp8_filter[0])
+    vmull.u8        q6, d6, d0              ;(src_ptr[-2] * vp9_filter[0])
     vmull.u8        q7, d7, d0
     vmull.u8        q8, d9, d0
     vmull.u8        q9, d10, d0
@@ -332,15 +332,15 @@
     vext.8          d28, d6, d7, #5         ;construct src_ptr[3]
     vext.8          d29, d9, d10, #5
 
-    vmlsl.u8        q6, d20, d1             ;-(src_ptr[-1] * vp8_filter[1])
+    vmlsl.u8        q6, d20, d1             ;-(src_ptr[-1] * vp9_filter[1])
     vmlsl.u8        q8, d21, d1
-    vmlsl.u8        q7, d22, d1             ;-(src_ptr[-1] * vp8_filter[1])
+    vmlsl.u8        q7, d22, d1             ;-(src_ptr[-1] * vp9_filter[1])
     vmlsl.u8        q9, d23, d1
-    vmlsl.u8        q6, d24, d4             ;-(src_ptr[2] * vp8_filter[4])
+    vmlsl.u8        q6, d24, d4             ;-(src_ptr[2] * vp9_filter[4])
     vmlsl.u8        q8, d25, d4
-    vmlsl.u8        q7, d26, d4             ;-(src_ptr[2] * vp8_filter[4])
+    vmlsl.u8        q7, d26, d4             ;-(src_ptr[2] * vp9_filter[4])
     vmlsl.u8        q9, d27, d4
-    vmlal.u8        q6, d28, d5             ;(src_ptr[3] * vp8_filter[5])
+    vmlal.u8        q6, d28, d5             ;(src_ptr[3] * vp9_filter[5])
     vmlal.u8        q8, d29, d5
 
     vext.8          d20, d7, d8, #5
@@ -355,16 +355,16 @@
     vext.8          d28, d7, d8, #3
     vext.8          d29, d10, d11, #3
 
-    vmlal.u8        q7, d20, d5             ;(src_ptr[3] * vp8_filter[5])
+    vmlal.u8        q7, d20, d5             ;(src_ptr[3] * vp9_filter[5])
     vmlal.u8        q9, d21, d5
-    vmlal.u8        q6, d22, d2             ;(src_ptr[0] * vp8_filter[2])
+    vmlal.u8        q6, d22, d2             ;(src_ptr[0] * vp9_filter[2])
     vmlal.u8        q8, d23, d2
-    vmlal.u8        q7, d24, d2             ;(src_ptr[0] * vp8_filter[2])
+    vmlal.u8        q7, d24, d2             ;(src_ptr[0] * vp9_filter[2])
     vmlal.u8        q9, d25, d2
 
-    vmull.u8        q10, d26, d3            ;(src_ptr[1] * vp8_filter[3])
+    vmull.u8        q10, d26, d3            ;(src_ptr[1] * vp9_filter[3])
     vmull.u8        q11, d27, d3
-    vmull.u8        q12, d28, d3            ;(src_ptr[1] * vp8_filter[3])
+    vmull.u8        q12, d28, d3            ;(src_ptr[1] * vp9_filter[3])
     vmull.u8        q15, d29, d3
 
     vqadd.s16       q6, q10                 ;sum of all (src_data*filter_parameters)
@@ -419,32 +419,32 @@
     vld1.u8         {d25}, [r0], r1
     vld1.u8         {d26}, [r0], r1
 
-    vmull.u8        q3, d18, d0             ;(src_ptr[-2] * vp8_filter[0])
+    vmull.u8        q3, d18, d0             ;(src_ptr[-2] * vp9_filter[0])
     vmull.u8        q4, d19, d0
     vmull.u8        q5, d20, d0
     vmull.u8        q6, d21, d0
 
-    vmlsl.u8        q3, d19, d1             ;-(src_ptr[-1] * vp8_filter[1])
+    vmlsl.u8        q3, d19, d1             ;-(src_ptr[-1] * vp9_filter[1])
     vmlsl.u8        q4, d20, d1
     vmlsl.u8        q5, d21, d1
     vmlsl.u8        q6, d22, d1
 
-    vmlsl.u8        q3, d22, d4             ;-(src_ptr[2] * vp8_filter[4])
+    vmlsl.u8        q3, d22, d4             ;-(src_ptr[2] * vp9_filter[4])
     vmlsl.u8        q4, d23, d4
     vmlsl.u8        q5, d24, d4
     vmlsl.u8        q6, d25, d4
 
-    vmlal.u8        q3, d20, d2             ;(src_ptr[0] * vp8_filter[2])
+    vmlal.u8        q3, d20, d2             ;(src_ptr[0] * vp9_filter[2])
     vmlal.u8        q4, d21, d2
     vmlal.u8        q5, d22, d2
     vmlal.u8        q6, d23, d2
 
-    vmlal.u8        q3, d23, d5             ;(src_ptr[3] * vp8_filter[5])
+    vmlal.u8        q3, d23, d5             ;(src_ptr[3] * vp9_filter[5])
     vmlal.u8        q4, d24, d5
     vmlal.u8        q5, d25, d5
     vmlal.u8        q6, d26, d5
 
-    vmull.u8        q7, d21, d3             ;(src_ptr[1] * vp8_filter[3])
+    vmull.u8        q7, d21, d3             ;(src_ptr[1] * vp9_filter[3])
     vmull.u8        q8, d22, d3
     vmull.u8        q9, d23, d3
     vmull.u8        q10, d24, d3
diff --git a/vp8/common/arm/neon/sixtappredict4x4_neon.asm b/vp8/common/arm/neon/sixtappredict4x4_neon.asm
index 41510e8..5966b64 100644
--- a/vp8/common/arm/neon/sixtappredict4x4_neon.asm
+++ b/vp8/common/arm/neon/sixtappredict4x4_neon.asm
@@ -82,7 +82,7 @@
 
     vzip.32         d18, d19                ;put 2-line data in 1 register (src_ptr[3])
     vzip.32         d20, d21
-    vmull.u8        q7, d18, d5             ;(src_ptr[3] * vp8_filter[5])
+    vmull.u8        q7, d18, d5             ;(src_ptr[3] * vp9_filter[5])
     vmull.u8        q8, d20, d5
 
     vmov            q4, q3                  ;keep original src data in q4 q6
@@ -92,33 +92,33 @@
     vzip.32         d10, d11
     vshr.u64        q9, q4, #8              ;construct src_ptr[-1]
     vshr.u64        q10, q6, #8
-    vmlal.u8        q7, d6, d0              ;+(src_ptr[-2] * vp8_filter[0])
+    vmlal.u8        q7, d6, d0              ;+(src_ptr[-2] * vp9_filter[0])
     vmlal.u8        q8, d10, d0
 
     vzip.32         d18, d19                ;put 2-line data in 1 register (src_ptr[-1])
     vzip.32         d20, d21
     vshr.u64        q3, q4, #32             ;construct src_ptr[2]
     vshr.u64        q5, q6, #32
-    vmlsl.u8        q7, d18, d1             ;-(src_ptr[-1] * vp8_filter[1])
+    vmlsl.u8        q7, d18, d1             ;-(src_ptr[-1] * vp9_filter[1])
     vmlsl.u8        q8, d20, d1
 
     vzip.32         d6, d7                  ;put 2-line data in 1 register (src_ptr[2])
     vzip.32         d10, d11
     vshr.u64        q9, q4, #16             ;construct src_ptr[0]
     vshr.u64        q10, q6, #16
-    vmlsl.u8        q7, d6, d4              ;-(src_ptr[2] * vp8_filter[4])
+    vmlsl.u8        q7, d6, d4              ;-(src_ptr[2] * vp9_filter[4])
     vmlsl.u8        q8, d10, d4
 
     vzip.32         d18, d19                ;put 2-line data in 1 register (src_ptr[0])
     vzip.32         d20, d21
     vshr.u64        q3, q4, #24             ;construct src_ptr[1]
     vshr.u64        q5, q6, #24
-    vmlal.u8        q7, d18, d2             ;(src_ptr[0] * vp8_filter[2])
+    vmlal.u8        q7, d18, d2             ;(src_ptr[0] * vp9_filter[2])
     vmlal.u8        q8, d20, d2
 
     vzip.32         d6, d7                  ;put 2-line data in 1 register (src_ptr[1])
     vzip.32         d10, d11
-    vmull.u8        q9, d6, d3              ;(src_ptr[1] * vp8_filter[3])
+    vmull.u8        q9, d6, d3              ;(src_ptr[1] * vp9_filter[3])
     vmull.u8        q10, d10, d3
 
     vld1.u8         {q3}, [r0], r1          ;load rest 5-line src data
@@ -147,9 +147,9 @@
     vzip.32         d18, d19                ;put 2-line data in 1 register (src_ptr[3])
     vzip.32         d20, d21
     vext.8          d31, d22, d23, #5       ;construct src_ptr[3]
-    vmull.u8        q7, d18, d5             ;(src_ptr[3] * vp8_filter[5])
+    vmull.u8        q7, d18, d5             ;(src_ptr[3] * vp9_filter[5])
     vmull.u8        q8, d20, d5
-    vmull.u8        q12, d31, d5            ;(src_ptr[3] * vp8_filter[5])
+    vmull.u8        q12, d31, d5            ;(src_ptr[3] * vp9_filter[5])
 
     vmov            q4, q3                  ;keep original src data in q4 q6
     vmov            q6, q5
@@ -159,9 +159,9 @@
     vshr.u64        q9, q4, #8              ;construct src_ptr[-1]
     vshr.u64        q10, q6, #8
 
-    vmlal.u8        q7, d6, d0              ;+(src_ptr[-2] * vp8_filter[0])
+    vmlal.u8        q7, d6, d0              ;+(src_ptr[-2] * vp9_filter[0])
     vmlal.u8        q8, d10, d0
-    vmlal.u8        q12, d22, d0            ;(src_ptr[-2] * vp8_filter[0])
+    vmlal.u8        q12, d22, d0            ;(src_ptr[-2] * vp9_filter[0])
 
     vzip.32         d18, d19                ;put 2-line data in 1 register (src_ptr[-1])
     vzip.32         d20, d21
@@ -169,9 +169,9 @@
     vshr.u64        q5, q6, #32
     vext.8          d31, d22, d23, #1       ;construct src_ptr[-1]
 
-    vmlsl.u8        q7, d18, d1             ;-(src_ptr[-1] * vp8_filter[1])
+    vmlsl.u8        q7, d18, d1             ;-(src_ptr[-1] * vp9_filter[1])
     vmlsl.u8        q8, d20, d1
-    vmlsl.u8        q12, d31, d1            ;-(src_ptr[-1] * vp8_filter[1])
+    vmlsl.u8        q12, d31, d1            ;-(src_ptr[-1] * vp9_filter[1])
 
     vzip.32         d6, d7                  ;put 2-line data in 1 register (src_ptr[2])
     vzip.32         d10, d11
@@ -179,9 +179,9 @@
     vshr.u64        q10, q6, #16
     vext.8          d31, d22, d23, #4       ;construct src_ptr[2]
 
-    vmlsl.u8        q7, d6, d4              ;-(src_ptr[2] * vp8_filter[4])
+    vmlsl.u8        q7, d6, d4              ;-(src_ptr[2] * vp9_filter[4])
     vmlsl.u8        q8, d10, d4
-    vmlsl.u8        q12, d31, d4            ;-(src_ptr[2] * vp8_filter[4])
+    vmlsl.u8        q12, d31, d4            ;-(src_ptr[2] * vp9_filter[4])
 
     vzip.32         d18, d19                ;put 2-line data in 1 register (src_ptr[0])
     vzip.32         d20, d21
@@ -189,16 +189,16 @@
     vshr.u64        q5, q6, #24
     vext.8          d31, d22, d23, #2       ;construct src_ptr[0]
 
-    vmlal.u8        q7, d18, d2             ;(src_ptr[0] * vp8_filter[2])
+    vmlal.u8        q7, d18, d2             ;(src_ptr[0] * vp9_filter[2])
     vmlal.u8        q8, d20, d2
-    vmlal.u8        q12, d31, d2            ;(src_ptr[0] * vp8_filter[2])
+    vmlal.u8        q12, d31, d2            ;(src_ptr[0] * vp9_filter[2])
 
     vzip.32         d6, d7                  ;put 2-line data in 1 register (src_ptr[1])
     vzip.32         d10, d11
     vext.8          d31, d22, d23, #3       ;construct src_ptr[1]
-    vmull.u8        q9, d6, d3              ;(src_ptr[1] * vp8_filter[3])
+    vmull.u8        q9, d6, d3              ;(src_ptr[1] * vp9_filter[3])
     vmull.u8        q10, d10, d3
-    vmull.u8        q11, d31, d3            ;(src_ptr[1] * vp8_filter[3])
+    vmull.u8        q11, d31, d3            ;(src_ptr[1] * vp9_filter[3])
 
     add             r3, r12, r3, lsl #5
 
@@ -228,22 +228,22 @@
     vdup.8          d4, d16[0]
     vdup.8          d5, d16[4]
 
-    vmull.u8        q3, d27, d0             ;(src_ptr[-2] * vp8_filter[0])
+    vmull.u8        q3, d27, d0             ;(src_ptr[-2] * vp9_filter[0])
     vmull.u8        q4, d28, d0
 
-    vmull.u8        q5, d25, d5             ;(src_ptr[3] * vp8_filter[5])
+    vmull.u8        q5, d25, d5             ;(src_ptr[3] * vp9_filter[5])
     vmull.u8        q6, d26, d5
 
-    vmlsl.u8        q3, d29, d4             ;-(src_ptr[2] * vp8_filter[4])
+    vmlsl.u8        q3, d29, d4             ;-(src_ptr[2] * vp9_filter[4])
     vmlsl.u8        q4, d30, d4
 
-    vmlsl.u8        q5, d23, d1             ;-(src_ptr[-1] * vp8_filter[1])
+    vmlsl.u8        q5, d23, d1             ;-(src_ptr[-1] * vp9_filter[1])
     vmlsl.u8        q6, d24, d1
 
-    vmlal.u8        q3, d28, d2             ;(src_ptr[0] * vp8_filter[2])
+    vmlal.u8        q3, d28, d2             ;(src_ptr[0] * vp9_filter[2])
     vmlal.u8        q4, d29, d2
 
-    vmlal.u8        q5, d24, d3             ;(src_ptr[1] * vp8_filter[3])
+    vmlal.u8        q5, d24, d3             ;(src_ptr[1] * vp9_filter[3])
     vmlal.u8        q6, d25, d3
 
     add             r0, r4, lr
@@ -294,7 +294,7 @@
 
     vzip.32         d18, d19                ;put 2-line data in 1 register (src_ptr[3])
     vzip.32         d20, d21
-    vmull.u8        q7, d18, d5             ;(src_ptr[3] * vp8_filter[5])
+    vmull.u8        q7, d18, d5             ;(src_ptr[3] * vp9_filter[5])
     vmull.u8        q8, d20, d5
 
     vmov            q4, q3                  ;keep original src data in q4 q6
@@ -304,33 +304,33 @@
     vzip.32         d10, d11
     vshr.u64        q9, q4, #8              ;construct src_ptr[-1]
     vshr.u64        q10, q6, #8
-    vmlal.u8        q7, d6, d0              ;+(src_ptr[-2] * vp8_filter[0])
+    vmlal.u8        q7, d6, d0              ;+(src_ptr[-2] * vp9_filter[0])
     vmlal.u8        q8, d10, d0
 
     vzip.32         d18, d19                ;put 2-line data in 1 register (src_ptr[-1])
     vzip.32         d20, d21
     vshr.u64        q3, q4, #32             ;construct src_ptr[2]
     vshr.u64        q5, q6, #32
-    vmlsl.u8        q7, d18, d1             ;-(src_ptr[-1] * vp8_filter[1])
+    vmlsl.u8        q7, d18, d1             ;-(src_ptr[-1] * vp9_filter[1])
     vmlsl.u8        q8, d20, d1
 
     vzip.32         d6, d7                  ;put 2-line data in 1 register (src_ptr[2])
     vzip.32         d10, d11
     vshr.u64        q9, q4, #16             ;construct src_ptr[0]
     vshr.u64        q10, q6, #16
-    vmlsl.u8        q7, d6, d4              ;-(src_ptr[2] * vp8_filter[4])
+    vmlsl.u8        q7, d6, d4              ;-(src_ptr[2] * vp9_filter[4])
     vmlsl.u8        q8, d10, d4
 
     vzip.32         d18, d19                ;put 2-line data in 1 register (src_ptr[0])
     vzip.32         d20, d21
     vshr.u64        q3, q4, #24             ;construct src_ptr[1]
     vshr.u64        q5, q6, #24
-    vmlal.u8        q7, d18, d2             ;(src_ptr[0] * vp8_filter[2])
+    vmlal.u8        q7, d18, d2             ;(src_ptr[0] * vp9_filter[2])
     vmlal.u8        q8, d20, d2
 
     vzip.32         d6, d7                  ;put 2-line data in 1 register (src_ptr[1])
     vzip.32         d10, d11
-    vmull.u8        q9, d6, d3              ;(src_ptr[1] * vp8_filter[3])
+    vmull.u8        q9, d6, d3              ;(src_ptr[1] * vp9_filter[3])
     vmull.u8        q10, d10, d3
 
     add             r0, r4, lr
@@ -380,22 +380,22 @@
     vext.8          d25, d29, d30, #4
     vext.8          d26, d30, d31, #4
 
-    vmull.u8        q3, d27, d0             ;(src_ptr[-2] * vp8_filter[0])
+    vmull.u8        q3, d27, d0             ;(src_ptr[-2] * vp9_filter[0])
     vmull.u8        q4, d28, d0
 
-    vmull.u8        q5, d25, d5             ;(src_ptr[3] * vp8_filter[5])
+    vmull.u8        q5, d25, d5             ;(src_ptr[3] * vp9_filter[5])
     vmull.u8        q6, d26, d5
 
-    vmlsl.u8        q3, d29, d4             ;-(src_ptr[2] * vp8_filter[4])
+    vmlsl.u8        q3, d29, d4             ;-(src_ptr[2] * vp9_filter[4])
     vmlsl.u8        q4, d30, d4
 
-    vmlsl.u8        q5, d23, d1             ;-(src_ptr[-1] * vp8_filter[1])
+    vmlsl.u8        q5, d23, d1             ;-(src_ptr[-1] * vp9_filter[1])
     vmlsl.u8        q6, d24, d1
 
-    vmlal.u8        q3, d28, d2             ;(src_ptr[0] * vp8_filter[2])
+    vmlal.u8        q3, d28, d2             ;(src_ptr[0] * vp9_filter[2])
     vmlal.u8        q4, d29, d2
 
-    vmlal.u8        q5, d24, d3             ;(src_ptr[1] * vp8_filter[3])
+    vmlal.u8        q5, d24, d3             ;(src_ptr[1] * vp9_filter[3])
     vmlal.u8        q6, d25, d3
 
     add             r0, r4, lr
diff --git a/vp8/common/arm/neon/sixtappredict8x4_neon.asm b/vp8/common/arm/neon/sixtappredict8x4_neon.asm
index a57ec01..9ce1e3b 100644
--- a/vp8/common/arm/neon/sixtappredict8x4_neon.asm
+++ b/vp8/common/arm/neon/sixtappredict8x4_neon.asm
@@ -76,7 +76,7 @@
     pld             [r0, r1]
     pld             [r0, r1, lsl #1]
 
-    vmull.u8        q7, d6, d0              ;(src_ptr[-2] * vp8_filter[0])
+    vmull.u8        q7, d6, d0              ;(src_ptr[-2] * vp9_filter[0])
     vmull.u8        q8, d8, d0
     vmull.u8        q9, d10, d0
     vmull.u8        q10, d12, d0
@@ -86,7 +86,7 @@
     vext.8          d30, d10, d11, #1
     vext.8          d31, d12, d13, #1
 
-    vmlsl.u8        q7, d28, d1             ;-(src_ptr[-1] * vp8_filter[1])
+    vmlsl.u8        q7, d28, d1             ;-(src_ptr[-1] * vp9_filter[1])
     vmlsl.u8        q8, d29, d1
     vmlsl.u8        q9, d30, d1
     vmlsl.u8        q10, d31, d1
@@ -96,7 +96,7 @@
     vext.8          d30, d10, d11, #4
     vext.8          d31, d12, d13, #4
 
-    vmlsl.u8        q7, d28, d4             ;-(src_ptr[2] * vp8_filter[4])
+    vmlsl.u8        q7, d28, d4             ;-(src_ptr[2] * vp9_filter[4])
     vmlsl.u8        q8, d29, d4
     vmlsl.u8        q9, d30, d4
     vmlsl.u8        q10, d31, d4
@@ -106,7 +106,7 @@
     vext.8          d30, d10, d11, #2
     vext.8          d31, d12, d13, #2
 
-    vmlal.u8        q7, d28, d2             ;(src_ptr[0] * vp8_filter[2])
+    vmlal.u8        q7, d28, d2             ;(src_ptr[0] * vp9_filter[2])
     vmlal.u8        q8, d29, d2
     vmlal.u8        q9, d30, d2
     vmlal.u8        q10, d31, d2
@@ -116,7 +116,7 @@
     vext.8          d30, d10, d11, #5
     vext.8          d31, d12, d13, #5
 
-    vmlal.u8        q7, d28, d5             ;(src_ptr[3] * vp8_filter[5])
+    vmlal.u8        q7, d28, d5             ;(src_ptr[3] * vp9_filter[5])
     vmlal.u8        q8, d29, d5
     vmlal.u8        q9, d30, d5
     vmlal.u8        q10, d31, d5
@@ -126,7 +126,7 @@
     vext.8          d30, d10, d11, #3
     vext.8          d31, d12, d13, #3
 
-    vmull.u8        q3, d28, d3             ;(src_ptr[1] * vp8_filter[3])
+    vmull.u8        q3, d28, d3             ;(src_ptr[1] * vp9_filter[3])
     vmull.u8        q4, d29, d3
     vmull.u8        q5, d30, d3
     vmull.u8        q6, d31, d3
@@ -153,7 +153,7 @@
     vst1.u8         {d25}, [lr]!
 
     ;first_pass filtering on the rest 5-line data
-    vmull.u8        q8, d6, d0              ;(src_ptr[-2] * vp8_filter[0])
+    vmull.u8        q8, d6, d0              ;(src_ptr[-2] * vp9_filter[0])
     vmull.u8        q9, d8, d0
     vmull.u8        q10, d10, d0
     vmull.u8        q11, d12, d0
@@ -165,7 +165,7 @@
     vext.8          d30, d12, d13, #1
     vext.8          d31, d14, d15, #1
 
-    vmlsl.u8        q8, d27, d1             ;-(src_ptr[-1] * vp8_filter[1])
+    vmlsl.u8        q8, d27, d1             ;-(src_ptr[-1] * vp9_filter[1])
     vmlsl.u8        q9, d28, d1
     vmlsl.u8        q10, d29, d1
     vmlsl.u8        q11, d30, d1
@@ -177,7 +177,7 @@
     vext.8          d30, d12, d13, #4
     vext.8          d31, d14, d15, #4
 
-    vmlsl.u8        q8, d27, d4             ;-(src_ptr[2] * vp8_filter[4])
+    vmlsl.u8        q8, d27, d4             ;-(src_ptr[2] * vp9_filter[4])
     vmlsl.u8        q9, d28, d4
     vmlsl.u8        q10, d29, d4
     vmlsl.u8        q11, d30, d4
@@ -189,7 +189,7 @@
     vext.8          d30, d12, d13, #2
     vext.8          d31, d14, d15, #2
 
-    vmlal.u8        q8, d27, d2             ;(src_ptr[0] * vp8_filter[2])
+    vmlal.u8        q8, d27, d2             ;(src_ptr[0] * vp9_filter[2])
     vmlal.u8        q9, d28, d2
     vmlal.u8        q10, d29, d2
     vmlal.u8        q11, d30, d2
@@ -201,7 +201,7 @@
     vext.8          d30, d12, d13, #5
     vext.8          d31, d14, d15, #5
 
-    vmlal.u8        q8, d27, d5             ;(src_ptr[3] * vp8_filter[5])
+    vmlal.u8        q8, d27, d5             ;(src_ptr[3] * vp9_filter[5])
     vmlal.u8        q9, d28, d5
     vmlal.u8        q10, d29, d5
     vmlal.u8        q11, d30, d5
@@ -213,7 +213,7 @@
     vext.8          d30, d12, d13, #3
     vext.8          d31, d14, d15, #3
 
-    vmull.u8        q3, d27, d3             ;(src_ptr[1] * vp8_filter[3])
+    vmull.u8        q3, d27, d3             ;(src_ptr[1] * vp9_filter[3])
     vmull.u8        q4, d28, d3
     vmull.u8        q5, d29, d3
     vmull.u8        q6, d30, d3
@@ -251,32 +251,32 @@
     vdup.8          d4, d16[0]
     vdup.8          d5, d16[4]
 
-    vmull.u8        q3, d22, d0             ;(src_ptr[-2] * vp8_filter[0])
+    vmull.u8        q3, d22, d0             ;(src_ptr[-2] * vp9_filter[0])
     vmull.u8        q4, d23, d0
     vmull.u8        q5, d24, d0
     vmull.u8        q6, d25, d0
 
-    vmlsl.u8        q3, d23, d1             ;-(src_ptr[-1] * vp8_filter[1])
+    vmlsl.u8        q3, d23, d1             ;-(src_ptr[-1] * vp9_filter[1])
     vmlsl.u8        q4, d24, d1
     vmlsl.u8        q5, d25, d1
     vmlsl.u8        q6, d26, d1
 
-    vmlsl.u8        q3, d26, d4             ;-(src_ptr[2] * vp8_filter[4])
+    vmlsl.u8        q3, d26, d4             ;-(src_ptr[2] * vp9_filter[4])
     vmlsl.u8        q4, d27, d4
     vmlsl.u8        q5, d28, d4
     vmlsl.u8        q6, d29, d4
 
-    vmlal.u8        q3, d24, d2             ;(src_ptr[0] * vp8_filter[2])
+    vmlal.u8        q3, d24, d2             ;(src_ptr[0] * vp9_filter[2])
     vmlal.u8        q4, d25, d2
     vmlal.u8        q5, d26, d2
     vmlal.u8        q6, d27, d2
 
-    vmlal.u8        q3, d27, d5             ;(src_ptr[3] * vp8_filter[5])
+    vmlal.u8        q3, d27, d5             ;(src_ptr[3] * vp9_filter[5])
     vmlal.u8        q4, d28, d5
     vmlal.u8        q5, d29, d5
     vmlal.u8        q6, d30, d5
 
-    vmull.u8        q7, d25, d3             ;(src_ptr[1] * vp8_filter[3])
+    vmull.u8        q7, d25, d3             ;(src_ptr[1] * vp9_filter[3])
     vmull.u8        q8, d26, d3
     vmull.u8        q9, d27, d3
     vmull.u8        q10, d28, d3
@@ -322,7 +322,7 @@
     pld             [r0, r1]
     pld             [r0, r1, lsl #1]
 
-    vmull.u8        q7, d6, d0              ;(src_ptr[-2] * vp8_filter[0])
+    vmull.u8        q7, d6, d0              ;(src_ptr[-2] * vp9_filter[0])
     vmull.u8        q8, d8, d0
     vmull.u8        q9, d10, d0
     vmull.u8        q10, d12, d0
@@ -332,7 +332,7 @@
     vext.8          d30, d10, d11, #1
     vext.8          d31, d12, d13, #1
 
-    vmlsl.u8        q7, d28, d1             ;-(src_ptr[-1] * vp8_filter[1])
+    vmlsl.u8        q7, d28, d1             ;-(src_ptr[-1] * vp9_filter[1])
     vmlsl.u8        q8, d29, d1
     vmlsl.u8        q9, d30, d1
     vmlsl.u8        q10, d31, d1
@@ -342,7 +342,7 @@
     vext.8          d30, d10, d11, #4
     vext.8          d31, d12, d13, #4
 
-    vmlsl.u8        q7, d28, d4             ;-(src_ptr[2] * vp8_filter[4])
+    vmlsl.u8        q7, d28, d4             ;-(src_ptr[2] * vp9_filter[4])
     vmlsl.u8        q8, d29, d4
     vmlsl.u8        q9, d30, d4
     vmlsl.u8        q10, d31, d4
@@ -352,7 +352,7 @@
     vext.8          d30, d10, d11, #2
     vext.8          d31, d12, d13, #2
 
-    vmlal.u8        q7, d28, d2             ;(src_ptr[0] * vp8_filter[2])
+    vmlal.u8        q7, d28, d2             ;(src_ptr[0] * vp9_filter[2])
     vmlal.u8        q8, d29, d2
     vmlal.u8        q9, d30, d2
     vmlal.u8        q10, d31, d2
@@ -362,7 +362,7 @@
     vext.8          d30, d10, d11, #5
     vext.8          d31, d12, d13, #5
 
-    vmlal.u8        q7, d28, d5             ;(src_ptr[3] * vp8_filter[5])
+    vmlal.u8        q7, d28, d5             ;(src_ptr[3] * vp9_filter[5])
     vmlal.u8        q8, d29, d5
     vmlal.u8        q9, d30, d5
     vmlal.u8        q10, d31, d5
@@ -372,7 +372,7 @@
     vext.8          d30, d10, d11, #3
     vext.8          d31, d12, d13, #3
 
-    vmull.u8        q3, d28, d3             ;(src_ptr[1] * vp8_filter[3])
+    vmull.u8        q3, d28, d3             ;(src_ptr[1] * vp9_filter[3])
     vmull.u8        q4, d29, d3
     vmull.u8        q5, d30, d3
     vmull.u8        q6, d31, d3
@@ -419,32 +419,32 @@
     vdup.8          d5, d16[4]
     vld1.u8         {d30}, [r0], r1
 
-    vmull.u8        q3, d22, d0             ;(src_ptr[-2] * vp8_filter[0])
+    vmull.u8        q3, d22, d0             ;(src_ptr[-2] * vp9_filter[0])
     vmull.u8        q4, d23, d0
     vmull.u8        q5, d24, d0
     vmull.u8        q6, d25, d0
 
-    vmlsl.u8        q3, d23, d1             ;-(src_ptr[-1] * vp8_filter[1])
+    vmlsl.u8        q3, d23, d1             ;-(src_ptr[-1] * vp9_filter[1])
     vmlsl.u8        q4, d24, d1
     vmlsl.u8        q5, d25, d1
     vmlsl.u8        q6, d26, d1
 
-    vmlsl.u8        q3, d26, d4             ;-(src_ptr[2] * vp8_filter[4])
+    vmlsl.u8        q3, d26, d4             ;-(src_ptr[2] * vp9_filter[4])
     vmlsl.u8        q4, d27, d4
     vmlsl.u8        q5, d28, d4
     vmlsl.u8        q6, d29, d4
 
-    vmlal.u8        q3, d24, d2             ;(src_ptr[0] * vp8_filter[2])
+    vmlal.u8        q3, d24, d2             ;(src_ptr[0] * vp9_filter[2])
     vmlal.u8        q4, d25, d2
     vmlal.u8        q5, d26, d2
     vmlal.u8        q6, d27, d2
 
-    vmlal.u8        q3, d27, d5             ;(src_ptr[3] * vp8_filter[5])
+    vmlal.u8        q3, d27, d5             ;(src_ptr[3] * vp9_filter[5])
     vmlal.u8        q4, d28, d5
     vmlal.u8        q5, d29, d5
     vmlal.u8        q6, d30, d5
 
-    vmull.u8        q7, d25, d3             ;(src_ptr[1] * vp8_filter[3])
+    vmull.u8        q7, d25, d3             ;(src_ptr[1] * vp9_filter[3])
     vmull.u8        q8, d26, d3
     vmull.u8        q9, d27, d3
     vmull.u8        q10, d28, d3
diff --git a/vp8/common/arm/neon/sixtappredict8x8_neon.asm b/vp8/common/arm/neon/sixtappredict8x8_neon.asm
index 00ed5ae..5ff1661 100644
--- a/vp8/common/arm/neon/sixtappredict8x8_neon.asm
+++ b/vp8/common/arm/neon/sixtappredict8x8_neon.asm
@@ -80,7 +80,7 @@
     pld             [r0, r1]
     pld             [r0, r1, lsl #1]
 
-    vmull.u8        q7, d6, d0              ;(src_ptr[-2] * vp8_filter[0])
+    vmull.u8        q7, d6, d0              ;(src_ptr[-2] * vp9_filter[0])
     vmull.u8        q8, d8, d0
     vmull.u8        q9, d10, d0
     vmull.u8        q10, d12, d0
@@ -90,7 +90,7 @@
     vext.8          d30, d10, d11, #1
     vext.8          d31, d12, d13, #1
 
-    vmlsl.u8        q7, d28, d1             ;-(src_ptr[-1] * vp8_filter[1])
+    vmlsl.u8        q7, d28, d1             ;-(src_ptr[-1] * vp9_filter[1])
     vmlsl.u8        q8, d29, d1
     vmlsl.u8        q9, d30, d1
     vmlsl.u8        q10, d31, d1
@@ -100,7 +100,7 @@
     vext.8          d30, d10, d11, #4
     vext.8          d31, d12, d13, #4
 
-    vmlsl.u8        q7, d28, d4             ;-(src_ptr[2] * vp8_filter[4])
+    vmlsl.u8        q7, d28, d4             ;-(src_ptr[2] * vp9_filter[4])
     vmlsl.u8        q8, d29, d4
     vmlsl.u8        q9, d30, d4
     vmlsl.u8        q10, d31, d4
@@ -110,7 +110,7 @@
     vext.8          d30, d10, d11, #2
     vext.8          d31, d12, d13, #2
 
-    vmlal.u8        q7, d28, d2             ;(src_ptr[0] * vp8_filter[2])
+    vmlal.u8        q7, d28, d2             ;(src_ptr[0] * vp9_filter[2])
     vmlal.u8        q8, d29, d2
     vmlal.u8        q9, d30, d2
     vmlal.u8        q10, d31, d2
@@ -120,7 +120,7 @@
     vext.8          d30, d10, d11, #5
     vext.8          d31, d12, d13, #5
 
-    vmlal.u8        q7, d28, d5             ;(src_ptr[3] * vp8_filter[5])
+    vmlal.u8        q7, d28, d5             ;(src_ptr[3] * vp9_filter[5])
     vmlal.u8        q8, d29, d5
     vmlal.u8        q9, d30, d5
     vmlal.u8        q10, d31, d5
@@ -130,7 +130,7 @@
     vext.8          d30, d10, d11, #3
     vext.8          d31, d12, d13, #3
 
-    vmull.u8        q3, d28, d3             ;(src_ptr[1] * vp8_filter[3])
+    vmull.u8        q3, d28, d3             ;(src_ptr[1] * vp9_filter[3])
     vmull.u8        q4, d29, d3
     vmull.u8        q5, d30, d3
     vmull.u8        q6, d31, d3
@@ -166,7 +166,7 @@
     ;vld1.u8            {q6}, [r0], r1
     vld1.u8         {q7}, [r0], r1
 
-    vmull.u8        q8, d6, d0              ;(src_ptr[-2] * vp8_filter[0])
+    vmull.u8        q8, d6, d0              ;(src_ptr[-2] * vp9_filter[0])
     vmull.u8        q9, d8, d0
     vmull.u8        q10, d10, d0
     vmull.u8        q11, d12, d0
@@ -178,7 +178,7 @@
     vext.8          d30, d12, d13, #1
     vext.8          d31, d14, d15, #1
 
-    vmlsl.u8        q8, d27, d1             ;-(src_ptr[-1] * vp8_filter[1])
+    vmlsl.u8        q8, d27, d1             ;-(src_ptr[-1] * vp9_filter[1])
     vmlsl.u8        q9, d28, d1
     vmlsl.u8        q10, d29, d1
     vmlsl.u8        q11, d30, d1
@@ -190,7 +190,7 @@
     vext.8          d30, d12, d13, #4
     vext.8          d31, d14, d15, #4
 
-    vmlsl.u8        q8, d27, d4             ;-(src_ptr[2] * vp8_filter[4])
+    vmlsl.u8        q8, d27, d4             ;-(src_ptr[2] * vp9_filter[4])
     vmlsl.u8        q9, d28, d4
     vmlsl.u8        q10, d29, d4
     vmlsl.u8        q11, d30, d4
@@ -202,7 +202,7 @@
     vext.8          d30, d12, d13, #2
     vext.8          d31, d14, d15, #2
 
-    vmlal.u8        q8, d27, d2             ;(src_ptr[0] * vp8_filter[2])
+    vmlal.u8        q8, d27, d2             ;(src_ptr[0] * vp9_filter[2])
     vmlal.u8        q9, d28, d2
     vmlal.u8        q10, d29, d2
     vmlal.u8        q11, d30, d2
@@ -214,7 +214,7 @@
     vext.8          d30, d12, d13, #5
     vext.8          d31, d14, d15, #5
 
-    vmlal.u8        q8, d27, d5             ;(src_ptr[3] * vp8_filter[5])
+    vmlal.u8        q8, d27, d5             ;(src_ptr[3] * vp9_filter[5])
     vmlal.u8        q9, d28, d5
     vmlal.u8        q10, d29, d5
     vmlal.u8        q11, d30, d5
@@ -226,7 +226,7 @@
     vext.8          d30, d12, d13, #3
     vext.8          d31, d14, d15, #3
 
-    vmull.u8        q3, d27, d3             ;(src_ptr[1] * vp8_filter[3])
+    vmull.u8        q3, d27, d3             ;(src_ptr[1] * vp9_filter[3])
     vmull.u8        q4, d28, d3
     vmull.u8        q5, d29, d3
     vmull.u8        q6, d30, d3
@@ -269,32 +269,32 @@
     vdup.8          d5, d16[4]
 
 filt_blk2d_sp8x8_loop_neon
-    vmull.u8        q3, d18, d0             ;(src_ptr[-2] * vp8_filter[0])
+    vmull.u8        q3, d18, d0             ;(src_ptr[-2] * vp9_filter[0])
     vmull.u8        q4, d19, d0
     vmull.u8        q5, d20, d0
     vmull.u8        q6, d21, d0
 
-    vmlsl.u8        q3, d19, d1             ;-(src_ptr[-1] * vp8_filter[1])
+    vmlsl.u8        q3, d19, d1             ;-(src_ptr[-1] * vp9_filter[1])
     vmlsl.u8        q4, d20, d1
     vmlsl.u8        q5, d21, d1
     vmlsl.u8        q6, d22, d1
 
-    vmlsl.u8        q3, d22, d4             ;-(src_ptr[2] * vp8_filter[4])
+    vmlsl.u8        q3, d22, d4             ;-(src_ptr[2] * vp9_filter[4])
     vmlsl.u8        q4, d23, d4
     vmlsl.u8        q5, d24, d4
     vmlsl.u8        q6, d25, d4
 
-    vmlal.u8        q3, d20, d2             ;(src_ptr[0] * vp8_filter[2])
+    vmlal.u8        q3, d20, d2             ;(src_ptr[0] * vp9_filter[2])
     vmlal.u8        q4, d21, d2
     vmlal.u8        q5, d22, d2
     vmlal.u8        q6, d23, d2
 
-    vmlal.u8        q3, d23, d5             ;(src_ptr[3] * vp8_filter[5])
+    vmlal.u8        q3, d23, d5             ;(src_ptr[3] * vp9_filter[5])
     vmlal.u8        q4, d24, d5
     vmlal.u8        q5, d25, d5
     vmlal.u8        q6, d26, d5
 
-    vmull.u8        q7, d21, d3             ;(src_ptr[1] * vp8_filter[3])
+    vmull.u8        q7, d21, d3             ;(src_ptr[1] * vp9_filter[3])
     vmull.u8        q8, d22, d3
     vmull.u8        q9, d23, d3
     vmull.u8        q10, d24, d3
@@ -354,7 +354,7 @@
     pld             [r0, r1]
     pld             [r0, r1, lsl #1]
 
-    vmull.u8        q7, d6, d0              ;(src_ptr[-2] * vp8_filter[0])
+    vmull.u8        q7, d6, d0              ;(src_ptr[-2] * vp9_filter[0])
     vmull.u8        q8, d8, d0
     vmull.u8        q9, d10, d0
     vmull.u8        q10, d12, d0
@@ -364,7 +364,7 @@
     vext.8          d30, d10, d11, #1
     vext.8          d31, d12, d13, #1
 
-    vmlsl.u8        q7, d28, d1             ;-(src_ptr[-1] * vp8_filter[1])
+    vmlsl.u8        q7, d28, d1             ;-(src_ptr[-1] * vp9_filter[1])
     vmlsl.u8        q8, d29, d1
     vmlsl.u8        q9, d30, d1
     vmlsl.u8        q10, d31, d1
@@ -374,7 +374,7 @@
     vext.8          d30, d10, d11, #4
     vext.8          d31, d12, d13, #4
 
-    vmlsl.u8        q7, d28, d4             ;-(src_ptr[2] * vp8_filter[4])
+    vmlsl.u8        q7, d28, d4             ;-(src_ptr[2] * vp9_filter[4])
     vmlsl.u8        q8, d29, d4
     vmlsl.u8        q9, d30, d4
     vmlsl.u8        q10, d31, d4
@@ -384,7 +384,7 @@
     vext.8          d30, d10, d11, #2
     vext.8          d31, d12, d13, #2
 
-    vmlal.u8        q7, d28, d2             ;(src_ptr[0] * vp8_filter[2])
+    vmlal.u8        q7, d28, d2             ;(src_ptr[0] * vp9_filter[2])
     vmlal.u8        q8, d29, d2
     vmlal.u8        q9, d30, d2
     vmlal.u8        q10, d31, d2
@@ -394,7 +394,7 @@
     vext.8          d30, d10, d11, #5
     vext.8          d31, d12, d13, #5
 
-    vmlal.u8        q7, d28, d5             ;(src_ptr[3] * vp8_filter[5])
+    vmlal.u8        q7, d28, d5             ;(src_ptr[3] * vp9_filter[5])
     vmlal.u8        q8, d29, d5
     vmlal.u8        q9, d30, d5
     vmlal.u8        q10, d31, d5
@@ -404,7 +404,7 @@
     vext.8          d30, d10, d11, #3
     vext.8          d31, d12, d13, #3
 
-    vmull.u8        q3, d28, d3             ;(src_ptr[1] * vp8_filter[3])
+    vmull.u8        q3, d28, d3             ;(src_ptr[1] * vp9_filter[3])
     vmull.u8        q4, d29, d3
     vmull.u8        q5, d30, d3
     vmull.u8        q6, d31, d3
@@ -461,32 +461,32 @@
 
 ;Second pass: 8x8
 filt_blk2d_spo8x8_loop_neon
-    vmull.u8        q3, d18, d0             ;(src_ptr[-2] * vp8_filter[0])
+    vmull.u8        q3, d18, d0             ;(src_ptr[-2] * vp9_filter[0])
     vmull.u8        q4, d19, d0
     vmull.u8        q5, d20, d0
     vmull.u8        q6, d21, d0
 
-    vmlsl.u8        q3, d19, d1             ;-(src_ptr[-1] * vp8_filter[1])
+    vmlsl.u8        q3, d19, d1             ;-(src_ptr[-1] * vp9_filter[1])
     vmlsl.u8        q4, d20, d1
     vmlsl.u8        q5, d21, d1
     vmlsl.u8        q6, d22, d1
 
-    vmlsl.u8        q3, d22, d4             ;-(src_ptr[2] * vp8_filter[4])
+    vmlsl.u8        q3, d22, d4             ;-(src_ptr[2] * vp9_filter[4])
     vmlsl.u8        q4, d23, d4
     vmlsl.u8        q5, d24, d4
     vmlsl.u8        q6, d25, d4
 
-    vmlal.u8        q3, d20, d2             ;(src_ptr[0] * vp8_filter[2])
+    vmlal.u8        q3, d20, d2             ;(src_ptr[0] * vp9_filter[2])
     vmlal.u8        q4, d21, d2
     vmlal.u8        q5, d22, d2
     vmlal.u8        q6, d23, d2
 
-    vmlal.u8        q3, d23, d5             ;(src_ptr[3] * vp8_filter[5])
+    vmlal.u8        q3, d23, d5             ;(src_ptr[3] * vp9_filter[5])
     vmlal.u8        q4, d24, d5
     vmlal.u8        q5, d25, d5
     vmlal.u8        q6, d26, d5
 
-    vmull.u8        q7, d21, d3             ;(src_ptr[1] * vp8_filter[3])
+    vmull.u8        q7, d21, d3             ;(src_ptr[1] * vp9_filter[3])
     vmull.u8        q8, d22, d3
     vmull.u8        q9, d23, d3
     vmull.u8        q10, d24, d3
diff --git a/vp8/common/arm/subpixel_arm.h b/vp8/common/arm/subpixel_arm.h
index 1e64c5c..b4f9f54 100644
--- a/vp8/common/arm/subpixel_arm.h
+++ b/vp8/common/arm/subpixel_arm.h
@@ -23,29 +23,29 @@
 extern prototype_subpixel_predict(vp9_bilinear_predict4x4_armv6);
 
 #if !CONFIG_RUNTIME_CPU_DETECT
-#undef  vp8_subpix_sixtap16x16
-#define vp8_subpix_sixtap16x16 vp9_sixtap_predict16x16_armv6
+#undef  vp9_subpix_sixtap16x16
+#define vp9_subpix_sixtap16x16 vp9_sixtap_predict16x16_armv6
 
-#undef  vp8_subpix_sixtap8x8
-#define vp8_subpix_sixtap8x8 vp9_sixtap_predict8x8_armv6
+#undef  vp9_subpix_sixtap8x8
+#define vp9_subpix_sixtap8x8 vp9_sixtap_predict8x8_armv6
 
-#undef  vp8_subpix_sixtap8x4
-#define vp8_subpix_sixtap8x4 vp9_sixtap_predict8x4_armv6
+#undef  vp9_subpix_sixtap8x4
+#define vp9_subpix_sixtap8x4 vp9_sixtap_predict8x4_armv6
 
-#undef  vp8_subpix_sixtap4x4
-#define vp8_subpix_sixtap4x4 vp9_sixtap_predict_armv6
+#undef  vp9_subpix_sixtap4x4
+#define vp9_subpix_sixtap4x4 vp9_sixtap_predict_armv6
 
-#undef  vp8_subpix_bilinear16x16
-#define vp8_subpix_bilinear16x16 vp9_bilinear_predict16x16_armv6
+#undef  vp9_subpix_bilinear16x16
+#define vp9_subpix_bilinear16x16 vp9_bilinear_predict16x16_armv6
 
-#undef  vp8_subpix_bilinear8x8
-#define vp8_subpix_bilinear8x8 vp9_bilinear_predict8x8_armv6
+#undef  vp9_subpix_bilinear8x8
+#define vp9_subpix_bilinear8x8 vp9_bilinear_predict8x8_armv6
 
-#undef  vp8_subpix_bilinear8x4
-#define vp8_subpix_bilinear8x4 vp9_bilinear_predict8x4_armv6
+#undef  vp9_subpix_bilinear8x4
+#define vp9_subpix_bilinear8x4 vp9_bilinear_predict8x4_armv6
 
-#undef  vp8_subpix_bilinear4x4
-#define vp8_subpix_bilinear4x4 vp9_bilinear_predict4x4_armv6
+#undef  vp9_subpix_bilinear4x4
+#define vp9_subpix_bilinear4x4 vp9_bilinear_predict4x4_armv6
 #endif
 #endif
 
@@ -60,29 +60,29 @@
 extern prototype_subpixel_predict(vp9_bilinear_predict4x4_neon);
 
 #if !CONFIG_RUNTIME_CPU_DETECT
-#undef  vp8_subpix_sixtap16x16
-#define vp8_subpix_sixtap16x16 vp9_sixtap_predict16x16_neon
+#undef  vp9_subpix_sixtap16x16
+#define vp9_subpix_sixtap16x16 vp9_sixtap_predict16x16_neon
 
-#undef  vp8_subpix_sixtap8x8
-#define vp8_subpix_sixtap8x8 vp9_sixtap_predict8x8_neon
+#undef  vp9_subpix_sixtap8x8
+#define vp9_subpix_sixtap8x8 vp9_sixtap_predict8x8_neon
 
-#undef  vp8_subpix_sixtap8x4
-#define vp8_subpix_sixtap8x4 vp9_sixtap_predict8x4_neon
+#undef  vp9_subpix_sixtap8x4
+#define vp9_subpix_sixtap8x4 vp9_sixtap_predict8x4_neon
 
-#undef  vp8_subpix_sixtap4x4
-#define vp8_subpix_sixtap4x4 vp9_sixtap_predict_neon
+#undef  vp9_subpix_sixtap4x4
+#define vp9_subpix_sixtap4x4 vp9_sixtap_predict_neon
 
-#undef  vp8_subpix_bilinear16x16
-#define vp8_subpix_bilinear16x16 vp9_bilinear_predict16x16_neon
+#undef  vp9_subpix_bilinear16x16
+#define vp9_subpix_bilinear16x16 vp9_bilinear_predict16x16_neon
 
-#undef  vp8_subpix_bilinear8x8
-#define vp8_subpix_bilinear8x8 vp9_bilinear_predict8x8_neon
+#undef  vp9_subpix_bilinear8x8
+#define vp9_subpix_bilinear8x8 vp9_bilinear_predict8x8_neon
 
-#undef  vp8_subpix_bilinear8x4
-#define vp8_subpix_bilinear8x4 vp9_bilinear_predict8x4_neon
+#undef  vp9_subpix_bilinear8x4
+#define vp9_subpix_bilinear8x4 vp9_bilinear_predict8x4_neon
 
-#undef  vp8_subpix_bilinear4x4
-#define vp8_subpix_bilinear4x4 vp9_bilinear_predict4x4_neon
+#undef  vp9_subpix_bilinear4x4
+#define vp9_subpix_bilinear4x4 vp9_bilinear_predict4x4_neon
 #endif
 #endif
 
diff --git a/vp8/common/blockd.h b/vp8/common/blockd.h
index 4db6fdb..ec010e9 100644
--- a/vp8/common/blockd.h
+++ b/vp8/common/blockd.h
@@ -72,7 +72,7 @@
 extern const unsigned char vp9_block2left_8x8[25];
 extern const unsigned char vp9_block2above_8x8[25];
 
-#define VP8_COMBINEENTROPYCONTEXTS( Dest, A, B) \
+#define VP9_COMBINEENTROPYCONTEXTS( Dest, A, B) \
   Dest = ((A)!=0) + ((B)!=0);
 
 typedef enum {
@@ -140,12 +140,12 @@
   ADST_ADST = 3                       // ADST in both directions
 } TX_TYPE;
 
-#define VP8_YMODES  (B_PRED + 1)
-#define VP8_UV_MODES (TM_PRED + 1)
-#define VP8_I8X8_MODES (TM_PRED + 1)
-#define VP8_I32X32_MODES (TM_PRED + 1)
+#define VP9_YMODES  (B_PRED + 1)
+#define VP9_UV_MODES (TM_PRED + 1)
+#define VP9_I8X8_MODES (TM_PRED + 1)
+#define VP9_I32X32_MODES (TM_PRED + 1)
 
-#define VP8_MVREFS (1 + SPLITMV - NEARESTMV)
+#define VP9_MVREFS (1 + SPLITMV - NEARESTMV)
 
 typedef enum {
   B_DC_PRED,          /* average of above and left pixels */
@@ -170,8 +170,8 @@
   B_MODE_COUNT
 } B_PREDICTION_MODE;
 
-#define VP8_BINTRAMODES (B_HU_PRED + 1)  /* 10 */
-#define VP8_SUBMVREFS (1 + NEW4X4 - LEFT4X4)
+#define VP9_BINTRAMODES (B_HU_PRED + 1)  /* 10 */
+#define VP9_SUBMVREFS (1 + NEW4X4 - LEFT4X4)
 
 typedef enum {
   PARTITIONING_16X8 = 0,
@@ -321,10 +321,10 @@
   /* are enabled and when enabled the proabilities used to decode the per MB flags in MB_MODE_INFO */
 
   // Probability Tree used to code Segment number
-  vp8_prob mb_segment_tree_probs[MB_FEATURE_TREE_PROBS];
+  vp9_prob mb_segment_tree_probs[MB_FEATURE_TREE_PROBS];
 
 #if CONFIG_NEW_MVREF
-  vp8_prob mb_mv_ref_id_probs[MAX_REF_FRAMES][3];
+  vp9_prob mb_mv_ref_id_probs[MAX_REF_FRAMES][3];
 #endif
 
   // Segment features
@@ -349,14 +349,14 @@
 
   unsigned int frames_since_golden;
   unsigned int frames_till_alt_ref_frame;
-  vp8_subpix_fn_t  subpixel_predict;
-  vp8_subpix_fn_t  subpixel_predict8x4;
-  vp8_subpix_fn_t  subpixel_predict8x8;
-  vp8_subpix_fn_t  subpixel_predict16x16;
-  vp8_subpix_fn_t  subpixel_predict_avg;
-  vp8_subpix_fn_t  subpixel_predict_avg8x4;
-  vp8_subpix_fn_t  subpixel_predict_avg8x8;
-  vp8_subpix_fn_t  subpixel_predict_avg16x16;
+  vp9_subpix_fn_t  subpixel_predict;
+  vp9_subpix_fn_t  subpixel_predict8x4;
+  vp9_subpix_fn_t  subpixel_predict8x8;
+  vp9_subpix_fn_t  subpixel_predict16x16;
+  vp9_subpix_fn_t  subpixel_predict_avg;
+  vp9_subpix_fn_t  subpixel_predict_avg8x4;
+  vp9_subpix_fn_t  subpixel_predict_avg8x8;
+  vp9_subpix_fn_t  subpixel_predict_avg16x16;
   int allow_high_precision_mv;
 
   int corrupted;
diff --git a/vp8/common/common.h b/vp8/common/common.h
index c6e6fcb..bd34bf9 100644
--- a/vp8/common/common.h
+++ b/vp8/common/common.h
@@ -22,20 +22,20 @@
 
 /* Only need this for fixed-size arrays, for structs just assign. */
 
-#define vp8_copy( Dest, Src) { \
+#define vp9_copy( Dest, Src) { \
     assert( sizeof( Dest) == sizeof( Src)); \
     vpx_memcpy( Dest, Src, sizeof( Src)); \
   }
 
 /* Use this for variably-sized arrays. */
 
-#define vp8_copy_array( Dest, Src, N) { \
+#define vp9_copy_array( Dest, Src, N) { \
     assert( sizeof( *Dest) == sizeof( *Src)); \
     vpx_memcpy( Dest, Src, N * sizeof( *Src)); \
   }
 
-#define vp8_zero( Dest)  vpx_memset( &Dest, 0, sizeof( Dest));
+#define vp9_zero( Dest)  vpx_memset( &Dest, 0, sizeof( Dest));
 
-#define vp8_zero_array( Dest, N)  vpx_memset( Dest, 0, N * sizeof( *Dest));
+#define vp9_zero_array( Dest, N)  vpx_memset( Dest, 0, N * sizeof( *Dest));
 
 #endif  /* common_h */
diff --git a/vp8/common/context.c b/vp8/common/context.c
index 7006bc7..181a27f 100644
--- a/vp8/common/context.c
+++ b/vp8/common/context.c
@@ -224,7 +224,7 @@
 };
 
 // Update probabilities for the nodes in the token entropy tree.
-const vp8_prob tree_update_probs[vp9_coef_tree_dimen] = {
+const vp9_prob tree_update_probs[vp9_coef_tree_dimen] = {
   {
     {
       {255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, },
diff --git a/vp8/common/default_coef_probs.h b/vp8/common/default_coef_probs.h
index bd1f795..4caf881 100644
--- a/vp8/common/default_coef_probs.h
+++ b/vp8/common/default_coef_probs.h
@@ -12,7 +12,7 @@
 /*Generated file, included by entropy.c*/
 
 
-static const vp8_prob default_coef_probs [BLOCK_TYPES]
+static const vp9_prob default_coef_probs [BLOCK_TYPES]
                                          [COEF_BANDS]
                                          [PREV_COEF_CONTEXTS]
                                          [ENTROPY_NODES] = {
@@ -254,7 +254,7 @@
   }
 };
 
-static const vp8_prob default_hybrid_coef_probs [BLOCK_TYPES]
+static const vp9_prob default_hybrid_coef_probs [BLOCK_TYPES]
                                                 [COEF_BANDS]
                                                 [PREV_COEF_CONTEXTS]
                                                 [ENTROPY_NODES] = {
@@ -496,7 +496,7 @@
   }
 };
 
-static const vp8_prob
+static const vp9_prob
 default_coef_probs_8x8[BLOCK_TYPES_8X8]
 [COEF_BANDS]
 [PREV_COEF_CONTEXTS]
@@ -729,7 +729,7 @@
   }
 };
 
-static const vp8_prob
+static const vp9_prob
 default_hybrid_coef_probs_8x8[BLOCK_TYPES_8X8]
                              [COEF_BANDS]
                              [PREV_COEF_CONTEXTS]
@@ -962,7 +962,7 @@
   }
 };
 
-static const vp8_prob
+static const vp9_prob
   default_coef_probs_16x16[BLOCK_TYPES_16X16]
                           [COEF_BANDS]
                           [PREV_COEF_CONTEXTS]
@@ -1169,7 +1169,7 @@
   }
 };
 
-static const vp8_prob
+static const vp9_prob
   default_hybrid_coef_probs_16x16[BLOCK_TYPES_16X16]
                                  [COEF_BANDS]
                                  [PREV_COEF_CONTEXTS]
diff --git a/vp8/common/entropy.c b/vp8/common/entropy.c
index c3a7c1b..a4ecae0 100644
--- a/vp8/common/entropy.c
+++ b/vp8/common/entropy.c
@@ -24,7 +24,7 @@
 typedef const uchar cuchar;
 typedef const uint cuint;
 
-typedef vp8_prob Prob;
+typedef vp9_prob Prob;
 
 #include "coefupdateprobs.h"
 
@@ -135,7 +135,7 @@
 
 /* Array indices are identical to previously-existing CONTEXT_NODE indices */
 
-const vp8_tree_index vp9_coef_tree[ 22] =     /* corresponding _CONTEXT_NODEs */
+const vp9_tree_index vp9_coef_tree[ 22] =     /* corresponding _CONTEXT_NODEs */
 {
   -DCT_EOB_TOKEN, 2,                             /* 0 = EOB */
   -ZERO_TOKEN, 4,                               /* 1 = ZERO */
@@ -150,7 +150,7 @@
   -DCT_VAL_CATEGORY5, -DCT_VAL_CATEGORY6   /* 10 = CAT_FIVE */
 };
 
-struct vp8_token_struct vp9_coef_encodings[MAX_ENTROPY_TOKENS];
+struct vp9_token_struct vp9_coef_encodings[MAX_ENTROPY_TOKENS];
 
 /* Trees for extra bits.  Probabilities are constant and
    do not depend on previously encoded bits */
@@ -163,9 +163,9 @@
 static const Prob Pcat6[] =
 { 254, 254, 252, 249, 243, 230, 196, 177, 153, 140, 133, 130, 129};
 
-static vp8_tree_index cat1[2], cat2[4], cat3[6], cat4[8], cat5[10], cat6[26];
+static vp9_tree_index cat1[2], cat2[4], cat3[6], cat4[8], cat5[10], cat6[26];
 
-static void init_bit_tree(vp8_tree_index *p, int n) {
+static void init_bit_tree(vp9_tree_index *p, int n) {
   int i = 0;
 
   while (++i < n) {
@@ -185,7 +185,7 @@
   init_bit_tree(cat6, 13);
 }
 
-vp8_extra_bit_struct vp9_extra_bits[12] = {
+vp9_extra_bit_struct vp9_extra_bits[12] = {
   { 0, 0, 0, 0},
   { 0, 0, 0, 1},
   { 0, 0, 0, 2},
@@ -237,7 +237,7 @@
 void vp9_adapt_coef_probs(VP9_COMMON *cm) {
   int t, i, j, k, count;
   unsigned int branch_ct[ENTROPY_NODES][2];
-  vp8_prob coef_probs[ENTROPY_NODES];
+  vp9_prob coef_probs[ENTROPY_NODES];
   int update_factor; /* denominator 256 */
   int factor;
   int count_sat;
diff --git a/vp8/common/entropy.h b/vp8/common/entropy.h
index 8dd7d00..884c6a1 100644
--- a/vp8/common/entropy.h
+++ b/vp8/common/entropy.h
@@ -17,10 +17,6 @@
 #include "common.h"
 #include "coefupdateprobs.h"
 
-
-//#define SUBMVREF_COUNT 5
-//#define VP8_NUMMBSPLITS 4
-
 extern const int vp9_i8x8_block[4];
 
 /* Coefficient token alphabet */
@@ -41,18 +37,18 @@
 #define ENTROPY_NODES 11
 #define EOSB_TOKEN              127     /* Not signalled, encoder only */
 
-extern const vp8_tree_index vp9_coef_tree[];
+extern const vp9_tree_index vp9_coef_tree[];
 
-extern struct vp8_token_struct vp9_coef_encodings[MAX_ENTROPY_TOKENS];
+extern struct vp9_token_struct vp9_coef_encodings[MAX_ENTROPY_TOKENS];
 
 typedef struct {
-  vp8_tree_p tree;
-  const vp8_prob *prob;
+  vp9_tree_p tree;
+  const vp9_prob *prob;
   int Len;
   int base_val;
-} vp8_extra_bit_struct;
+} vp9_extra_bit_struct;
 
-extern vp8_extra_bit_struct vp9_extra_bits[12];    /* indexed by token value */
+extern vp9_extra_bit_struct vp9_extra_bits[12];    /* indexed by token value */
 
 #define PROB_UPDATE_BASELINE_COST   7
 
@@ -107,7 +103,6 @@
 extern DECLARE_ALIGNED(16, const int, vp9_col_scan[16]);
 extern DECLARE_ALIGNED(16, const int, vp9_row_scan[16]);
 
-extern short vp8_default_zig_zag_mask[16];
 extern DECLARE_ALIGNED(64, const int, vp9_default_zig_zag1d_8x8[64]);
 void vp9_coef_tree_initialize(void);
 
diff --git a/vp8/common/entropymode.c b/vp8/common/entropymode.c
index 8e68550..67011c1 100644
--- a/vp8/common/entropymode.c
+++ b/vp8/common/entropymode.c
@@ -14,7 +14,7 @@
 #include "vpx_mem/vpx_mem.h"
 
 
-static const unsigned int kf_y_mode_cts[8][VP8_YMODES] = {
+static const unsigned int kf_y_mode_cts[8][VP9_YMODES] = {
   /* DC V   H  D45 135 117 153 D27 D63 TM i8x8 BPRED */
   {12,  6,  5,  5,  5,  5,  5,  5,  5,  2, 22, 200},
   {25, 13, 13,  7,  7,  7,  7,  7,  7,  6, 27, 160},
@@ -26,12 +26,12 @@
   {89, 42, 42,  8,  8,  8,  8,  8,  8, 21, 12,  34},
 };
 
-static const unsigned int y_mode_cts  [VP8_YMODES] = {
+static const unsigned int y_mode_cts  [VP9_YMODES] = {
   /* DC V   H  D45 135 117 153 D27 D63 TM i8x8 BPRED */
   98, 19, 15, 14, 14, 14, 14, 12, 12, 13, 16, 70
 };
 
-static const unsigned int uv_mode_cts [VP8_YMODES] [VP8_UV_MODES] = {
+static const unsigned int uv_mode_cts [VP9_YMODES] [VP9_UV_MODES] = {
   /* DC   V   H  D45 135 117 153 D27 D63 TM */
   { 200, 15, 15, 10, 10, 10, 10, 10, 10,  6}, /* DC */
   { 130, 75, 10, 10, 10, 10, 10, 10, 10,  6}, /* V */
@@ -47,12 +47,12 @@
   { 150, 35, 41, 10, 10, 10, 10, 10, 10, 10}, /* BPRED */
 };
 
-static const unsigned int i8x8_mode_cts  [VP8_I8X8_MODES] = {
+static const unsigned int i8x8_mode_cts  [VP9_I8X8_MODES] = {
   /* DC V   H D45 135 117 153 D27 D63  TM */
   73, 49, 61, 30, 30, 30, 30, 30, 30, 13
 };
 
-static const unsigned int kf_uv_mode_cts [VP8_YMODES] [VP8_UV_MODES] = {
+static const unsigned int kf_uv_mode_cts [VP9_YMODES] [VP9_UV_MODES] = {
   // DC   V   H  D45 135 117 153 D27 D63 TM
   { 160, 24, 24, 20, 20, 20, 20, 20, 20,  8}, /* DC */
   { 102, 64, 30, 20, 20, 20, 20, 20, 20, 10}, /* V */
@@ -68,7 +68,7 @@
   { 122, 41, 35, 20, 20, 20, 20, 20, 20, 18}, /* BPRED */
 };
 
-static const unsigned int bmode_cts[VP8_BINTRAMODES] = {
+static const unsigned int bmode_cts[VP9_BINTRAMODES] = {
   /* DC    TM     VE     HE   LD    RD    VR    VL    HD    HU */
   43891, 17694, 10036, 3920, 3363, 2546, 5119, 3221, 2471, 1723
 };
@@ -101,9 +101,9 @@
   return SUBMVREF_NORMAL;
 }
 
-const vp8_prob vp9_sub_mv_ref_prob [VP8_SUBMVREFS - 1] = { 180, 162, 25};
+const vp9_prob vp9_sub_mv_ref_prob [VP9_SUBMVREFS - 1] = { 180, 162, 25};
 
-const vp8_prob vp9_sub_mv_ref_prob2 [SUBMVREF_COUNT][VP8_SUBMVREFS - 1] = {
+const vp9_prob vp9_sub_mv_ref_prob2 [SUBMVREF_COUNT][VP9_SUBMVREFS - 1] = {
   { 147, 136, 18 },
   { 106, 145, 1  },
   { 179, 121, 1  },
@@ -113,7 +113,7 @@
 
 
 
-vp9_mbsplit vp9_mbsplits [VP8_NUMMBSPLITS] = {
+vp9_mbsplit vp9_mbsplits [VP9_NUMMBSPLITS] = {
   {
     0,  0,  0,  0,
     0,  0,  0,  0,
@@ -140,14 +140,14 @@
   },
 };
 
-const int vp9_mbsplit_count [VP8_NUMMBSPLITS] = { 2, 2, 4, 16};
+const int vp9_mbsplit_count [VP9_NUMMBSPLITS] = { 2, 2, 4, 16};
 
-const vp8_prob vp9_mbsplit_probs [VP8_NUMMBSPLITS - 1] = { 110, 111, 150};
+const vp9_prob vp9_mbsplit_probs [VP9_NUMMBSPLITS - 1] = { 110, 111, 150};
 
 
 /* Array indices are identical to previously-existing INTRAMODECONTEXTNODES. */
 
-const vp8_tree_index vp9_bmode_tree[VP8_BINTRAMODES * 2 - 2] = /* INTRAMODECONTEXTNODE value */
+const vp9_tree_index vp9_bmode_tree[VP9_BINTRAMODES * 2 - 2] = /* INTRAMODECONTEXTNODE value */
 {
   -B_DC_PRED, 2,                             /* 0 = DC_NODE */
   -B_TM_PRED, 4,                            /* 1 = TM_NODE */
@@ -162,7 +162,7 @@
 
 /* Again, these trees use the same probability indices as their
    explicitly-programmed predecessors. */
-const vp8_tree_index vp9_ymode_tree[VP8_YMODES * 2 - 2] = {
+const vp9_tree_index vp9_ymode_tree[VP9_YMODES * 2 - 2] = {
   2, 14,
   -DC_PRED, 4,
   6, 8,
@@ -176,7 +176,7 @@
   -B_PRED, -I8X8_PRED
 };
 
-const vp8_tree_index vp9_kf_ymode_tree[VP8_YMODES * 2 - 2] = {
+const vp9_tree_index vp9_kf_ymode_tree[VP9_YMODES * 2 - 2] = {
   2, 14,
   -DC_PRED, 4,
   6, 8,
@@ -190,7 +190,7 @@
   -B_PRED, -I8X8_PRED
 };
 
-const vp8_tree_index vp9_i8x8_mode_tree[VP8_I8X8_MODES * 2 - 2] = {
+const vp9_tree_index vp9_i8x8_mode_tree[VP9_I8X8_MODES * 2 - 2] = {
   2, 14,
   -DC_PRED, 4,
   6, 8,
@@ -202,7 +202,7 @@
   -H_PRED, -TM_PRED
 };
 
-const vp8_tree_index vp9_uv_mode_tree[VP8_UV_MODES * 2 - 2] = {
+const vp9_tree_index vp9_uv_mode_tree[VP9_UV_MODES * 2 - 2] = {
   2, 14,
   -DC_PRED, 4,
   6, 8,
@@ -214,13 +214,13 @@
   -H_PRED, -TM_PRED
 };
 
-const vp8_tree_index vp9_mbsplit_tree[6] = {
+const vp9_tree_index vp9_mbsplit_tree[6] = {
   -PARTITIONING_4X4,   2,
   -PARTITIONING_8X8,   4,
   -PARTITIONING_16X8, -PARTITIONING_8X16,
 };
 
-const vp8_tree_index vp9_mv_ref_tree[8] = {
+const vp9_tree_index vp9_mv_ref_tree[8] = {
   -ZEROMV, 2,
   -NEARESTMV, 4,
   -NEARMV, 6,
@@ -228,53 +228,53 @@
 };
 
 #if CONFIG_SUPERBLOCKS
-const vp8_tree_index vp9_sb_mv_ref_tree[6] = {
+const vp9_tree_index vp9_sb_mv_ref_tree[6] = {
   -ZEROMV, 2,
   -NEARESTMV, 4,
   -NEARMV, -NEWMV
 };
 #endif
 
-const vp8_tree_index vp9_sub_mv_ref_tree[6] = {
+const vp9_tree_index vp9_sub_mv_ref_tree[6] = {
   -LEFT4X4, 2,
   -ABOVE4X4, 4,
   -ZERO4X4, -NEW4X4
 };
 
 
-struct vp8_token_struct vp9_bmode_encodings   [VP8_BINTRAMODES];
-struct vp8_token_struct vp9_ymode_encodings   [VP8_YMODES];
+struct vp9_token_struct vp9_bmode_encodings   [VP9_BINTRAMODES];
+struct vp9_token_struct vp9_ymode_encodings   [VP9_YMODES];
 #if CONFIG_SUPERBLOCKS
-struct vp8_token_struct vp9_sb_kf_ymode_encodings [VP8_I32X32_MODES];
+struct vp9_token_struct vp9_sb_kf_ymode_encodings [VP9_I32X32_MODES];
 #endif
-struct vp8_token_struct vp9_kf_ymode_encodings [VP8_YMODES];
-struct vp8_token_struct vp9_uv_mode_encodings  [VP8_UV_MODES];
-struct vp8_token_struct vp9_i8x8_mode_encodings  [VP8_I8X8_MODES];
-struct vp8_token_struct vp9_mbsplit_encodings [VP8_NUMMBSPLITS];
+struct vp9_token_struct vp9_kf_ymode_encodings [VP9_YMODES];
+struct vp9_token_struct vp9_uv_mode_encodings  [VP9_UV_MODES];
+struct vp9_token_struct vp9_i8x8_mode_encodings  [VP9_I8X8_MODES];
+struct vp9_token_struct vp9_mbsplit_encodings [VP9_NUMMBSPLITS];
 
-struct vp8_token_struct vp9_mv_ref_encoding_array    [VP8_MVREFS];
+struct vp9_token_struct vp9_mv_ref_encoding_array    [VP9_MVREFS];
 #if CONFIG_SUPERBLOCKS
-struct vp8_token_struct vp9_sb_mv_ref_encoding_array  [VP8_MVREFS];
+struct vp9_token_struct vp9_sb_mv_ref_encoding_array  [VP9_MVREFS];
 #endif
-struct vp8_token_struct vp9_sub_mv_ref_encoding_array [VP8_SUBMVREFS];
+struct vp9_token_struct vp9_sub_mv_ref_encoding_array [VP9_SUBMVREFS];
 
 
 
 void vp9_init_mbmode_probs(VP9_COMMON *x) {
-  unsigned int bct [VP8_YMODES] [2];      /* num Ymodes > num UV modes */
+  unsigned int bct [VP9_YMODES] [2];      /* num Ymodes > num UV modes */
 
-  vp9_tree_probs_from_distribution(VP8_YMODES, vp9_ymode_encodings,
+  vp9_tree_probs_from_distribution(VP9_YMODES, vp9_ymode_encodings,
     vp9_ymode_tree, x->fc.ymode_prob, bct, y_mode_cts, 256, 1);
   {
     int i;
     for (i = 0; i < 8; i++) {
       vp9_tree_probs_from_distribution(
-        VP8_YMODES, vp9_kf_ymode_encodings, vp9_kf_ymode_tree,
+        VP9_YMODES, vp9_kf_ymode_encodings, vp9_kf_ymode_tree,
         x->kf_ymode_prob[i], bct, kf_y_mode_cts[i],
         256, 1);
 #if CONFIG_SUPERBLOCKS
       vp9_tree_probs_from_distribution(
-        VP8_I32X32_MODES, vp9_sb_kf_ymode_encodings, vp8_sb_ymode_tree,
+        VP9_I32X32_MODES, vp9_sb_kf_ymode_encodings, vp9_sb_ymode_tree,
         x->sb_kf_ymode_prob[i], bct, kf_y_mode_cts[i],
         256, 1);
 #endif
@@ -282,20 +282,20 @@
   }
   {
     int i;
-    for (i = 0; i < VP8_YMODES; i++) {
+    for (i = 0; i < VP9_YMODES; i++) {
       vp9_tree_probs_from_distribution(
-        VP8_UV_MODES, vp9_uv_mode_encodings, vp9_uv_mode_tree,
+        VP9_UV_MODES, vp9_uv_mode_encodings, vp9_uv_mode_tree,
         x->kf_uv_mode_prob[i], bct, kf_uv_mode_cts[i],
         256, 1);
       vp9_tree_probs_from_distribution(
-        VP8_UV_MODES, vp9_uv_mode_encodings, vp9_uv_mode_tree,
+        VP9_UV_MODES, vp9_uv_mode_encodings, vp9_uv_mode_tree,
         x->fc.uv_mode_prob[i], bct, uv_mode_cts[i],
         256, 1);
     }
   }
 
   vp9_tree_probs_from_distribution(
-    VP8_I8X8_MODES, vp9_i8x8_mode_encodings, vp9_i8x8_mode_tree,
+    VP9_I8X8_MODES, vp9_i8x8_mode_encodings, vp9_i8x8_mode_tree,
     x->fc.i8x8_mode_prob, bct, i8x8_mode_cts,
     256, 1);
 
@@ -307,20 +307,20 @@
 
 
 static void intra_bmode_probs_from_distribution(
-  vp8_prob p [VP8_BINTRAMODES - 1],
-  unsigned int branch_ct [VP8_BINTRAMODES - 1] [2],
-  const unsigned int events [VP8_BINTRAMODES]) {
-  vp9_tree_probs_from_distribution(VP8_BINTRAMODES, vp9_bmode_encodings,
+  vp9_prob p [VP9_BINTRAMODES - 1],
+  unsigned int branch_ct [VP9_BINTRAMODES - 1] [2],
+  const unsigned int events [VP9_BINTRAMODES]) {
+  vp9_tree_probs_from_distribution(VP9_BINTRAMODES, vp9_bmode_encodings,
     vp9_bmode_tree, p, branch_ct, events, 256, 1);
 }
 
-void vp9_default_bmode_probs(vp8_prob p [VP8_BINTRAMODES - 1]) {
-  unsigned int branch_ct [VP8_BINTRAMODES - 1] [2];
+void vp9_default_bmode_probs(vp9_prob p [VP9_BINTRAMODES - 1]) {
+  unsigned int branch_ct [VP9_BINTRAMODES - 1] [2];
   intra_bmode_probs_from_distribution(p, branch_ct, bmode_cts);
 }
 
-void vp9_kf_default_bmode_probs(vp8_prob p [VP8_BINTRAMODES] [VP8_BINTRAMODES] [VP8_BINTRAMODES - 1]) {
-  unsigned int branch_ct [VP8_BINTRAMODES - 1] [2];
+void vp9_kf_default_bmode_probs(vp9_prob p [VP9_BINTRAMODES] [VP9_BINTRAMODES] [VP9_BINTRAMODES - 1]) {
+  unsigned int branch_ct [VP9_BINTRAMODES - 1] [2];
 
   int i = 0;
 
@@ -331,35 +331,35 @@
       intra_bmode_probs_from_distribution(
         p[i][j], branch_ct, vp9_kf_default_bmode_counts[i][j]);
 
-    } while (++j < VP8_BINTRAMODES);
-  } while (++i < VP8_BINTRAMODES);
+    } while (++j < VP9_BINTRAMODES);
+  } while (++i < VP9_BINTRAMODES);
 }
 
-#if VP8_SWITCHABLE_FILTERS == 3
-const vp8_tree_index vp9_switchable_interp_tree[VP8_SWITCHABLE_FILTERS*2-2] = {
+#if VP9_SWITCHABLE_FILTERS == 3
+const vp9_tree_index vp9_switchable_interp_tree[VP9_SWITCHABLE_FILTERS*2-2] = {
   -0, 2,
   -1, -2
 };
-struct vp8_token_struct vp9_switchable_interp_encodings[VP8_SWITCHABLE_FILTERS];
-const INTERPOLATIONFILTERTYPE vp9_switchable_interp[VP8_SWITCHABLE_FILTERS] = {
+struct vp9_token_struct vp9_switchable_interp_encodings[VP9_SWITCHABLE_FILTERS];
+const INTERPOLATIONFILTERTYPE vp9_switchable_interp[VP9_SWITCHABLE_FILTERS] = {
   EIGHTTAP, SIXTAP, EIGHTTAP_SHARP};
 const int vp9_switchable_interp_map[SWITCHABLE+1] = {1, -1, 0, 2, -1};
-const vp8_prob vp9_switchable_interp_prob [VP8_SWITCHABLE_FILTERS+1]
-                                          [VP8_SWITCHABLE_FILTERS-1] = {
+const vp9_prob vp9_switchable_interp_prob [VP9_SWITCHABLE_FILTERS+1]
+                                          [VP9_SWITCHABLE_FILTERS-1] = {
   {248, 192}, { 32, 248}, { 32,  32}, {192, 160}
 };
-#elif VP8_SWITCHABLE_FILTERS == 2
-const vp8_tree_index vp9_switchable_interp_tree[VP8_SWITCHABLE_FILTERS*2-2] = {
+#elif VP9_SWITCHABLE_FILTERS == 2
+const vp9_tree_index vp9_switchable_interp_tree[VP9_SWITCHABLE_FILTERS*2-2] = {
   -0, -1,
 };
-struct vp8_token_struct vp9_switchable_interp_encodings[VP8_SWITCHABLE_FILTERS];
-const vp8_prob vp9_switchable_interp_prob [VP8_SWITCHABLE_FILTERS+1]
-                                          [VP8_SWITCHABLE_FILTERS-1] = {
+struct vp9_token_struct vp9_switchable_interp_encodings[VP9_SWITCHABLE_FILTERS];
+const vp9_prob vp9_switchable_interp_prob [VP9_SWITCHABLE_FILTERS+1]
+                                          [VP9_SWITCHABLE_FILTERS-1] = {
   {248},
   { 64},
   {192},
 };
-const INTERPOLATIONFILTERTYPE vp9_switchable_interp[VP8_SWITCHABLE_FILTERS] = {
+const INTERPOLATIONFILTERTYPE vp9_switchable_interp[VP9_SWITCHABLE_FILTERS] = {
   EIGHTTAP, EIGHTTAP_SHARP};
 const int vp9_switchable_interp_map[SWITCHABLE+1] = {-1, -1, 0, 1, -1}; //8, 8s
 #endif
@@ -369,7 +369,7 @@
   vp9_tokens_from_tree(vp9_ymode_encodings,   vp9_ymode_tree);
   vp9_tokens_from_tree(vp9_kf_ymode_encodings, vp9_kf_ymode_tree);
 #if CONFIG_SUPERBLOCKS
-  vp9_tokens_from_tree(vp9_sb_kf_ymode_encodings, vp8_sb_ymode_tree);
+  vp9_tokens_from_tree(vp9_sb_kf_ymode_encodings, vp9_sb_ymode_tree);
 #endif
   vp9_tokens_from_tree(vp9_uv_mode_encodings,  vp9_uv_mode_tree);
   vp9_tokens_from_tree(vp9_i8x8_mode_encodings,  vp9_i8x8_mode_tree);
@@ -492,51 +492,51 @@
 void vp9_adapt_mode_probs(VP9_COMMON *cm) {
   int i, t, count, factor;
   unsigned int branch_ct[32][2];
-  vp8_prob ymode_probs[VP8_YMODES - 1];
-  vp8_prob uvmode_probs[VP8_UV_MODES - 1];
-  vp8_prob bmode_probs[VP8_BINTRAMODES - 1];
-  vp8_prob i8x8_mode_probs[VP8_I8X8_MODES - 1];
-  vp8_prob sub_mv_ref_probs[VP8_SUBMVREFS - 1];
-  vp8_prob mbsplit_probs[VP8_NUMMBSPLITS - 1];
+  vp9_prob ymode_probs[VP9_YMODES - 1];
+  vp9_prob uvmode_probs[VP9_UV_MODES - 1];
+  vp9_prob bmode_probs[VP9_BINTRAMODES - 1];
+  vp9_prob i8x8_mode_probs[VP9_I8X8_MODES - 1];
+  vp9_prob sub_mv_ref_probs[VP9_SUBMVREFS - 1];
+  vp9_prob mbsplit_probs[VP9_NUMMBSPLITS - 1];
 #ifdef MODE_COUNT_TESTING
   printf("static const unsigned int\nymode_counts"
-         "[VP8_YMODES] = {\n");
-  for (t = 0; t < VP8_YMODES; ++t) printf("%d, ", cm->fc.ymode_counts[t]);
+         "[VP9_YMODES] = {\n");
+  for (t = 0; t < VP9_YMODES; ++t) printf("%d, ", cm->fc.ymode_counts[t]);
   printf("};\n");
   printf("static const unsigned int\nuv_mode_counts"
-         "[VP8_YMODES] [VP8_UV_MODES] = {\n");
-  for (i = 0; i < VP8_YMODES; ++i) {
+         "[VP9_YMODES] [VP9_UV_MODES] = {\n");
+  for (i = 0; i < VP9_YMODES; ++i) {
     printf("  {");
-    for (t = 0; t < VP8_UV_MODES; ++t) printf("%d, ", cm->fc.uv_mode_counts[i][t]);
+    for (t = 0; t < VP9_UV_MODES; ++t) printf("%d, ", cm->fc.uv_mode_counts[i][t]);
     printf("},\n");
   }
   printf("};\n");
   printf("static const unsigned int\nbmode_counts"
-         "[VP8_BINTRAMODES] = {\n");
-  for (t = 0; t < VP8_BINTRAMODES; ++t) printf("%d, ", cm->fc.bmode_counts[t]);
+         "[VP9_BINTRAMODES] = {\n");
+  for (t = 0; t < VP9_BINTRAMODES; ++t) printf("%d, ", cm->fc.bmode_counts[t]);
   printf("};\n");
   printf("static const unsigned int\ni8x8_mode_counts"
-         "[VP8_I8X8_MODES] = {\n");
-  for (t = 0; t < VP8_I8X8_MODES; ++t) printf("%d, ", cm->fc.i8x8_mode_counts[t]);
+         "[VP9_I8X8_MODES] = {\n");
+  for (t = 0; t < VP9_I8X8_MODES; ++t) printf("%d, ", cm->fc.i8x8_mode_counts[t]);
   printf("};\n");
   printf("static const unsigned int\nsub_mv_ref_counts"
-         "[SUBMVREF_COUNT] [VP8_SUBMVREFS] = {\n");
+         "[SUBMVREF_COUNT] [VP9_SUBMVREFS] = {\n");
   for (i = 0; i < SUBMVREF_COUNT; ++i) {
     printf("  {");
-    for (t = 0; t < VP8_SUBMVREFS; ++t) printf("%d, ", cm->fc.sub_mv_ref_counts[i][t]);
+    for (t = 0; t < VP9_SUBMVREFS; ++t) printf("%d, ", cm->fc.sub_mv_ref_counts[i][t]);
     printf("},\n");
   }
   printf("};\n");
   printf("static const unsigned int\nmbsplit_counts"
-         "[VP8_NUMMBSPLITS] = {\n");
-  for (t = 0; t < VP8_NUMMBSPLITS; ++t) printf("%d, ", cm->fc.mbsplit_counts[t]);
+         "[VP9_NUMMBSPLITS] = {\n");
+  for (t = 0; t < VP9_NUMMBSPLITS; ++t) printf("%d, ", cm->fc.mbsplit_counts[t]);
   printf("};\n");
 #endif
   vp9_tree_probs_from_distribution(
-    VP8_YMODES, vp9_ymode_encodings, vp9_ymode_tree,
+    VP9_YMODES, vp9_ymode_encodings, vp9_ymode_tree,
     ymode_probs, branch_ct, cm->fc.ymode_counts,
     256, 1);
-  for (t = 0; t < VP8_YMODES - 1; ++t) {
+  for (t = 0; t < VP9_YMODES - 1; ++t) {
     int prob;
     count = branch_ct[t][0] + branch_ct[t][1];
     count = count > MODE_COUNT_SAT ? MODE_COUNT_SAT : count;
@@ -547,12 +547,12 @@
     else if (prob > 255) cm->fc.ymode_prob[t] = 255;
     else cm->fc.ymode_prob[t] = prob;
   }
-  for (i = 0; i < VP8_YMODES; ++i) {
+  for (i = 0; i < VP9_YMODES; ++i) {
     vp9_tree_probs_from_distribution(
-      VP8_UV_MODES, vp9_uv_mode_encodings, vp9_uv_mode_tree,
+      VP9_UV_MODES, vp9_uv_mode_encodings, vp9_uv_mode_tree,
       uvmode_probs, branch_ct, cm->fc.uv_mode_counts[i],
       256, 1);
-    for (t = 0; t < VP8_UV_MODES - 1; ++t) {
+    for (t = 0; t < VP9_UV_MODES - 1; ++t) {
       int prob;
       count = branch_ct[t][0] + branch_ct[t][1];
       count = count > MODE_COUNT_SAT ? MODE_COUNT_SAT : count;
@@ -565,10 +565,10 @@
     }
   }
   vp9_tree_probs_from_distribution(
-    VP8_BINTRAMODES, vp9_bmode_encodings, vp9_bmode_tree,
+    VP9_BINTRAMODES, vp9_bmode_encodings, vp9_bmode_tree,
     bmode_probs, branch_ct, cm->fc.bmode_counts,
     256, 1);
-  for (t = 0; t < VP8_BINTRAMODES - 1; ++t) {
+  for (t = 0; t < VP9_BINTRAMODES - 1; ++t) {
     int prob;
     count = branch_ct[t][0] + branch_ct[t][1];
     count = count > MODE_COUNT_SAT ? MODE_COUNT_SAT : count;
@@ -580,10 +580,10 @@
     else cm->fc.bmode_prob[t] = prob;
   }
   vp9_tree_probs_from_distribution(
-    VP8_I8X8_MODES, vp9_i8x8_mode_encodings, vp9_i8x8_mode_tree,
+    VP9_I8X8_MODES, vp9_i8x8_mode_encodings, vp9_i8x8_mode_tree,
     i8x8_mode_probs, branch_ct, cm->fc.i8x8_mode_counts,
     256, 1);
-  for (t = 0; t < VP8_I8X8_MODES - 1; ++t) {
+  for (t = 0; t < VP9_I8X8_MODES - 1; ++t) {
     int prob;
     count = branch_ct[t][0] + branch_ct[t][1];
     count = count > MODE_COUNT_SAT ? MODE_COUNT_SAT : count;
@@ -596,10 +596,10 @@
   }
   for (i = 0; i < SUBMVREF_COUNT; ++i) {
     vp9_tree_probs_from_distribution(
-      VP8_SUBMVREFS, vp9_sub_mv_ref_encoding_array, vp9_sub_mv_ref_tree,
+      VP9_SUBMVREFS, vp9_sub_mv_ref_encoding_array, vp9_sub_mv_ref_tree,
       sub_mv_ref_probs, branch_ct, cm->fc.sub_mv_ref_counts[i],
       256, 1);
-    for (t = 0; t < VP8_SUBMVREFS - 1; ++t) {
+    for (t = 0; t < VP9_SUBMVREFS - 1; ++t) {
       int prob;
       count = branch_ct[t][0] + branch_ct[t][1];
       count = count > MODE_COUNT_SAT ? MODE_COUNT_SAT : count;
@@ -612,10 +612,10 @@
     }
   }
   vp9_tree_probs_from_distribution(
-    VP8_NUMMBSPLITS, vp9_mbsplit_encodings, vp9_mbsplit_tree,
+    VP9_NUMMBSPLITS, vp9_mbsplit_encodings, vp9_mbsplit_tree,
     mbsplit_probs, branch_ct, cm->fc.mbsplit_counts,
     256, 1);
-  for (t = 0; t < VP8_NUMMBSPLITS - 1; ++t) {
+  for (t = 0; t < VP9_NUMMBSPLITS - 1; ++t) {
     int prob;
     count = branch_ct[t][0] + branch_ct[t][1];
     count = count > MODE_COUNT_SAT ? MODE_COUNT_SAT : count;
diff --git a/vp8/common/entropymode.h b/vp8/common/entropymode.h
index 5af6d9a..4049eae 100644
--- a/vp8/common/entropymode.h
+++ b/vp8/common/entropymode.h
@@ -16,50 +16,50 @@
 #include "treecoder.h"
 
 #define SUBMVREF_COUNT 5
-#define VP8_NUMMBSPLITS 4
+#define VP9_NUMMBSPLITS 4
 
 typedef const int vp9_mbsplit[16];
 
-extern vp9_mbsplit vp9_mbsplits [VP8_NUMMBSPLITS];
+extern vp9_mbsplit vp9_mbsplits [VP9_NUMMBSPLITS];
 
-extern const int vp9_mbsplit_count [VP8_NUMMBSPLITS];    /* # of subsets */
+extern const int vp9_mbsplit_count [VP9_NUMMBSPLITS];    /* # of subsets */
 
-extern const vp8_prob vp9_mbsplit_probs [VP8_NUMMBSPLITS - 1];
+extern const vp9_prob vp9_mbsplit_probs [VP9_NUMMBSPLITS - 1];
 
 extern int vp9_mv_cont(const int_mv *l, const int_mv *a);
 
-extern const vp8_prob vp9_sub_mv_ref_prob [VP8_SUBMVREFS - 1];
-extern const vp8_prob vp9_sub_mv_ref_prob2 [SUBMVREF_COUNT][VP8_SUBMVREFS - 1];
+extern const vp9_prob vp9_sub_mv_ref_prob [VP9_SUBMVREFS - 1];
+extern const vp9_prob vp9_sub_mv_ref_prob2 [SUBMVREF_COUNT][VP9_SUBMVREFS - 1];
 
 
-extern const unsigned int vp9_kf_default_bmode_counts[VP8_BINTRAMODES][VP8_BINTRAMODES][VP8_BINTRAMODES];
+extern const unsigned int vp9_kf_default_bmode_counts[VP9_BINTRAMODES][VP9_BINTRAMODES][VP9_BINTRAMODES];
 
 
-extern const vp8_tree_index vp9_bmode_tree[];
+extern const vp9_tree_index vp9_bmode_tree[];
 
-extern const vp8_tree_index  vp9_ymode_tree[];
-extern const vp8_tree_index  vp9_kf_ymode_tree[];
-extern const vp8_tree_index  vp9_uv_mode_tree[];
-#define vp8_sb_ymode_tree vp9_uv_mode_tree
-extern const vp8_tree_index  vp9_i8x8_mode_tree[];
-extern const vp8_tree_index  vp9_mbsplit_tree[];
-extern const vp8_tree_index  vp9_mv_ref_tree[];
-extern const vp8_tree_index  vp9_sb_mv_ref_tree[];
-extern const vp8_tree_index  vp9_sub_mv_ref_tree[];
+extern const vp9_tree_index  vp9_ymode_tree[];
+extern const vp9_tree_index  vp9_kf_ymode_tree[];
+extern const vp9_tree_index  vp9_uv_mode_tree[];
+#define vp9_sb_ymode_tree vp9_uv_mode_tree
+extern const vp9_tree_index  vp9_i8x8_mode_tree[];
+extern const vp9_tree_index  vp9_mbsplit_tree[];
+extern const vp9_tree_index  vp9_mv_ref_tree[];
+extern const vp9_tree_index  vp9_sb_mv_ref_tree[];
+extern const vp9_tree_index  vp9_sub_mv_ref_tree[];
 
-extern struct vp8_token_struct vp9_bmode_encodings   [VP8_BINTRAMODES];
-extern struct vp8_token_struct vp9_ymode_encodings   [VP8_YMODES];
-extern struct vp8_token_struct vp9_sb_kf_ymode_encodings [VP8_I32X32_MODES];
-extern struct vp8_token_struct vp9_kf_ymode_encodings [VP8_YMODES];
-extern struct vp8_token_struct vp9_i8x8_mode_encodings  [VP8_I8X8_MODES];
-extern struct vp8_token_struct vp9_uv_mode_encodings  [VP8_UV_MODES];
-extern struct vp8_token_struct vp9_mbsplit_encodings  [VP8_NUMMBSPLITS];
+extern struct vp9_token_struct vp9_bmode_encodings   [VP9_BINTRAMODES];
+extern struct vp9_token_struct vp9_ymode_encodings   [VP9_YMODES];
+extern struct vp9_token_struct vp9_sb_kf_ymode_encodings [VP9_I32X32_MODES];
+extern struct vp9_token_struct vp9_kf_ymode_encodings [VP9_YMODES];
+extern struct vp9_token_struct vp9_i8x8_mode_encodings  [VP9_I8X8_MODES];
+extern struct vp9_token_struct vp9_uv_mode_encodings  [VP9_UV_MODES];
+extern struct vp9_token_struct vp9_mbsplit_encodings  [VP9_NUMMBSPLITS];
 
 /* Inter mode values do not start at zero */
 
-extern struct vp8_token_struct vp9_mv_ref_encoding_array    [VP8_MVREFS];
-extern struct vp8_token_struct vp9_sb_mv_ref_encoding_array    [VP8_MVREFS];
-extern struct vp8_token_struct vp9_sub_mv_ref_encoding_array [VP8_SUBMVREFS];
+extern struct vp9_token_struct vp9_mv_ref_encoding_array    [VP9_MVREFS];
+extern struct vp9_token_struct vp9_sb_mv_ref_encoding_array    [VP9_MVREFS];
+extern struct vp9_token_struct vp9_sub_mv_ref_encoding_array [VP9_SUBMVREFS];
 
 void vp9_entropy_mode_init(void);
 
@@ -71,19 +71,19 @@
                               MB_PREDICTION_MODE m,
                               const int ct[4]);
 
-void vp9_default_bmode_probs(vp8_prob dest [VP8_BINTRAMODES - 1]);
-void vp9_kf_default_bmode_probs(vp8_prob dest [VP8_BINTRAMODES] [VP8_BINTRAMODES] [VP8_BINTRAMODES - 1]);
+void vp9_default_bmode_probs(vp9_prob dest [VP9_BINTRAMODES - 1]);
+void vp9_kf_default_bmode_probs(vp9_prob dest [VP9_BINTRAMODES] [VP9_BINTRAMODES] [VP9_BINTRAMODES - 1]);
 
 void vp9_adapt_mode_probs(struct VP9Common *);
 
-#define VP8_SWITCHABLE_FILTERS 2 /* number of switchable filters */
+#define VP9_SWITCHABLE_FILTERS 2 /* number of switchable filters */
 extern const  INTERPOLATIONFILTERTYPE vp9_switchable_interp
-                  [VP8_SWITCHABLE_FILTERS];
+                  [VP9_SWITCHABLE_FILTERS];
 extern const  int vp9_switchable_interp_map[SWITCHABLE + 1];
-extern const  vp8_tree_index vp9_switchable_interp_tree
-                  [2*(VP8_SWITCHABLE_FILTERS - 1)];
-extern struct vp8_token_struct vp9_switchable_interp_encodings
-                  [VP8_SWITCHABLE_FILTERS];
-extern const  vp8_prob vp9_switchable_interp_prob
-                  [VP8_SWITCHABLE_FILTERS + 1][VP8_SWITCHABLE_FILTERS - 1];
+extern const  vp9_tree_index vp9_switchable_interp_tree
+                  [2*(VP9_SWITCHABLE_FILTERS - 1)];
+extern struct vp9_token_struct vp9_switchable_interp_encodings
+                  [VP9_SWITCHABLE_FILTERS];
+extern const  vp9_prob vp9_switchable_interp_prob
+                  [VP9_SWITCHABLE_FILTERS + 1][VP9_SWITCHABLE_FILTERS - 1];
 #endif
diff --git a/vp8/common/entropymv.c b/vp8/common/entropymv.c
index e89520d..1edb868 100644
--- a/vp8/common/entropymv.c
+++ b/vp8/common/entropymv.c
@@ -28,14 +28,14 @@
 /* Smooth or bias the mv-counts before prob computation */
 /* #define SMOOTH_MV_COUNTS */
 
-const vp8_tree_index vp9_mv_joint_tree[2 * MV_JOINTS - 2] = {
+const vp9_tree_index vp9_mv_joint_tree[2 * MV_JOINTS - 2] = {
   -MV_JOINT_ZERO, 2,
   -MV_JOINT_HNZVZ, 4,
   -MV_JOINT_HZVNZ, -MV_JOINT_HNZVNZ
 };
-struct vp8_token_struct vp9_mv_joint_encodings[MV_JOINTS];
+struct vp9_token_struct vp9_mv_joint_encodings[MV_JOINTS];
 
-const vp8_tree_index vp9_mv_class_tree[2 * MV_CLASSES - 2] = {
+const vp9_tree_index vp9_mv_class_tree[2 * MV_CLASSES - 2] = {
   -MV_CLASS_0, 2,
   -MV_CLASS_1, 4,
   6, 8,
@@ -44,19 +44,19 @@
   -MV_CLASS_4, -MV_CLASS_5,
   -MV_CLASS_6, -MV_CLASS_7,
 };
-struct vp8_token_struct vp9_mv_class_encodings[MV_CLASSES];
+struct vp9_token_struct vp9_mv_class_encodings[MV_CLASSES];
 
-const vp8_tree_index vp9_mv_class0_tree [2 * CLASS0_SIZE - 2] = {
+const vp9_tree_index vp9_mv_class0_tree [2 * CLASS0_SIZE - 2] = {
   -0, -1,
 };
-struct vp8_token_struct vp9_mv_class0_encodings[CLASS0_SIZE];
+struct vp9_token_struct vp9_mv_class0_encodings[CLASS0_SIZE];
 
-const vp8_tree_index vp9_mv_fp_tree [2 * 4 - 2] = {
+const vp9_tree_index vp9_mv_fp_tree [2 * 4 - 2] = {
   -0, 2,
   -1, 4,
   -2, -3
 };
-struct vp8_token_struct vp9_mv_fp_encodings[4];
+struct vp9_token_struct vp9_mv_fp_encodings[4];
 
 const nmv_context vp9_default_nmv_context = {
   {32, 64, 96},
@@ -211,7 +211,7 @@
   }
 }
 
-static void adapt_prob(vp8_prob *dest, vp8_prob prep, vp8_prob newp,
+static void adapt_prob(vp9_prob *dest, vp9_prob prep, vp9_prob newp,
                        unsigned int ct[2]) {
   int factor;
   int prob;
diff --git a/vp8/common/entropymv.h b/vp8/common/entropymv.h
index 85e14f1..a489d11 100644
--- a/vp8/common/entropymv.h
+++ b/vp8/common/entropymv.h
@@ -20,13 +20,11 @@
 
 void vp9_entropy_mv_init();
 void vp9_init_mv_probs(struct VP9Common *cm);
-void vp8_adapt_mv_probs(struct VP9Common *cm);
 
 void vp9_adapt_nmv_probs(struct VP9Common *cm, int usehp);
-void vp8_lower_mv_precision(MV *mv);
 int vp9_use_nmv_hp(const MV *ref);
 
-#define VP8_NMV_UPDATE_PROB  255
+#define VP9_NMV_UPDATE_PROB  255
 //#define MV_GROUP_UPDATE
 
 #define LOW_PRECISION_MV_UPDATE  /* Use 7 bit forward update */
@@ -40,8 +38,8 @@
   MV_JOINT_HNZVNZ = 3,           /* Both components nonzero */
 } MV_JOINT_TYPE;
 
-extern const vp8_tree_index vp9_mv_joint_tree[2 * MV_JOINTS - 2];
-extern struct vp8_token_struct vp9_mv_joint_encodings [MV_JOINTS];
+extern const vp9_tree_index vp9_mv_joint_tree[2 * MV_JOINTS - 2];
+extern struct vp9_token_struct vp9_mv_joint_encodings [MV_JOINTS];
 
 /* Symbols for coding magnitude class of nonzero components */
 #define MV_CLASSES     8
@@ -56,8 +54,8 @@
   MV_CLASS_7 = 7,      /* (128, 256] integer pel */
 } MV_CLASS_TYPE;
 
-extern const vp8_tree_index vp9_mv_class_tree[2 * MV_CLASSES - 2];
-extern struct vp8_token_struct vp9_mv_class_encodings [MV_CLASSES];
+extern const vp9_tree_index vp9_mv_class_tree[2 * MV_CLASSES - 2];
+extern struct vp9_token_struct vp9_mv_class_encodings [MV_CLASSES];
 
 #define CLASS0_BITS    1  /* bits at integer precision for class 0 */
 #define CLASS0_SIZE    (1 << CLASS0_BITS)
@@ -67,25 +65,25 @@
 #define MV_MAX         ((1 << MV_MAX_BITS) - 1)
 #define MV_VALS        ((MV_MAX << 1) + 1)
 
-extern const vp8_tree_index vp9_mv_class0_tree[2 * CLASS0_SIZE - 2];
-extern struct vp8_token_struct vp9_mv_class0_encodings[CLASS0_SIZE];
+extern const vp9_tree_index vp9_mv_class0_tree[2 * CLASS0_SIZE - 2];
+extern struct vp9_token_struct vp9_mv_class0_encodings[CLASS0_SIZE];
 
-extern const vp8_tree_index vp9_mv_fp_tree[2 * 4 - 2];
-extern struct vp8_token_struct vp9_mv_fp_encodings[4];
+extern const vp9_tree_index vp9_mv_fp_tree[2 * 4 - 2];
+extern struct vp9_token_struct vp9_mv_fp_encodings[4];
 
 typedef struct {
-  vp8_prob sign;
-  vp8_prob classes[MV_CLASSES - 1];
-  vp8_prob class0[CLASS0_SIZE - 1];
-  vp8_prob bits[MV_OFFSET_BITS];
-  vp8_prob class0_fp[CLASS0_SIZE][4 - 1];
-  vp8_prob fp[4 - 1];
-  vp8_prob class0_hp;
-  vp8_prob hp;
+  vp9_prob sign;
+  vp9_prob classes[MV_CLASSES - 1];
+  vp9_prob class0[CLASS0_SIZE - 1];
+  vp9_prob bits[MV_OFFSET_BITS];
+  vp9_prob class0_fp[CLASS0_SIZE][4 - 1];
+  vp9_prob fp[4 - 1];
+  vp9_prob class0_hp;
+  vp9_prob hp;
 } nmv_component;
 
 typedef struct {
-  vp8_prob joints[MV_JOINTS - 1];
+  vp9_prob joints[MV_JOINTS - 1];
   nmv_component comps[2];
 } nmv_context;
 
diff --git a/vp8/common/filter.c b/vp8/common/filter.c
index c2a20e1..83a30a4 100644
--- a/vp8/common/filter.c
+++ b/vp8/common/filter.c
@@ -148,23 +148,23 @@
   unsigned int pixel_step,
   unsigned int output_height,
   unsigned int output_width,
-  const short *vp8_filter
+  const short *vp9_filter
 ) {
   unsigned int i, j;
   int  Temp;
 
   for (i = 0; i < output_height; i++) {
     for (j = 0; j < output_width; j++) {
-      Temp = ((int)src_ptr[-2 * (int)pixel_step] * vp8_filter[0]) +
-             ((int)src_ptr[-1 * (int)pixel_step] * vp8_filter[1]) +
-             ((int)src_ptr[0]                    * vp8_filter[2]) +
-             ((int)src_ptr[pixel_step]           * vp8_filter[3]) +
-             ((int)src_ptr[2 * pixel_step]       * vp8_filter[4]) +
-             ((int)src_ptr[3 * pixel_step]       * vp8_filter[5]) +
-             (VP8_FILTER_WEIGHT >> 1);      /* Rounding */
+      Temp = ((int)src_ptr[-2 * (int)pixel_step] * vp9_filter[0]) +
+             ((int)src_ptr[-1 * (int)pixel_step] * vp9_filter[1]) +
+             ((int)src_ptr[0]                    * vp9_filter[2]) +
+             ((int)src_ptr[pixel_step]           * vp9_filter[3]) +
+             ((int)src_ptr[2 * pixel_step]       * vp9_filter[4]) +
+             ((int)src_ptr[3 * pixel_step]       * vp9_filter[5]) +
+             (VP9_FILTER_WEIGHT >> 1);      /* Rounding */
 
       /* Normalize back to 0-255 */
-      Temp = Temp >> VP8_FILTER_SHIFT;
+      Temp = Temp >> VP9_FILTER_SHIFT;
 
       if (Temp < 0)
         Temp = 0;
@@ -190,7 +190,7 @@
   unsigned int pixel_step,
   unsigned int output_height,
   unsigned int output_width,
-  const short *vp8_filter
+  const short *vp9_filter
 ) {
   unsigned int i, j;
   int  Temp;
@@ -198,16 +198,16 @@
   for (i = 0; i < output_height; i++) {
     for (j = 0; j < output_width; j++) {
       /* Apply filter */
-      Temp = ((int)src_ptr[-2 * (int)pixel_step] * vp8_filter[0]) +
-             ((int)src_ptr[-1 * (int)pixel_step] * vp8_filter[1]) +
-             ((int)src_ptr[0]                    * vp8_filter[2]) +
-             ((int)src_ptr[pixel_step]           * vp8_filter[3]) +
-             ((int)src_ptr[2 * pixel_step]         * vp8_filter[4]) +
-             ((int)src_ptr[3 * pixel_step]         * vp8_filter[5]) +
-             (VP8_FILTER_WEIGHT >> 1);   /* Rounding */
+      Temp = ((int)src_ptr[-2 * (int)pixel_step] * vp9_filter[0]) +
+             ((int)src_ptr[-1 * (int)pixel_step] * vp9_filter[1]) +
+             ((int)src_ptr[0]                    * vp9_filter[2]) +
+             ((int)src_ptr[pixel_step]           * vp9_filter[3]) +
+             ((int)src_ptr[2 * pixel_step]         * vp9_filter[4]) +
+             ((int)src_ptr[3 * pixel_step]         * vp9_filter[5]) +
+             (VP9_FILTER_WEIGHT >> 1);   /* Rounding */
 
       /* Normalize back to 0-255 */
-      Temp = Temp >> VP8_FILTER_SHIFT;
+      Temp = Temp >> VP9_FILTER_SHIFT;
 
       if (Temp < 0)
         Temp = 0;
@@ -241,7 +241,7 @@
   unsigned int pixel_step,
   unsigned int output_height,
   unsigned int output_width,
-  const short *vp8_filter
+  const short *vp9_filter
 ) {
   unsigned int i, j;
   int  Temp;
@@ -249,16 +249,16 @@
   for (i = 0; i < output_height; i++) {
     for (j = 0; j < output_width; j++) {
       /* Apply filter */
-      Temp = ((int)src_ptr[-2 * (int)pixel_step] * vp8_filter[0]) +
-             ((int)src_ptr[-1 * (int)pixel_step] * vp8_filter[1]) +
-             ((int)src_ptr[0]                    * vp8_filter[2]) +
-             ((int)src_ptr[pixel_step]           * vp8_filter[3]) +
-             ((int)src_ptr[2 * pixel_step]         * vp8_filter[4]) +
-             ((int)src_ptr[3 * pixel_step]         * vp8_filter[5]) +
-             (VP8_FILTER_WEIGHT >> 1);   /* Rounding */
+      Temp = ((int)src_ptr[-2 * (int)pixel_step] * vp9_filter[0]) +
+             ((int)src_ptr[-1 * (int)pixel_step] * vp9_filter[1]) +
+             ((int)src_ptr[0]                    * vp9_filter[2]) +
+             ((int)src_ptr[pixel_step]           * vp9_filter[3]) +
+             ((int)src_ptr[2 * pixel_step]         * vp9_filter[4]) +
+             ((int)src_ptr[3 * pixel_step]         * vp9_filter[5]) +
+             (VP9_FILTER_WEIGHT >> 1);   /* Rounding */
 
       /* Normalize back to 0-255 */
-      Temp = Temp >> VP8_FILTER_SHIFT;
+      Temp = Temp >> VP9_FILTER_SHIFT;
 
       if (Temp < 0)
         Temp = 0;
@@ -510,13 +510,13 @@
 static const unsigned int filter_max_height = 16;
 static const unsigned int filter_max_width = 16;
 
-static void vp8_filter_block2d_8_c
-(
- const unsigned char *src_ptr, const unsigned int   src_stride,
- const short *HFilter, const short *VFilter,
- const filter_size_t filter_size,
- unsigned char *dst_ptr, unsigned int   dst_stride
-) {
+static void filter_block2d_8_c(const unsigned char *src_ptr,
+                               const unsigned int   src_stride,
+                               const short *HFilter,
+                               const short *VFilter,
+                               const filter_size_t filter_size,
+                               unsigned char *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];
 
@@ -554,10 +554,10 @@
                    ((int)src_ptr[5] * HFilter[5]) +
                    ((int)src_ptr[6] * HFilter[6]) +
                    ((int)src_ptr[7] * HFilter[7]) +
-                   (VP8_FILTER_WEIGHT >> 1); // Rounding
+                   (VP9_FILTER_WEIGHT >> 1); // Rounding
 
         // Normalize back to 0-255...
-        temp >>= VP8_FILTER_SHIFT;
+        temp >>= VP9_FILTER_SHIFT;
         if (temp < 0) {
           temp = 0;
         } else if (temp > 255) {
@@ -588,10 +588,10 @@
                    ((int)src_ptr[5] * VFilter[5]) +
                    ((int)src_ptr[6] * VFilter[6]) +
                    ((int)src_ptr[7] * VFilter[7]) +
-                   (VP8_FILTER_WEIGHT >> 1); // Rounding
+                   (VP9_FILTER_WEIGHT >> 1); // Rounding
 
         // Normalize back to 0-255...
-        temp >>= VP8_FILTER_SHIFT;
+        temp >>= VP9_FILTER_SHIFT;
         if (temp < 0) {
           temp = 0;
         } else if (temp > 255) {
@@ -607,58 +607,55 @@
   }
 }
 
-void vp9_filter_block2d_4x4_8_c
-(
- 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
-) {
-  vp8_filter_block2d_8_c(src_ptr, src_stride,
-                         HFilter_aligned16, VFilter_aligned16,
-                         VPX_FILTER_4x4, dst_ptr, dst_stride);
+void vp9_filter_block2d_4x4_8_c(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) {
+  filter_block2d_8_c(src_ptr, src_stride,
+                     HFilter_aligned16, VFilter_aligned16,
+                     VPX_FILTER_4x4, dst_ptr, dst_stride);
 }
 
-void vp9_filter_block2d_8x4_8_c
-(
- 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
-) {
-  vp8_filter_block2d_8_c(src_ptr, src_stride,
-                         HFilter_aligned16, VFilter_aligned16,
-                         VPX_FILTER_8x4, dst_ptr, dst_stride);
+void vp9_filter_block2d_8x4_8_c(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) {
+  filter_block2d_8_c(src_ptr, src_stride,
+                     HFilter_aligned16, VFilter_aligned16,
+                     VPX_FILTER_8x4, dst_ptr, dst_stride);
 }
 
-void vp9_filter_block2d_8x8_8_c
-(
- 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
-) {
-  vp8_filter_block2d_8_c(src_ptr, src_stride,
-                         HFilter_aligned16, VFilter_aligned16,
-                         VPX_FILTER_8x8, dst_ptr, dst_stride);
+void vp9_filter_block2d_8x8_8_c(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) {
+  filter_block2d_8_c(src_ptr, src_stride,
+                     HFilter_aligned16, VFilter_aligned16,
+                     VPX_FILTER_8x8, dst_ptr, dst_stride);
 }
 
-void vp9_filter_block2d_16x16_8_c
-(
- 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
-) {
-  vp8_filter_block2d_8_c(src_ptr, src_stride,
-                         HFilter_aligned16, VFilter_aligned16,
-                         VPX_FILTER_16x16, dst_ptr, dst_stride);
+void vp9_filter_block2d_16x16_8_c(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) {
+  filter_block2d_8_c(src_ptr, src_stride,
+                     HFilter_aligned16, VFilter_aligned16,
+                     VPX_FILTER_16x16, dst_ptr, dst_stride);
 }
 
-static void vp8_block2d_average_c
-(
-  unsigned char *src,
-  unsigned int   src_stride,
-  unsigned char *output_ptr,
-  unsigned int output_stride,
-  const filter_size_t filter_size
-) {
+static void block2d_average_c(unsigned char *src,
+                              unsigned int   src_stride,
+                              unsigned char *output_ptr,
+                              unsigned int output_stride,
+                              const filter_size_t filter_size) {
   const unsigned int output_width = filter_size_to_wh[filter_size][0];
   const unsigned int output_height = filter_size_to_wh[filter_size][1];
 
@@ -671,7 +668,7 @@
   }
 }
 
-#define vp8_block2d_average vp8_block2d_average_c
+#define block2d_average block2d_average_c
 
 void vp9_eighttap_predict_c
 (
@@ -709,7 +706,7 @@
   vp9_filter_block2d_4x4_8(src_ptr, src_pixels_per_line,
                            HFilter, VFilter,
                            tmp, 4);
-  vp8_block2d_average(tmp, 4, dst_ptr, dst_pitch, VPX_FILTER_4x4);
+  block2d_average(tmp, 4, dst_ptr, dst_pitch, VPX_FILTER_4x4);
 }
 
 void vp9_eighttap_predict_sharp_c
@@ -748,7 +745,7 @@
   vp9_filter_block2d_4x4_8(src_ptr, src_pixels_per_line,
                            HFilter, VFilter,
                            tmp, 4);
-  vp8_block2d_average(tmp, 4, dst_ptr, dst_pitch, VPX_FILTER_4x4);
+  block2d_average(tmp, 4, dst_ptr, dst_pitch, VPX_FILTER_4x4);
 }
 
 void vp9_eighttap_predict8x8_c
@@ -801,7 +798,7 @@
   vp9_filter_block2d_8x8_8(src_ptr, src_pixels_per_line,
                            HFilter, VFilter,
                            tmp, 8);
-  vp8_block2d_average(tmp, 8, dst_ptr, dst_pitch, VPX_FILTER_8x8);
+  block2d_average(tmp, 8, dst_ptr, dst_pitch, VPX_FILTER_8x8);
 }
 
 void vp9_eighttap_predict_avg8x8_sharp_c
@@ -820,7 +817,7 @@
   vp9_filter_block2d_8x8_8(src_ptr, src_pixels_per_line,
                            HFilter, VFilter,
                            tmp, 8);
-  vp8_block2d_average(tmp, 8, dst_ptr, dst_pitch, VPX_FILTER_8x8);
+  block2d_average(tmp, 8, dst_ptr, dst_pitch, VPX_FILTER_8x8);
 }
 
 void vp9_eighttap_predict8x4_c
@@ -908,7 +905,7 @@
   vp9_filter_block2d_16x16_8(src_ptr, src_pixels_per_line,
                        HFilter, VFilter,
                        tmp, 16);
-  vp8_block2d_average(tmp, 16, dst_ptr, dst_pitch, VPX_FILTER_16x16);
+  block2d_average(tmp, 16, dst_ptr, dst_pitch, VPX_FILTER_16x16);
 }
 
 void vp9_eighttap_predict_avg16x16_sharp_c
@@ -927,7 +924,7 @@
   vp9_filter_block2d_16x16_8(src_ptr, src_pixels_per_line,
                        HFilter, VFilter,
                        tmp, 16);
-  vp8_block2d_average(tmp, 16, dst_ptr, dst_pitch, VPX_FILTER_16x16);
+  block2d_average(tmp, 16, dst_ptr, dst_pitch, VPX_FILTER_16x16);
 }
 
 /****************************************************************************
@@ -938,7 +935,7 @@
  *                  UINT32  src_stride : Stride of source block.
  *                  UINT32  height     : Block height.
  *                  UINT32  width      : Block width.
- *                  INT32  *vp8_filter : Array of 2 bi-linear filter taps.
+ *                  INT32  *vp9_filter : Array of 2 bi-linear filter taps.
  *
  *  OUTPUTS       : INT32  *dst_ptr    : Pointer to filtered block.
  *
@@ -949,7 +946,7 @@
  *                  block. Used to implement first-pass of 2-D separable filter.
  *
  *  SPECIAL NOTES : Produces INT32 output to retain precision for next pass.
- *                  Two filter taps should sum to VP8_FILTER_WEIGHT.
+ *                  Two filter taps should sum to VP9_FILTER_WEIGHT.
  *
  ****************************************************************************/
 static void filter_block2d_bil_first_pass
@@ -959,16 +956,16 @@
   unsigned int    src_stride,
   unsigned int    height,
   unsigned int    width,
-  const short    *vp8_filter
+  const short    *vp9_filter
 ) {
   unsigned int i, j;
 
   for (i = 0; i < height; i++) {
     for (j = 0; j < width; j++) {
       /* Apply bilinear filter */
-      dst_ptr[j] = (((int)src_ptr[0] * vp8_filter[0]) +
-                    ((int)src_ptr[1] * vp8_filter[1]) +
-                    (VP8_FILTER_WEIGHT / 2)) >> VP8_FILTER_SHIFT;
+      dst_ptr[j] = (((int)src_ptr[0] * vp9_filter[0]) +
+                    ((int)src_ptr[1] * vp9_filter[1]) +
+                    (VP9_FILTER_WEIGHT / 2)) >> VP9_FILTER_SHIFT;
       src_ptr++;
     }
 
@@ -986,7 +983,7 @@
  *                  UINT32  dst_pitch  : Destination block pitch.
  *                  UINT32  height     : Block height.
  *                  UINT32  width      : Block width.
- *                  INT32  *vp8_filter : Array of 2 bi-linear filter taps.
+ *                  INT32  *vp9_filter : Array of 2 bi-linear filter taps.
  *
  *  OUTPUTS       : UINT16 *dst_ptr    : Pointer to filtered block.
  *
@@ -997,7 +994,7 @@
  *                  block. Used to implement second-pass of 2-D separable filter.
  *
  *  SPECIAL NOTES : Requires 32-bit input as produced by filter_block2d_bil_first_pass.
- *                  Two filter taps should sum to VP8_FILTER_WEIGHT.
+ *                  Two filter taps should sum to VP9_FILTER_WEIGHT.
  *
  ****************************************************************************/
 static void filter_block2d_bil_second_pass
@@ -1007,7 +1004,7 @@
   int             dst_pitch,
   unsigned int    height,
   unsigned int    width,
-  const short    *vp8_filter
+  const short    *vp9_filter
 ) {
   unsigned int  i, j;
   int  Temp;
@@ -1015,10 +1012,10 @@
   for (i = 0; i < height; i++) {
     for (j = 0; j < width; j++) {
       /* Apply filter */
-      Temp = ((int)src_ptr[0]     * vp8_filter[0]) +
-             ((int)src_ptr[width] * vp8_filter[1]) +
-             (VP8_FILTER_WEIGHT / 2);
-      dst_ptr[j] = (unsigned int)(Temp >> VP8_FILTER_SHIFT);
+      Temp = ((int)src_ptr[0]     * vp9_filter[0]) +
+             ((int)src_ptr[width] * vp9_filter[1]) +
+             (VP9_FILTER_WEIGHT / 2);
+      dst_ptr[j] = (unsigned int)(Temp >> VP9_FILTER_SHIFT);
       src_ptr++;
     }
 
@@ -1043,7 +1040,7 @@
   int             dst_pitch,
   unsigned int    height,
   unsigned int    width,
-  const short    *vp8_filter
+  const short    *vp9_filter
 ) {
   unsigned int  i, j;
   int  Temp;
@@ -1051,10 +1048,10 @@
   for (i = 0; i < height; i++) {
     for (j = 0; j < width; j++) {
       /* Apply filter */
-      Temp = ((int)src_ptr[0]     * vp8_filter[0]) +
-             ((int)src_ptr[width] * vp8_filter[1]) +
-             (VP8_FILTER_WEIGHT / 2);
-      dst_ptr[j] = (unsigned int)(((Temp >> VP8_FILTER_SHIFT) + dst_ptr[j] + 1) >> 1);
+      Temp = ((int)src_ptr[0]     * vp9_filter[0]) +
+             ((int)src_ptr[width] * vp9_filter[1]) +
+             (VP9_FILTER_WEIGHT / 2);
+      dst_ptr[j] = (unsigned int)(((Temp >> VP9_FILTER_SHIFT) + dst_ptr[j] + 1) >> 1);
       src_ptr++;
     }
 
diff --git a/vp8/common/filter.h b/vp8/common/filter.h
index 142c784..c194887 100644
--- a/vp8/common/filter.h
+++ b/vp8/common/filter.h
@@ -15,8 +15,8 @@
 #include "vpx_scale/yv12config.h"
 
 #define BLOCK_HEIGHT_WIDTH 4
-#define VP8_FILTER_WEIGHT 128
-#define VP8_FILTER_SHIFT  7
+#define VP9_FILTER_WEIGHT 128
+#define VP9_FILTER_SHIFT  7
 
 #define SUBPEL_SHIFTS 16
 
diff --git a/vp8/common/findnearmv.c b/vp8/common/findnearmv.c
index 8b0efef..a21fe6e 100644
--- a/vp8/common/findnearmv.c
+++ b/vp8/common/findnearmv.c
@@ -152,13 +152,13 @@
   lower_mv_precision(nearby, xd->allow_high_precision_mv);
 
   // TODO: move clamp outside findnearmv
-  vp8_clamp_mv2(nearest, xd);
-  vp8_clamp_mv2(nearby, xd);
-  vp8_clamp_mv2(best_mv, xd);
+  clamp_mv2(nearest, xd);
+  clamp_mv2(nearby, xd);
+  clamp_mv2(best_mv, xd);
 }
 
-vp8_prob *vp9_mv_ref_probs(VP9_COMMON *pc,
-                           vp8_prob p[VP8_MVREFS - 1], const int near_mv_ref_ct[4]
+vp9_prob *vp9_mv_ref_probs(VP9_COMMON *pc,
+                           vp9_prob p[VP9_MVREFS - 1], const int near_mv_ref_ct[4]
                           ) {
   p[0] = pc->fc.vp8_mode_contexts [near_mv_ref_ct[0]] [0];
   p[1] = pc->fc.vp8_mode_contexts [near_mv_ref_ct[1]] [1];
@@ -169,7 +169,7 @@
 
 #if CONFIG_NEWBESTREFMV
 #define SP(x) (((x) & 7) << 1)
-unsigned int vp8_sad3x16_c(
+unsigned int vp9_sad3x16_c(
   const unsigned char *src_ptr,
   int  src_stride,
   const unsigned char *ref_ptr,
@@ -177,7 +177,7 @@
   int max_sad) {
   return sad_mx_n_c(src_ptr, src_stride, ref_ptr, ref_stride, 3, 16);
 }
-unsigned int vp8_sad16x3_c(
+unsigned int vp9_sad16x3_c(
   const unsigned char *src_ptr,
   int  src_stride,
   const unsigned char *ref_ptr,
@@ -190,7 +190,7 @@
  * above and a number cols of pixels in the left to select the one with best
  * score to use as ref motion vector
  */
-void vp8_find_best_ref_mvs(MACROBLOCKD *xd,
+void vp9_find_best_ref_mvs(MACROBLOCKD *xd,
                            unsigned char *ref_y_buffer,
                            int ref_y_stride,
                            int_mv *mvlist,
@@ -240,24 +240,24 @@
 
     zero_seen = zero_seen || !this_mv.as_int;
 
-    vp8_clamp_mv(&this_mv,
-                 xd->mb_to_left_edge - LEFT_TOP_MARGIN + 24,
-                 xd->mb_to_right_edge + RIGHT_BOTTOM_MARGIN,
-                 xd->mb_to_top_edge - LEFT_TOP_MARGIN + 24,
-                 xd->mb_to_bottom_edge + RIGHT_BOTTOM_MARGIN);
+    clamp_mv(&this_mv,
+             xd->mb_to_left_edge - LEFT_TOP_MARGIN + 24,
+             xd->mb_to_right_edge + RIGHT_BOTTOM_MARGIN,
+             xd->mb_to_top_edge - LEFT_TOP_MARGIN + 24,
+             xd->mb_to_bottom_edge + RIGHT_BOTTOM_MARGIN);
 #if CONFIG_SUBPELREFMV
     row_offset = this_mv.as_mv.row >> 3;
     col_offset = this_mv.as_mv.col >> 3;
     offset = ref_y_stride * row_offset + col_offset;
     score = 0;
     if (xd->up_available) {
-      vp8_sub_pixel_variance16x2_c(above_ref + offset, ref_y_stride,
+      vp9_sub_pixel_variance16x2_c(above_ref + offset, ref_y_stride,
                                    SP(this_mv.as_mv.col), SP(this_mv.as_mv.row),
                                    above_src, xd->dst.y_stride, &sse);
       score += sse;
     }
     if (xd->left_available) {
-      vp8_sub_pixel_variance2x16_c(left_ref + offset, ref_y_stride,
+      vp9_sub_pixel_variance2x16_c(left_ref + offset, ref_y_stride,
                                    SP(this_mv.as_mv.col), SP(this_mv.as_mv.row),
                                    left_src, xd->dst.y_stride, &sse);
       score += sse;
@@ -270,11 +270,11 @@
     offset = ref_y_stride * row_offset + col_offset;
     score = 0;
     if (xd->up_available) {
-      score += vp8_sad16x3(above_src, xd->dst.y_stride,
+      score += vp9_sad16x3(above_src, xd->dst.y_stride,
                            above_ref + offset, ref_y_stride, INT_MAX);
     }
     if (xd->left_available) {
-      score += vp8_sad3x16(left_src, xd->dst.y_stride,
+      score += vp9_sad3x16(left_src, xd->dst.y_stride,
                            left_ref + offset, ref_y_stride, INT_MAX);
     }
 #endif
@@ -297,7 +297,7 @@
   // Make sure all the candidates are properly clamped etc
   for (i = 0; i < 4; ++i) {
     lower_mv_precision(&sorted_mvs[i], xd->allow_high_precision_mv);
-    vp8_clamp_mv2(&sorted_mvs[i], xd);
+    clamp_mv2(&sorted_mvs[i], xd);
   }
 
   // Set the best mv to the first entry in the sorted list
diff --git a/vp8/common/findnearmv.h b/vp8/common/findnearmv.h
index 715105d..e927c22 100644
--- a/vp8/common/findnearmv.h
+++ b/vp8/common/findnearmv.h
@@ -23,7 +23,7 @@
  * above and a number cols of pixels in the left to select the one with best
  * score to use as ref motion vector
  */
-void vp8_find_best_ref_mvs(MACROBLOCKD *xd,
+void vp9_find_best_ref_mvs(MACROBLOCKD *xd,
                            unsigned char *ref_y_buffer,
                            int ref_y_stride,
                            int_mv *mvlist,
@@ -47,13 +47,11 @@
 #define LEFT_TOP_MARGIN (16 << 3)
 #define RIGHT_BOTTOM_MARGIN (16 << 3)
 
-
-
-static void vp8_clamp_mv(int_mv *mv,
-                         int mb_to_left_edge,
-                         int mb_to_right_edge,
-                         int mb_to_top_edge,
-                         int mb_to_bottom_edge) {
+static void clamp_mv(int_mv *mv,
+                     int mb_to_left_edge,
+                     int mb_to_right_edge,
+                     int mb_to_top_edge,
+                     int mb_to_bottom_edge) {
   mv->as_mv.col = (mv->as_mv.col < mb_to_left_edge) ?
                   mb_to_left_edge : mv->as_mv.col;
   mv->as_mv.col = (mv->as_mv.col > mb_to_right_edge) ?
@@ -64,21 +62,19 @@
                   mb_to_bottom_edge : mv->as_mv.row;
 }
 
-static void vp8_clamp_mv2(int_mv *mv, const MACROBLOCKD *xd) {
-  vp8_clamp_mv(mv,
-              xd->mb_to_left_edge - LEFT_TOP_MARGIN,
-              xd->mb_to_right_edge + RIGHT_BOTTOM_MARGIN,
-              xd->mb_to_top_edge - LEFT_TOP_MARGIN,
-              xd->mb_to_bottom_edge + RIGHT_BOTTOM_MARGIN);
+static void clamp_mv2(int_mv *mv, const MACROBLOCKD *xd) {
+  clamp_mv(mv,
+           xd->mb_to_left_edge - LEFT_TOP_MARGIN,
+           xd->mb_to_right_edge + RIGHT_BOTTOM_MARGIN,
+           xd->mb_to_top_edge - LEFT_TOP_MARGIN,
+           xd->mb_to_bottom_edge + RIGHT_BOTTOM_MARGIN);
 }
 
-
-
-static unsigned int vp8_check_mv_bounds(int_mv *mv,
-                                        int mb_to_left_edge,
-                                        int mb_to_right_edge,
-                                        int mb_to_top_edge,
-                                        int mb_to_bottom_edge) {
+static unsigned int check_mv_bounds(int_mv *mv,
+                                    int mb_to_left_edge,
+                                    int mb_to_right_edge,
+                                    int mb_to_top_edge,
+                                    int mb_to_bottom_edge) {
   return (mv->as_mv.col < mb_to_left_edge) ||
          (mv->as_mv.col > mb_to_right_edge) ||
          (mv->as_mv.row < mb_to_top_edge) ||
@@ -96,8 +92,8 @@
   int *ref_frame_sign_bias
 );
 
-vp8_prob *vp9_mv_ref_probs(VP9_COMMON *pc,
-                           vp8_prob p[VP8_MVREFS - 1], const int near_mv_ref_ct[4]
+vp9_prob *vp9_mv_ref_probs(VP9_COMMON *pc,
+                           vp9_prob p[VP9_MVREFS - 1], const int near_mv_ref_ct[4]
                           );
 
 extern const unsigned char vp9_mbsplit_offset[4][16];
diff --git a/vp8/common/g_common.h b/vp8/common/g_common.h
index 0898984..7dc9420 100644
--- a/vp8/common/g_common.h
+++ b/vp8/common/g_common.h
@@ -9,7 +9,7 @@
  */
 
 
-extern void (*vp8_clear_system_state)(void);
+extern void (*vp9_clear_system_state)(void);
 extern void (*vp9_plane_add_noise)(unsigned char *Start, unsigned int Width, unsigned int Height, int Pitch, int DPitch, int q);
 extern void (*de_interlace)
 (
diff --git a/vp8/common/generic/systemdependent.c b/vp8/common/generic/systemdependent.c
index 6fff66d..55b6646 100644
--- a/vp8/common/generic/systemdependent.c
+++ b/vp8/common/generic/systemdependent.c
@@ -18,7 +18,7 @@
 #include "vp8/common/onyxc_int.h"
 
 extern void vp9_arch_x86_common_init(VP9_COMMON *ctx);
-extern void vp8_arch_arm_common_init(VP9_COMMON *ctx);
+extern void vp9_arch_arm_common_init(VP9_COMMON *ctx);
 
 void vp9_machine_specific_config(VP9_COMMON *ctx) {
 #if CONFIG_RUNTIME_CPU_DETECT
@@ -82,7 +82,7 @@
 
 
 #if ARCH_ARM
-  vp8_arch_arm_common_init(ctx);
+  vp9_arch_arm_common_init(ctx);
 #endif
 
   vpx_rtcd();
diff --git a/vp8/common/header.h b/vp8/common/header.h
index 6fe0ca4..a88b6e3 100644
--- a/vp8/common/header.h
+++ b/vp8/common/header.h
@@ -30,12 +30,12 @@
   unsigned int uses_last: 1;
 #endif
 
-} VP8_HEADER;
+} VP9_HEADER;
 
 #ifdef PACKET_TESTING
-#define VP8_HEADER_SIZE 8
+#define VP9_HEADER_SIZE 8
 #else
-#define VP8_HEADER_SIZE 3
+#define VP9_HEADER_SIZE 3
 #endif
 
 
diff --git a/vp8/common/idct.h b/vp8/common/idct.h
index 275bb19..ee6b0ba 100644
--- a/vp8/common/idct.h
+++ b/vp8/common/idct.h
@@ -45,63 +45,63 @@
 #define Y2_WHT_UPSCALE_FACTOR 2
 #endif
 
-#ifndef vp8_idct_idct16x16
-#define vp8_idct_idct16x16 vp9_short_idct16x16_c
+#ifndef vp9_idct_idct16x16
+#define vp9_idct_idct16x16 vp9_short_idct16x16_c
 #endif
-extern prototype_idct(vp8_idct_idct16x16);
+extern prototype_idct(vp9_idct_idct16x16);
 
-#ifndef vp8_idct_idct8
-#define vp8_idct_idct8 vp9_short_idct8x8_c
+#ifndef vp9_idct_idct8
+#define vp9_idct_idct8 vp9_short_idct8x8_c
 #endif
-extern prototype_idct(vp8_idct_idct8);
+extern prototype_idct(vp9_idct_idct8);
 
-#ifndef vp8_idct_idct8_1
-#define vp8_idct_idct8_1 vp9_short_idct8x8_1_c
+#ifndef vp9_idct_idct8_1
+#define vp9_idct_idct8_1 vp9_short_idct8x8_1_c
 #endif
-extern prototype_idct(vp8_idct_idct8_1);
+extern prototype_idct(vp9_idct_idct8_1);
 
-#ifndef vp8_idct_ihaar2
-#define vp8_idct_ihaar2 vp9_short_ihaar2x2_c
+#ifndef vp9_idct_ihaar2
+#define vp9_idct_ihaar2 vp9_short_ihaar2x2_c
 #endif
-extern prototype_idct(vp8_idct_ihaar2);
+extern prototype_idct(vp9_idct_ihaar2);
 
-#ifndef vp8_idct_ihaar2_1
-#define vp8_idct_ihaar2_1 vp9_short_ihaar2x2_1_c
+#ifndef vp9_idct_ihaar2_1
+#define vp9_idct_ihaar2_1 vp9_short_ihaar2x2_1_c
 #endif
-extern prototype_idct(vp8_idct_ihaar2_1);
+extern prototype_idct(vp9_idct_ihaar2_1);
 
-#ifndef vp8_idct_idct1_scalar_add_8x8
-#define vp8_idct_idct1_scalar_add_8x8 vp9_dc_only_idct_add_8x8_c
+#ifndef vp9_idct_idct1_scalar_add_8x8
+#define vp9_idct_idct1_scalar_add_8x8 vp9_dc_only_idct_add_8x8_c
 #endif
-extern prototype_idct_scalar_add(vp8_idct_idct1_scalar_add_8x8);
+extern prototype_idct_scalar_add(vp9_idct_idct1_scalar_add_8x8);
 
 
 
-#ifndef vp8_idct_idct1
-#define vp8_idct_idct1 vp9_short_idct4x4llm_1_c
+#ifndef vp9_idct_idct1
+#define vp9_idct_idct1 vp9_short_idct4x4llm_1_c
 #endif
-extern prototype_idct(vp8_idct_idct1);
+extern prototype_idct(vp9_idct_idct1);
 
-#ifndef vp8_idct_idct16
-#define vp8_idct_idct16 vp9_short_idct4x4llm_c
+#ifndef vp9_idct_idct16
+#define vp9_idct_idct16 vp9_short_idct4x4llm_c
 #endif
-extern prototype_idct(vp8_idct_idct16);
+extern prototype_idct(vp9_idct_idct16);
 
-#ifndef vp8_idct_idct1_scalar_add
-#define vp8_idct_idct1_scalar_add vp9_dc_only_idct_add_c
+#ifndef vp9_idct_idct1_scalar_add
+#define vp9_idct_idct1_scalar_add vp9_dc_only_idct_add_c
 #endif
-extern prototype_idct_scalar_add(vp8_idct_idct1_scalar_add);
+extern prototype_idct_scalar_add(vp9_idct_idct1_scalar_add);
 
 
-#ifndef vp8_idct_iwalsh1
-#define vp8_idct_iwalsh1 vp9_short_inv_walsh4x4_1_c
+#ifndef vp9_idct_iwalsh1
+#define vp9_idct_iwalsh1 vp9_short_inv_walsh4x4_1_c
 #endif
-extern prototype_second_order(vp8_idct_iwalsh1);
+extern prototype_second_order(vp9_idct_iwalsh1);
 
-#ifndef vp8_idct_iwalsh16
-#define vp8_idct_iwalsh16 vp9_short_inv_walsh4x4_c
+#ifndef vp9_idct_iwalsh16
+#define vp9_idct_iwalsh16 vp9_short_inv_walsh4x4_c
 #endif
-extern prototype_second_order(vp8_idct_iwalsh16);
+extern prototype_second_order(vp9_idct_iwalsh16);
 
 #if CONFIG_LOSSLESS
 extern prototype_idct(vp9_short_inv_walsh4x4_x8_c);
@@ -114,31 +114,31 @@
 void vp9_ihtllm_c(const int16_t *input, int16_t *output, int pitch,
                   TX_TYPE tx_type, int tx_dim);
 
-typedef prototype_idct((*vp8_idct_fn_t));
-typedef prototype_idct_scalar_add((*vp8_idct_scalar_add_fn_t));
-typedef prototype_second_order((*vp8_second_order_fn_t));
+typedef prototype_idct((*vp9_idct_fn_t));
+typedef prototype_idct_scalar_add((*vp9_idct_scalar_add_fn_t));
+typedef prototype_second_order((*vp9_second_order_fn_t));
 
 typedef struct {
-  vp8_idct_fn_t            idct1;
-  vp8_idct_fn_t            idct16;
-  vp8_idct_scalar_add_fn_t idct1_scalar_add;
+  vp9_idct_fn_t            idct1;
+  vp9_idct_fn_t            idct16;
+  vp9_idct_scalar_add_fn_t idct1_scalar_add;
 
-  vp8_second_order_fn_t iwalsh1;
-  vp8_second_order_fn_t iwalsh16;
+  vp9_second_order_fn_t iwalsh1;
+  vp9_second_order_fn_t iwalsh16;
 
-  vp8_idct_fn_t            idct8;
-  vp8_idct_fn_t            idct8_1;
-  vp8_idct_scalar_add_fn_t idct1_scalar_add_8x8;
-  vp8_idct_fn_t ihaar2;
-  vp8_idct_fn_t ihaar2_1;
+  vp9_idct_fn_t            idct8;
+  vp9_idct_fn_t            idct8_1;
+  vp9_idct_scalar_add_fn_t idct1_scalar_add_8x8;
+  vp9_idct_fn_t ihaar2;
+  vp9_idct_fn_t ihaar2_1;
 
-  vp8_idct_fn_t            idct16x16;
-} vp8_idct_rtcd_vtable_t;
+  vp9_idct_fn_t            idct16x16;
+} vp9_idct_rtcd_vtable_t;
 
 #if CONFIG_RUNTIME_CPU_DETECT
 #define IDCT_INVOKE(ctx,fn) (ctx)->fn
 #else
-#define IDCT_INVOKE(ctx,fn) vp8_idct_##fn
+#define IDCT_INVOKE(ctx,fn) vp9_idct_##fn
 #endif
 
 #endif
diff --git a/vp8/common/idctllm.c b/vp8/common/idctllm.c
index 279ec58..efbb643 100644
--- a/vp8/common/idctllm.c
+++ b/vp8/common/idctllm.c
@@ -290,7 +290,7 @@
 
 void vp9_ihtllm_float_c(const int16_t *input, int16_t *output, int pitch,
                   TX_TYPE tx_type, int tx_dim) {
-  vp8_clear_system_state();  // Make it simd safe : __asm emms;
+  vp9_clear_system_state();  // Make it simd safe : __asm emms;
   {
     int i, j, k;
     float bufa[256], bufb[256];  // buffers are for floating-point test purpose
@@ -404,7 +404,7 @@
       pfa += tx_dim;
     }
   }
-  vp8_clear_system_state(); // Make it simd safe : __asm emms;
+  vp9_clear_system_state(); // Make it simd safe : __asm emms;
 }
 
 /* Converted the transforms to integer form. */
@@ -985,7 +985,7 @@
 // Keep a really bad float version as reference for now.
 void vp9_short_idct16x16_c(short *input, short *output, int pitch) {
 
-  vp8_clear_system_state(); // Make it simd safe : __asm emms;
+  vp9_clear_system_state(); // Make it simd safe : __asm emms;
   {
     double x;
     const int short_pitch = pitch >> 1;
@@ -1007,7 +1007,7 @@
       }
     }
   }
-  vp8_clear_system_state(); // Make it simd safe : __asm emms;
+  vp9_clear_system_state(); // Make it simd safe : __asm emms;
 }
 #endif
 
@@ -1030,7 +1030,7 @@
 
 static void butterfly_16x16_idct_1d(double input[16], double output[16]) {
 
-  vp8_clear_system_state(); // Make it simd safe : __asm emms;
+  vp9_clear_system_state(); // Make it simd safe : __asm emms;
   {
     double step[16];
     double intermediate[16];
@@ -1217,14 +1217,14 @@
     output[9] = (step[6] - step[ 9]);
     output[8] = (step[7] - step[ 8]);
   }
-  vp8_clear_system_state(); // Make it simd safe : __asm emms;
+  vp9_clear_system_state(); // Make it simd safe : __asm emms;
 }
 
 // Remove once an int version of iDCT is written
 #if 0
 void reference_16x16_idct_1d(double input[16], double output[16]) {
 
-  vp8_clear_system_state(); // Make it simd safe : __asm emms;
+  vp9_clear_system_state(); // Make it simd safe : __asm emms;
   {
     const double kPi = 3.141592653589793238462643383279502884;
     const double kSqrt2 = 1.414213562373095048801688724209698;
@@ -1237,13 +1237,13 @@
       }
     }
   }
-  vp8_clear_system_state(); // Make it simd safe : __asm emms;
+  vp9_clear_system_state(); // Make it simd safe : __asm emms;
 }
 #endif
 
 void vp9_short_idct16x16_c(short *input, short *output, int pitch) {
 
-  vp8_clear_system_state(); // Make it simd safe : __asm emms;
+  vp9_clear_system_state(); // Make it simd safe : __asm emms;
   {
     double out[16*16], out2[16*16];
     const int short_pitch = pitch >> 1;
@@ -1269,5 +1269,5 @@
     for (i = 0; i < 16*16; ++i)
       output[i] = round(out2[i]/128);
   }
-  vp8_clear_system_state(); // Make it simd safe : __asm emms;
+  vp9_clear_system_state(); // Make it simd safe : __asm emms;
 }
diff --git a/vp8/common/invtrans.c b/vp8/common/invtrans.c
index 3f9dbff..f972afa 100644
--- a/vp8/common/invtrans.c
+++ b/vp8/common/invtrans.c
@@ -28,7 +28,7 @@
   xd->block[12].dqcoeff[0] = b->diff[8];
 }
 
-void vp9_inverse_transform_b_4x4(const vp8_idct_rtcd_vtable_t *rtcd,
+void vp9_inverse_transform_b_4x4(const vp9_idct_rtcd_vtable_t *rtcd,
                                  BLOCKD *b, int pitch) {
   if (b->eob <= 1)
     IDCT_INVOKE(rtcd, idct1)(b->dqcoeff, b->diff, pitch);
@@ -36,7 +36,7 @@
     IDCT_INVOKE(rtcd, idct16)(b->dqcoeff, b->diff, pitch);
 }
 
-void vp9_inverse_transform_mby_4x4(const vp8_idct_rtcd_vtable_t *rtcd,
+void vp9_inverse_transform_mby_4x4(const vp9_idct_rtcd_vtable_t *rtcd,
                                    MACROBLOCKD *xd) {
   int i;
   BLOCKD *blockd = xd->block;
@@ -52,7 +52,7 @@
   }
 }
 
-void vp9_inverse_transform_mbuv_4x4(const vp8_idct_rtcd_vtable_t *rtcd,
+void vp9_inverse_transform_mbuv_4x4(const vp9_idct_rtcd_vtable_t *rtcd,
                                     MACROBLOCKD *xd) {
   int i;
   BLOCKD *blockd = xd->block;
@@ -62,13 +62,13 @@
   }
 }
 
-void vp9_inverse_transform_mb_4x4(const vp8_idct_rtcd_vtable_t *rtcd,
+void vp9_inverse_transform_mb_4x4(const vp9_idct_rtcd_vtable_t *rtcd,
                                   MACROBLOCKD *xd) {
   vp9_inverse_transform_mby_4x4(rtcd, xd);
   vp9_inverse_transform_mbuv_4x4(rtcd, xd);
 }
 
-void vp9_inverse_transform_b_8x8(const vp8_idct_rtcd_vtable_t *rtcd,
+void vp9_inverse_transform_b_8x8(const vp9_idct_rtcd_vtable_t *rtcd,
                                  short *input_dqcoeff, short *output_coeff,
                                  int pitch) {
   // int b,i;
@@ -78,7 +78,7 @@
   // IDCT_INVOKE(rtcd, idct8_1)(b->dqcoeff, b->diff, pitch);//pitch
 }
 
-void vp9_inverse_transform_mby_8x8(const vp8_idct_rtcd_vtable_t *rtcd,
+void vp9_inverse_transform_mby_8x8(const vp9_idct_rtcd_vtable_t *rtcd,
                                    MACROBLOCKD *xd) {
   int i;
   BLOCKD *blockd = xd->block;
@@ -99,7 +99,7 @@
   }
 }
 
-void vp9_inverse_transform_mbuv_8x8(const vp8_idct_rtcd_vtable_t *rtcd,
+void vp9_inverse_transform_mbuv_8x8(const vp9_idct_rtcd_vtable_t *rtcd,
                                     MACROBLOCKD *xd) {
   int i;
   BLOCKD *blockd = xd->block;
@@ -110,25 +110,25 @@
   }
 }
 
-void vp9_inverse_transform_mb_8x8(const vp8_idct_rtcd_vtable_t *rtcd,
+void vp9_inverse_transform_mb_8x8(const vp9_idct_rtcd_vtable_t *rtcd,
                                   MACROBLOCKD *xd) {
   vp9_inverse_transform_mby_8x8(rtcd, xd);
   vp9_inverse_transform_mbuv_8x8(rtcd, xd);
 }
 
-void vp9_inverse_transform_b_16x16(const vp8_idct_rtcd_vtable_t *rtcd,
+void vp9_inverse_transform_b_16x16(const vp9_idct_rtcd_vtable_t *rtcd,
                                    short *input_dqcoeff,
                                    short *output_coeff, int pitch) {
   IDCT_INVOKE(rtcd, idct16x16)(input_dqcoeff, output_coeff, pitch);
 }
 
-void vp9_inverse_transform_mby_16x16(const vp8_idct_rtcd_vtable_t *rtcd,
+void vp9_inverse_transform_mby_16x16(const vp9_idct_rtcd_vtable_t *rtcd,
                                      MACROBLOCKD *xd) {
   vp9_inverse_transform_b_16x16(rtcd, &xd->block[0].dqcoeff[0],
                                 &xd->block[0].diff[0], 32);
 }
 
-void vp9_inverse_transform_mb_16x16(const vp8_idct_rtcd_vtable_t *rtcd,
+void vp9_inverse_transform_mb_16x16(const vp9_idct_rtcd_vtable_t *rtcd,
                                     MACROBLOCKD *xd) {
   vp9_inverse_transform_mby_16x16(rtcd, xd);
   vp9_inverse_transform_mbuv_8x8(rtcd, xd);
diff --git a/vp8/common/invtrans.h b/vp8/common/invtrans.h
index c0ca9e1..00dc815 100644
--- a/vp8/common/invtrans.h
+++ b/vp8/common/invtrans.h
@@ -16,19 +16,19 @@
 #include "idct.h"
 #include "blockd.h"
 
-extern void vp9_inverse_transform_b_4x4(const vp8_idct_rtcd_vtable_t *rtcd, BLOCKD *b, int pitch);
-extern void vp9_inverse_transform_mb_4x4(const vp8_idct_rtcd_vtable_t *rtcd, MACROBLOCKD *xd);
-extern void vp9_inverse_transform_mby_4x4(const vp8_idct_rtcd_vtable_t *rtcd, MACROBLOCKD *xd);
-extern void vp9_inverse_transform_mbuv_4x4(const vp8_idct_rtcd_vtable_t *rtcd, MACROBLOCKD *xd);
+extern void vp9_inverse_transform_b_4x4(const vp9_idct_rtcd_vtable_t *rtcd, BLOCKD *b, int pitch);
+extern void vp9_inverse_transform_mb_4x4(const vp9_idct_rtcd_vtable_t *rtcd, MACROBLOCKD *xd);
+extern void vp9_inverse_transform_mby_4x4(const vp9_idct_rtcd_vtable_t *rtcd, MACROBLOCKD *xd);
+extern void vp9_inverse_transform_mbuv_4x4(const vp9_idct_rtcd_vtable_t *rtcd, MACROBLOCKD *xd);
 
-extern void vp9_inverse_transform_b_8x8(const vp8_idct_rtcd_vtable_t *rtcd, short *input_dqcoeff, short *output_coeff, int pitch);
-extern void vp9_inverse_transform_mb_8x8(const vp8_idct_rtcd_vtable_t *rtcd, MACROBLOCKD *xd);
-extern void vp9_inverse_transform_mby_8x8(const vp8_idct_rtcd_vtable_t *rtcd, MACROBLOCKD *xd);
-extern void vp9_inverse_transform_mbuv_8x8(const vp8_idct_rtcd_vtable_t *rtcd, MACROBLOCKD *xd);
+extern void vp9_inverse_transform_b_8x8(const vp9_idct_rtcd_vtable_t *rtcd, short *input_dqcoeff, short *output_coeff, int pitch);
+extern void vp9_inverse_transform_mb_8x8(const vp9_idct_rtcd_vtable_t *rtcd, MACROBLOCKD *xd);
+extern void vp9_inverse_transform_mby_8x8(const vp9_idct_rtcd_vtable_t *rtcd, MACROBLOCKD *xd);
+extern void vp9_inverse_transform_mbuv_8x8(const vp9_idct_rtcd_vtable_t *rtcd, MACROBLOCKD *xd);
 
-extern void vp9_inverse_transform_b_16x16(const vp8_idct_rtcd_vtable_t *rtcd,
+extern void vp9_inverse_transform_b_16x16(const vp9_idct_rtcd_vtable_t *rtcd,
                                           short *input_dqcoeff, short *output_coeff,
                                           int pitch);
-extern void vp9_inverse_transform_mb_16x16(const vp8_idct_rtcd_vtable_t *rtcd, MACROBLOCKD *xd);
-extern void vp9_inverse_transform_mby_16x16(const vp8_idct_rtcd_vtable_t *rtcd, MACROBLOCKD *xd);
+extern void vp9_inverse_transform_mb_16x16(const vp9_idct_rtcd_vtable_t *rtcd, MACROBLOCKD *xd);
+extern void vp9_inverse_transform_mby_16x16(const vp9_idct_rtcd_vtable_t *rtcd, MACROBLOCKD *xd);
 #endif
diff --git a/vp8/common/loopfilter.c b/vp8/common/loopfilter.c
index 16e75e9..25ab308 100644
--- a/vp8/common/loopfilter.c
+++ b/vp8/common/loopfilter.c
@@ -207,7 +207,7 @@
   u_ptr = post->u_buffer;
   v_ptr = post->v_buffer;
 
-  /* vp8_filter each macro block */
+  /* vp9_filter each macro block */
   for (mb_row = 0; mb_row < cm->mb_rows; mb_row++) {
     for (mb_col = 0; mb_col < cm->mb_cols; mb_col++) {
       int skip_lf = (mode_info_context->mbmi.mode != B_PRED &&
@@ -277,11 +277,11 @@
                    mode_info_context[-1].mbmi.mb_skip_coeff)
 #endif
               )
-            vp8_loop_filter_simple_mbv(y_ptr, post->y_stride,
+            vp9_loop_filter_simple_mbv(y_ptr, post->y_stride,
                                        lfi_n->mblim[filter_level]);
 
           if (!skip_lf)
-            vp8_loop_filter_simple_bv(y_ptr, post->y_stride,
+            vp9_loop_filter_simple_bv(y_ptr, post->y_stride,
                                       lfi_n->blim[filter_level]);
 
           /* don't apply across umv border */
@@ -292,11 +292,11 @@
                    mode_info_context[-cm->mode_info_stride].mbmi.mb_skip_coeff)
 #endif
               )
-            vp8_loop_filter_simple_mbh(y_ptr, post->y_stride,
+            vp9_loop_filter_simple_mbh(y_ptr, post->y_stride,
                                        lfi_n->mblim[filter_level]);
 
           if (!skip_lf)
-            vp8_loop_filter_simple_bh(y_ptr, post->y_stride,
+            vp9_loop_filter_simple_bh(y_ptr, post->y_stride,
                                       lfi_n->blim[filter_level]);
         }
       }
@@ -348,7 +348,7 @@
   /* Set up the buffer pointers */
   y_ptr = post->y_buffer;
 
-  /* vp8_filter each macro block */
+  /* vp9_filter each macro block */
   for (mb_row = 0; mb_row < cm->mb_rows; mb_row++) {
     for (mb_col = 0; mb_col < cm->mb_cols; mb_col++) {
       int skip_lf = (mode_info_context->mbmi.mode != B_PRED &&
@@ -393,20 +393,20 @@
         } else {
           // FIXME: Not 8x8 aware
           if (mb_col > 0)
-            vp8_loop_filter_simple_mbv(y_ptr, post->y_stride,
+            vp9_loop_filter_simple_mbv(y_ptr, post->y_stride,
                                        lfi_n->mblim[filter_level]);
 
           if (!skip_lf)
-            vp8_loop_filter_simple_bv(y_ptr, post->y_stride,
+            vp9_loop_filter_simple_bv(y_ptr, post->y_stride,
                                       lfi_n->blim[filter_level]);
 
           /* don't apply across umv border */
           if (mb_row > 0)
-            vp8_loop_filter_simple_mbh(y_ptr, post->y_stride,
+            vp9_loop_filter_simple_mbh(y_ptr, post->y_stride,
                                        lfi_n->mblim[filter_level]);
 
           if (!skip_lf)
-            vp8_loop_filter_simple_bh(y_ptr, post->y_stride,
+            vp9_loop_filter_simple_bh(y_ptr, post->y_stride,
                                       lfi_n->blim[filter_level]);
         }
       }
@@ -481,7 +481,7 @@
   /* Set up the buffer pointers */
   y_ptr = post->y_buffer + (post->y_height >> 5) * 16 * post->y_stride;
 
-  /* vp8_filter each macro block */
+  /* vp9_filter each macro block */
   for (mb_row = 0; mb_row < (linestocopy >> 4); mb_row++) {
     for (mb_col = 0; mb_col < mb_cols; mb_col++) {
       int skip_lf = (mode_info_context->mbmi.mode != B_PRED &&
@@ -514,18 +514,18 @@
             vp9_loop_filter_bh(y_ptr, 0, 0, post->y_stride, 0, &lfi);
         } else {
           if (mb_col > 0)
-            vp8_loop_filter_simple_mbv (y_ptr, post->y_stride,
+            vp9_loop_filter_simple_mbv (y_ptr, post->y_stride,
                                         lfi_n->mblim[filter_level]);
 
           if (!skip_lf)
-            vp8_loop_filter_simple_bv(y_ptr, post->y_stride,
+            vp9_loop_filter_simple_bv(y_ptr, post->y_stride,
                                       lfi_n->blim[filter_level]);
 
-          vp8_loop_filter_simple_mbh(y_ptr, post->y_stride,
+          vp9_loop_filter_simple_mbh(y_ptr, post->y_stride,
                                      lfi_n->mblim[filter_level]);
 
           if (!skip_lf)
-            vp8_loop_filter_simple_bh(y_ptr, post->y_stride,
+            vp9_loop_filter_simple_bh(y_ptr, post->y_stride,
                                       lfi_n->blim[filter_level]);
         }
       }
diff --git a/vp8/common/loopfilter_filters.c b/vp8/common/loopfilter_filters.c
index 0882b8f..9808287 100644
--- a/vp8/common/loopfilter_filters.c
+++ b/vp8/common/loopfilter_filters.c
@@ -14,7 +14,7 @@
 
 typedef unsigned char uc;
 
-static __inline signed char vp8_signed_char_clamp(int t) {
+static __inline signed char signed_char_clamp(int t) {
   t = (t < -128 ? -128 : t);
   t = (t > 127 ? 127 : t);
   return (signed char) t;
@@ -22,9 +22,9 @@
 
 
 /* should we apply any filter at all ( 11111111 yes, 00000000 no) */
-static __inline signed char vp8_filter_mask(uc limit, uc blimit,
-                                            uc p3, uc p2, uc p1, uc p0,
-                                            uc q0, uc q1, uc q2, uc q3) {
+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;
   mask |= (abs(p3 - p2) > limit) * -1;
   mask |= (abs(p2 - p1) > limit) * -1;
@@ -38,20 +38,20 @@
 }
 
 /* is there high variance internal edge ( 11111111 yes, 00000000 no) */
-static __inline signed char vp8_hevmask(uc thresh, uc p1, uc p0, uc q0, uc q1) {
+static __inline signed char hevmask(uc thresh, uc p1, uc p0, uc q0, uc q1) {
   signed char hev = 0;
   hev  |= (abs(p1 - p0) > thresh) * -1;
   hev  |= (abs(q1 - q0) > thresh) * -1;
   return hev;
 }
 
-static __inline void vp8_filter(signed char mask, uc hev, uc *op1,
-                                uc *op0, uc *oq0, uc *oq1)
+static __inline void filter(signed char mask, uc hev, uc *op1,
+                            uc *op0, uc *oq0, uc *oq1)
 
 {
   signed char ps0, qs0;
   signed char ps1, qs1;
-  signed char vp8_filter, Filter1, Filter2;
+  signed char filter, Filter1, Filter2;
   signed char u;
 
   ps1 = (signed char) * op1 ^ 0x80;
@@ -60,35 +60,35 @@
   qs1 = (signed char) * oq1 ^ 0x80;
 
   /* add outer taps if we have high edge variance */
-  vp8_filter = vp8_signed_char_clamp(ps1 - qs1);
-  vp8_filter &= hev;
+  filter = signed_char_clamp(ps1 - qs1);
+  filter &= hev;
 
   /* inner taps */
-  vp8_filter = vp8_signed_char_clamp(vp8_filter + 3 * (qs0 - ps0));
-  vp8_filter &= mask;
+  filter = signed_char_clamp(filter + 3 * (qs0 - ps0));
+  filter &= mask;
 
   /* save bottom 3 bits so that we round one side +4 and the other +3
    * if it equals 4 we'll set to adjust by -1 to account for the fact
    * we'd round 3 the other way
    */
-  Filter1 = vp8_signed_char_clamp(vp8_filter + 4);
-  Filter2 = vp8_signed_char_clamp(vp8_filter + 3);
+  Filter1 = signed_char_clamp(filter + 4);
+  Filter2 = signed_char_clamp(filter + 3);
   Filter1 >>= 3;
   Filter2 >>= 3;
-  u = vp8_signed_char_clamp(qs0 - Filter1);
+  u = signed_char_clamp(qs0 - Filter1);
   *oq0 = u ^ 0x80;
-  u = vp8_signed_char_clamp(ps0 + Filter2);
+  u = signed_char_clamp(ps0 + Filter2);
   *op0 = u ^ 0x80;
-  vp8_filter = Filter1;
+  filter = Filter1;
 
   /* outer tap adjustments */
-  vp8_filter += 1;
-  vp8_filter >>= 1;
-  vp8_filter &= ~hev;
+  filter += 1;
+  filter >>= 1;
+  filter &= ~hev;
 
-  u = vp8_signed_char_clamp(qs1 - vp8_filter);
+  u = signed_char_clamp(qs1 - filter);
   *oq1 = u ^ 0x80;
-  u = vp8_signed_char_clamp(ps1 + vp8_filter);
+  u = signed_char_clamp(ps1 + filter);
   *op1 = u ^ 0x80;
 
 }
@@ -110,13 +110,13 @@
    * of 8 bit simd instructions.
    */
   do {
-    mask = vp8_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]);
+    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]);
 
-    hev = vp8_hevmask(thresh[0], s[-2 * p], s[-1 * p], s[0 * p], s[1 * p]);
+    hev = hevmask(thresh[0], s[-2 * p], s[-1 * p], s[0 * p], s[1 * p]);
 
-    vp8_filter(mask, hev, s - 2 * p, s - 1 * p, s, s + 1 * p);
+    filter(mask, hev, s - 2 * p, s - 1 * p, s, s + 1 * p);
 
     ++s;
   } while (++i < count * 8);
@@ -139,20 +139,20 @@
    * of 8 bit simd instructions.
    */
   do {
-    mask = vp8_filter_mask(limit[0], blimit[0],
-                           s[-4], s[-3], s[-2], s[-1],
-                           s[0], s[1], s[2], s[3]);
+    mask = filter_mask(limit[0], blimit[0],
+                       s[-4], s[-3], s[-2], s[-1],
+                       s[0], s[1], s[2], s[3]);
 
-    hev = vp8_hevmask(thresh[0], s[-2], s[-1], s[0], s[1]);
+    hev = hevmask(thresh[0], s[-2], s[-1], s[0], s[1]);
 
-    vp8_filter(mask, hev, s - 2, s - 1, s, s + 1);
+    filter(mask, hev, s - 2, s - 1, s, s + 1);
 
     s += p;
   } while (++i < count * 8);
 }
-static __inline signed char vp8_flatmask(uc thresh,
-                                         uc p4, uc p3, uc p2, uc p1, uc p0,
-                                         uc q0, uc q1, uc q2, uc q3, uc q4) {
+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;
   flat |= (abs(p1 - p0) > 1) * -1;
   flat |= (abs(q1 - q0) > 1) * -1;
@@ -166,9 +166,9 @@
   return flat;
 }
 
-static __inline void vp8_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(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) {
   /* use a 7 tap filter [1, 1, 1, 2, 1, 1, 1] for flat line */
   if (flat && mask) {
     unsigned char p0, q0;
@@ -197,7 +197,7 @@
   } else {
     signed char ps0, qs0;
     signed char ps1, qs1;
-    signed char vp8_filter, Filter1, Filter2;
+    signed char filter, Filter1, Filter2;
     signed char u;
 
     ps1 = (signed char) * op1 ^ 0x80;
@@ -206,32 +206,32 @@
     qs1 = (signed char) * oq1 ^ 0x80;
 
     /* add outer taps if we have high edge variance */
-    vp8_filter = vp8_signed_char_clamp(ps1 - qs1);
-    vp8_filter &= hev;
+    filter = signed_char_clamp(ps1 - qs1);
+    filter &= hev;
 
     /* inner taps */
-    vp8_filter = vp8_signed_char_clamp(vp8_filter + 3 * (qs0 - ps0));
-    vp8_filter &= mask;
+    filter = signed_char_clamp(filter + 3 * (qs0 - ps0));
+    filter &= mask;
 
-    Filter1 = vp8_signed_char_clamp(vp8_filter + 4);
-    Filter2 = vp8_signed_char_clamp(vp8_filter + 3);
+    Filter1 = signed_char_clamp(filter + 4);
+    Filter2 = signed_char_clamp(filter + 3);
     Filter1 >>= 3;
     Filter2 >>= 3;
 
-    u = vp8_signed_char_clamp(qs0 - Filter1);
+    u = signed_char_clamp(qs0 - Filter1);
     *oq0 = u ^ 0x80;
-    u = vp8_signed_char_clamp(ps0 + Filter2);
+    u = signed_char_clamp(ps0 + Filter2);
     *op0 = u ^ 0x80;
-    vp8_filter = Filter1;
+    filter = Filter1;
 
     /* outer tap adjustments */
-    vp8_filter += 1;
-    vp8_filter >>= 1;
-    vp8_filter &= ~hev;
+    filter += 1;
+    filter >>= 1;
+    filter &= ~hev;
 
-    u = vp8_signed_char_clamp(qs1 - vp8_filter);
+    u = signed_char_clamp(qs1 - filter);
     *oq1 = u ^ 0x80;
-    u = vp8_signed_char_clamp(ps1 + vp8_filter);
+    u = signed_char_clamp(ps1 + filter);
     *op1 = u ^ 0x80;
   }
 }
@@ -254,18 +254,18 @@
    */
   do {
 
-    mask = vp8_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]);
+    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]);
 
-    hev = vp8_hevmask(thresh[0], s[-2 * p], s[-1 * p], s[0 * p], s[1 * p]);
+    hev = hevmask(thresh[0], s[-2 * p], s[-1 * p], s[0 * p], s[1 * p]);
 
-    flat = vp8_flatmask(thresh[0],
-                        s[-5 * p], s[-4 * p], s[-3 * p], s[-2 * p], s[-1 * p],
-                        s[ 0 * p], s[ 1 * p], s[ 2 * p], s[ 3 * p], s[ 4 * p]);
-    vp8_mbfilter(mask, hev, flat,
-                 s - 5 * p, s - 4 * p, s - 3 * p, s - 2 * p, s - 1 * p,
-                 s,       s + 1 * p, s + 2 * p, s + 3 * p, s + 4 * p);
+    flat = flatmask(thresh[0],
+                    s[-5 * p], s[-4 * p], s[-3 * p], s[-2 * p], s[-1 * p],
+                    s[ 0 * p], s[ 1 * p], s[ 2 * p], s[ 3 * p], s[ 4 * p]);
+    mbfilter(mask, hev, flat,
+             s - 5 * p, s - 4 * p, s - 3 * p, s - 2 * p, s - 1 * p,
+             s,       s + 1 * p, s + 2 * p, s + 3 * p, s + 4 * p);
 
     ++s;
   } while (++i < count * 8);
@@ -287,26 +287,26 @@
 
   do {
 
-    mask = vp8_filter_mask(limit[0], blimit[0],
-                           s[-4], s[-3], s[-2], s[-1],
-                           s[0], s[1], s[2], s[3]);
+    mask = filter_mask(limit[0], blimit[0],
+                       s[-4], s[-3], s[-2], s[-1],
+                       s[0], s[1], s[2], s[3]);
 
-    hev = vp8_hevmask(thresh[0], s[-2], s[-1], s[0], s[1]);
-    flat = vp8_flatmask(thresh[0],
-                        s[-5], s[-4], s[-3], s[-2], s[-1],
-                        s[ 0], s[ 1], s[ 2], s[ 3], s[ 4]);
-    vp8_mbfilter(mask, hev, flat,
-                 s - 5, s - 4, s - 3, s - 2, s - 1,
-                 s,     s + 1, s + 2, s + 3, s + 4);
+    hev = hevmask(thresh[0], s[-2], s[-1], s[0], s[1]);
+    flat = flatmask(thresh[0],
+                    s[-5], s[-4], s[-3], s[-2], s[-1],
+                    s[ 0], s[ 1], s[ 2], s[ 3], s[ 4]);
+    mbfilter(mask, hev, flat,
+             s - 5, s - 4, s - 3, s - 2, s - 1,
+             s,     s + 1, s + 2, s + 3, s + 4);
     s += p;
   } while (++i < count * 8);
 
 }
 
 /* should we apply any filter at all ( 11111111 yes, 00000000 no) */
-static __inline signed char vp8_simple_filter_mask(uc blimit,
-                                                   uc p1, uc p0,
-                                                   uc q0, uc q1) {
+static __inline signed char simple_filter_mask(uc blimit,
+                                               uc p1, uc p0,
+                                               uc q0, uc q1) {
   /* Why does this cause problems for win32?
    * error C2143: syntax error : missing ';' before 'type'
    *  (void) limit;
@@ -315,29 +315,29 @@
   return mask;
 }
 
-static __inline void vp8_simple_filter(signed char mask,
-                                       uc *op1, uc *op0,
-                                       uc *oq0, uc *oq1) {
-  signed char vp8_filter, Filter1, Filter2;
+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;
 
-  vp8_filter = vp8_signed_char_clamp(p1 - q1);
-  vp8_filter = vp8_signed_char_clamp(vp8_filter + 3 * (q0 - p0));
-  vp8_filter &= mask;
+  filter = signed_char_clamp(p1 - q1);
+  filter = signed_char_clamp(filter + 3 * (q0 - p0));
+  filter &= mask;
 
   /* save bottom 3 bits so that we round one side +4 and the other +3 */
-  Filter1 = vp8_signed_char_clamp(vp8_filter + 4);
+  Filter1 = signed_char_clamp(filter + 4);
   Filter1 >>= 3;
-  u = vp8_signed_char_clamp(q0 - Filter1);
+  u = signed_char_clamp(q0 - Filter1);
   *oq0  = u ^ 0x80;
 
-  Filter2 = vp8_signed_char_clamp(vp8_filter + 3);
+  Filter2 = signed_char_clamp(filter + 3);
   Filter2 >>= 3;
-  u = vp8_signed_char_clamp(p0 + Filter2);
+  u = signed_char_clamp(p0 + Filter2);
   *op0 = u ^ 0x80;
 }
 
@@ -351,12 +351,12 @@
   int i = 0;
 
   do {
-    mask = vp8_simple_filter_mask(blimit[0],
-                                  s[-2 * p], s[-1 * p],
-                                  s[0 * p], s[1 * p]);
-    vp8_simple_filter(mask,
-                      s - 2 * p, s - 1 * p,
-                      s, s + 1 * p);
+    mask = simple_filter_mask(blimit[0],
+                              s[-2 * p], s[-1 * p],
+                              s[0 * p], s[1 * p]);
+    simple_filter(mask,
+                  s - 2 * p, s - 1 * p,
+                  s, s + 1 * p);
     ++s;
   } while (++i < 16);
 }
@@ -371,8 +371,8 @@
   int i = 0;
 
   do {
-    mask = vp8_simple_filter_mask(blimit[0], s[-2], s[-1], s[0], s[1]);
-    vp8_simple_filter(mask, s - 2, s - 1, s, s + 1);
+    mask = simple_filter_mask(blimit[0], s[-2], s[-1], s[0], s[1]);
+    simple_filter(mask, s - 2, s - 1, s, s + 1);
     s += p;
   } while (++i < 16);
 
diff --git a/vp8/common/modecontext.c b/vp8/common/modecontext.c
index 412f558..37796d8 100644
--- a/vp8/common/modecontext.c
+++ b/vp8/common/modecontext.c
@@ -11,7 +11,7 @@
 
 #include "entropymode.h"
 
-const unsigned int vp9_kf_default_bmode_counts[VP8_BINTRAMODES][VP8_BINTRAMODES][VP8_BINTRAMODES] = {
+const unsigned int vp9_kf_default_bmode_counts[VP9_BINTRAMODES][VP9_BINTRAMODES][VP9_BINTRAMODES] = {
   {
     /*Above Mode :  0*/
     { 43438,   2195,    470,    316,    615,    171,    217,    412,    124,    160, }, /* left_mode 0 */
diff --git a/vp8/common/onyx.h b/vp8/common/onyx.h
index 38034b8..0f84e8c 100644
--- a/vp8/common/onyx.h
+++ b/vp8/common/onyx.h
@@ -9,8 +9,8 @@
  */
 
 
-#ifndef __INC_VP8_H
-#define __INC_VP8_H
+#ifndef __INC_ONYX_H
+#define __INC_ONYX_H
 
 #ifdef __cplusplus
 extern "C"
@@ -35,10 +35,10 @@
   } VPX_SCALING;
 
   typedef enum {
-    VP8_LAST_FLAG = 1,
-    VP8_GOLD_FLAG = 2,
-    VP8_ALT_FLAG = 4
-  } VP8_REFFRAME;
+    VP9_LAST_FLAG = 1,
+    VP9_GOLD_FLAG = 2,
+    VP9_ALT_FLAG = 4
+  } VP9_REFFRAME;
 
 
   typedef enum {
@@ -169,16 +169,15 @@
     struct vpx_codec_pkt_list  *output_pkt_list;
 
     vp8e_tuning tuning;
-  } VP8_CONFIG;
+  } VP9_CONFIG;
 
 
   void vp9_initialize_enc();
 
-  VP9_PTR vp9_create_compressor(VP8_CONFIG *oxcf);
+  VP9_PTR vp9_create_compressor(VP9_CONFIG *oxcf);
   void vp9_remove_compressor(VP9_PTR *comp);
 
-  void vp8_init_config(VP9_PTR onyx, VP8_CONFIG *oxcf);
-  void vp9_change_config(VP9_PTR onyx, VP8_CONFIG *oxcf);
+  void vp9_change_config(VP9_PTR onyx, VP9_CONFIG *oxcf);
 
 // receive a frames worth of data caller can assume that a copy of this frame is made
 // and not just a copy of the pointer..
@@ -192,16 +191,16 @@
                               int flush);
 
   int vp9_get_preview_raw_frame(VP9_PTR comp, YV12_BUFFER_CONFIG *dest,
-                                vp8_ppflags_t *flags);
+                                vp9_ppflags_t *flags);
 
   int vp9_use_as_reference(VP9_PTR comp, int ref_frame_flags);
 
   int vp9_update_reference(VP9_PTR comp, int ref_frame_flags);
 
-  int vp9_get_reference_enc(VP9_PTR comp, VP8_REFFRAME ref_frame_flag,
+  int vp9_get_reference_enc(VP9_PTR comp, VP9_REFFRAME ref_frame_flag,
                             YV12_BUFFER_CONFIG *sd);
 
-  int vp9_set_reference_enc(VP9_PTR comp, VP8_REFFRAME ref_frame_flag,
+  int vp9_set_reference_enc(VP9_PTR comp, VP9_REFFRAME ref_frame_flag,
                             YV12_BUFFER_CONFIG *sd);
 
   int vp9_update_entropy(VP9_PTR comp, int update);
@@ -223,4 +222,4 @@
 }
 #endif
 
-#endif
+#endif  // __INC_ONYX_H
diff --git a/vp8/common/onyxc_int.h b/vp8/common/onyxc_int.h
index 342d1e2..c85c7ef 100644
--- a/vp8/common/onyxc_int.h
+++ b/vp8/common/onyxc_int.h
@@ -9,8 +9,8 @@
  */
 
 
-#ifndef __INC_VP8C_INT_H
-#define __INC_VP8C_INT_H
+#ifndef __INC_ONYXC_INT_H
+#define __INC_ONYXC_INT_H
 
 #include "vpx_config.h"
 #include "vpx/internal/vpx_codec_internal.h"
@@ -44,47 +44,47 @@
 #define COMP_PRED_CONTEXTS   2
 
 typedef struct frame_contexts {
-  vp8_prob bmode_prob [VP8_BINTRAMODES - 1];
-  vp8_prob ymode_prob [VP8_YMODES - 1]; /* interframe intra mode probs */
-  vp8_prob uv_mode_prob [VP8_YMODES][VP8_UV_MODES - 1];
-  vp8_prob i8x8_mode_prob [VP8_I8X8_MODES - 1];
-  vp8_prob sub_mv_ref_prob [SUBMVREF_COUNT][VP8_SUBMVREFS - 1];
-  vp8_prob mbsplit_prob [VP8_NUMMBSPLITS - 1];
-  vp8_prob coef_probs [BLOCK_TYPES] [COEF_BANDS] [PREV_COEF_CONTEXTS] [ENTROPY_NODES];
-  vp8_prob hybrid_coef_probs [BLOCK_TYPES] [COEF_BANDS] [PREV_COEF_CONTEXTS] [ENTROPY_NODES];
-  vp8_prob coef_probs_8x8 [BLOCK_TYPES_8X8] [COEF_BANDS] [PREV_COEF_CONTEXTS] [ENTROPY_NODES];
-  vp8_prob hybrid_coef_probs_8x8 [BLOCK_TYPES_8X8] [COEF_BANDS] [PREV_COEF_CONTEXTS] [ENTROPY_NODES];
-  vp8_prob coef_probs_16x16 [BLOCK_TYPES_16X16] [COEF_BANDS] [PREV_COEF_CONTEXTS] [ENTROPY_NODES];
-  vp8_prob hybrid_coef_probs_16x16 [BLOCK_TYPES_16X16] [COEF_BANDS] [PREV_COEF_CONTEXTS] [ENTROPY_NODES];
+  vp9_prob bmode_prob [VP9_BINTRAMODES - 1];
+  vp9_prob ymode_prob [VP9_YMODES - 1]; /* interframe intra mode probs */
+  vp9_prob uv_mode_prob [VP9_YMODES][VP9_UV_MODES - 1];
+  vp9_prob i8x8_mode_prob [VP9_I8X8_MODES - 1];
+  vp9_prob sub_mv_ref_prob [SUBMVREF_COUNT][VP9_SUBMVREFS - 1];
+  vp9_prob mbsplit_prob [VP9_NUMMBSPLITS - 1];
+  vp9_prob coef_probs [BLOCK_TYPES] [COEF_BANDS] [PREV_COEF_CONTEXTS] [ENTROPY_NODES];
+  vp9_prob hybrid_coef_probs [BLOCK_TYPES] [COEF_BANDS] [PREV_COEF_CONTEXTS] [ENTROPY_NODES];
+  vp9_prob coef_probs_8x8 [BLOCK_TYPES_8X8] [COEF_BANDS] [PREV_COEF_CONTEXTS] [ENTROPY_NODES];
+  vp9_prob hybrid_coef_probs_8x8 [BLOCK_TYPES_8X8] [COEF_BANDS] [PREV_COEF_CONTEXTS] [ENTROPY_NODES];
+  vp9_prob coef_probs_16x16 [BLOCK_TYPES_16X16] [COEF_BANDS] [PREV_COEF_CONTEXTS] [ENTROPY_NODES];
+  vp9_prob hybrid_coef_probs_16x16 [BLOCK_TYPES_16X16] [COEF_BANDS] [PREV_COEF_CONTEXTS] [ENTROPY_NODES];
 
   nmv_context nmvc;
   nmv_context pre_nmvc;
-  vp8_prob pre_bmode_prob [VP8_BINTRAMODES - 1];
-  vp8_prob pre_ymode_prob [VP8_YMODES - 1]; /* interframe intra mode probs */
-  vp8_prob pre_uv_mode_prob [VP8_YMODES][VP8_UV_MODES - 1];
-  vp8_prob pre_i8x8_mode_prob [VP8_I8X8_MODES - 1];
-  vp8_prob pre_sub_mv_ref_prob [SUBMVREF_COUNT][VP8_SUBMVREFS - 1];
-  vp8_prob pre_mbsplit_prob [VP8_NUMMBSPLITS - 1];
-  unsigned int bmode_counts [VP8_BINTRAMODES];
-  unsigned int ymode_counts [VP8_YMODES];   /* interframe intra mode probs */
-  unsigned int uv_mode_counts [VP8_YMODES][VP8_UV_MODES];
-  unsigned int i8x8_mode_counts [VP8_I8X8_MODES];   /* interframe intra mode probs */
-  unsigned int sub_mv_ref_counts [SUBMVREF_COUNT][VP8_SUBMVREFS];
-  unsigned int mbsplit_counts [VP8_NUMMBSPLITS];
+  vp9_prob pre_bmode_prob [VP9_BINTRAMODES - 1];
+  vp9_prob pre_ymode_prob [VP9_YMODES - 1]; /* interframe intra mode probs */
+  vp9_prob pre_uv_mode_prob [VP9_YMODES][VP9_UV_MODES - 1];
+  vp9_prob pre_i8x8_mode_prob [VP9_I8X8_MODES - 1];
+  vp9_prob pre_sub_mv_ref_prob [SUBMVREF_COUNT][VP9_SUBMVREFS - 1];
+  vp9_prob pre_mbsplit_prob [VP9_NUMMBSPLITS - 1];
+  unsigned int bmode_counts [VP9_BINTRAMODES];
+  unsigned int ymode_counts [VP9_YMODES];   /* interframe intra mode probs */
+  unsigned int uv_mode_counts [VP9_YMODES][VP9_UV_MODES];
+  unsigned int i8x8_mode_counts [VP9_I8X8_MODES];   /* interframe intra mode probs */
+  unsigned int sub_mv_ref_counts [SUBMVREF_COUNT][VP9_SUBMVREFS];
+  unsigned int mbsplit_counts [VP9_NUMMBSPLITS];
 
-  vp8_prob pre_coef_probs [BLOCK_TYPES] [COEF_BANDS]
+  vp9_prob pre_coef_probs [BLOCK_TYPES] [COEF_BANDS]
       [PREV_COEF_CONTEXTS] [ENTROPY_NODES];
-  vp8_prob pre_hybrid_coef_probs [BLOCK_TYPES] [COEF_BANDS]
+  vp9_prob pre_hybrid_coef_probs [BLOCK_TYPES] [COEF_BANDS]
       [PREV_COEF_CONTEXTS] [ENTROPY_NODES];
 
-  vp8_prob pre_coef_probs_8x8 [BLOCK_TYPES_8X8] [COEF_BANDS]
+  vp9_prob pre_coef_probs_8x8 [BLOCK_TYPES_8X8] [COEF_BANDS]
       [PREV_COEF_CONTEXTS] [ENTROPY_NODES];
-  vp8_prob pre_hybrid_coef_probs_8x8 [BLOCK_TYPES_8X8] [COEF_BANDS]
+  vp9_prob pre_hybrid_coef_probs_8x8 [BLOCK_TYPES_8X8] [COEF_BANDS]
       [PREV_COEF_CONTEXTS] [ENTROPY_NODES];
 
-  vp8_prob pre_coef_probs_16x16 [BLOCK_TYPES_16X16] [COEF_BANDS]
+  vp9_prob pre_coef_probs_16x16 [BLOCK_TYPES_16X16] [COEF_BANDS]
       [PREV_COEF_CONTEXTS] [ENTROPY_NODES];
-  vp8_prob pre_hybrid_coef_probs_16x16 [BLOCK_TYPES_16X16] [COEF_BANDS]
+  vp9_prob pre_hybrid_coef_probs_16x16 [BLOCK_TYPES_16X16] [COEF_BANDS]
       [PREV_COEF_CONTEXTS] [ENTROPY_NODES];
 
   unsigned int coef_counts [BLOCK_TYPES] [COEF_BANDS]
@@ -103,8 +103,8 @@
       [PREV_COEF_CONTEXTS] [MAX_ENTROPY_TOKENS];
 
   nmv_context_counts NMVcount;
-  vp8_prob switchable_interp_prob[VP8_SWITCHABLE_FILTERS + 1]
-                                 [VP8_SWITCHABLE_FILTERS - 1];
+  vp9_prob switchable_interp_prob[VP9_SWITCHABLE_FILTERS + 1]
+                                 [VP9_SWITCHABLE_FILTERS - 1];
 
   int mode_context[6][4];
   int mode_context_a[6][4];
@@ -135,10 +135,10 @@
 
 typedef struct VP9_COMMON_RTCD {
 #if CONFIG_RUNTIME_CPU_DETECT
-  vp8_idct_rtcd_vtable_t        idct;
-  vp8_subpix_rtcd_vtable_t      subpix;
+  vp9_idct_rtcd_vtable_t        idct;
+  vp9_subpix_rtcd_vtable_t      subpix;
 #if CONFIG_POSTPROC
-  vp8_postproc_rtcd_vtable_t    postproc;
+  vp9_postproc_rtcd_vtable_t    postproc;
 #endif
   int                           flags;
 #else
@@ -241,37 +241,37 @@
 
   /* keyframe block modes are predicted by their above, left neighbors */
 
-  vp8_prob kf_bmode_prob [VP8_BINTRAMODES] [VP8_BINTRAMODES] [VP8_BINTRAMODES - 1];
-  vp8_prob kf_ymode_prob[8][VP8_YMODES - 1]; /* keyframe "" */
+  vp9_prob kf_bmode_prob [VP9_BINTRAMODES] [VP9_BINTRAMODES] [VP9_BINTRAMODES - 1];
+  vp9_prob kf_ymode_prob[8][VP9_YMODES - 1]; /* keyframe "" */
 #if CONFIG_SUPERBLOCKS
-  vp8_prob sb_kf_ymode_prob[8][VP8_I32X32_MODES - 1];
+  vp9_prob sb_kf_ymode_prob[8][VP9_I32X32_MODES - 1];
 #endif
   int kf_ymode_probs_index;
   int kf_ymode_probs_update;
-  vp8_prob kf_uv_mode_prob[VP8_YMODES] [VP8_UV_MODES - 1];
+  vp9_prob kf_uv_mode_prob[VP9_YMODES] [VP9_UV_MODES - 1];
 
-  vp8_prob prob_intra_coded;
-  vp8_prob prob_last_coded;
-  vp8_prob prob_gf_coded;
+  vp9_prob prob_intra_coded;
+  vp9_prob prob_last_coded;
+  vp9_prob prob_gf_coded;
 #if CONFIG_SUPERBLOCKS
-  vp8_prob sb_coded;
+  vp9_prob sb_coded;
 #endif
 
   // Context probabilities when using predictive coding of segment id
-  vp8_prob segment_pred_probs[PREDICTION_PROBS];
+  vp9_prob segment_pred_probs[PREDICTION_PROBS];
   unsigned char temporal_update;
 
   // Context probabilities for reference frame prediction
   unsigned char ref_scores[MAX_REF_FRAMES];
-  vp8_prob ref_pred_probs[PREDICTION_PROBS];
-  vp8_prob mod_refprobs[MAX_REF_FRAMES][PREDICTION_PROBS];
+  vp9_prob ref_pred_probs[PREDICTION_PROBS];
+  vp9_prob mod_refprobs[MAX_REF_FRAMES][PREDICTION_PROBS];
 
-  vp8_prob prob_comppred[COMP_PRED_CONTEXTS];
+  vp9_prob prob_comppred[COMP_PRED_CONTEXTS];
 
   // FIXME contextualize
-  vp8_prob prob_tx[TX_SIZE_MAX - 1];
+  vp9_prob prob_tx[TX_SIZE_MAX - 1];
 
-  vp8_prob mbskip_pred_probs[MBSKIP_CONTEXTS];
+  vp9_prob mbskip_pred_probs[MBSKIP_CONTEXTS];
 
   FRAME_CONTEXT lfc_a; /* last alt ref entropy */
   FRAME_CONTEXT lfc; /* last frame entropy */
@@ -288,7 +288,7 @@
   int version;
 
 #ifdef PACKET_TESTING
-  VP8_HEADER oh;
+  VP9_HEADER oh;
 #endif
   double bitrate;
   double framerate;
@@ -306,9 +306,9 @@
   int pred_filter_mode;   // 0=disabled at the frame level (no MB filtered)
   // 1=enabled at the frame level (all MB filtered)
   // 2=specified per MB (1=filtered, 0=non-filtered)
-  vp8_prob prob_pred_filter_off;
+  vp9_prob prob_pred_filter_off;
 #endif
 
 } VP9_COMMON;
 
-#endif
+#endif  // __INC_ONYX_INT_H
diff --git a/vp8/common/onyxd.h b/vp8/common/onyxd.h
index 672c1f5..110c753 100644
--- a/vp8/common/onyxd.h
+++ b/vp8/common/onyxd.h
@@ -9,8 +9,8 @@
  */
 
 
-#ifndef __INC_VP8D_H
-#define __INC_VP8D_H
+#ifndef __INC_ONYXD_H
+#define __INC_ONYXD_H
 
 
 /* Create/destroy static data structures. */
@@ -24,7 +24,7 @@
 #include "vpx_ports/mem.h"
 #include "vpx/vpx_codec.h"
 
-  typedef void   *VP8D_PTR;
+  typedef void   *VP9D_PTR;
   typedef struct {
     int     Width;
     int     Height;
@@ -32,42 +32,37 @@
     int     postprocess;
     int     max_threads;
     int     input_partition;
-  } VP8D_CONFIG;
+  } VP9D_CONFIG;
   typedef enum {
-    VP8_LAST_FLAG = 1,
-    VP8_GOLD_FLAG = 2,
-    VP8_ALT_FLAG = 4
-  } VP8_REFFRAME;
-
-  typedef enum {
-    VP8D_OK = 0
-  } VP8D_SETTING;
+    VP9_LAST_FLAG = 1,
+    VP9_GOLD_FLAG = 2,
+    VP9_ALT_FLAG = 4
+  } VP9_REFFRAME;
 
   void vp9_initialize_dec(void);
 
-  int vp9_receive_compressed_data(VP8D_PTR comp, unsigned long size,
+  int vp9_receive_compressed_data(VP9D_PTR comp, unsigned long size,
                                   const unsigned char *dest,
                                   int64_t time_stamp);
 
-  int vp9_get_raw_frame(VP8D_PTR comp, YV12_BUFFER_CONFIG *sd,
+  int vp9_get_raw_frame(VP9D_PTR comp, YV12_BUFFER_CONFIG *sd,
                         int64_t *time_stamp, int64_t *time_end_stamp,
-                        vp8_ppflags_t *flags);
+                        vp9_ppflags_t *flags);
 
-  vpx_codec_err_t vp9_get_reference_dec(VP8D_PTR comp,
-                                        VP8_REFFRAME ref_frame_flag,
+  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(VP8D_PTR comp,
-                                        VP8_REFFRAME ref_frame_flag,
+  vpx_codec_err_t vp9_set_reference_dec(VP9D_PTR comp,
+                                        VP9_REFFRAME ref_frame_flag,
                                         YV12_BUFFER_CONFIG *sd);
 
-  VP8D_PTR vp9_create_decompressor(VP8D_CONFIG *oxcf);
+  VP9D_PTR vp9_create_decompressor(VP9D_CONFIG *oxcf);
 
-  void vp9_remove_decompressor(VP8D_PTR comp);
+  void vp9_remove_decompressor(VP9D_PTR comp);
 
 #ifdef __cplusplus
 }
 #endif
 
-
-#endif
+#endif  // __INC_ONYXD_H
diff --git a/vp8/common/postproc.c b/vp8/common/postproc.c
index 7ea4236..4dea88b 100644
--- a/vp8/common/postproc.c
+++ b/vp8/common/postproc.c
@@ -124,8 +124,8 @@
 };
 
 
-extern void vp8_blit_text(const char *msg, unsigned char *address, const int pitch);
-extern void vp8_blit_line(int x0, int x1, int y0, int y1, unsigned char *image, const int pitch);
+extern void vp9_blit_text(const char *msg, unsigned char *address, const int pitch);
+extern void vp9_blit_line(int x0, int x1, int y0, int y1, unsigned char *image, const int pitch);
 /***********************************************************************************************************
  */
 void vp9_post_proc_down_and_across_c
@@ -285,13 +285,12 @@
   }
 }
 
-
-static void vp9_deblock_and_de_macro_block(YV12_BUFFER_CONFIG         *source,
-                                           YV12_BUFFER_CONFIG         *post,
-                                           int                         q,
-                                           int                         low_var_thresh,
-                                           int                         flag,
-                                           vp8_postproc_rtcd_vtable_t *rtcd) {
+static void deblock_and_de_macro_block(YV12_BUFFER_CONFIG   *source,
+                                       YV12_BUFFER_CONFIG   *post,
+                                       int                   q,
+                                       int                   low_var_thresh,
+                                       int                   flag,
+                                       vp9_postproc_rtcd_vtable_t *rtcd) {
   double level = 6.0e-05 * q * q * q - .0067 * q * q + .306 * q + .0065;
   int ppl = (int)(level + .5);
   (void) low_var_thresh;
@@ -311,7 +310,7 @@
                  int                         q,
                  int                         low_var_thresh,
                  int                         flag,
-                 vp8_postproc_rtcd_vtable_t *rtcd) {
+                 vp9_postproc_rtcd_vtable_t *rtcd) {
   double level = 6.0e-05 * q * q * q - .0067 * q * q + .306 * q + .0065;
   int ppl = (int)(level + .5);
   (void) low_var_thresh;
@@ -327,7 +326,7 @@
                   int                         q,
                   int                         low_var_thresh,
                   int                         flag,
-                  vp8_postproc_rtcd_vtable_t *rtcd) {
+                  vp9_postproc_rtcd_vtable_t *rtcd) {
   double level = 6.0e-05 * q * q * q - .0067 * q * q + .306 * q + .0065;
   int ppl = (int)(level + .5);
   (void) post;
@@ -364,7 +363,7 @@
          (exp(-(x - mu) * (x - mu) / (2 * sigma * sigma)));
 }
 
-extern void (*vp8_clear_system_state)(void);
+extern void (*vp9_clear_system_state)(void);
 
 
 static void fillrd(struct postproc_state *state, int q, int a) {
@@ -373,7 +372,7 @@
   double sigma;
   int ai = a, qi = q, i;
 
-  vp8_clear_system_state();
+  vp9_clear_system_state();
 
 
   sigma = ai + .5 + .6 * (63 - qi) / 63.0;
@@ -626,7 +625,7 @@
 #define RTCD_VTABLE(oci) NULL
 #endif
 
-int vp9_post_proc_frame(VP9_COMMON *oci, YV12_BUFFER_CONFIG *dest, vp8_ppflags_t *ppflags) {
+int vp9_post_proc_frame(VP9_COMMON *oci, YV12_BUFFER_CONFIG *dest, vp9_ppflags_t *ppflags) {
   int q = oci->filter_level * 10 / 6;
   int flags = ppflags->post_proc_flag;
   int deblock_level = ppflags->deblocking_level;
@@ -653,17 +652,18 @@
   vpx_reset_mmx_state();
 #endif
 
-  if (flags & VP8D_DEMACROBLOCK) {
-    vp9_deblock_and_de_macro_block(oci->frame_to_show, &oci->post_proc_buffer,
-                                   q + (deblock_level - 5) * 10, 1, 0, RTCD_VTABLE(oci));
-  } else if (flags & VP8D_DEBLOCK) {
+  if (flags & VP9D_DEMACROBLOCK) {
+    deblock_and_de_macro_block(oci->frame_to_show, &oci->post_proc_buffer,
+                               q + (deblock_level - 5) * 10, 1, 0,
+                               RTCD_VTABLE(oci));
+  } else if (flags & VP9D_DEBLOCK) {
     vp9_deblock(oci->frame_to_show, &oci->post_proc_buffer,
                 q, 1, 0, RTCD_VTABLE(oci));
   } else {
     vp8_yv12_copy_frame_ptr(oci->frame_to_show, &oci->post_proc_buffer);
   }
 
-  if (flags & VP8D_ADDNOISE) {
+  if (flags & VP9D_ADDNOISE) {
     if (oci->postproc_state.last_q != q
         || oci->postproc_state.last_noise != noise_level) {
       fillrd(&oci->postproc_state, 63 - q, noise_level);
@@ -680,7 +680,7 @@
   }
 
 #if CONFIG_POSTPROC_VISUALIZER
-  if (flags & VP8D_DEBUG_TXT_FRAME_INFO) {
+  if (flags & VP9D_DEBUG_TXT_FRAME_INFO) {
     char message[512];
     sprintf(message, "F%1dG%1dQ%3dF%3dP%d_s%dx%d",
             (oci->frame_type == KEY_FRAME),
@@ -689,10 +689,10 @@
             oci->filter_level,
             flags,
             oci->mb_cols, oci->mb_rows);
-    vp8_blit_text(message, oci->post_proc_buffer.y_buffer, oci->post_proc_buffer.y_stride);
+    vp9_blit_text(message, oci->post_proc_buffer.y_buffer, oci->post_proc_buffer.y_stride);
   }
 
-  if (flags & VP8D_DEBUG_TXT_MBLK_MODES) {
+  if (flags & VP9D_DEBUG_TXT_MBLK_MODES) {
     int i, j;
     unsigned char *y_ptr;
     YV12_BUFFER_CONFIG *post = &oci->post_proc_buffer;
@@ -703,14 +703,14 @@
 
     y_ptr = post->y_buffer + 4 * post->y_stride + 4;
 
-    /* vp8_filter each macro block */
+    /* vp9_filter each macro block */
     for (i = 0; i < mb_rows; i++) {
       for (j = 0; j < mb_cols; j++) {
         char zz[4];
 
         sprintf(zz, "%c", mi[mb_index].mbmi.mode + 'a');
 
-        vp8_blit_text(zz, y_ptr, post->y_stride);
+        vp9_blit_text(zz, y_ptr, post->y_stride);
         mb_index++;
         y_ptr += 16;
       }
@@ -721,7 +721,7 @@
     }
   }
 
-  if (flags & VP8D_DEBUG_TXT_DC_DIFF) {
+  if (flags & VP9D_DEBUG_TXT_DC_DIFF) {
     int i, j;
     unsigned char *y_ptr;
     YV12_BUFFER_CONFIG *post = &oci->post_proc_buffer;
@@ -732,7 +732,7 @@
 
     y_ptr = post->y_buffer + 4 * post->y_stride + 4;
 
-    /* vp8_filter each macro block */
+    /* vp9_filter each macro block */
     for (i = 0; i < mb_rows; i++) {
       for (j = 0; j < mb_cols; j++) {
         char zz[4];
@@ -745,7 +745,7 @@
         else
           sprintf(zz, "%c", dc_diff + '0');
 
-        vp8_blit_text(zz, y_ptr, post->y_stride);
+        vp9_blit_text(zz, y_ptr, post->y_stride);
         mb_index++;
         y_ptr += 16;
       }
@@ -756,14 +756,14 @@
     }
   }
 
-  if (flags & VP8D_DEBUG_TXT_RATE_INFO) {
+  if (flags & VP9D_DEBUG_TXT_RATE_INFO) {
     char message[512];
     sprintf(message, "Bitrate: %10.2f frame_rate: %10.2f ", oci->bitrate, oci->framerate);
-    vp8_blit_text(message, oci->post_proc_buffer.y_buffer, oci->post_proc_buffer.y_stride);
+    vp9_blit_text(message, oci->post_proc_buffer.y_buffer, oci->post_proc_buffer.y_stride);
   }
 
   /* Draw motion vectors */
-  if ((flags & VP8D_DEBUG_DRAW_MV) && ppflags->display_mv_flag) {
+  if ((flags & VP9D_DEBUG_DRAW_MV) && ppflags->display_mv_flag) {
     YV12_BUFFER_CONFIG *post = &oci->post_proc_buffer;
     int width  = post->y_width;
     int height = post->y_height;
@@ -791,7 +791,7 @@
               y1 = y0 + 4 + (mv->row >> 3);
 
               constrain_line(x0 + 8, &x1, y0 + 4, &y1, width, height);
-              vp8_blit_line(x0 + 8,  x1, y0 + 4,  y1, y_buffer, y_stride);
+              vp9_blit_line(x0 + 8,  x1, y0 + 4,  y1, y_buffer, y_stride);
 
               bmi = &mi->bmi[8];
 
@@ -799,7 +799,7 @@
               y1 = y0 + 12 + (mv->row >> 3);
 
               constrain_line(x0 + 8, &x1, y0 + 12, &y1, width, height);
-              vp8_blit_line(x0 + 8,  x1, y0 + 12,  y1, y_buffer, y_stride);
+              vp9_blit_line(x0 + 8,  x1, y0 + 12,  y1, y_buffer, y_stride);
 
               break;
             }
@@ -811,7 +811,7 @@
               y1 = y0 + 8 + (mv->row >> 3);
 
               constrain_line(x0 + 4, &x1, y0 + 8, &y1, width, height);
-              vp8_blit_line(x0 + 4,  x1, y0 + 8,  y1, y_buffer, y_stride);
+              vp9_blit_line(x0 + 4,  x1, y0 + 8,  y1, y_buffer, y_stride);
 
               bmi = &mi->bmi[2];
 
@@ -819,7 +819,7 @@
               y1 = y0 + 8 + (mv->row >> 3);
 
               constrain_line(x0 + 12, &x1, y0 + 8, &y1, width, height);
-              vp8_blit_line(x0 + 12,  x1, y0 + 8,  y1, y_buffer, y_stride);
+              vp9_blit_line(x0 + 12,  x1, y0 + 8,  y1, y_buffer, y_stride);
 
               break;
             }
@@ -831,7 +831,7 @@
               y1 = y0 + 4 + (mv->row >> 3);
 
               constrain_line(x0 + 4, &x1, y0 + 4, &y1, width, height);
-              vp8_blit_line(x0 + 4,  x1, y0 + 4,  y1, y_buffer, y_stride);
+              vp9_blit_line(x0 + 4,  x1, y0 + 4,  y1, y_buffer, y_stride);
 
               bmi = &mi->bmi[2];
 
@@ -839,7 +839,7 @@
               y1 = y0 + 4 + (mv->row >> 3);
 
               constrain_line(x0 + 12, &x1, y0 + 4, &y1, width, height);
-              vp8_blit_line(x0 + 12,  x1, y0 + 4,  y1, y_buffer, y_stride);
+              vp9_blit_line(x0 + 12,  x1, y0 + 4,  y1, y_buffer, y_stride);
 
               bmi = &mi->bmi[8];
 
@@ -847,7 +847,7 @@
               y1 = y0 + 12 + (mv->row >> 3);
 
               constrain_line(x0 + 4, &x1, y0 + 12, &y1, width, height);
-              vp8_blit_line(x0 + 4,  x1, y0 + 12,  y1, y_buffer, y_stride);
+              vp9_blit_line(x0 + 4,  x1, y0 + 12,  y1, y_buffer, y_stride);
 
               bmi = &mi->bmi[10];
 
@@ -855,7 +855,7 @@
               y1 = y0 + 12 + (mv->row >> 3);
 
               constrain_line(x0 + 12, &x1, y0 + 12, &y1, width, height);
-              vp8_blit_line(x0 + 12,  x1, y0 + 12,  y1, y_buffer, y_stride);
+              vp9_blit_line(x0 + 12,  x1, y0 + 12,  y1, y_buffer, y_stride);
               break;
             }
             case PARTITIONING_4X4:
@@ -871,7 +871,7 @@
                   y1 = by0 + 2 + (mv->row >> 3);
 
                   constrain_line(bx0 + 2, &x1, by0 + 2, &y1, width, height);
-                  vp8_blit_line(bx0 + 2,  x1, by0 + 2,  y1, y_buffer, y_stride);
+                  vp9_blit_line(bx0 + 2,  x1, by0 + 2,  y1, y_buffer, y_stride);
 
                   bmi++;
                 }
@@ -888,12 +888,12 @@
 
           if (x1 != lx0 && y1 != ly0) {
             constrain_line(lx0, &x1, ly0 - 1, &y1, width, height);
-            vp8_blit_line(lx0,  x1, ly0 - 1,  y1, y_buffer, y_stride);
+            vp9_blit_line(lx0,  x1, ly0 - 1,  y1, y_buffer, y_stride);
 
             constrain_line(lx0, &x1, ly0 + 1, &y1, width, height);
-            vp8_blit_line(lx0,  x1, ly0 + 1,  y1, y_buffer, y_stride);
+            vp9_blit_line(lx0,  x1, ly0 + 1,  y1, y_buffer, y_stride);
           } else
-            vp8_blit_line(lx0,  x1, ly0,  y1, y_buffer, y_stride);
+            vp9_blit_line(lx0,  x1, ly0,  y1, y_buffer, y_stride);
         }
 
         mi++;
@@ -903,7 +903,7 @@
   }
 
   /* Color in block modes */
-  if ((flags & VP8D_DEBUG_CLR_BLK_MODES)
+  if ((flags & VP9D_DEBUG_CLR_BLK_MODES)
       && (ppflags->display_mb_modes_flag || ppflags->display_b_modes_flag)) {
     int y, x;
     YV12_BUFFER_CONFIG *post = &oci->post_proc_buffer;
@@ -967,7 +967,7 @@
   }
 
   /* Color in frame reference blocks */
-  if ((flags & VP8D_DEBUG_CLR_FRM_REF_BLKS) && ppflags->display_ref_frame_flag) {
+  if ((flags & VP9D_DEBUG_CLR_FRM_REF_BLKS) && ppflags->display_ref_frame_flag) {
     int y, x;
     YV12_BUFFER_CONFIG *post = &oci->post_proc_buffer;
     int width  = post->y_width;
diff --git a/vp8/common/postproc.h b/vp8/common/postproc.h
index f34dd11..226f89d 100644
--- a/vp8/common/postproc.h
+++ b/vp8/common/postproc.h
@@ -40,61 +40,61 @@
 #include "x86/postproc_x86.h"
 #endif
 
-#ifndef vp8_postproc_down
-#define vp8_postproc_down vp9_mbpost_proc_down_c
+#ifndef vp9_postproc_down
+#define vp9_postproc_down vp9_mbpost_proc_down_c
 #endif
-extern prototype_postproc_inplace(vp8_postproc_down);
+extern prototype_postproc_inplace(vp9_postproc_down);
 
-#ifndef vp8_postproc_across
-#define vp8_postproc_across vp9_mbpost_proc_across_ip_c
+#ifndef vp9_postproc_across
+#define vp9_postproc_across vp9_mbpost_proc_across_ip_c
 #endif
-extern prototype_postproc_inplace(vp8_postproc_across);
+extern prototype_postproc_inplace(vp9_postproc_across);
 
-#ifndef vp8_postproc_downacross
-#define vp8_postproc_downacross vp9_post_proc_down_and_across_c
+#ifndef vp9_postproc_downacross
+#define vp9_postproc_downacross vp9_post_proc_down_and_across_c
 #endif
-extern prototype_postproc(vp8_postproc_downacross);
+extern prototype_postproc(vp9_postproc_downacross);
 
-#ifndef vp8_postproc_addnoise
-#define vp8_postproc_addnoise vp9_plane_add_noise_c
+#ifndef vp9_postproc_addnoise
+#define vp9_postproc_addnoise vp9_plane_add_noise_c
 #endif
-extern prototype_postproc_addnoise(vp8_postproc_addnoise);
+extern prototype_postproc_addnoise(vp9_postproc_addnoise);
 
-#ifndef vp8_postproc_blend_mb_inner
-#define vp8_postproc_blend_mb_inner vp9_blend_mb_inner_c
+#ifndef vp9_postproc_blend_mb_inner
+#define vp9_postproc_blend_mb_inner vp9_blend_mb_inner_c
 #endif
-extern prototype_postproc_blend_mb_inner(vp8_postproc_blend_mb_inner);
+extern prototype_postproc_blend_mb_inner(vp9_postproc_blend_mb_inner);
 
-#ifndef vp8_postproc_blend_mb_outer
-#define vp8_postproc_blend_mb_outer vp9_blend_mb_outer_c
+#ifndef vp9_postproc_blend_mb_outer
+#define vp9_postproc_blend_mb_outer vp9_blend_mb_outer_c
 #endif
-extern prototype_postproc_blend_mb_outer(vp8_postproc_blend_mb_outer);
+extern prototype_postproc_blend_mb_outer(vp9_postproc_blend_mb_outer);
 
-#ifndef vp8_postproc_blend_b
-#define vp8_postproc_blend_b vp9_blend_b_c
+#ifndef vp9_postproc_blend_b
+#define vp9_postproc_blend_b vp9_blend_b_c
 #endif
-extern prototype_postproc_blend_b(vp8_postproc_blend_b);
+extern prototype_postproc_blend_b(vp9_postproc_blend_b);
 
-typedef prototype_postproc((*vp8_postproc_fn_t));
-typedef prototype_postproc_inplace((*vp8_postproc_inplace_fn_t));
-typedef prototype_postproc_addnoise((*vp8_postproc_addnoise_fn_t));
-typedef prototype_postproc_blend_mb_inner((*vp8_postproc_blend_mb_inner_fn_t));
-typedef prototype_postproc_blend_mb_outer((*vp8_postproc_blend_mb_outer_fn_t));
-typedef prototype_postproc_blend_b((*vp8_postproc_blend_b_fn_t));
+typedef prototype_postproc((*vp9_postproc_fn_t));
+typedef prototype_postproc_inplace((*vp9_postproc_inplace_fn_t));
+typedef prototype_postproc_addnoise((*vp9_postproc_addnoise_fn_t));
+typedef prototype_postproc_blend_mb_inner((*vp9_postproc_blend_mb_inner_fn_t));
+typedef prototype_postproc_blend_mb_outer((*vp9_postproc_blend_mb_outer_fn_t));
+typedef prototype_postproc_blend_b((*vp9_postproc_blend_b_fn_t));
 typedef struct {
-  vp8_postproc_inplace_fn_t           down;
-  vp8_postproc_inplace_fn_t           across;
-  vp8_postproc_fn_t                   downacross;
-  vp8_postproc_addnoise_fn_t          addnoise;
-  vp8_postproc_blend_mb_inner_fn_t    blend_mb_inner;
-  vp8_postproc_blend_mb_outer_fn_t    blend_mb_outer;
-  vp8_postproc_blend_b_fn_t           blend_b;
-} vp8_postproc_rtcd_vtable_t;
+  vp9_postproc_inplace_fn_t           down;
+  vp9_postproc_inplace_fn_t           across;
+  vp9_postproc_fn_t                   downacross;
+  vp9_postproc_addnoise_fn_t          addnoise;
+  vp9_postproc_blend_mb_inner_fn_t    blend_mb_inner;
+  vp9_postproc_blend_mb_outer_fn_t    blend_mb_outer;
+  vp9_postproc_blend_b_fn_t           blend_b;
+} vp9_postproc_rtcd_vtable_t;
 
 #if CONFIG_RUNTIME_CPU_DETECT
 #define POSTPROC_INVOKE(ctx,fn) (ctx)->fn
 #else
-#define POSTPROC_INVOKE(ctx,fn) vp8_postproc_##fn
+#define POSTPROC_INVOKE(ctx,fn) vp9_postproc_##fn
 #endif
 
 #include "vpx_ports/mem.h"
@@ -109,7 +109,7 @@
 #include "onyxc_int.h"
 #include "ppflags.h"
 int vp9_post_proc_frame(struct VP9Common *oci, YV12_BUFFER_CONFIG *dest,
-                        vp8_ppflags_t *flags);
+                        vp9_ppflags_t *flags);
 
 
 void vp9_de_noise(YV12_BUFFER_CONFIG         *source,
@@ -117,12 +117,12 @@
                   int                         q,
                   int                         low_var_thresh,
                   int                         flag,
-                  vp8_postproc_rtcd_vtable_t *rtcd);
+                  vp9_postproc_rtcd_vtable_t *rtcd);
 
 void vp9_deblock(YV12_BUFFER_CONFIG         *source,
                  YV12_BUFFER_CONFIG         *post,
                  int                         q,
                  int                         low_var_thresh,
                  int                         flag,
-                 vp8_postproc_rtcd_vtable_t *rtcd);
+                 vp9_postproc_rtcd_vtable_t *rtcd);
 #endif
diff --git a/vp8/common/ppc/systemdependent.c b/vp8/common/ppc/systemdependent.c
index 137f45c..9ed17db 100644
--- a/vp8/common/ppc/systemdependent.c
+++ b/vp8/common/ppc/systemdependent.c
@@ -123,12 +123,12 @@
 extern loop_filter_block_function *vp8_lf_bvsimple;
 extern loop_filter_block_function *vp8_lf_bhsimple;
 
-void vp8_clear_c(void) {
+void vp9_clear_c(void) {
 }
 
 void vp9_machine_specific_config(void) {
   // Pure C:
-  vp8_clear_system_state                = vp8_clear_c;
+  vp9_clear_system_state                = vp9_clear_c;
   vp9_recon_b                          = vp9_recon_b_c;
   vp9_recon4b                         = vp9_recon4b_c;
   vp9_recon2b                         = vp9_recon2b_c;
diff --git a/vp8/common/ppflags.h b/vp8/common/ppflags.h
index 9d3f1a8..fd83711 100644
--- a/vp8/common/ppflags.h
+++ b/vp8/common/ppflags.h
@@ -12,17 +12,17 @@
 #ifndef __INC_PPFLAGS_H
 #define __INC_PPFLAGS_H
 enum {
-  VP8D_NOFILTERING            = 0,
-  VP8D_DEBLOCK                = 1 << 0,
-  VP8D_DEMACROBLOCK           = 1 << 1,
-  VP8D_ADDNOISE               = 1 << 2,
-  VP8D_DEBUG_TXT_FRAME_INFO   = 1 << 3,
-  VP8D_DEBUG_TXT_MBLK_MODES   = 1 << 4,
-  VP8D_DEBUG_TXT_DC_DIFF      = 1 << 5,
-  VP8D_DEBUG_TXT_RATE_INFO    = 1 << 6,
-  VP8D_DEBUG_DRAW_MV          = 1 << 7,
-  VP8D_DEBUG_CLR_BLK_MODES    = 1 << 8,
-  VP8D_DEBUG_CLR_FRM_REF_BLKS = 1 << 9
+  VP9D_NOFILTERING            = 0,
+  VP9D_DEBLOCK                = 1 << 0,
+  VP9D_DEMACROBLOCK           = 1 << 1,
+  VP9D_ADDNOISE               = 1 << 2,
+  VP9D_DEBUG_TXT_FRAME_INFO   = 1 << 3,
+  VP9D_DEBUG_TXT_MBLK_MODES   = 1 << 4,
+  VP9D_DEBUG_TXT_DC_DIFF      = 1 << 5,
+  VP9D_DEBUG_TXT_RATE_INFO    = 1 << 6,
+  VP9D_DEBUG_DRAW_MV          = 1 << 7,
+  VP9D_DEBUG_CLR_BLK_MODES    = 1 << 8,
+  VP9D_DEBUG_CLR_FRM_REF_BLKS = 1 << 9
 };
 
 typedef struct {
@@ -33,6 +33,6 @@
   int display_mb_modes_flag;
   int display_b_modes_flag;
   int display_mv_flag;
-} vp8_ppflags_t;
+} vp9_ppflags_t;
 
 #endif
diff --git a/vp8/common/pred_common.c b/vp8/common/pred_common.c
index 50b9b1c..e1b93d3 100644
--- a/vp8/common/pred_common.c
+++ b/vp8/common/pred_common.c
@@ -73,23 +73,23 @@
         if (left_in_image && left_mode >= NEARESTMV && left_mode <= SPLITMV)
           left_interp = vp9_switchable_interp_map[(m - 1)->mbmi.interp_filter];
         else
-          left_interp = VP8_SWITCHABLE_FILTERS;
+          left_interp = VP9_SWITCHABLE_FILTERS;
         if (above_in_image && above_mode >= NEARESTMV && above_mode <= SPLITMV)
           above_interp = vp9_switchable_interp_map[
               (m - cm->mode_info_stride)->mbmi.interp_filter];
         else
-          above_interp = VP8_SWITCHABLE_FILTERS;
+          above_interp = VP9_SWITCHABLE_FILTERS;
 
         if (left_interp == above_interp)
           pred_context = left_interp;
-        else if (left_interp == VP8_SWITCHABLE_FILTERS &&
-                 above_interp != VP8_SWITCHABLE_FILTERS)
+        else if (left_interp == VP9_SWITCHABLE_FILTERS &&
+                 above_interp != VP9_SWITCHABLE_FILTERS)
           pred_context = above_interp;
-        else if (left_interp != VP8_SWITCHABLE_FILTERS &&
-                 above_interp == VP8_SWITCHABLE_FILTERS)
+        else if (left_interp != VP9_SWITCHABLE_FILTERS &&
+                 above_interp == VP9_SWITCHABLE_FILTERS)
           pred_context = left_interp;
         else
-          pred_context = VP8_SWITCHABLE_FILTERS;
+          pred_context = VP9_SWITCHABLE_FILTERS;
       }
       break;
 
@@ -104,10 +104,10 @@
 
 // This function returns a context probability for coding a given
 // prediction signal
-vp8_prob vp9_get_pred_prob(const VP9_COMMON *const cm,
+vp9_prob vp9_get_pred_prob(const VP9_COMMON *const cm,
                           const MACROBLOCKD *const xd,
                           PRED_ID pred_id) {
-  vp8_prob pred_probability;
+  vp9_prob pred_probability;
   int pred_context;
 
   // Get the appropriate prediction context
@@ -144,10 +144,10 @@
 
 // This function returns a context probability ptr for coding a given
 // prediction signal
-const vp8_prob *vp9_get_pred_probs(const VP9_COMMON *const cm,
+const vp9_prob *vp9_get_pred_probs(const VP9_COMMON *const cm,
                                    const MACROBLOCKD *const xd,
                                    PRED_ID pred_id) {
-  const vp8_prob *pred_probability;
+  const vp9_prob *pred_probability;
   int pred_context;
 
   // Get the appropriate prediction context
@@ -377,26 +377,26 @@
 
 // Functions to computes a set of modified reference frame probabilities
 // to use when the prediction of the reference frame value fails
-void vp9_calc_ref_probs(int *count, vp8_prob *probs) {
+void vp9_calc_ref_probs(int *count, vp9_prob *probs) {
   int tot_count;
 
   tot_count = count[0] + count[1] + count[2] + count[3];
   if (tot_count) {
-    probs[0] = (vp8_prob)((count[0] * 255 + (tot_count >> 1)) / tot_count);
+    probs[0] = (vp9_prob)((count[0] * 255 + (tot_count >> 1)) / tot_count);
     probs[0] += !probs[0];
   } else
     probs[0] = 128;
 
   tot_count -= count[0];
   if (tot_count) {
-    probs[1] = (vp8_prob)((count[1] * 255 + (tot_count >> 1)) / tot_count);
+    probs[1] = (vp9_prob)((count[1] * 255 + (tot_count >> 1)) / tot_count);
     probs[1] += !probs[1];
   } else
     probs[1] = 128;
 
   tot_count -= count[1];
   if (tot_count) {
-    probs[2] = (vp8_prob)((count[2] * 255 + (tot_count >> 1)) / tot_count);
+    probs[2] = (vp9_prob)((count[2] * 255 + (tot_count >> 1)) / tot_count);
     probs[2] += !probs[2];
   } else
     probs[2] = 128;
diff --git a/vp8/common/pred_common.h b/vp8/common/pred_common.h
index 7dd517f..1978269 100644
--- a/vp8/common/pred_common.h
+++ b/vp8/common/pred_common.h
@@ -29,11 +29,11 @@
                                           const MACROBLOCKD *const xd,
                                           PRED_ID pred_id);
 
-extern vp8_prob vp9_get_pred_prob(const VP9_COMMON *const cm,
+extern vp9_prob vp9_get_pred_prob(const VP9_COMMON *const cm,
                                   const MACROBLOCKD *const xd,
                                   PRED_ID pred_id);
 
-extern const vp8_prob *vp9_get_pred_probs(const VP9_COMMON *const cm,
+extern const vp9_prob *vp9_get_pred_probs(const VP9_COMMON *const cm,
                                           const MACROBLOCKD *const xd,
                                           PRED_ID pred_id);
 
diff --git a/vp8/common/reconinter.c b/vp8/common/reconinter.c
index 8892113..e404c63 100644
--- a/vp8/common/reconinter.c
+++ b/vp8/common/reconinter.c
@@ -222,7 +222,7 @@
 
 
 
-void vp9_build_inter_predictors_b(BLOCKD *d, int pitch, vp8_subpix_fn_t sppf) {
+void vp9_build_inter_predictors_b(BLOCKD *d, int pitch, vp9_subpix_fn_t sppf) {
   int r;
   unsigned char *ptr_base;
   unsigned char *ptr;
@@ -260,7 +260,7 @@
  * come from an earlier call to vp9_build_inter_predictors_b()) with the
  * predictor of the second reference frame / motion vector.
  */
-void vp9_build_2nd_inter_predictors_b(BLOCKD *d, int pitch, vp8_subpix_fn_t sppf) {
+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;
@@ -800,7 +800,7 @@
 
 /*
  * The following functions should be called after an initial
- * call to vp8_build_inter16x16_predictors_mb() or _mby()/_mbuv().
+ * call to vp9_build_1st_inter16x16_predictors_mb() or _mby()/_mbuv().
  * It will run a second sixtap filter on a (different) ref
  * frame and average the result with the output of the
  * first sixtap filter. The second reference frame is stored
diff --git a/vp8/common/reconinter.h b/vp8/common/reconinter.h
index 001bdd4..3b72b0a 100644
--- a/vp8/common/reconinter.h
+++ b/vp8/common/reconinter.h
@@ -55,9 +55,9 @@
 extern void vp9_build_inter_predictors_mb(MACROBLOCKD *xd);
 
 extern void vp9_build_inter_predictors_b(BLOCKD *d, int pitch,
-                                         vp8_subpix_fn_t sppf);
+                                         vp9_subpix_fn_t sppf);
 extern void vp9_build_2nd_inter_predictors_b(BLOCKD *d, int pitch,
-                                             vp8_subpix_fn_t sppf);
+                                             vp9_subpix_fn_t sppf);
 
 extern void vp9_build_inter_predictors4b(MACROBLOCKD *xd, BLOCKD *d,
                                          int pitch);
diff --git a/vp8/common/reconintra.c b/vp8/common/reconintra.c
index d4e6c94..16e6edb 100644
--- a/vp8/common/reconintra.c
+++ b/vp8/common/reconintra.c
@@ -355,7 +355,7 @@
 #endif
 
 #if CONFIG_COMP_INTRA_PRED
-void vp8_build_comp_intra_predictors_mby(MACROBLOCKD *xd) {
+void vp9_build_comp_intra_predictors_mby(MACROBLOCKD *xd) {
   unsigned char predictor[2][256];
   int i;
 
@@ -414,7 +414,7 @@
 #endif
 
 #if CONFIG_COMP_INTRA_PRED
-void vp8_build_comp_intra_predictors_mbuv(MACROBLOCKD *xd) {
+void vp9_build_comp_intra_predictors_mbuv(MACROBLOCKD *xd) {
   unsigned char predictor[2][2][64];
   int i;
 
@@ -441,7 +441,7 @@
 }
 
 #if CONFIG_COMP_INTRA_PRED
-void vp8_comp_intra8x8_predict(BLOCKD *xd,
+void vp9_comp_intra8x8_predict(BLOCKD *xd,
                                int mode, int second_mode,
                                unsigned char *out_predictor) {
   unsigned char predictor[2][8 * 16];
@@ -467,7 +467,7 @@
 }
 
 #if CONFIG_COMP_INTRA_PRED
-void vp8_comp_intra_uv4x4_predict(BLOCKD *xd,
+void vp9_comp_intra_uv4x4_predict(BLOCKD *xd,
                                   int mode, int mode2,
                                   unsigned char *out_predictor) {
   unsigned char predictor[2][8 * 4];
diff --git a/vp8/common/reconintra4x4.c b/vp8/common/reconintra4x4.c
index 5778363..d2b457c 100644
--- a/vp8/common/reconintra4x4.c
+++ b/vp8/common/reconintra4x4.c
@@ -275,7 +275,7 @@
 }
 
 #if CONFIG_COMP_INTRA_PRED
-void vp8_comp_intra4x4_predict_c(BLOCKD *x,
+void vp9_comp_intra4x4_predict_c(BLOCKD *x,
                                int b_mode, int b_mode2,
                                unsigned char *out_predictor) {
   unsigned char predictor[2][4 * 16];
diff --git a/vp8/common/rtcd_defs.sh b/vp8/common/rtcd_defs.sh
index 166fad0..403966d 100644
--- a/vp8/common/rtcd_defs.sh
+++ b/vp8/common/rtcd_defs.sh
@@ -130,8 +130,8 @@
 prototype void vp9_build_intra_predictors_mby "struct macroblockd *x"
 specialize vp9_build_intra_predictors_mby;
 
-prototype void vp8_build_comp_intra_predictors_mby "struct macroblockd *x"
-specialize vp8_build_comp_intra_predictors_mby;
+prototype void vp9_build_comp_intra_predictors_mby "struct macroblockd *x"
+specialize vp9_build_comp_intra_predictors_mby;
 
 prototype void vp9_build_intra_predictors_mby_s "struct macroblockd *x"
 specialize vp9_build_intra_predictors_mby_s;
@@ -142,26 +142,26 @@
 prototype void vp9_build_intra_predictors_mbuv_s "struct macroblockd *x"
 specialize vp9_build_intra_predictors_mbuv_s;
 
-prototype void vp8_build_comp_intra_predictors_mbuv "struct macroblockd *x"
-specialize vp8_build_comp_intra_predictors_mbuv;
+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"
 specialize vp9_intra4x4_predict;
 
-prototype void vp8_comp_intra4x4_predict "struct blockd *x, int b_mode, int second_mode, unsigned char *predictor"
-specialize vp8_comp_intra4x4_predict;
+prototype void vp9_comp_intra4x4_predict "struct blockd *x, int b_mode, int second_mode, unsigned char *predictor"
+specialize vp9_comp_intra4x4_predict;
 
 prototype void vp9_intra8x8_predict "struct blockd *x, int b_mode, unsigned char *predictor"
 specialize vp9_intra8x8_predict;
 
-prototype void vp8_comp_intra8x8_predict "struct blockd *x, int b_mode, int second_mode, unsigned char *predictor"
-specialize vp8_comp_intra8x8_predict;
+prototype void vp9_comp_intra8x8_predict "struct blockd *x, int b_mode, int second_mode, unsigned char *predictor"
+specialize vp9_comp_intra8x8_predict;
 
 prototype void vp9_intra_uv4x4_predict "struct blockd *x, int b_mode, unsigned char *predictor"
 specialize vp9_intra_uv4x4_predict;
 
-prototype void vp8_comp_intra_uv4x4_predict "struct blockd *x, int b_mode, int second_mode, unsigned char *predictor"
-specialize vp8_comp_intra_uv4x4_predict;
+prototype void vp9_comp_intra_uv4x4_predict "struct blockd *x, int b_mode, int second_mode, unsigned char *predictor"
+specialize vp9_comp_intra_uv4x4_predict;
 
 #
 # Loopfilter
@@ -184,47 +184,47 @@
 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"
 specialize vp9_loop_filter_bh8x8 sse2
 
-prototype void vp8_loop_filter_simple_mbv "unsigned char *y, int ystride, const unsigned char *blimit"
-specialize vp8_loop_filter_simple_mbv mmx sse2 media neon
-vp8_loop_filter_simple_mbv_c=vp9_loop_filter_simple_vertical_edge_c
-vp8_loop_filter_simple_mbv_mmx=vp9_loop_filter_simple_vertical_edge_mmx
-vp8_loop_filter_simple_mbv_sse2=vp9_loop_filter_simple_vertical_edge_sse2
-vp8_loop_filter_simple_mbv_media=vp9_loop_filter_simple_vertical_edge_armv6
-vp8_loop_filter_simple_mbv_neon=vp9_loop_filter_mbvs_neon
+prototype void vp9_loop_filter_simple_mbv "unsigned char *y, int ystride, const unsigned char *blimit"
+specialize vp9_loop_filter_simple_mbv mmx sse2 media neon
+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
+vp9_loop_filter_simple_mbv_media=vp9_loop_filter_simple_vertical_edge_armv6
+vp9_loop_filter_simple_mbv_neon=vp9_loop_filter_mbvs_neon
 
-prototype void vp8_loop_filter_simple_mbh "unsigned char *y, int ystride, const unsigned char *blimit"
-specialize vp8_loop_filter_simple_mbh mmx sse2 media neon
-vp8_loop_filter_simple_mbh_c=vp9_loop_filter_simple_horizontal_edge_c
-vp8_loop_filter_simple_mbh_mmx=vp9_loop_filter_simple_horizontal_edge_mmx
-vp8_loop_filter_simple_mbh_sse2=vp9_loop_filter_simple_horizontal_edge_sse2
-vp8_loop_filter_simple_mbh_media=vp9_loop_filter_simple_horizontal_edge_armv6
-vp8_loop_filter_simple_mbh_neon=vp9_loop_filter_mbhs_neon
+prototype void vp9_loop_filter_simple_mbh "unsigned char *y, int ystride, const unsigned char *blimit"
+specialize vp9_loop_filter_simple_mbh mmx sse2 media neon
+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
+vp9_loop_filter_simple_mbh_media=vp9_loop_filter_simple_horizontal_edge_armv6
+vp9_loop_filter_simple_mbh_neon=vp9_loop_filter_mbhs_neon
 
-prototype void vp8_loop_filter_simple_bv "unsigned char *y, int ystride, const unsigned char *blimit"
-specialize vp8_loop_filter_simple_bv mmx sse2 media neon
-vp8_loop_filter_simple_bv_c=vp9_loop_filter_bvs_c
-vp8_loop_filter_simple_bv_mmx=vp9_loop_filter_bvs_mmx
-vp8_loop_filter_simple_bv_sse2=vp9_loop_filter_bvs_sse2
-vp8_loop_filter_simple_bv_media=vp9_loop_filter_bvs_armv6
-vp8_loop_filter_simple_bv_neon=vp9_loop_filter_bvs_neon
+prototype void vp9_loop_filter_simple_bv "unsigned char *y, int ystride, const unsigned char *blimit"
+specialize vp9_loop_filter_simple_bv mmx sse2 media neon
+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
+vp9_loop_filter_simple_bv_media=vp9_loop_filter_bvs_armv6
+vp9_loop_filter_simple_bv_neon=vp9_loop_filter_bvs_neon
 
-prototype void vp8_loop_filter_simple_bh "unsigned char *y, int ystride, const unsigned char *blimit"
-specialize vp8_loop_filter_simple_bh mmx sse2 media neon
-vp8_loop_filter_simple_bh_c=vp9_loop_filter_bhs_c
-vp8_loop_filter_simple_bh_mmx=vp9_loop_filter_bhs_mmx
-vp8_loop_filter_simple_bh_sse2=vp9_loop_filter_bhs_sse2
-vp8_loop_filter_simple_bh_media=vp9_loop_filter_bhs_armv6
-vp8_loop_filter_simple_bh_neon=vp9_loop_filter_bhs_neon
+prototype void vp9_loop_filter_simple_bh "unsigned char *y, int ystride, const unsigned char *blimit"
+specialize vp9_loop_filter_simple_bh mmx sse2 media neon
+vp9_loop_filter_simple_bh_c=vp9_loop_filter_bhs_c
+vp9_loop_filter_simple_bh_mmx=vp9_loop_filter_bhs_mmx
+vp9_loop_filter_simple_bh_sse2=vp9_loop_filter_bhs_sse2
+vp9_loop_filter_simple_bh_media=vp9_loop_filter_bhs_armv6
+vp9_loop_filter_simple_bh_neon=vp9_loop_filter_bhs_neon
 
 #
 # sad 16x3, 3x16
 #
 if [ "$CONFIG_NEWBESTREFMV" = "yes" ]; then
-prototype unsigned int vp8_sad16x3 "const unsigned char *src_ptr, int  src_stride, const unsigned char *ref_ptr, int ref_stride, int max_sad"
-specialize vp8_sad16x3 sse2
+prototype unsigned int vp9_sad16x3 "const unsigned char *src_ptr, int  src_stride, const unsigned char *ref_ptr, int ref_stride, int max_sad"
+specialize vp9_sad16x3 sse2
 
-prototype unsigned int vp8_sad3x16 "const unsigned char *src_ptr, int  src_stride, const unsigned char *ref_ptr, int ref_stride, int max_sad"
-specialize vp8_sad3x16 sse2
+prototype unsigned int vp9_sad3x16 "const unsigned char *src_ptr, int  src_stride, const unsigned char *ref_ptr, int ref_stride, int max_sad"
+specialize vp9_sad3x16 sse2
 fi
 
 #
diff --git a/vp8/common/subpixel.h b/vp8/common/subpixel.h
index b57fb52..03bb9f2 100644
--- a/vp8/common/subpixel.h
+++ b/vp8/common/subpixel.h
@@ -24,181 +24,181 @@
 #include "arm/subpixel_arm.h"
 #endif
 
-#ifndef vp8_subpix_sixtap16x16
-#define vp8_subpix_sixtap16x16 vp9_sixtap_predict16x16_c
+#ifndef vp9_subpix_sixtap16x16
+#define vp9_subpix_sixtap16x16 vp9_sixtap_predict16x16_c
 #endif
-extern prototype_subpixel_predict(vp8_subpix_sixtap16x16);
+extern prototype_subpixel_predict(vp9_subpix_sixtap16x16);
 
-#ifndef vp8_subpix_sixtap8x8
-#define vp8_subpix_sixtap8x8 vp9_sixtap_predict8x8_c
+#ifndef vp9_subpix_sixtap8x8
+#define vp9_subpix_sixtap8x8 vp9_sixtap_predict8x8_c
 #endif
-extern prototype_subpixel_predict(vp8_subpix_sixtap8x8);
+extern prototype_subpixel_predict(vp9_subpix_sixtap8x8);
 
-#ifndef vp8_subpix_sixtap_avg16x16
-#define vp8_subpix_sixtap_avg16x16 vp9_sixtap_predict_avg16x16_c
+#ifndef vp9_subpix_sixtap_avg16x16
+#define vp9_subpix_sixtap_avg16x16 vp9_sixtap_predict_avg16x16_c
 #endif
-extern prototype_subpixel_predict(vp8_subpix_sixtap_avg16x16);
+extern prototype_subpixel_predict(vp9_subpix_sixtap_avg16x16);
 
-#ifndef vp8_subpix_sixtap_avg8x8
-#define vp8_subpix_sixtap_avg8x8 vp9_sixtap_predict_avg8x8_c
+#ifndef vp9_subpix_sixtap_avg8x8
+#define vp9_subpix_sixtap_avg8x8 vp9_sixtap_predict_avg8x8_c
 #endif
-extern prototype_subpixel_predict(vp8_subpix_sixtap_avg8x8);
-#ifndef vp8_subpix_sixtap8x4
-#define vp8_subpix_sixtap8x4 vp9_sixtap_predict8x4_c
+extern prototype_subpixel_predict(vp9_subpix_sixtap_avg8x8);
+#ifndef vp9_subpix_sixtap8x4
+#define vp9_subpix_sixtap8x4 vp9_sixtap_predict8x4_c
 #endif
-extern prototype_subpixel_predict(vp8_subpix_sixtap8x4);
+extern prototype_subpixel_predict(vp9_subpix_sixtap8x4);
 
-#ifndef vp8_subpix_sixtap4x4
-#define vp8_subpix_sixtap4x4 vp9_sixtap_predict_c
+#ifndef vp9_subpix_sixtap4x4
+#define vp9_subpix_sixtap4x4 vp9_sixtap_predict_c
 #endif
-extern prototype_subpixel_predict(vp8_subpix_sixtap4x4);
+extern prototype_subpixel_predict(vp9_subpix_sixtap4x4);
 
-#ifndef vp8_subpix_sixtap_avg4x4
-#define vp8_subpix_sixtap_avg4x4 vp9_sixtap_predict_avg_c
+#ifndef vp9_subpix_sixtap_avg4x4
+#define vp9_subpix_sixtap_avg4x4 vp9_sixtap_predict_avg_c
 #endif
-extern prototype_subpixel_predict(vp8_subpix_sixtap_avg4x4);
+extern prototype_subpixel_predict(vp9_subpix_sixtap_avg4x4);
 
-#ifndef vp8_subpix_eighttap16x16
-#define vp8_subpix_eighttap16x16 vp9_eighttap_predict16x16_c
+#ifndef vp9_subpix_eighttap16x16
+#define vp9_subpix_eighttap16x16 vp9_eighttap_predict16x16_c
 #endif
-extern prototype_subpixel_predict(vp8_subpix_eighttap16x16);
+extern prototype_subpixel_predict(vp9_subpix_eighttap16x16);
 
-#ifndef vp8_subpix_eighttap8x8
-#define vp8_subpix_eighttap8x8 vp9_eighttap_predict8x8_c
+#ifndef vp9_subpix_eighttap8x8
+#define vp9_subpix_eighttap8x8 vp9_eighttap_predict8x8_c
 #endif
-extern prototype_subpixel_predict(vp8_subpix_eighttap8x8);
+extern prototype_subpixel_predict(vp9_subpix_eighttap8x8);
 
-#ifndef vp8_subpix_eighttap_avg16x16
-#define vp8_subpix_eighttap_avg16x16 vp9_eighttap_predict_avg16x16_c
+#ifndef vp9_subpix_eighttap_avg16x16
+#define vp9_subpix_eighttap_avg16x16 vp9_eighttap_predict_avg16x16_c
 #endif
-extern prototype_subpixel_predict(vp8_subpix_eighttap_avg16x16);
+extern prototype_subpixel_predict(vp9_subpix_eighttap_avg16x16);
 
-#ifndef vp8_subpix_eighttap_avg8x8
-#define vp8_subpix_eighttap_avg8x8 vp9_eighttap_predict_avg8x8_c
+#ifndef vp9_subpix_eighttap_avg8x8
+#define vp9_subpix_eighttap_avg8x8 vp9_eighttap_predict_avg8x8_c
 #endif
-extern prototype_subpixel_predict(vp8_subpix_eighttap_avg8x8);
+extern prototype_subpixel_predict(vp9_subpix_eighttap_avg8x8);
 
-#ifndef vp8_subpix_eighttap8x4
-#define vp8_subpix_eighttap8x4 vp9_eighttap_predict8x4_c
+#ifndef vp9_subpix_eighttap8x4
+#define vp9_subpix_eighttap8x4 vp9_eighttap_predict8x4_c
 #endif
-extern prototype_subpixel_predict(vp8_subpix_eighttap8x4);
+extern prototype_subpixel_predict(vp9_subpix_eighttap8x4);
 
-#ifndef vp8_subpix_eighttap4x4
-#define vp8_subpix_eighttap4x4 vp9_eighttap_predict_c
+#ifndef vp9_subpix_eighttap4x4
+#define vp9_subpix_eighttap4x4 vp9_eighttap_predict_c
 #endif
-extern prototype_subpixel_predict(vp8_subpix_eighttap4x4);
+extern prototype_subpixel_predict(vp9_subpix_eighttap4x4);
 
-#ifndef vp8_subpix_eighttap_avg4x4
-#define vp8_subpix_eighttap_avg4x4 vp9_eighttap_predict_avg4x4_c
+#ifndef vp9_subpix_eighttap_avg4x4
+#define vp9_subpix_eighttap_avg4x4 vp9_eighttap_predict_avg4x4_c
 #endif
-extern prototype_subpixel_predict(vp8_subpix_eighttap_avg4x4);
+extern prototype_subpixel_predict(vp9_subpix_eighttap_avg4x4);
 
-#ifndef vp8_subpix_eighttap16x16_sharp
-#define vp8_subpix_eighttap16x16_sharp vp9_eighttap_predict16x16_sharp_c
+#ifndef vp9_subpix_eighttap16x16_sharp
+#define vp9_subpix_eighttap16x16_sharp vp9_eighttap_predict16x16_sharp_c
 #endif
-extern prototype_subpixel_predict(vp8_subpix_eighttap16x16_sharp);
+extern prototype_subpixel_predict(vp9_subpix_eighttap16x16_sharp);
 
-#ifndef vp8_subpix_eighttap8x8_sharp
-#define vp8_subpix_eighttap8x8_sharp vp9_eighttap_predict8x8_sharp_c
+#ifndef vp9_subpix_eighttap8x8_sharp
+#define vp9_subpix_eighttap8x8_sharp vp9_eighttap_predict8x8_sharp_c
 #endif
-extern prototype_subpixel_predict(vp8_subpix_eighttap8x8_sharp);
+extern prototype_subpixel_predict(vp9_subpix_eighttap8x8_sharp);
 
-#ifndef vp8_subpix_eighttap_avg16x16_sharp
-#define vp8_subpix_eighttap_avg16x16_sharp vp9_eighttap_predict_avg16x16_sharp_c
+#ifndef vp9_subpix_eighttap_avg16x16_sharp
+#define vp9_subpix_eighttap_avg16x16_sharp vp9_eighttap_predict_avg16x16_sharp_c
 #endif
-extern prototype_subpixel_predict(vp8_subpix_eighttap_avg16x16_sharp);
+extern prototype_subpixel_predict(vp9_subpix_eighttap_avg16x16_sharp);
 
-#ifndef vp8_subpix_eighttap_avg8x8_sharp
-#define vp8_subpix_eighttap_avg8x8_sharp vp9_eighttap_predict_avg8x8_sharp_c
+#ifndef vp9_subpix_eighttap_avg8x8_sharp
+#define vp9_subpix_eighttap_avg8x8_sharp vp9_eighttap_predict_avg8x8_sharp_c
 #endif
-extern prototype_subpixel_predict(vp8_subpix_eighttap_avg8x8_sharp);
+extern prototype_subpixel_predict(vp9_subpix_eighttap_avg8x8_sharp);
 
-#ifndef vp8_subpix_eighttap8x4_sharp
-#define vp8_subpix_eighttap8x4_sharp vp9_eighttap_predict8x4_sharp_c
+#ifndef vp9_subpix_eighttap8x4_sharp
+#define vp9_subpix_eighttap8x4_sharp vp9_eighttap_predict8x4_sharp_c
 #endif
-extern prototype_subpixel_predict(vp8_subpix_eighttap8x4_sharp);
+extern prototype_subpixel_predict(vp9_subpix_eighttap8x4_sharp);
 
-#ifndef vp8_subpix_eighttap4x4_sharp
-#define vp8_subpix_eighttap4x4_sharp vp9_eighttap_predict_sharp_c
+#ifndef vp9_subpix_eighttap4x4_sharp
+#define vp9_subpix_eighttap4x4_sharp vp9_eighttap_predict_sharp_c
 #endif
-extern prototype_subpixel_predict(vp8_subpix_eighttap4x4_sharp);
+extern prototype_subpixel_predict(vp9_subpix_eighttap4x4_sharp);
 
-#ifndef vp8_subpix_eighttap_avg4x4_sharp
-#define vp8_subpix_eighttap_avg4x4_sharp vp9_eighttap_predict_avg4x4_sharp_c
+#ifndef vp9_subpix_eighttap_avg4x4_sharp
+#define vp9_subpix_eighttap_avg4x4_sharp vp9_eighttap_predict_avg4x4_sharp_c
 #endif
-extern prototype_subpixel_predict(vp8_subpix_eighttap_avg4x4_sharp);
+extern prototype_subpixel_predict(vp9_subpix_eighttap_avg4x4_sharp);
 
-#ifndef vp8_subpix_bilinear16x16
-#define vp8_subpix_bilinear16x16 vp9_bilinear_predict16x16_c
+#ifndef vp9_subpix_bilinear16x16
+#define vp9_subpix_bilinear16x16 vp9_bilinear_predict16x16_c
 #endif
-extern prototype_subpixel_predict(vp8_subpix_bilinear16x16);
+extern prototype_subpixel_predict(vp9_subpix_bilinear16x16);
 
-#ifndef vp8_subpix_bilinear8x8
-#define vp8_subpix_bilinear8x8 vp9_bilinear_predict8x8_c
+#ifndef vp9_subpix_bilinear8x8
+#define vp9_subpix_bilinear8x8 vp9_bilinear_predict8x8_c
 #endif
-extern prototype_subpixel_predict(vp8_subpix_bilinear8x8);
+extern prototype_subpixel_predict(vp9_subpix_bilinear8x8);
 
-#ifndef vp8_subpix_bilinear_avg16x16
-#define vp8_subpix_bilinear_avg16x16 vp9_bilinear_predict_avg16x16_c
+#ifndef vp9_subpix_bilinear_avg16x16
+#define vp9_subpix_bilinear_avg16x16 vp9_bilinear_predict_avg16x16_c
 #endif
-extern prototype_subpixel_predict(vp8_subpix_bilinear_avg16x16);
+extern prototype_subpixel_predict(vp9_subpix_bilinear_avg16x16);
 
-#ifndef vp8_subpix_bilinear_avg8x8
-#define vp8_subpix_bilinear_avg8x8 vp9_bilinear_predict_avg8x8_c
+#ifndef vp9_subpix_bilinear_avg8x8
+#define vp9_subpix_bilinear_avg8x8 vp9_bilinear_predict_avg8x8_c
 #endif
-extern prototype_subpixel_predict(vp8_subpix_bilinear_avg8x8);
+extern prototype_subpixel_predict(vp9_subpix_bilinear_avg8x8);
 
-#ifndef vp8_subpix_bilinear8x4
-#define vp8_subpix_bilinear8x4 vp9_bilinear_predict8x4_c
+#ifndef vp9_subpix_bilinear8x4
+#define vp9_subpix_bilinear8x4 vp9_bilinear_predict8x4_c
 #endif
-extern prototype_subpixel_predict(vp8_subpix_bilinear8x4);
+extern prototype_subpixel_predict(vp9_subpix_bilinear8x4);
 
-#ifndef vp8_subpix_bilinear4x4
-#define vp8_subpix_bilinear4x4 vp9_bilinear_predict4x4_c
+#ifndef vp9_subpix_bilinear4x4
+#define vp9_subpix_bilinear4x4 vp9_bilinear_predict4x4_c
 #endif
-extern prototype_subpixel_predict(vp8_subpix_bilinear4x4);
+extern prototype_subpixel_predict(vp9_subpix_bilinear4x4);
 
-#ifndef vp8_subpix_bilinear_avg4x4
-#define vp8_subpix_bilinear_avg4x4 vp9_bilinear_predict_avg4x4_c
+#ifndef vp9_subpix_bilinear_avg4x4
+#define vp9_subpix_bilinear_avg4x4 vp9_bilinear_predict_avg4x4_c
 #endif
-extern prototype_subpixel_predict(vp8_subpix_bilinear_avg4x4);
+extern prototype_subpixel_predict(vp9_subpix_bilinear_avg4x4);
 
-typedef prototype_subpixel_predict((*vp8_subpix_fn_t));
+typedef prototype_subpixel_predict((*vp9_subpix_fn_t));
 typedef struct {
-  vp8_subpix_fn_t  eighttap16x16;
-  vp8_subpix_fn_t  eighttap8x8;
-  vp8_subpix_fn_t  eighttap_avg16x16;
-  vp8_subpix_fn_t  eighttap_avg8x8;
-  vp8_subpix_fn_t  eighttap_avg4x4;
-  vp8_subpix_fn_t  eighttap8x4;
-  vp8_subpix_fn_t  eighttap4x4;
-  vp8_subpix_fn_t  eighttap16x16_sharp;
-  vp8_subpix_fn_t  eighttap8x8_sharp;
-  vp8_subpix_fn_t  eighttap_avg16x16_sharp;
-  vp8_subpix_fn_t  eighttap_avg8x8_sharp;
-  vp8_subpix_fn_t  eighttap_avg4x4_sharp;
-  vp8_subpix_fn_t  eighttap8x4_sharp;
-  vp8_subpix_fn_t  eighttap4x4_sharp;
-  vp8_subpix_fn_t  sixtap16x16;
-  vp8_subpix_fn_t  sixtap8x8;
-  vp8_subpix_fn_t  sixtap_avg16x16;
-  vp8_subpix_fn_t  sixtap_avg8x8;
-  vp8_subpix_fn_t  sixtap8x4;
-  vp8_subpix_fn_t  sixtap4x4;
-  vp8_subpix_fn_t  sixtap_avg4x4;
-  vp8_subpix_fn_t  bilinear16x16;
-  vp8_subpix_fn_t  bilinear8x8;
-  vp8_subpix_fn_t  bilinear_avg16x16;
-  vp8_subpix_fn_t  bilinear_avg8x8;
-  vp8_subpix_fn_t  bilinear8x4;
-  vp8_subpix_fn_t  bilinear4x4;
-  vp8_subpix_fn_t  bilinear_avg4x4;
-} vp8_subpix_rtcd_vtable_t;
+  vp9_subpix_fn_t  eighttap16x16;
+  vp9_subpix_fn_t  eighttap8x8;
+  vp9_subpix_fn_t  eighttap_avg16x16;
+  vp9_subpix_fn_t  eighttap_avg8x8;
+  vp9_subpix_fn_t  eighttap_avg4x4;
+  vp9_subpix_fn_t  eighttap8x4;
+  vp9_subpix_fn_t  eighttap4x4;
+  vp9_subpix_fn_t  eighttap16x16_sharp;
+  vp9_subpix_fn_t  eighttap8x8_sharp;
+  vp9_subpix_fn_t  eighttap_avg16x16_sharp;
+  vp9_subpix_fn_t  eighttap_avg8x8_sharp;
+  vp9_subpix_fn_t  eighttap_avg4x4_sharp;
+  vp9_subpix_fn_t  eighttap8x4_sharp;
+  vp9_subpix_fn_t  eighttap4x4_sharp;
+  vp9_subpix_fn_t  sixtap16x16;
+  vp9_subpix_fn_t  sixtap8x8;
+  vp9_subpix_fn_t  sixtap_avg16x16;
+  vp9_subpix_fn_t  sixtap_avg8x8;
+  vp9_subpix_fn_t  sixtap8x4;
+  vp9_subpix_fn_t  sixtap4x4;
+  vp9_subpix_fn_t  sixtap_avg4x4;
+  vp9_subpix_fn_t  bilinear16x16;
+  vp9_subpix_fn_t  bilinear8x8;
+  vp9_subpix_fn_t  bilinear_avg16x16;
+  vp9_subpix_fn_t  bilinear_avg8x8;
+  vp9_subpix_fn_t  bilinear8x4;
+  vp9_subpix_fn_t  bilinear4x4;
+  vp9_subpix_fn_t  bilinear_avg4x4;
+} vp9_subpix_rtcd_vtable_t;
 
 #if CONFIG_RUNTIME_CPU_DETECT
 #define SUBPIX_INVOKE(ctx,fn) (ctx)->fn
 #else
-#define SUBPIX_INVOKE(ctx,fn) vp8_subpix_##fn
+#define SUBPIX_INVOKE(ctx,fn) vp9_subpix_##fn
 #endif
 
 #endif
diff --git a/vp8/common/systemdependent.h b/vp8/common/systemdependent.h
index 436f56d..5d778bc 100644
--- a/vp8/common/systemdependent.h
+++ b/vp8/common/systemdependent.h
@@ -12,9 +12,9 @@
 #include "vpx_ports/config.h"
 #if ARCH_X86 || ARCH_X86_64
 void vpx_reset_mmx_state(void);
-#define vp8_clear_system_state() vpx_reset_mmx_state()
+#define vp9_clear_system_state() vpx_reset_mmx_state()
 #else
-#define vp8_clear_system_state()
+#define vp9_clear_system_state()
 #endif
 
 struct VP9Common;
diff --git a/vp8/common/textblit.c b/vp8/common/textblit.c
index 2a704ea..e5a061b 100644
--- a/vp8/common/textblit.c
+++ b/vp8/common/textblit.c
@@ -11,7 +11,7 @@
 #include <stdlib.h>
 
 
-void vp8_blit_text(const char *msg, unsigned char *address, const int pitch) {
+void vp9_blit_text(const char *msg, unsigned char *address, const int pitch) {
   int letter_bitmap;
   unsigned char *output_pos = address;
   int colpos;
@@ -54,7 +54,7 @@
 }
 
 /* Bresenham line algorithm */
-void vp8_blit_line(int x0, int x1, int y0, int y1, unsigned char *image, const int pitch) {
+void vp9_blit_line(int x0, int x1, int y0, int y1, unsigned char *image, const int pitch) {
   int steep = abs(y1 - y0) > abs(x1 - x0);
   int deltax, deltay;
   int error, ystep, y, x;
diff --git a/vp8/common/treecoder.c b/vp8/common/treecoder.c
index 6845f11..3962940 100644
--- a/vp8/common/treecoder.c
+++ b/vp8/common/treecoder.c
@@ -19,8 +19,8 @@
 #include "treecoder.h"
 
 static void tree2tok(
-  struct vp8_token_struct *const p,
-  vp8_tree t,
+  struct vp9_token_struct *const p,
+  vp9_tree t,
   int i,
   int v,
   int L
@@ -29,7 +29,7 @@
   ++L;
 
   do {
-    const vp8_tree_index j = t[i++];
+    const vp9_tree_index j = t[i++];
 
     if (j <= 0) {
       p[-j].value = v;
@@ -39,19 +39,19 @@
   } while (++v & 1);
 }
 
-void vp9_tokens_from_tree(struct vp8_token_struct *p, vp8_tree t) {
+void vp9_tokens_from_tree(struct vp9_token_struct *p, vp9_tree t) {
   tree2tok(p, t, 0, 0, 0);
 }
 
-void vp9_tokens_from_tree_offset(struct vp8_token_struct *p, vp8_tree t,
+void vp9_tokens_from_tree_offset(struct vp9_token_struct *p, vp9_tree t,
                                  int offset) {
   tree2tok(p - offset, t, 0, 0, 0);
 }
 
 static void branch_counts(
   int n,                      /* n = size of alphabet */
-  vp8_token tok               [ /* n */ ],
-  vp8_tree tree,
+  vp9_token tok               [ /* n */ ],
+  vp9_tree tree,
   unsigned int branch_ct       [ /* n-1 */ ] [2],
   const unsigned int num_events[ /* n */ ]
 ) {
@@ -73,7 +73,7 @@
     const int enc = tok[t].value;
     const unsigned int ct = num_events[t];
 
-    vp8_tree_index i = 0;
+    vp9_tree_index i = 0;
 
     do {
       const int b = (enc >> --L) & 1;
@@ -96,9 +96,9 @@
 
 void vp9_tree_probs_from_distribution(
   int n,                      /* n = size of alphabet */
-  vp8_token tok               [ /* n */ ],
-  vp8_tree tree,
-  vp8_prob probs          [ /* n-1 */ ],
+  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 */ ],
   unsigned int Pfac,
@@ -121,13 +121,13 @@
       const unsigned int p = ((c[0] * Pfac) + (rd ? tot >> 1 : 0)) / tot;
       probs[t] = p < 256 ? (p ? p : 1) : 255; /* agree w/old version for now */
     } else
-      probs[t] = vp8_prob_half;
+      probs[t] = vp9_prob_half;
   } while (++t < tree_len);
 }
 
-vp8_prob vp9_bin_prob_from_distribution(const unsigned int counts[2]) {
+vp9_prob vp9_bin_prob_from_distribution(const unsigned int counts[2]) {
   int tot_count = counts[0] + counts[1];
-  vp8_prob prob;
+  vp9_prob prob;
   if (tot_count) {
     prob = (counts[0] * 255 + (tot_count >> 1)) / tot_count;
     prob += !prob;
diff --git a/vp8/common/treecoder.h b/vp8/common/treecoder.h
index f291d3d..1ebc82d 100644
--- a/vp8/common/treecoder.h
+++ b/vp8/common/treecoder.h
@@ -12,14 +12,11 @@
 #ifndef __INC_TREECODER_H
 #define __INC_TREECODER_H
 
-typedef unsigned char vp8bc_index_t; /* probability index */
+typedef unsigned char vp9_prob;
 
+#define vp9_prob_half ( (vp9_prob) 128)
 
-typedef unsigned char vp8_prob;
-
-#define vp8_prob_half ( (vp8_prob) 128)
-
-typedef signed char vp8_tree_index;
+typedef signed char vp9_tree_index;
 struct bool_coder_spec;
 
 typedef struct bool_coder_spec bool_coder_spec;
@@ -32,28 +29,28 @@
 
 
 
-# define vp8_complement( x) (255 - x)
+# define vp9_complement( x) (255 - x)
 
 
 /* We build coding trees compactly in arrays.
-   Each node of the tree is a pair of vp8_tree_indices.
+   Each node of the tree is a pair of vp9_tree_indices.
    Array index often references a corresponding probability table.
    Index <= 0 means done encoding/decoding and value = -Index,
    Index > 0 means need another bit, specification at index.
    Nonnegative indices are always even;  processing begins at node 0. */
 
-typedef const vp8_tree_index vp8_tree[], *vp8_tree_p;
+typedef const vp9_tree_index vp9_tree[], *vp9_tree_p;
 
 
-typedef const struct vp8_token_struct {
+typedef const struct vp9_token_struct {
   int value;
   int Len;
-} vp8_token;
+} vp9_token;
 
 /* Construct encoding array from tree. */
 
-void vp9_tokens_from_tree(struct vp8_token_struct *, vp8_tree);
-void vp9_tokens_from_tree_offset(struct vp8_token_struct *, vp8_tree,
+void vp9_tokens_from_tree(struct vp9_token_struct *, vp9_tree);
+void vp9_tokens_from_tree_offset(struct vp9_token_struct *, vp9_tree,
                                  int offset);
 
 
@@ -64,27 +61,15 @@
 
 void vp9_tree_probs_from_distribution(
   int n,                      /* n = size of alphabet */
-  vp8_token tok               [ /* n */ ],
-  vp8_tree tree,
-  vp8_prob probs          [ /* n-1 */ ],
+  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 */ ],
   unsigned int Pfactor,
   int Round
 );
 
-/* Variant of above using coder spec rather than hardwired 8-bit probs. */
-
-void vp8bc_tree_probs_from_distribution(
-  int n,                      /* n = size of alphabet */
-  vp8_token tok               [ /* n */ ],
-  vp8_tree tree,
-  vp8_prob probs          [ /* n-1 */ ],
-  unsigned int branch_ct       [ /* n-1 */ ] [2],
-  const unsigned int num_events[ /* n */ ],
-  c_bool_coder_spec *s
-);
-
-vp8_prob vp9_bin_prob_from_distribution(const unsigned int counts[2]);
+vp9_prob vp9_bin_prob_from_distribution(const unsigned int counts[2]);
 
 #endif
diff --git a/vp8/common/x86/filter_sse2.c b/vp8/common/x86/filter_sse2.c
index 939bfae..21845ff 100644
--- a/vp8/common/x86/filter_sse2.c
+++ b/vp8/common/x86/filter_sse2.c
@@ -25,10 +25,10 @@
 //           coefficients.
 
 DECLARE_ALIGNED(16, static const unsigned int, rounding_c[4]) = {
-  VP8_FILTER_WEIGHT >> 1,
-  VP8_FILTER_WEIGHT >> 1,
-  VP8_FILTER_WEIGHT >> 1,
-  VP8_FILTER_WEIGHT >> 1,
+  VP9_FILTER_WEIGHT >> 1,
+  VP9_FILTER_WEIGHT >> 1,
+  VP9_FILTER_WEIGHT >> 1,
+  VP9_FILTER_WEIGHT >> 1,
 };
 
 // Creating a macro to do more than four pixels at once to hide instruction
@@ -62,7 +62,7 @@
   const __m128i mad4567 = _mm_add_epi32(mad45, mad67);                         \
   __m128i mad_all = _mm_add_epi32(mad0123, mad4567);                           \
   mad_all = _mm_add_epi32(mad_all, rounding);                                  \
-  result = _mm_srai_epi32(mad_all, VP8_FILTER_SHIFT);                          \
+  result = _mm_srai_epi32(mad_all, VP9_FILTER_SHIFT);                          \
   }
 
 void vp9_filter_block2d_4x4_8_sse2
diff --git a/vp8/common/x86/filter_sse4.c b/vp8/common/x86/filter_sse4.c
index e3f962f..ad753b9 100644
--- a/vp8/common/x86/filter_sse4.c
+++ b/vp8/common/x86/filter_sse4.c
@@ -47,10 +47,10 @@
   0x09, 0x0A,
 };
 DECLARE_ALIGNED(16, static const unsigned int, rounding_c[4]) = {
-  VP8_FILTER_WEIGHT >> 1,
-  VP8_FILTER_WEIGHT >> 1,
-  VP8_FILTER_WEIGHT >> 1,
-  VP8_FILTER_WEIGHT >> 1,
+  VP9_FILTER_WEIGHT >> 1,
+  VP9_FILTER_WEIGHT >> 1,
+  VP9_FILTER_WEIGHT >> 1,
+  VP9_FILTER_WEIGHT >> 1,
 };
 DECLARE_ALIGNED(16, static const unsigned char, transpose_c[16]) = {
   0, 4,  8, 12,
@@ -81,7 +81,7 @@
   __m128i mad4567 = _mm_add_epi32(mad45, mad67);                               \
   __m128i mad_all = _mm_add_epi32(mad0123, mad4567);                           \
   mad_all = _mm_add_epi32(mad_all, rounding);                                  \
-  result = _mm_srai_epi32(mad_all, VP8_FILTER_SHIFT);                          \
+  result = _mm_srai_epi32(mad_all, VP9_FILTER_SHIFT);                          \
   }
 
 void vp9_filter_block2d_4x4_8_sse4_1
@@ -219,7 +219,7 @@
         __m128i mad4567 = _mm_add_epi32(mad45, mad67);
         __m128i mad_all = _mm_add_epi32(mad0123, mad4567);
         mad_all = _mm_add_epi32(mad_all, rounding);
-        mad_all = _mm_srai_epi32(mad_all, VP8_FILTER_SHIFT);
+        mad_all = _mm_srai_epi32(mad_all, VP9_FILTER_SHIFT);
         mad_all = _mm_packs_epi32(mad_all, mad_all);
         col0 = _mm_packus_epi16(mad_all, mad_all);
       }
@@ -242,7 +242,7 @@
         __m128i mad4567 = _mm_add_epi32(mad45, mad67);
         __m128i mad_all = _mm_add_epi32(mad0123, mad4567);
         mad_all = _mm_add_epi32(mad_all, rounding);
-        mad_all = _mm_srai_epi32(mad_all, VP8_FILTER_SHIFT);
+        mad_all = _mm_srai_epi32(mad_all, VP9_FILTER_SHIFT);
         mad_all = _mm_packs_epi32(mad_all, mad_all);
         col1 = _mm_packus_epi16(mad_all, mad_all);
       }
@@ -265,7 +265,7 @@
         __m128i mad4567 = _mm_add_epi32(mad45, mad67);
         __m128i mad_all = _mm_add_epi32(mad0123, mad4567);
         mad_all = _mm_add_epi32(mad_all, rounding);
-        mad_all = _mm_srai_epi32(mad_all, VP8_FILTER_SHIFT);
+        mad_all = _mm_srai_epi32(mad_all, VP9_FILTER_SHIFT);
         mad_all = _mm_packs_epi32(mad_all, mad_all);
         col2 = _mm_packus_epi16(mad_all, mad_all);
       }
@@ -288,7 +288,7 @@
         __m128i mad4567 = _mm_add_epi32(mad45, mad67);
         __m128i mad_all = _mm_add_epi32(mad0123, mad4567);
         mad_all = _mm_add_epi32(mad_all, rounding);
-        mad_all = _mm_srai_epi32(mad_all, VP8_FILTER_SHIFT);
+        mad_all = _mm_srai_epi32(mad_all, VP9_FILTER_SHIFT);
         mad_all = _mm_packs_epi32(mad_all, mad_all);
         col3 = _mm_packus_epi16(mad_all, mad_all);
       }
diff --git a/vp8/common/x86/idct_x86.h b/vp8/common/x86/idct_x86.h
index 65b7f37..297ab0d 100644
--- a/vp8/common/x86/idct_x86.h
+++ b/vp8/common/x86/idct_x86.h
@@ -28,20 +28,20 @@
 extern prototype_second_order(vp9_short_inv_walsh4x4_1_mmx);
 
 #if !CONFIG_RUNTIME_CPU_DETECT
-#undef  vp8_idct_idct1
-#define vp8_idct_idct1 vp9_short_idct4x4llm_1_mmx
+#undef  vp9_idct_idct1
+#define vp9_idct_idct1 vp9_short_idct4x4llm_1_mmx
 
-#undef  vp8_idct_idct16
-#define vp8_idct_idct16 vp9_short_idct4x4llm_mmx
+#undef  vp9_idct_idct16
+#define vp9_idct_idct16 vp9_short_idct4x4llm_mmx
 
-#undef  vp8_idct_idct1_scalar_add
-#define vp8_idct_idct1_scalar_add vp9_dc_only_idct_add_mmx
+#undef  vp9_idct_idct1_scalar_add
+#define vp9_idct_idct1_scalar_add vp9_dc_only_idct_add_mmx
 
-#undef vp8_idct_iwalsh16
-#define vp8_idct_iwalsh16 vp9_short_inv_walsh4x4_mmx
+#undef vp9_idct_iwalsh16
+#define vp9_idct_iwalsh16 vp9_short_inv_walsh4x4_mmx
 
-#undef vp8_idct_iwalsh1
-#define vp8_idct_iwalsh1 vp9_short_inv_walsh4x4_1_mmx
+#undef vp9_idct_iwalsh1
+#define vp9_idct_iwalsh1 vp9_short_inv_walsh4x4_1_mmx
 
 #endif
 #endif
@@ -52,8 +52,8 @@
 
 #if !CONFIG_RUNTIME_CPU_DETECT
 
-#undef vp8_idct_iwalsh16
-#define vp8_idct_iwalsh16 vp9_short_inv_walsh4x4_sse2
+#undef vp9_idct_iwalsh16
+#define vp9_idct_iwalsh16 vp9_short_inv_walsh4x4_sse2
 
 #endif
 
diff --git a/vp8/common/x86/loopfilter_x86.c b/vp8/common/x86/loopfilter_x86.c
index c04be21..30933d2 100644
--- a/vp8/common/x86/loopfilter_x86.c
+++ b/vp8/common/x86/loopfilter_x86.c
@@ -238,20 +238,20 @@
                                       t80);
     const __m128i qs1 = _mm_xor_si128(_mm_loadu_si128((__m128i *)(s + 1 * p)),
                                       t80);
-    __m128i vp8_filt;
+    __m128i filt;
     __m128i work_a;
     __m128i filter1, filter2;
 
-    vp8_filt = _mm_and_si128(_mm_subs_epi8(ps1, qs1), hev);
+    filt = _mm_and_si128(_mm_subs_epi8(ps1, qs1), hev);
     work_a = _mm_subs_epi8(qs0, ps0);
-    vp8_filt = _mm_adds_epi8(vp8_filt, work_a);
-    vp8_filt = _mm_adds_epi8(vp8_filt, work_a);
-    vp8_filt = _mm_adds_epi8(vp8_filt, work_a);
-    /* (vp8_filter + 3 * (qs0 - ps0)) & mask */
-    vp8_filt = _mm_and_si128(vp8_filt, mask);
+    filt = _mm_adds_epi8(filt, work_a);
+    filt = _mm_adds_epi8(filt, work_a);
+    filt = _mm_adds_epi8(filt, work_a);
+    /* (vp9_filter + 3 * (qs0 - ps0)) & mask */
+    filt = _mm_and_si128(filt, mask);
 
-    filter1 = _mm_adds_epi8(vp8_filt, t4);
-    filter2 = _mm_adds_epi8(vp8_filt, t3);
+    filter1 = _mm_adds_epi8(filt, t4);
+    filter2 = _mm_adds_epi8(filt, t3);
 
     /* Filter1 >> 3 */
     work_a = _mm_cmpgt_epi8(zero, filter1);
@@ -267,15 +267,15 @@
     filter2 = _mm_and_si128(filter2, t1f);
     filter2 = _mm_or_si128(filter2, work_a);
 
-    /* vp8_filt >> 1 */
-    vp8_filt = _mm_adds_epi8(filter1, t1);
-    work_a = _mm_cmpgt_epi8(zero, vp8_filt);
-    vp8_filt = _mm_srli_epi16(vp8_filt, 1);
+    /* filt >> 1 */
+    filt = _mm_adds_epi8(filter1, t1);
+    work_a = _mm_cmpgt_epi8(zero, filt);
+    filt = _mm_srli_epi16(filt, 1);
     work_a = _mm_and_si128(work_a, t80);
-    vp8_filt = _mm_and_si128(vp8_filt, t7f);
-    vp8_filt = _mm_or_si128(vp8_filt, work_a);
+    filt = _mm_and_si128(filt, t7f);
+    filt = _mm_or_si128(filt, work_a);
 
-    vp8_filt = _mm_andnot_si128(hev, vp8_filt);
+    filt = _mm_andnot_si128(hev, filt);
 
     work_a = _mm_xor_si128(_mm_subs_epi8(qs0, filter1), t80);
     q0 = _mm_load_si128((__m128i *)flat_oq0);
@@ -283,7 +283,7 @@
     q0 = _mm_and_si128(flat, q0);
     q0 = _mm_or_si128(work_a, q0);
 
-    work_a = _mm_xor_si128(_mm_subs_epi8(qs1, vp8_filt), t80);
+    work_a = _mm_xor_si128(_mm_subs_epi8(qs1, filt), t80);
     q1 = _mm_load_si128((__m128i *)flat_oq1);
     work_a = _mm_andnot_si128(flat, work_a);
     q1 = _mm_and_si128(flat, q1);
@@ -301,7 +301,7 @@
     p0 = _mm_and_si128(flat, p0);
     p0 = _mm_or_si128(work_a, p0);
 
-    work_a = _mm_xor_si128(_mm_adds_epi8(ps1, vp8_filt), t80);
+    work_a = _mm_xor_si128(_mm_adds_epi8(ps1, filt), t80);
     p1 = _mm_load_si128((__m128i *)flat_op1);
     work_a = _mm_andnot_si128(flat, work_a);
     p1 = _mm_and_si128(flat, p1);
diff --git a/vp8/common/x86/postproc_mmx.asm b/vp8/common/x86/postproc_mmx.asm
index 3e511b8..fa2152b 100644
--- a/vp8/common/x86/postproc_mmx.asm
+++ b/vp8/common/x86/postproc_mmx.asm
@@ -11,8 +11,8 @@
 
 %include "vpx_ports/x86_abi_support.asm"
 
-%define VP8_FILTER_WEIGHT 128
-%define VP8_FILTER_SHIFT  7
+%define VP9_FILTER_WEIGHT 128
+%define VP9_FILTER_SHIFT  7
 
 ;void vp9_post_proc_down_and_across_mmx
 ;(
@@ -129,7 +129,7 @@
 
 
         paddusw     mm3, RD               ; mm3 += round value
-        psraw       mm3, VP8_FILTER_SHIFT     ; mm3 /= 128
+        psraw       mm3, VP9_FILTER_SHIFT     ; mm3 /= 128
 
         pand        mm1, mm7              ; mm1 select vals > thresh from source
         pandn       mm7, mm3              ; mm7 select vals < thresh from blurred result
@@ -225,7 +225,7 @@
         por         mm7, mm6              ; accumulate thresholds
 
         paddusw     mm3, RD               ; mm3 += round value
-        psraw       mm3, VP8_FILTER_SHIFT     ; mm3 /= 128
+        psraw       mm3, VP9_FILTER_SHIFT     ; mm3 /= 128
 
         pand        mm1, mm7              ; mm1 select vals > thresh from source
         pandn       mm7, mm3              ; mm7 select vals < thresh from blurred result
diff --git a/vp8/common/x86/postproc_x86.h b/vp8/common/x86/postproc_x86.h
index d8792fe..a4c4f8c 100644
--- a/vp8/common/x86/postproc_x86.h
+++ b/vp8/common/x86/postproc_x86.h
@@ -25,14 +25,14 @@
 extern prototype_postproc_addnoise(vp9_plane_add_noise_mmx);
 
 #if !CONFIG_RUNTIME_CPU_DETECT
-#undef  vp8_postproc_down
-#define vp8_postproc_down vp9_mbpost_proc_down_mmx
+#undef  vp9_postproc_down
+#define vp9_postproc_down vp9_mbpost_proc_down_mmx
 
-#undef  vp8_postproc_downacross
-#define vp8_postproc_downacross vp9_post_proc_down_and_across_mmx
+#undef  vp9_postproc_downacross
+#define vp9_postproc_downacross vp9_post_proc_down_and_across_mmx
 
-#undef  vp8_postproc_addnoise
-#define vp8_postproc_addnoise vp9_plane_add_noise_mmx
+#undef  vp9_postproc_addnoise
+#define vp9_postproc_addnoise vp9_plane_add_noise_mmx
 
 #endif
 #endif
@@ -45,17 +45,17 @@
 extern prototype_postproc_addnoise(vp9_plane_add_noise_wmt);
 
 #if !CONFIG_RUNTIME_CPU_DETECT
-#undef  vp8_postproc_down
-#define vp8_postproc_down vp9_mbpost_proc_down_xmm
+#undef  vp9_postproc_down
+#define vp9_postproc_down vp9_mbpost_proc_down_xmm
 
-#undef  vp8_postproc_across
-#define vp8_postproc_across vp9_mbpost_proc_across_ip_xmm
+#undef  vp9_postproc_across
+#define vp9_postproc_across vp9_mbpost_proc_across_ip_xmm
 
-#undef  vp8_postproc_downacross
-#define vp8_postproc_downacross vp9_post_proc_down_and_across_xmm
+#undef  vp9_postproc_downacross
+#define vp9_postproc_downacross vp9_post_proc_down_and_across_xmm
 
-#undef  vp8_postproc_addnoise
-#define vp8_postproc_addnoise vp9_plane_add_noise_wmt
+#undef  vp9_postproc_addnoise
+#define vp9_postproc_addnoise vp9_plane_add_noise_wmt
 
 
 #endif
diff --git a/vp8/common/x86/recon_wrapper_sse2.c b/vp8/common/x86/recon_wrapper_sse2.c
index edec44c..9ee8087 100644
--- a/vp8/common/x86/recon_wrapper_sse2.c
+++ b/vp8/common/x86/recon_wrapper_sse2.c
@@ -15,7 +15,7 @@
 #define build_intra_predictors_mbuv_prototype(sym) \
   void sym(unsigned char *dst, int dst_stride, \
            const unsigned char *src, int src_stride)
-typedef build_intra_predictors_mbuv_prototype((*build_intra_predictors_mbuv_fn_t));
+typedef build_intra_predictors_mbuv_prototype((*build_intra_pred_mbuv_fn_t));
 
 extern build_intra_predictors_mbuv_prototype(vp9_intra_pred_uv_dc_mmx2);
 extern build_intra_predictors_mbuv_prototype(vp9_intra_pred_uv_dctop_mmx2);
@@ -27,14 +27,14 @@
 extern build_intra_predictors_mbuv_prototype(vp9_intra_pred_uv_tm_sse2);
 extern build_intra_predictors_mbuv_prototype(vp9_intra_pred_uv_tm_ssse3);
 
-static void vp9_build_intra_predictors_mbuv_x86(MACROBLOCKD *xd,
-                                                unsigned char *dst_u,
-                                                unsigned char *dst_v,
-                                                int dst_stride,
-                                                build_intra_predictors_mbuv_fn_t tm_func,
-                                                build_intra_predictors_mbuv_fn_t ho_func) {
+static void build_intra_predictors_mbuv_x86(MACROBLOCKD *xd,
+                                            unsigned char *dst_u,
+                                            unsigned char *dst_v,
+                                            int dst_stride,
+                                            build_intra_pred_mbuv_fn_t tm_fn,
+                                            build_intra_pred_mbuv_fn_t ho_fn) {
   int mode = xd->mode_info_context->mbmi.uv_mode;
-  build_intra_predictors_mbuv_fn_t fn;
+  build_intra_pred_mbuv_fn_t fn;
   int src_stride = xd->dst.uv_stride;
 
   switch (mode) {
@@ -42,10 +42,10 @@
       fn = vp9_intra_pred_uv_ve_mmx;
       break;
     case  H_PRED:
-      fn = ho_func;
+      fn = ho_fn;
       break;
     case TM_PRED:
-      fn = tm_func;
+      fn = tm_fn;
       break;
     case DC_PRED:
       if (xd->up_available) {
@@ -73,29 +73,29 @@
 }
 
 void vp9_build_intra_predictors_mbuv_sse2(MACROBLOCKD *xd) {
-  vp9_build_intra_predictors_mbuv_x86(xd, &xd->predictor[256],
-                                      &xd->predictor[320], 8,
-                                      vp9_intra_pred_uv_tm_sse2,
-                                      vp9_intra_pred_uv_ho_mmx2);
+  build_intra_predictors_mbuv_x86(xd, &xd->predictor[256],
+                                  &xd->predictor[320], 8,
+                                  vp9_intra_pred_uv_tm_sse2,
+                                  vp9_intra_pred_uv_ho_mmx2);
 }
 
 void vp9_build_intra_predictors_mbuv_ssse3(MACROBLOCKD *xd) {
-  vp9_build_intra_predictors_mbuv_x86(xd, &xd->predictor[256],
-                                      &xd->predictor[320], 8,
-                                      vp9_intra_pred_uv_tm_ssse3,
-                                      vp9_intra_pred_uv_ho_ssse3);
+  build_intra_predictors_mbuv_x86(xd, &xd->predictor[256],
+                                  &xd->predictor[320], 8,
+                                  vp9_intra_pred_uv_tm_ssse3,
+                                  vp9_intra_pred_uv_ho_ssse3);
 }
 
 void vp9_build_intra_predictors_mbuv_s_sse2(MACROBLOCKD *xd) {
-  vp9_build_intra_predictors_mbuv_x86(xd, xd->dst.u_buffer,
-                                      xd->dst.v_buffer, xd->dst.uv_stride,
-                                      vp9_intra_pred_uv_tm_sse2,
-                                      vp9_intra_pred_uv_ho_mmx2);
+  build_intra_predictors_mbuv_x86(xd, xd->dst.u_buffer,
+                                  xd->dst.v_buffer, xd->dst.uv_stride,
+                                  vp9_intra_pred_uv_tm_sse2,
+                                  vp9_intra_pred_uv_ho_mmx2);
 }
 
 void vp9_build_intra_predictors_mbuv_s_ssse3(MACROBLOCKD *xd) {
-  vp9_build_intra_predictors_mbuv_x86(xd, xd->dst.u_buffer,
-                                      xd->dst.v_buffer, xd->dst.uv_stride,
-                                      vp9_intra_pred_uv_tm_ssse3,
-                                      vp9_intra_pred_uv_ho_ssse3);
+  build_intra_predictors_mbuv_x86(xd, xd->dst.u_buffer,
+                                  xd->dst.v_buffer, xd->dst.uv_stride,
+                                  vp9_intra_pred_uv_tm_ssse3,
+                                  vp9_intra_pred_uv_ho_ssse3);
 }
diff --git a/vp8/common/x86/sadmxn_x86.c b/vp8/common/x86/sadmxn_x86.c
index 46f3882..71fa320 100644
--- a/vp8/common/x86/sadmxn_x86.c
+++ b/vp8/common/x86/sadmxn_x86.c
@@ -17,7 +17,7 @@
 
 
 #if HAVE_SSE2
-unsigned int vp8_sad16x3_sse2(
+unsigned int vp9_sad16x3_sse2(
   const unsigned char *src_ptr,
   int  src_stride,
   const unsigned char *ref_ptr,
@@ -45,7 +45,7 @@
   return _mm_cvtsi128_si32(sad);
 }
 
-unsigned int vp8_sad3x16_sse2(
+unsigned int vp9_sad3x16_sse2(
   const unsigned char *src_ptr,
   int  src_stride,
   const unsigned char *ref_ptr,
diff --git a/vp8/common/x86/subpixel_mmx.asm b/vp8/common/x86/subpixel_mmx.asm
index 919892d..2f757fa 100644
--- a/vp8/common/x86/subpixel_mmx.asm
+++ b/vp8/common/x86/subpixel_mmx.asm
@@ -13,8 +13,8 @@
 
 
 %define BLOCK_HEIGHT_WIDTH 4
-%define vp8_filter_weight 128
-%define VP8_FILTER_SHIFT  7
+%define vp9_filter_weight 128
+%define VP9_FILTER_SHIFT  7
 
 
 ;void vp9_filter_block1d_h6_mmx
@@ -25,7 +25,7 @@
 ;    unsigned int    pixel_step,
 ;    unsigned int    output_height,
 ;    unsigned int    output_width,
-;    short           * vp8_filter
+;    short           * vp9_filter
 ;)
 global sym(vp9_filter_block1d_h6_mmx)
 sym(vp9_filter_block1d_h6_mmx):
@@ -37,7 +37,7 @@
     push        rdi
     ; end prolog
 
-        mov         rdx,    arg(6) ;vp8_filter
+        mov         rdx,    arg(6) ;vp9_filter
 
         movq        mm1,    [rdx + 16]             ; do both the negative taps first!!!
         movq        mm2,    [rdx + 32]         ;
@@ -85,7 +85,7 @@
         paddsw      mm3,    mm5              ; mm3 += mm5
 
         paddsw      mm3,    [GLOBAL(rd)]              ; mm3 += round value
-        psraw       mm3,    VP8_FILTER_SHIFT     ; mm3 /= 128
+        psraw       mm3,    VP9_FILTER_SHIFT     ; mm3 /= 128
         packuswb    mm3,    mm0              ; pack and unpack to saturate
         punpcklbw   mm3,    mm0              ;
 
@@ -122,7 +122,7 @@
 ;   unsigned int pixel_step,
 ;   unsigned int output_height,
 ;   unsigned int output_width,
-;   short * vp8_filter
+;   short * vp9_filter
 ;)
 global sym(vp9_filter_block1dc_v6_mmx)
 sym(vp9_filter_block1dc_v6_mmx):
@@ -136,7 +136,7 @@
 
         movq      mm5, [GLOBAL(rd)]
         push        rbx
-        mov         rbx, arg(7) ;vp8_filter
+        mov         rbx, arg(7) ;vp9_filter
         movq      mm1, [rbx + 16]             ; do both the negative taps first!!!
         movq      mm2, [rbx + 32]         ;
         movq      mm6, [rbx + 48]        ;
@@ -181,7 +181,7 @@
 
 
         paddsw      mm3, mm5               ; mm3 += round value
-        psraw       mm3, VP8_FILTER_SHIFT     ; mm3 /= 128
+        psraw       mm3, VP9_FILTER_SHIFT     ; mm3 /= 128
         packuswb    mm3, mm0              ; pack and saturate
 
         movd        [rdi],mm3             ; store the results in the destination
@@ -273,10 +273,10 @@
         paddw       mm4,        mm6                 ;
 
         paddw       mm3,        [GLOBAL(rd)]                 ; xmm3 += round value
-        psraw       mm3,        VP8_FILTER_SHIFT        ; xmm3 /= 128
+        psraw       mm3,        VP9_FILTER_SHIFT        ; xmm3 /= 128
 
         paddw       mm4,        [GLOBAL(rd)]                 ;
-        psraw       mm4,        VP8_FILTER_SHIFT        ;
+        psraw       mm4,        VP9_FILTER_SHIFT        ;
 
         movq        mm7,        mm3                 ;
         packuswb    mm7,        mm4                 ;
@@ -314,10 +314,10 @@
         pmullw      mm6,        [rax]               ;
 
         paddw       mm3,        [GLOBAL(rd)]                 ; xmm3 += round value
-        psraw       mm3,        VP8_FILTER_SHIFT        ; xmm3 /= 128
+        psraw       mm3,        VP9_FILTER_SHIFT        ; xmm3 /= 128
 
         paddw       mm4,        [GLOBAL(rd)]                 ;
-        psraw       mm4,        VP8_FILTER_SHIFT        ;
+        psraw       mm4,        VP9_FILTER_SHIFT        ;
 
         movq        mm7,        mm3                 ;
         packuswb    mm7,        mm4                 ;
@@ -331,10 +331,10 @@
 
 
         paddw       mm3,        [GLOBAL(rd)]                 ; xmm3 += round value
-        psraw       mm3,        VP8_FILTER_SHIFT        ; xmm3 /= 128
+        psraw       mm3,        VP9_FILTER_SHIFT        ; xmm3 /= 128
 
         paddw       mm4,        [GLOBAL(rd)]                 ;
-        psraw       mm4,        VP8_FILTER_SHIFT        ;
+        psraw       mm4,        VP9_FILTER_SHIFT        ;
 
         packuswb    mm3,        mm4
 
@@ -428,10 +428,10 @@
         paddw       mm4,        mm6                 ;
 
         paddw       mm3,        [GLOBAL(rd)]                 ; xmm3 += round value
-        psraw       mm3,        VP8_FILTER_SHIFT        ; xmm3 /= 128
+        psraw       mm3,        VP9_FILTER_SHIFT        ; xmm3 /= 128
 
         paddw       mm4,        [GLOBAL(rd)]                 ;
-        psraw       mm4,        VP8_FILTER_SHIFT        ;
+        psraw       mm4,        VP9_FILTER_SHIFT        ;
 
         movq        mm7,        mm3                 ;
         packuswb    mm7,        mm4                 ;
@@ -469,10 +469,10 @@
         pmullw      mm6,        [rax]               ;
 
         paddw       mm3,        [GLOBAL(rd)]                 ; xmm3 += round value
-        psraw       mm3,        VP8_FILTER_SHIFT        ; xmm3 /= 128
+        psraw       mm3,        VP9_FILTER_SHIFT        ; xmm3 /= 128
 
         paddw       mm4,        [GLOBAL(rd)]                 ;
-        psraw       mm4,        VP8_FILTER_SHIFT        ;
+        psraw       mm4,        VP9_FILTER_SHIFT        ;
 
         movq        mm7,        mm3                 ;
         packuswb    mm7,        mm4                 ;
@@ -486,10 +486,10 @@
 
 
         paddw       mm3,        [GLOBAL(rd)]                 ; xmm3 += round value
-        psraw       mm3,        VP8_FILTER_SHIFT        ; xmm3 /= 128
+        psraw       mm3,        VP9_FILTER_SHIFT        ; xmm3 /= 128
 
         paddw       mm4,        [GLOBAL(rd)]                 ;
-        psraw       mm4,        VP8_FILTER_SHIFT        ;
+        psraw       mm4,        VP9_FILTER_SHIFT        ;
 
         packuswb    mm3,        mm4
 
@@ -573,7 +573,7 @@
         paddw       mm3,        mm5                 ;
         paddw       mm3,        [GLOBAL(rd)]                 ; xmm3 += round value
 
-        psraw       mm3,        VP8_FILTER_SHIFT        ; xmm3 /= 128
+        psraw       mm3,        VP9_FILTER_SHIFT        ; xmm3 /= 128
 
         movq        mm7,        mm3                 ;
         packuswb    mm7,        mm0                 ;
@@ -597,7 +597,7 @@
         pmullw      mm5,        [rax]               ;
         paddw       mm3,        [GLOBAL(rd)]                 ; xmm3 += round value
 
-        psraw       mm3,        VP8_FILTER_SHIFT        ; xmm3 /= 128
+        psraw       mm3,        VP9_FILTER_SHIFT        ; xmm3 /= 128
         movq        mm7,        mm3                 ;
 
         packuswb    mm7,        mm0                 ;
@@ -607,7 +607,7 @@
 
 
         paddw       mm3,        [GLOBAL(rd)]                 ; xmm3 += round value
-        psraw       mm3,        VP8_FILTER_SHIFT        ; xmm3 /= 128
+        psraw       mm3,        VP9_FILTER_SHIFT        ; xmm3 /= 128
 
         packuswb    mm3,        mm0
         movd        [rdi],      mm3                 ; store the results in the destination
diff --git a/vp8/common/x86/subpixel_sse2.asm b/vp8/common/x86/subpixel_sse2.asm
index 4646d5d..f625874 100644
--- a/vp8/common/x86/subpixel_sse2.asm
+++ b/vp8/common/x86/subpixel_sse2.asm
@@ -12,8 +12,8 @@
 %include "vpx_ports/x86_abi_support.asm"
 
 %define BLOCK_HEIGHT_WIDTH 4
-%define VP8_FILTER_WEIGHT 128
-%define VP8_FILTER_SHIFT  7
+%define VP9_FILTER_WEIGHT 128
+%define VP9_FILTER_SHIFT  7
 
 
 ;/************************************************************************************
@@ -30,7 +30,7 @@
 ;    unsigned int    pixel_step,
 ;    unsigned int    output_height,
 ;    unsigned int    output_width,
-;    short           *vp8_filter
+;    short           *vp9_filter
 ;)
 global sym(vp9_filter_block1d8_h6_sse2)
 sym(vp9_filter_block1d8_h6_sse2):
@@ -43,7 +43,7 @@
     push        rdi
     ; end prolog
 
-        mov         rdx,        arg(6) ;vp8_filter
+        mov         rdx,        arg(6) ;vp9_filter
         mov         rsi,        arg(0) ;src_ptr
 
         mov         rdi,        arg(1) ;output_ptr
@@ -144,7 +144,7 @@
 ;    unsigned int    pixel_step,
 ;    unsigned int    output_height,
 ;    unsigned int    output_width,
-;    short           *vp8_filter
+;    short           *vp9_filter
 ;)
 ;/************************************************************************************
 ; Notes: filter_block1d_h6 applies a 6 tap filter horizontally to the input pixels. The
@@ -163,7 +163,7 @@
     push        rdi
     ; end prolog
 
-        mov         rdx,        arg(6) ;vp8_filter
+        mov         rdx,        arg(6) ;vp9_filter
         mov         rsi,        arg(0) ;src_ptr
 
         mov         rdi,        arg(1) ;output_ptr
@@ -322,7 +322,7 @@
 ;    unsigned int pixel_step,
 ;    unsigned int output_height,
 ;    unsigned int output_width,
-;    short * vp8_filter
+;    short * vp9_filter
 ;)
 ;/************************************************************************************
 ; Notes: filter_block1d8_v6 applies a 6 tap filter vertically to the input pixels. The
@@ -339,7 +339,7 @@
     push        rdi
     ; end prolog
 
-        mov         rax,        arg(7) ;vp8_filter
+        mov         rax,        arg(7) ;vp9_filter
         movsxd      rdx,        dword ptr arg(3) ;pixels_per_line
 
         mov         rdi,        arg(1) ;output_ptr
@@ -417,7 +417,7 @@
 ;    unsigned int pixel_step,
 ;    unsigned int output_height,
 ;    unsigned int output_width,
-;    const short    *vp8_filter
+;    const short    *vp9_filter
 ;)
 ;/************************************************************************************
 ; Notes: filter_block1d16_v6 applies a 6 tap filter vertically to the input pixels. The
@@ -434,7 +434,7 @@
     push        rdi
     ; end prolog
 
-        mov         rax,        arg(7) ;vp8_filter
+        mov         rax,        arg(7) ;vp9_filter
         movsxd      rdx,        dword ptr arg(3) ;pixels_per_line
 
         mov         rdi,        arg(1) ;output_ptr
@@ -530,7 +530,7 @@
 ;    unsigned char  *output_ptr,
 ;    int dst_ptich,
 ;    unsigned int    output_height,
-;    const short    *vp8_filter
+;    const short    *vp9_filter
 ;)
 ; First-pass filter only when yoffset==0
 global sym(vp9_filter_block1d8_h6_only_sse2)
@@ -544,7 +544,7 @@
     push        rdi
     ; end prolog
 
-        mov         rdx,        arg(5) ;vp8_filter
+        mov         rdx,        arg(5) ;vp9_filter
         mov         rsi,        arg(0) ;src_ptr
 
         mov         rdi,        arg(2) ;output_ptr
@@ -643,7 +643,7 @@
 ;    unsigned char  *output_ptr,
 ;    int dst_ptich,
 ;    unsigned int    output_height,
-;    const short    *vp8_filter
+;    const short    *vp9_filter
 ;)
 ; First-pass filter only when yoffset==0
 global sym(vp9_filter_block1d16_h6_only_sse2)
@@ -657,7 +657,7 @@
     push        rdi
     ; end prolog
 
-        mov         rdx,        arg(5) ;vp8_filter
+        mov         rdx,        arg(5) ;vp9_filter
         mov         rsi,        arg(0) ;src_ptr
 
         mov         rdi,        arg(2) ;output_ptr
@@ -808,7 +808,7 @@
 ;    unsigned char *output_ptr,
 ;    int dst_ptich,
 ;    unsigned int output_height,
-;    const short    *vp8_filter
+;    const short    *vp9_filter
 ;)
 ; Second-pass filter only when xoffset==0
 global sym(vp9_filter_block1d8_v6_only_sse2)
@@ -828,7 +828,7 @@
         movsxd      rcx,        dword ptr arg(4) ;output_height
         movsxd      rdx,        dword ptr arg(1) ;src_pixels_per_line
 
-        mov         rax,        arg(5) ;vp8_filter
+        mov         rax,        arg(5) ;vp9_filter
 
         pxor        xmm0,       xmm0                        ; clear xmm0
 
@@ -1032,10 +1032,10 @@
         paddw       xmm4,       xmm6
 
         paddw       xmm3,       [GLOBAL(rd)]        ; xmm3 += round value
-        psraw       xmm3,       VP8_FILTER_SHIFT        ; xmm3 /= 128
+        psraw       xmm3,       VP9_FILTER_SHIFT        ; xmm3 /= 128
 
         paddw       xmm4,       [GLOBAL(rd)]
-        psraw       xmm4,       VP8_FILTER_SHIFT
+        psraw       xmm4,       VP9_FILTER_SHIFT
 
         movdqa      xmm7,       xmm3
         packuswb    xmm7,       xmm4
@@ -1073,10 +1073,10 @@
         pmullw      xmm6,       [rax]
 
         paddw       xmm3,       [GLOBAL(rd)]        ; xmm3 += round value
-        psraw       xmm3,       VP8_FILTER_SHIFT        ; xmm3 /= 128
+        psraw       xmm3,       VP9_FILTER_SHIFT        ; xmm3 /= 128
 
         paddw       xmm4,       [GLOBAL(rd)]
-        psraw       xmm4,       VP8_FILTER_SHIFT
+        psraw       xmm4,       VP9_FILTER_SHIFT
 
         movdqa      xmm7,       xmm3
         packuswb    xmm7,       xmm4
@@ -1088,10 +1088,10 @@
         paddw       xmm4,       xmm6
 
         paddw       xmm3,       [GLOBAL(rd)]        ; xmm3 += round value
-        psraw       xmm3,       VP8_FILTER_SHIFT        ; xmm3 /= 128
+        psraw       xmm3,       VP9_FILTER_SHIFT        ; xmm3 /= 128
 
         paddw       xmm4,       [GLOBAL(rd)]
-        psraw       xmm4,       VP8_FILTER_SHIFT
+        psraw       xmm4,       VP9_FILTER_SHIFT
 
         packuswb    xmm3,       xmm4
         movdqa      [rdi],      xmm3                 ; store the results in the destination
@@ -1153,10 +1153,10 @@
         paddw       xmm4,       xmm6
 
         paddw       xmm3,       [GLOBAL(rd)]        ; xmm3 += round value
-        psraw       xmm3,       VP8_FILTER_SHIFT        ; xmm3 /= 128
+        psraw       xmm3,       VP9_FILTER_SHIFT        ; xmm3 /= 128
 
         paddw       xmm4,       [GLOBAL(rd)]
-        psraw       xmm4,       VP8_FILTER_SHIFT
+        psraw       xmm4,       VP9_FILTER_SHIFT
 
         packuswb    xmm3,       xmm4
         movdqa      [rdi],      xmm3                 ; store the results in the destination
@@ -1197,10 +1197,10 @@
         paddw       xmm4,       xmm6
 
         paddw       xmm3,       [GLOBAL(rd)]        ; xmm3 += round value
-        psraw       xmm3,       VP8_FILTER_SHIFT        ; xmm3 /= 128
+        psraw       xmm3,       VP9_FILTER_SHIFT        ; xmm3 /= 128
 
         paddw       xmm4,       [GLOBAL(rd)]
-        psraw       xmm4,       VP8_FILTER_SHIFT
+        psraw       xmm4,       VP9_FILTER_SHIFT
 
         packuswb    xmm3,       xmm4
         movdqa      [rdi],      xmm3                 ; store the results in the destination
@@ -1314,7 +1314,7 @@
         paddw       xmm3,       xmm4
 
         paddw       xmm3,       [GLOBAL(rd)]        ; xmm3 += round value
-        psraw       xmm3,       VP8_FILTER_SHIFT        ; xmm3 /= 128
+        psraw       xmm3,       VP9_FILTER_SHIFT        ; xmm3 /= 128
 
         movdqa      xmm7,       xmm3
         add         rsp,        16                 ; next line
@@ -1333,7 +1333,7 @@
         pmullw      xmm7,       xmm5
 
         paddw       xmm3,       [GLOBAL(rd)]        ; xmm3 += round value
-        psraw       xmm3,       VP8_FILTER_SHIFT        ; xmm3 /= 128
+        psraw       xmm3,       VP9_FILTER_SHIFT        ; xmm3 /= 128
 
         movdqa      xmm4,       xmm3
 
@@ -1343,7 +1343,7 @@
         movdqa      xmm7,       xmm4
 
         paddw       xmm3,       [GLOBAL(rd)]        ; xmm3 += round value
-        psraw       xmm3,       VP8_FILTER_SHIFT        ; xmm3 /= 128
+        psraw       xmm3,       VP9_FILTER_SHIFT        ; xmm3 /= 128
 
         packuswb    xmm3,       xmm0
         movq        [rdi],      xmm3                 ; store the results in the destination
diff --git a/vp8/common/x86/subpixel_ssse3.asm b/vp8/common/x86/subpixel_ssse3.asm
index 7929623..4a16f19 100644
--- a/vp8/common/x86/subpixel_ssse3.asm
+++ b/vp8/common/x86/subpixel_ssse3.asm
@@ -12,8 +12,8 @@
 %include "vpx_ports/x86_abi_support.asm"
 
 %define BLOCK_HEIGHT_WIDTH 4
-%define VP8_FILTER_WEIGHT 128
-%define VP8_FILTER_SHIFT  7
+%define VP9_FILTER_WEIGHT 128
+%define VP9_FILTER_SHIFT  7
 
 
 ;/************************************************************************************
@@ -32,7 +32,7 @@
 ;    unsigned char *output_ptr,
 ;    unsigned int    output_pitch,
 ;    unsigned int    output_height,
-;    unsigned int    vp8_filter_index
+;    unsigned int    vp9_filter_index
 ;)
 global sym(vp9_filter_block1d8_h6_ssse3)
 sym(vp9_filter_block1d8_h6_ssse3):
@@ -56,7 +56,7 @@
     mov         rdi, arg(2)             ;output_ptr
 
     cmp         esi, DWORD PTR [rax]
-    je          vp8_filter_block1d8_h4_ssse3
+    je          vp9_filter_block1d8_h4_ssse3
 
     movdqa      xmm4, XMMWORD PTR [rax]         ;k0_k5
     movdqa      xmm5, XMMWORD PTR [rax+256]     ;k2_k4
@@ -113,7 +113,7 @@
     pop         rbp
     ret
 
-vp8_filter_block1d8_h4_ssse3:
+vp9_filter_block1d8_h4_ssse3:
     movdqa      xmm5, XMMWORD PTR [rax+256]     ;k2_k4
     movdqa      xmm6, XMMWORD PTR [rax+128]     ;k1_k3
 
@@ -175,7 +175,7 @@
 ;    unsigned char  *output_ptr,
 ;    unsigned int    output_pitch,
 ;    unsigned int    output_height,
-;    unsigned int    vp8_filter_index
+;    unsigned int    vp9_filter_index
 ;)
 global sym(vp9_filter_block1d16_h6_ssse3)
 sym(vp9_filter_block1d16_h6_ssse3):
@@ -282,7 +282,7 @@
 ;    unsigned char  *output_ptr,
 ;    unsigned int    output_pitch,
 ;    unsigned int    output_height,
-;    unsigned int    vp8_filter_index
+;    unsigned int    vp9_filter_index
 ;)
 global sym(vp9_filter_block1d4_h6_ssse3)
 sym(vp9_filter_block1d4_h6_ssse3):
@@ -304,7 +304,7 @@
     movdqa      xmm7, [GLOBAL(rd)]
 
     cmp         esi, DWORD PTR [rax]
-    je          .vp8_filter_block1d4_h4_ssse3
+    je          .vp9_filter_block1d4_h4_ssse3
 
     movdqa      xmm4, XMMWORD PTR [rax]         ;k0_k5
     movdqa      xmm5, XMMWORD PTR [rax+256]     ;k2_k4
@@ -356,7 +356,7 @@
     pop         rbp
     ret
 
-.vp8_filter_block1d4_h4_ssse3:
+.vp9_filter_block1d4_h4_ssse3:
     movdqa      xmm5, XMMWORD PTR [rax+256]     ;k2_k4
     movdqa      xmm6, XMMWORD PTR [rax+128]     ;k1_k3
     movdqa      xmm0, XMMWORD PTR [GLOBAL(shuf2b)]
@@ -411,7 +411,7 @@
 ;    unsigned char *output_ptr,
 ;    unsigned int   out_pitch,
 ;    unsigned int   output_height,
-;    unsigned int   vp8_filter_index
+;    unsigned int   vp9_filter_index
 ;)
 global sym(vp9_filter_block1d16_v6_ssse3)
 sym(vp9_filter_block1d16_v6_ssse3):
@@ -432,7 +432,7 @@
     add         rax, rdx
 
     cmp         esi, DWORD PTR [rax]
-    je          .vp8_filter_block1d16_v4_ssse3
+    je          .vp9_filter_block1d16_v4_ssse3
 
     movdqa      xmm5, XMMWORD PTR [rax]         ;k0_k5
     movdqa      xmm6, XMMWORD PTR [rax+256]     ;k2_k4
@@ -519,7 +519,7 @@
     pop         rbp
     ret
 
-.vp8_filter_block1d16_v4_ssse3:
+.vp9_filter_block1d16_v4_ssse3:
     movdqa      xmm6, XMMWORD PTR [rax+256]     ;k2_k4
     movdqa      xmm7, XMMWORD PTR [rax+128]     ;k1_k3
 
@@ -534,7 +534,7 @@
     movsxd      rcx, DWORD PTR arg(4)   ;output_height
     add         rax, rdx
 
-.vp8_filter_block1d16_v4_ssse3_loop:
+.vp9_filter_block1d16_v4_ssse3_loop:
     movq        xmm2, MMWORD PTR [rsi + rdx]            ;B
     movq        xmm3, MMWORD PTR [rsi + rdx * 2]        ;C
     movq        xmm4, MMWORD PTR [rax + rdx * 2]        ;D
@@ -581,7 +581,7 @@
     add         rdi,        r8
 %endif
     dec         rcx
-    jnz         .vp8_filter_block1d16_v4_ssse3_loop
+    jnz         .vp9_filter_block1d16_v4_ssse3_loop
 
     ; begin epilog
     pop rdi
@@ -599,7 +599,7 @@
 ;    unsigned char *output_ptr,
 ;    unsigned int   out_pitch,
 ;    unsigned int   output_height,
-;    unsigned int   vp8_filter_index
+;    unsigned int   vp9_filter_index
 ;)
 global sym(vp9_filter_block1d8_v6_ssse3)
 sym(vp9_filter_block1d8_v6_ssse3):
@@ -627,7 +627,7 @@
     movsxd      rcx, DWORD PTR arg(4)   ;[output_height]
 
     cmp         esi, DWORD PTR [rax]
-    je          .vp8_filter_block1d8_v4_ssse3
+    je          .vp9_filter_block1d8_v4_ssse3
 
     movdqa      xmm5, XMMWORD PTR [rax]         ;k0_k5
     movdqa      xmm6, XMMWORD PTR [rax+256]     ;k2_k4
@@ -684,7 +684,7 @@
     pop         rbp
     ret
 
-.vp8_filter_block1d8_v4_ssse3:
+.vp9_filter_block1d8_v4_ssse3:
     movdqa      xmm6, XMMWORD PTR [rax+256]     ;k2_k4
     movdqa      xmm7, XMMWORD PTR [rax+128]     ;k1_k3
     movdqa      xmm5, [GLOBAL(rd)]
@@ -694,7 +694,7 @@
     mov         rax, rsi
     add         rax, rdx
 
-.vp8_filter_block1d8_v4_ssse3_loop:
+.vp9_filter_block1d8_v4_ssse3_loop:
     movq        xmm2, MMWORD PTR [rsi + rdx]            ;B
     movq        xmm3, MMWORD PTR [rsi + rdx * 2]        ;C
     movq        xmm4, MMWORD PTR [rax + rdx * 2]        ;D
@@ -722,7 +722,7 @@
     add         rdi,        r8
 %endif
     dec         rcx
-    jnz         .vp8_filter_block1d8_v4_ssse3_loop
+    jnz         .vp9_filter_block1d8_v4_ssse3_loop
 
     ; begin epilog
     pop rdi
@@ -739,7 +739,7 @@
 ;    unsigned char *output_ptr,
 ;    unsigned int   out_pitch,
 ;    unsigned int   output_height,
-;    unsigned int   vp8_filter_index
+;    unsigned int   vp9_filter_index
 ;)
 global sym(vp9_filter_block1d4_v6_ssse3)
 sym(vp9_filter_block1d4_v6_ssse3):
@@ -766,7 +766,7 @@
     movsxd      rcx, DWORD PTR arg(4)   ;[output_height]
 
     cmp         esi, DWORD PTR [rax]
-    je          .vp8_filter_block1d4_v4_ssse3
+    je          .vp9_filter_block1d4_v4_ssse3
 
     movq        mm5, MMWORD PTR [rax]         ;k0_k5
     movq        mm6, MMWORD PTR [rax+256]     ;k2_k4
@@ -823,7 +823,7 @@
     pop         rbp
     ret
 
-.vp8_filter_block1d4_v4_ssse3:
+.vp9_filter_block1d4_v4_ssse3:
     movq        mm6, MMWORD PTR [rax+256]     ;k2_k4
     movq        mm7, MMWORD PTR [rax+128]     ;k1_k3
     movq        mm5, MMWORD PTR [GLOBAL(rd)]
@@ -833,7 +833,7 @@
     mov         rax, rsi
     add         rax, rdx
 
-.vp8_filter_block1d4_v4_ssse3_loop:
+.vp9_filter_block1d4_v4_ssse3_loop:
     movd        mm2, DWORD PTR [rsi + rdx]            ;B
     movd        mm3, DWORD PTR [rsi + rdx * 2]        ;C
     movd        mm4, DWORD PTR [rax + rdx * 2]        ;D
@@ -861,7 +861,7 @@
     add         rdi,        r8
 %endif
     dec         rcx
-    jnz         .vp8_filter_block1d4_v4_ssse3_loop
+    jnz         .vp9_filter_block1d4_v4_ssse3_loop
 
     ; begin epilog
     pop rdi
@@ -891,7 +891,7 @@
     push        rdi
     ; end prolog
 
-        lea         rcx,        [GLOBAL(vp8_bilinear_filters_ssse3)]
+        lea         rcx,        [GLOBAL(bilinear_filters_ssse3)]
         movsxd      rax,        dword ptr arg(2)    ; xoffset
 
         cmp         rax,        0                   ; skip first_pass filter if xoffset=0
@@ -939,10 +939,10 @@
         pmaddubsw   xmm4,       xmm1                ; 01 03 05 07 09 11 13 15
 
         paddw       xmm3,       [GLOBAL(rd)]        ; xmm3 += round value
-        psraw       xmm3,       VP8_FILTER_SHIFT    ; xmm3 /= 128
+        psraw       xmm3,       VP9_FILTER_SHIFT    ; xmm3 /= 128
 
         paddw       xmm4,       [GLOBAL(rd)]        ; xmm4 += round value
-        psraw       xmm4,       VP8_FILTER_SHIFT    ; xmm4 /= 128
+        psraw       xmm4,       VP9_FILTER_SHIFT    ; xmm4 /= 128
 
         movdqa      xmm7,       xmm3
         packuswb    xmm7,       xmm4                ; 00 01 02 03 04 05 06 07 08 09 10 11 12 13 14 15
@@ -963,10 +963,10 @@
         pmaddubsw   xmm4,       xmm1
 
         paddw       xmm6,       [GLOBAL(rd)]        ; xmm6 += round value
-        psraw       xmm6,       VP8_FILTER_SHIFT    ; xmm6 /= 128
+        psraw       xmm6,       VP9_FILTER_SHIFT    ; xmm6 /= 128
 
         paddw       xmm4,       [GLOBAL(rd)]        ; xmm4 += round value
-        psraw       xmm4,       VP8_FILTER_SHIFT    ; xmm4 /= 128
+        psraw       xmm4,       VP9_FILTER_SHIFT    ; xmm4 /= 128
 
         packuswb    xmm6,       xmm4
         movdqa      xmm5,       xmm7
@@ -978,10 +978,10 @@
         pmaddubsw   xmm7,       xmm2
 
         paddw       xmm5,       [GLOBAL(rd)]        ; xmm5 += round value
-        psraw       xmm5,       VP8_FILTER_SHIFT    ; xmm5 /= 128
+        psraw       xmm5,       VP9_FILTER_SHIFT    ; xmm5 /= 128
 
         paddw       xmm7,       [GLOBAL(rd)]        ; xmm7 += round value
-        psraw       xmm7,       VP8_FILTER_SHIFT    ; xmm7 /= 128
+        psraw       xmm7,       VP9_FILTER_SHIFT    ; xmm7 /= 128
 
         packuswb    xmm5,       xmm7
         movdqa      xmm7,       xmm6
@@ -1040,8 +1040,8 @@
         pmaddubsw   xmm5,       xmm1
         paddw       xmm2,       [GLOBAL(rd)]
 
-        psraw       xmm4,       VP8_FILTER_SHIFT
-        psraw       xmm2,       VP8_FILTER_SHIFT
+        psraw       xmm4,       VP9_FILTER_SHIFT
+        psraw       xmm2,       VP9_FILTER_SHIFT
 
         packuswb    xmm4,       xmm2
         paddw       xmm3,       [GLOBAL(rd)]
@@ -1049,8 +1049,8 @@
         movdqa      [rdi],      xmm4                ; store row 0
         paddw       xmm5,       [GLOBAL(rd)]
 
-        psraw       xmm3,       VP8_FILTER_SHIFT
-        psraw       xmm5,       VP8_FILTER_SHIFT
+        psraw       xmm3,       VP9_FILTER_SHIFT
+        psraw       xmm5,       VP9_FILTER_SHIFT
 
         packuswb    xmm3,       xmm5
         movdqa      xmm4,       xmm7
@@ -1091,7 +1091,7 @@
         movq        xmm7,       [rsi+1]
 
         movq        xmm6,       [rsi+8]
-        psraw       xmm2,       VP8_FILTER_SHIFT
+        psraw       xmm2,       VP9_FILTER_SHIFT
 
         punpcklbw   xmm5,       xmm7
         movq        xmm7,       [rsi+9]
@@ -1099,7 +1099,7 @@
         paddw       xmm3,       [GLOBAL(rd)]
         pmaddubsw   xmm5,       xmm1
 
-        psraw       xmm3,       VP8_FILTER_SHIFT
+        psraw       xmm3,       VP9_FILTER_SHIFT
         punpcklbw   xmm6,       xmm7
 
         packuswb    xmm2,       xmm3
@@ -1109,10 +1109,10 @@
         paddw       xmm5,       [GLOBAL(rd)]
 
         lea         rdi,        [rdi + rdx]         ; dst_pitch
-        psraw       xmm5,       VP8_FILTER_SHIFT
+        psraw       xmm5,       VP9_FILTER_SHIFT
 
         paddw       xmm6,       [GLOBAL(rd)]
-        psraw       xmm6,       VP8_FILTER_SHIFT
+        psraw       xmm6,       VP9_FILTER_SHIFT
 
         packuswb    xmm5,       xmm6
         lea         rsi,        [rsi + rax]         ; next line
@@ -1157,7 +1157,7 @@
     ALIGN_STACK 16, rax
     sub         rsp, 144                         ; reserve 144 bytes
 
-        lea         rcx,        [GLOBAL(vp8_bilinear_filters_ssse3)]
+        lea         rcx,        [GLOBAL(bilinear_filters_ssse3)]
 
         mov         rsi,        arg(0) ;src_ptr
         movsxd      rdx,        dword ptr arg(1) ;src_pixels_per_line
@@ -1223,7 +1223,7 @@
         pmaddubsw   xmm3,       xmm0                ; 00 02 04 06 08 10 12 14
 
         paddw       xmm3,       [GLOBAL(rd)]        ; xmm3 += round value
-        psraw       xmm3,       VP8_FILTER_SHIFT    ; xmm3 /= 128
+        psraw       xmm3,       VP9_FILTER_SHIFT    ; xmm3 /= 128
 
         movdqa      xmm7,       xmm3
         packuswb    xmm7,       xmm7                ; 00 01 02 03 04 05 06 07 08 09 10 11 12 13 14 15
@@ -1240,7 +1240,7 @@
         pmaddubsw   xmm6,       xmm0
 
         paddw       xmm6,       [GLOBAL(rd)]        ; xmm6 += round value
-        psraw       xmm6,       VP8_FILTER_SHIFT    ; xmm6 /= 128
+        psraw       xmm6,       VP9_FILTER_SHIFT    ; xmm6 /= 128
 
         packuswb    xmm6,       xmm6
 
@@ -1248,7 +1248,7 @@
         pmaddubsw   xmm7,       xmm1
 
         paddw       xmm7,       [GLOBAL(rd)]        ; xmm7 += round value
-        psraw       xmm7,       VP8_FILTER_SHIFT    ; xmm7 /= 128
+        psraw       xmm7,       VP9_FILTER_SHIFT    ; xmm7 /= 128
 
         packuswb    xmm7,       xmm7
 
@@ -1303,21 +1303,21 @@
         paddw       xmm1,       [GLOBAL(rd)]
 
         paddw       xmm2,       [GLOBAL(rd)]
-        psraw       xmm1,       VP8_FILTER_SHIFT
+        psraw       xmm1,       VP9_FILTER_SHIFT
 
         paddw       xmm3,       [GLOBAL(rd)]
-        psraw       xmm2,       VP8_FILTER_SHIFT
+        psraw       xmm2,       VP9_FILTER_SHIFT
 
         paddw       xmm4,       [GLOBAL(rd)]
-        psraw       xmm3,       VP8_FILTER_SHIFT
+        psraw       xmm3,       VP9_FILTER_SHIFT
 
         paddw       xmm5,       [GLOBAL(rd)]
-        psraw       xmm4,       VP8_FILTER_SHIFT
+        psraw       xmm4,       VP9_FILTER_SHIFT
 
         paddw       xmm6,       [GLOBAL(rd)]
-        psraw       xmm5,       VP8_FILTER_SHIFT
+        psraw       xmm5,       VP9_FILTER_SHIFT
 
-        psraw       xmm6,       VP8_FILTER_SHIFT
+        psraw       xmm6,       VP9_FILTER_SHIFT
         packuswb    xmm1,       xmm1
 
         packuswb    xmm2,       xmm2
@@ -1350,10 +1350,10 @@
         pmaddubsw   xmm1,       xmm0
         paddw       xmm7,       [GLOBAL(rd)]
 
-        psraw       xmm7,       VP8_FILTER_SHIFT
+        psraw       xmm7,       VP9_FILTER_SHIFT
         paddw       xmm1,       [GLOBAL(rd)]
 
-        psraw       xmm1,       VP8_FILTER_SHIFT
+        psraw       xmm1,       VP9_FILTER_SHIFT
         packuswb    xmm7,       xmm7
 
         packuswb    xmm1,       xmm1
@@ -1401,16 +1401,16 @@
         pmaddubsw   xmm7,       xmm0
 
         paddw       xmm1,       [GLOBAL(rd)]
-        psraw       xmm1,       VP8_FILTER_SHIFT
+        psraw       xmm1,       VP9_FILTER_SHIFT
 
         paddw       xmm3,       [GLOBAL(rd)]
-        psraw       xmm3,       VP8_FILTER_SHIFT
+        psraw       xmm3,       VP9_FILTER_SHIFT
 
         paddw       xmm5,       [GLOBAL(rd)]
-        psraw       xmm5,       VP8_FILTER_SHIFT
+        psraw       xmm5,       VP9_FILTER_SHIFT
 
         paddw       xmm7,       [GLOBAL(rd)]
-        psraw       xmm7,       VP8_FILTER_SHIFT
+        psraw       xmm7,       VP9_FILTER_SHIFT
 
         packuswb    xmm1,       xmm1
         packuswb    xmm3,       xmm3
@@ -1495,7 +1495,7 @@
     times 8 db  36,  -11
     times 8 db  12,   -6
 align 16
-vp8_bilinear_filters_ssse3:
+bilinear_filters_ssse3:
     times 8 db 128, 0
     times 8 db 120, 8
     times 8 db 112, 16
diff --git a/vp8/common/x86/subpixel_x86.h b/vp8/common/x86/subpixel_x86.h
index 59225c7..4c224da 100644
--- a/vp8/common/x86/subpixel_x86.h
+++ b/vp8/common/x86/subpixel_x86.h
@@ -31,29 +31,29 @@
 
 
 #if !CONFIG_RUNTIME_CPU_DETECT
-#undef  vp8_subpix_sixtap16x16
-#define vp8_subpix_sixtap16x16 vp9_sixtap_predict16x16_mmx
+#undef  vp9_subpix_sixtap16x16
+#define vp9_subpix_sixtap16x16 vp9_sixtap_predict16x16_mmx
 
-#undef  vp8_subpix_sixtap8x8
-#define vp8_subpix_sixtap8x8 vp9_sixtap_predict8x8_mmx
+#undef  vp9_subpix_sixtap8x8
+#define vp9_subpix_sixtap8x8 vp9_sixtap_predict8x8_mmx
 
-#undef  vp8_subpix_sixtap8x4
-#define vp8_subpix_sixtap8x4 vp9_sixtap_predict8x4_mmx
+#undef  vp9_subpix_sixtap8x4
+#define vp9_subpix_sixtap8x4 vp9_sixtap_predict8x4_mmx
 
-#undef  vp8_subpix_sixtap4x4
-#define vp8_subpix_sixtap4x4 vp9_sixtap_predict4x4_mmx
+#undef  vp9_subpix_sixtap4x4
+#define vp9_subpix_sixtap4x4 vp9_sixtap_predict4x4_mmx
 
-#undef  vp8_subpix_bilinear16x16
-#define vp8_subpix_bilinear16x16 vp9_bilinear_predict16x16_mmx
+#undef  vp9_subpix_bilinear16x16
+#define vp9_subpix_bilinear16x16 vp9_bilinear_predict16x16_mmx
 
-#undef  vp8_subpix_bilinear8x8
-#define vp8_subpix_bilinear8x8 vp9_bilinear_predict8x8_mmx
+#undef  vp9_subpix_bilinear8x8
+#define vp9_subpix_bilinear8x8 vp9_bilinear_predict8x8_mmx
 
-#undef  vp8_subpix_bilinear8x4
-#define vp8_subpix_bilinear8x4 vp9_bilinear_predict8x4_mmx
+#undef  vp9_subpix_bilinear8x4
+#define vp9_subpix_bilinear8x4 vp9_bilinear_predict8x4_mmx
 
-#undef  vp8_subpix_bilinear4x4
-#define vp8_subpix_bilinear4x4 vp9_bilinear_predict4x4_mmx
+#undef  vp9_subpix_bilinear4x4
+#define vp9_subpix_bilinear4x4 vp9_bilinear_predict4x4_mmx
 
 #endif
 #endif
@@ -68,20 +68,20 @@
 
 
 #if !CONFIG_RUNTIME_CPU_DETECT
-#undef  vp8_subpix_sixtap16x16
-#define vp8_subpix_sixtap16x16 vp9_sixtap_predict16x16_sse2
+#undef  vp9_subpix_sixtap16x16
+#define vp9_subpix_sixtap16x16 vp9_sixtap_predict16x16_sse2
 
-#undef  vp8_subpix_sixtap8x8
-#define vp8_subpix_sixtap8x8 vp9_sixtap_predict8x8_sse2
+#undef  vp9_subpix_sixtap8x8
+#define vp9_subpix_sixtap8x8 vp9_sixtap_predict8x8_sse2
 
-#undef  vp8_subpix_sixtap8x4
-#define vp8_subpix_sixtap8x4 vp9_sixtap_predict8x4_sse2
+#undef  vp9_subpix_sixtap8x4
+#define vp9_subpix_sixtap8x4 vp9_sixtap_predict8x4_sse2
 
-#undef  vp8_subpix_bilinear16x16
-#define vp8_subpix_bilinear16x16 vp9_bilinear_predict16x16_sse2
+#undef  vp9_subpix_bilinear16x16
+#define vp9_subpix_bilinear16x16 vp9_bilinear_predict16x16_sse2
 
-#undef  vp8_subpix_bilinear8x8
-#define vp8_subpix_bilinear8x8 vp9_bilinear_predict8x8_sse2
+#undef  vp9_subpix_bilinear8x8
+#define vp9_subpix_bilinear8x8 vp9_bilinear_predict8x8_sse2
 
 #endif
 #endif
@@ -95,24 +95,24 @@
 extern prototype_subpixel_predict(vp9_bilinear_predict8x8_ssse3);
 
 #if !CONFIG_RUNTIME_CPU_DETECT
-#undef  vp8_subpix_sixtap16x16
-#define vp8_subpix_sixtap16x16 vp9_sixtap_predict16x16_ssse3
+#undef  vp9_subpix_sixtap16x16
+#define vp9_subpix_sixtap16x16 vp9_sixtap_predict16x16_ssse3
 
-#undef  vp8_subpix_sixtap8x8
-#define vp8_subpix_sixtap8x8 vp9_sixtap_predict8x8_ssse3
+#undef  vp9_subpix_sixtap8x8
+#define vp9_subpix_sixtap8x8 vp9_sixtap_predict8x8_ssse3
 
-#undef  vp8_subpix_sixtap8x4
-#define vp8_subpix_sixtap8x4 vp9_sixtap_predict8x4_ssse3
+#undef  vp9_subpix_sixtap8x4
+#define vp9_subpix_sixtap8x4 vp9_sixtap_predict8x4_ssse3
 
-#undef  vp8_subpix_sixtap4x4
-#define vp8_subpix_sixtap4x4 vp9_sixtap_predict4x4_ssse3
+#undef  vp9_subpix_sixtap4x4
+#define vp9_subpix_sixtap4x4 vp9_sixtap_predict4x4_ssse3
 
 
-#undef  vp8_subpix_bilinear16x16
-#define vp8_subpix_bilinear16x16 vp9_bilinear_predict16x16_ssse3
+#undef  vp9_subpix_bilinear16x16
+#define vp9_subpix_bilinear16x16 vp9_bilinear_predict16x16_ssse3
 
-#undef  vp8_subpix_bilinear8x8
-#define vp8_subpix_bilinear8x8 vp9_bilinear_predict8x8_ssse3
+#undef  vp9_subpix_bilinear8x8
+#define vp9_subpix_bilinear8x8 vp9_bilinear_predict8x8_ssse3
 
 #endif
 #endif
diff --git a/vp8/common/x86/vp8_asm_stubs.c b/vp8/common/x86/vp8_asm_stubs.c
index 8e4fd96..86ae5a6 100644
--- a/vp8/common/x86/vp8_asm_stubs.c
+++ b/vp8/common/x86/vp8_asm_stubs.c
@@ -24,7 +24,7 @@
   unsigned int    pixel_step,
   unsigned int    output_height,
   unsigned int    output_width,
-  const short      *vp8_filter
+  const short      *vp9_filter
 );
 extern void vp9_filter_block1dc_v6_mmx
 (
@@ -35,7 +35,7 @@
   unsigned int    pixel_step,
   unsigned int    output_height,
   unsigned int    output_width,
-  const short    *vp8_filter
+  const short    *vp9_filter
 );
 extern void vp9_filter_block1d8_h6_sse2
 (
@@ -45,7 +45,7 @@
   unsigned int    pixel_step,
   unsigned int    output_height,
   unsigned int    output_width,
-  const short    *vp8_filter
+  const short    *vp9_filter
 );
 extern void vp9_filter_block1d16_h6_sse2
 (
@@ -55,7 +55,7 @@
   unsigned int    pixel_step,
   unsigned int    output_height,
   unsigned int    output_width,
-  const short    *vp8_filter
+  const short    *vp9_filter
 );
 extern void vp9_filter_block1d8_v6_sse2
 (
@@ -66,7 +66,7 @@
   unsigned int pixel_step,
   unsigned int output_height,
   unsigned int output_width,
-  const short    *vp8_filter
+  const short    *vp9_filter
 );
 extern void vp9_filter_block1d16_v6_sse2
 (
@@ -77,7 +77,7 @@
   unsigned int pixel_step,
   unsigned int output_height,
   unsigned int output_width,
-  const short    *vp8_filter
+  const short    *vp9_filter
 );
 extern void vp9_unpack_block1d16_h6_sse2
 (
@@ -94,7 +94,7 @@
   unsigned char  *output_ptr,
   int dst_ptich,
   unsigned int    output_height,
-  const short    *vp8_filter
+  const short    *vp9_filter
 );
 extern void vp9_filter_block1d16_h6_only_sse2
 (
@@ -103,7 +103,7 @@
   unsigned char  *output_ptr,
   int dst_ptich,
   unsigned int    output_height,
-  const short    *vp8_filter
+  const short    *vp9_filter
 );
 extern void vp9_filter_block1d8_v6_only_sse2
 (
@@ -112,7 +112,7 @@
   unsigned char *output_ptr,
   int dst_ptich,
   unsigned int   output_height,
-  const short   *vp8_filter
+  const short   *vp9_filter
 );
 extern prototype_subpixel_predict(vp9_bilinear_predict8x8_mmx);
 
@@ -363,7 +363,7 @@
   unsigned char  *output_ptr,
   unsigned int    output_pitch,
   unsigned int    output_height,
-  unsigned int    vp8_filter_index
+  unsigned int    vp9_filter_index
 );
 
 extern void vp9_filter_block1d16_h6_ssse3
@@ -373,7 +373,7 @@
   unsigned char  *output_ptr,
   unsigned int    output_pitch,
   unsigned int    output_height,
-  unsigned int    vp8_filter_index
+  unsigned int    vp9_filter_index
 );
 
 extern void vp9_filter_block1d16_v6_ssse3
@@ -383,7 +383,7 @@
   unsigned char *output_ptr,
   unsigned int   out_pitch,
   unsigned int   output_height,
-  unsigned int   vp8_filter_index
+  unsigned int   vp9_filter_index
 );
 
 extern void vp9_filter_block1d8_v6_ssse3
@@ -393,7 +393,7 @@
   unsigned char *output_ptr,
   unsigned int   out_pitch,
   unsigned int   output_height,
-  unsigned int   vp8_filter_index
+  unsigned int   vp9_filter_index
 );
 
 extern void vp9_filter_block1d4_h6_ssse3
@@ -403,7 +403,7 @@
   unsigned char  *output_ptr,
   unsigned int    output_pitch,
   unsigned int    output_height,
-  unsigned int    vp8_filter_index
+  unsigned int    vp9_filter_index
 );
 
 extern void vp9_filter_block1d4_v6_ssse3
@@ -413,7 +413,7 @@
   unsigned char *output_ptr,
   unsigned int   out_pitch,
   unsigned int   output_height,
-  unsigned int   vp8_filter_index
+  unsigned int   vp9_filter_index
 );
 
 void vp9_sixtap_predict16x16_ssse3
diff --git a/vp8/decoder/dboolhuff.c b/vp8/decoder/dboolhuff.c
index e81d61a..f1e1cdb 100644
--- a/vp8/decoder/dboolhuff.c
+++ b/vp8/decoder/dboolhuff.c
@@ -35,14 +35,14 @@
 void vp9_bool_decoder_fill(BOOL_DECODER *br) {
   const unsigned char *bufptr;
   const unsigned char *bufend;
-  VP8_BD_VALUE         value;
+  VP9_BD_VALUE         value;
   int                  count;
   bufend = br->user_buffer_end;
   bufptr = br->user_buffer;
   value = br->value;
   count = br->count;
 
-  VP8DX_BOOL_DECODER_FILL(count, value, bufptr, bufend);
+  VP9DX_BOOL_DECODER_FILL(count, value, bufptr, bufend);
 
   br->user_buffer = bufptr;
   br->value = value;
@@ -71,11 +71,11 @@
   int l = get_unsigned_bits(n);
   int m = (1 << l) - n;
   if (!l) return 0;
-  v = vp8_decode_value(br, l - 1);
+  v = decode_value(br, l - 1);
   if (v < m)
     return v;
   else
-    return (v << 1) - m + vp8_decode_value(br, 1);
+    return (v << 1) - m + decode_value(br, 1);
 }
 
 int vp9_decode_term_subexp(BOOL_DECODER *br, int k, int num_syms) {
@@ -87,11 +87,11 @@
       word = vp9_decode_uniform(br, num_syms - mk) + mk;
       break;
     } else {
-      if (vp8_decode_value(br, 1)) {
+      if (decode_value(br, 1)) {
         i++;
         mk += a;
       } else {
-        word = vp8_decode_value(br, b) + mk;
+        word = decode_value(br, b) + mk;
         break;
       }
     }
diff --git a/vp8/decoder/dboolhuff.h b/vp8/decoder/dboolhuff.h
index f6af5c8..285d2a9 100644
--- a/vp8/decoder/dboolhuff.h
+++ b/vp8/decoder/dboolhuff.h
@@ -17,18 +17,18 @@
 #include "vpx_ports/mem.h"
 #include "vpx/vpx_integer.h"
 
-typedef size_t VP8_BD_VALUE;
+typedef size_t VP9_BD_VALUE;
 
-# define VP8_BD_VALUE_SIZE ((int)sizeof(VP8_BD_VALUE)*CHAR_BIT)
+# define VP9_BD_VALUE_SIZE ((int)sizeof(VP9_BD_VALUE)*CHAR_BIT)
 /*This is meant to be a large, positive constant that can still be efficiently
    loaded as an immediate (on platforms like ARM, for example).
   Even relatively modest values like 100 would work fine.*/
-# define VP8_LOTS_OF_BITS (0x40000000)
+# define VP9_LOTS_OF_BITS (0x40000000)
 
 typedef struct {
   const unsigned char *user_buffer_end;
   const unsigned char *user_buffer;
-  VP8_BD_VALUE         value;
+  VP9_BD_VALUE         value;
   int                  count;
   unsigned int         range;
 } BOOL_DECODER;
@@ -51,10 +51,10 @@
    multiple BOOL_DECODER fields must be modified, and the compiler is not smart
    enough to eliminate the stores to those fields and the subsequent reloads
    from them when inlining the function.*/
-#define VP8DX_BOOL_DECODER_FILL(_count,_value,_bufptr,_bufend) \
+#define VP9DX_BOOL_DECODER_FILL(_count,_value,_bufptr,_bufend) \
   do \
   { \
-    int shift = VP8_BD_VALUE_SIZE - 8 - ((_count) + 8); \
+    int shift = VP9_BD_VALUE_SIZE - 8 - ((_count) + 8); \
     int loop_end, x; \
     size_t bits_left = ((_bufend)-(_bufptr))*CHAR_BIT; \
     \
@@ -62,25 +62,25 @@
     loop_end = 0; \
     if(x >= 0) \
     { \
-      (_count) += VP8_LOTS_OF_BITS; \
+      (_count) += VP9_LOTS_OF_BITS; \
       loop_end = x; \
       if(!bits_left) break; \
     } \
     while(shift >= loop_end) \
     { \
       (_count) += CHAR_BIT; \
-      (_value) |= (VP8_BD_VALUE)*(_bufptr)++ << shift; \
+      (_value) |= (VP9_BD_VALUE)*(_bufptr)++ << shift; \
       shift -= CHAR_BIT; \
     } \
   } \
   while(0) \
 
 
-static int vp8dx_decode_bool(BOOL_DECODER *br, int probability) {
+static int decode_bool(BOOL_DECODER *br, int probability) {
   unsigned int bit = 0;
-  VP8_BD_VALUE value;
+  VP9_BD_VALUE value;
   unsigned int split;
-  VP8_BD_VALUE bigsplit;
+  VP9_BD_VALUE bigsplit;
   int count;
   unsigned int range;
 
@@ -92,7 +92,7 @@
   value = br->value;
   count = br->count;
 
-  bigsplit = (VP8_BD_VALUE)split << (VP8_BD_VALUE_SIZE - 8);
+  bigsplit = (VP9_BD_VALUE)split << (VP9_BD_VALUE_SIZE - 8);
 
   range = split;
 
@@ -115,18 +115,18 @@
   return bit;
 }
 
-static int vp8_decode_value(BOOL_DECODER *br, int bits) {
+static int decode_value(BOOL_DECODER *br, int bits) {
   int z = 0;
   int bit;
 
   for (bit = bits - 1; bit >= 0; bit--) {
-    z |= (vp8dx_decode_bool(br, 0x80) << bit);
+    z |= (decode_bool(br, 0x80) << bit);
   }
 
   return z;
 }
 
-static int vp8dx_bool_error(BOOL_DECODER *br) {
+static int bool_error(BOOL_DECODER *br) {
   /* Check if we have reached the end of the buffer.
    *
    * Variable 'count' stores the number of bits in the 'value' buffer, minus
@@ -136,10 +136,10 @@
    *
    * When reading a byte from the user's buffer, count is filled with 8 and
    * one byte is filled into the value buffer. When we reach the end of the
-   * data, count is additionally filled with VP8_LOTS_OF_BITS. So when
-   * count == VP8_LOTS_OF_BITS - 1, the user's data has been exhausted.
+   * data, count is additionally filled with VP9_LOTS_OF_BITS. So when
+   * count == VP9_LOTS_OF_BITS - 1, the user's data has been exhausted.
    */
-  if ((br->count > VP8_BD_VALUE_SIZE) && (br->count < VP8_LOTS_OF_BITS)) {
+  if ((br->count > VP9_BD_VALUE_SIZE) && (br->count < VP9_LOTS_OF_BITS)) {
     /* We have tried to decode bits after the end of
      * stream was encountered.
      */
diff --git a/vp8/decoder/decodemv.c b/vp8/decoder/decodemv.c
index afe2a24..5130797 100644
--- a/vp8/decoder/decodemv.c
+++ b/vp8/decoder/decodemv.c
@@ -28,60 +28,58 @@
 int dec_mvcount = 0;
 #endif
 
-static int vp8_read_bmode(vp8_reader *bc, const vp8_prob *p) {
-  return vp8_treed_read(bc, vp9_bmode_tree, p);
+static int read_bmode(vp9_reader *bc, const vp9_prob *p) {
+  return treed_read(bc, vp9_bmode_tree, p);
 }
 
-
-static int vp8_read_ymode(vp8_reader *bc, const vp8_prob *p) {
-  return vp8_treed_read(bc, vp9_ymode_tree, p);
+static int read_ymode(vp9_reader *bc, const vp9_prob *p) {
+  return treed_read(bc, vp9_ymode_tree, p);
 }
 
 #if CONFIG_SUPERBLOCKS
-static int vp8_sb_kfread_ymode(vp8_reader *bc, const vp8_prob *p) {
-  return vp8_treed_read(bc, vp9_uv_mode_tree, p);
+static int read_kf_sb_ymode(vp9_reader *bc, const vp9_prob *p) {
+  return treed_read(bc, vp9_uv_mode_tree, p);
 }
 #endif
 
-static int vp8_kfread_ymode(vp8_reader *bc, const vp8_prob *p) {
-  return vp8_treed_read(bc, vp9_kf_ymode_tree, p);
+static int read_kf_mb_ymode(vp9_reader *bc, const vp9_prob *p) {
+  return treed_read(bc, vp9_kf_ymode_tree, p);
 }
 
-static int vp8_read_i8x8_mode(vp8_reader *bc, const vp8_prob *p) {
-  return vp8_treed_read(bc, vp9_i8x8_mode_tree, p);
+static int read_i8x8_mode(vp9_reader *bc, const vp9_prob *p) {
+  return treed_read(bc, vp9_i8x8_mode_tree, p);
 }
 
-
-static int vp8_read_uv_mode(vp8_reader *bc, const vp8_prob *p) {
-  return vp8_treed_read(bc, vp9_uv_mode_tree, p);
+static int read_uv_mode(vp9_reader *bc, const vp9_prob *p) {
+  return treed_read(bc, vp9_uv_mode_tree, p);
 }
 
 // This function reads the current macro block's segnent id from the bitstream
 // It should only be called if a segment map update is indicated.
-static void vp8_read_mb_segid(vp8_reader *r, MB_MODE_INFO *mi,
-                              MACROBLOCKD *xd) {
+static void read_mb_segid(vp9_reader *r, MB_MODE_INFO *mi,
+                          MACROBLOCKD *xd) {
   /* Is segmentation enabled */
   if (xd->segmentation_enabled && xd->update_mb_segmentation_map) {
     /* If so then read the segment id. */
-    if (vp8_read(r, xd->mb_segment_tree_probs[0]))
+    if (vp9_read(r, xd->mb_segment_tree_probs[0]))
       mi->segment_id =
-        (unsigned char)(2 + vp8_read(r, xd->mb_segment_tree_probs[2]));
+        (unsigned char)(2 + vp9_read(r, xd->mb_segment_tree_probs[2]));
     else
       mi->segment_id =
-        (unsigned char)(vp8_read(r, xd->mb_segment_tree_probs[1]));
+        (unsigned char)(vp9_read(r, xd->mb_segment_tree_probs[1]));
   }
 }
 
 #if CONFIG_NEW_MVREF
-int vp8_read_mv_ref_id(vp8_reader *r,
-                       vp8_prob * ref_id_probs) {
+int vp9_read_mv_ref_id(vp9_reader *r,
+                       vp9_prob * ref_id_probs) {
   int ref_index = 0;
 
-  if (vp8_read(r, ref_id_probs[0])) {
+  if (vp9_read(r, ref_id_probs[0])) {
     ref_index++;
-    if (vp8_read(r, ref_id_probs[1])) {
+    if (vp9_read(r, ref_id_probs[1])) {
       ref_index++;
-      if (vp8_read(r, ref_id_probs[2]))
+      if (vp9_read(r, ref_id_probs[2]))
         ref_index++;
     }
   }
@@ -104,7 +102,7 @@
   // this frame (reset to 0 by default).
   m->mbmi.segment_id = 0;
   if (pbi->mb.update_mb_segmentation_map) {
-    vp8_read_mb_segid(bc, &m->mbmi, &pbi->mb);
+    read_mb_segid(bc, &m->mbmi, &pbi->mb);
     pbi->common.last_frame_seg_map[map_index] = m->mbmi.segment_id;
   }
 
@@ -116,7 +114,7 @@
                         m->mbmi.segment_id, SEG_LVL_EOB) != 0))) {
     MACROBLOCKD *const xd  = &pbi->mb;
     m->mbmi.mb_skip_coeff =
-      vp8_read(bc, vp9_get_pred_prob(cm, xd, PRED_MBSKIP));
+      vp9_read(bc, vp9_get_pred_prob(cm, xd, PRED_MBSKIP));
   } else {
     if (vp9_segfeature_active(&pbi->mb,
                               m->mbmi.segment_id, SEG_LVL_EOB) &&
@@ -129,11 +127,11 @@
 
 #if CONFIG_SUPERBLOCKS
   if (m->mbmi.encoded_as_sb) {
-    y_mode = (MB_PREDICTION_MODE) vp8_sb_kfread_ymode(bc,
+    y_mode = (MB_PREDICTION_MODE) read_kf_sb_ymode(bc,
       pbi->common.sb_kf_ymode_prob[pbi->common.kf_ymode_probs_index]);
   } else
 #endif
-  y_mode = (MB_PREDICTION_MODE) vp8_kfread_ymode(bc,
+  y_mode = (MB_PREDICTION_MODE) read_kf_mb_ymode(bc,
     pbi->common.kf_ymode_prob[pbi->common.kf_ymode_probs_index]);
 #if CONFIG_COMP_INTRA_PRED
   m->mbmi.second_mode = (MB_PREDICTION_MODE)(DC_PRED - 1);
@@ -144,19 +142,19 @@
   if ((m->mbmi.mode = y_mode) == B_PRED) {
     int i = 0;
 #if CONFIG_COMP_INTRA_PRED
-    int use_comp_pred = vp8_read(bc, 128);
+    int use_comp_pred = vp9_read(bc, 128);
 #endif
     do {
       const B_PREDICTION_MODE A = above_block_mode(m, i, mis);
       const B_PREDICTION_MODE L = left_block_mode(m, i);
 
       m->bmi[i].as_mode.first =
-        (B_PREDICTION_MODE) vp8_read_bmode(
+        (B_PREDICTION_MODE) read_bmode(
           bc, pbi->common.kf_bmode_prob [A] [L]);
 #if CONFIG_COMP_INTRA_PRED
       if (use_comp_pred) {
         m->bmi[i].as_mode.second =
-          (B_PREDICTION_MODE) vp8_read_bmode(
+          (B_PREDICTION_MODE) read_bmode(
             bc, pbi->common.kf_bmode_prob [A] [L]);
       } else {
         m->bmi[i].as_mode.second = (B_PREDICTION_MODE)(B_DC_PRED - 1);
@@ -169,7 +167,7 @@
     int mode8x8;
     for (i = 0; i < 4; i++) {
       int ib = vp9_i8x8_block[i];
-      mode8x8 = vp8_read_i8x8_mode(bc, pbi->common.fc.i8x8_mode_prob);
+      mode8x8 = read_i8x8_mode(bc, pbi->common.fc.i8x8_mode_prob);
       m->bmi[ib + 0].as_mode.first = mode8x8;
       m->bmi[ib + 1].as_mode.first = mode8x8;
       m->bmi[ib + 4].as_mode.first = mode8x8;
@@ -182,8 +180,8 @@
 #endif
     }
   } else
-    m->mbmi.uv_mode = (MB_PREDICTION_MODE)vp8_read_uv_mode(bc,
-                                                           pbi->common.kf_uv_mode_prob[m->mbmi.mode]);
+    m->mbmi.uv_mode = (MB_PREDICTION_MODE)read_uv_mode(bc,
+                                                       pbi->common.kf_uv_mode_prob[m->mbmi.mode]);
 #if CONFIG_COMP_INTRA_PRED
   m->mbmi.second_uv_mode = (MB_PREDICTION_MODE)(DC_PRED - 1);
 #endif
@@ -196,9 +194,9 @@
   if (cm->txfm_mode == TX_MODE_SELECT && m->mbmi.mb_skip_coeff == 0 &&
       m->mbmi.mode <= I8X8_PRED) {
     // FIXME(rbultje) code ternary symbol once all experiments are merged
-    m->mbmi.txfm_size = vp8_read(bc, cm->prob_tx[0]);
+    m->mbmi.txfm_size = vp9_read(bc, cm->prob_tx[0]);
     if (m->mbmi.txfm_size != TX_4X4 && m->mbmi.mode != I8X8_PRED)
-      m->mbmi.txfm_size += vp8_read(bc, cm->prob_tx[1]);
+      m->mbmi.txfm_size += vp9_read(bc, cm->prob_tx[1]);
   } else if (cm->txfm_mode >= ALLOW_16X16 && m->mbmi.mode <= TM_PRED) {
     m->mbmi.txfm_size = TX_16X16;
   } else if (cm->txfm_mode >= ALLOW_8X8 && m->mbmi.mode != B_PRED) {
@@ -208,20 +206,20 @@
   }
 }
 
-static int read_nmv_component(vp8_reader *r,
+static int read_nmv_component(vp9_reader *r,
                               int rv,
                               const nmv_component *mvcomp) {
   int v, s, z, c, o, d;
-  s = vp8_read(r, mvcomp->sign);
-  c = vp8_treed_read(r, vp9_mv_class_tree, mvcomp->classes);
+  s = vp9_read(r, mvcomp->sign);
+  c = treed_read(r, vp9_mv_class_tree, mvcomp->classes);
   if (c == MV_CLASS_0) {
-    d = vp8_treed_read(r, vp9_mv_class0_tree, mvcomp->class0);
+    d = treed_read(r, vp9_mv_class0_tree, mvcomp->class0);
   } else {
     int i, b;
     d = 0;
     b = c + CLASS0_BITS - 1;  /* number of bits */
     for (i = 0; i < b; ++i)
-      d |= (vp8_read(r, mvcomp->bits[i]) << i);
+      d |= (vp9_read(r, mvcomp->bits[i]) << i);
   }
   o = d << 3;
 
@@ -230,7 +228,7 @@
   return v;
 }
 
-static int read_nmv_component_fp(vp8_reader *r,
+static int read_nmv_component_fp(vp9_reader *r,
                                  int v,
                                  int rv,
                                  const nmv_component *mvcomp,
@@ -244,17 +242,17 @@
   d = o >> 3;
 
   if (c == MV_CLASS_0) {
-    f = vp8_treed_read(r, vp9_mv_fp_tree, mvcomp->class0_fp[d]);
+    f = treed_read(r, vp9_mv_fp_tree, mvcomp->class0_fp[d]);
   } else {
-    f = vp8_treed_read(r, vp9_mv_fp_tree, mvcomp->fp);
+    f = treed_read(r, vp9_mv_fp_tree, mvcomp->fp);
   }
   o += (f << 1);
 
   if (usehp) {
     if (c == MV_CLASS_0) {
-      e = vp8_read(r, mvcomp->class0_hp);
+      e = vp9_read(r, mvcomp->class0_hp);
     } else {
-      e = vp8_read(r, mvcomp->hp);
+      e = vp9_read(r, mvcomp->hp);
     }
     o += e;
   } else {
@@ -265,9 +263,9 @@
   return v;
 }
 
-static void read_nmv(vp8_reader *r, MV *mv, const MV *ref,
+static void read_nmv(vp9_reader *r, MV *mv, const MV *ref,
                      const nmv_context *mvctx) {
-  MV_JOINT_TYPE j = vp8_treed_read(r, vp9_mv_joint_tree, mvctx->joints);
+  MV_JOINT_TYPE j = treed_read(r, vp9_mv_joint_tree, mvctx->joints);
   mv->row = mv-> col = 0;
   if (j == MV_JOINT_HZVNZ || j == MV_JOINT_HNZVNZ) {
     mv->row = read_nmv_component(r, ref->row, &mvctx->comps[0]);
@@ -277,7 +275,7 @@
   }
 }
 
-static void read_nmv_fp(vp8_reader *r, MV *mv, const MV *ref,
+static void read_nmv_fp(vp9_reader *r, MV *mv, const MV *ref,
                         const nmv_context *mvctx, int usehp) {
   MV_JOINT_TYPE j = vp9_get_mv_joint(*mv);
   usehp = usehp && vp9_use_nmv_hp(ref);
@@ -292,41 +290,41 @@
   //printf("  %d: %d %d ref: %d %d\n", usehp, mv->row, mv-> col, ref->row, ref->col);
 }
 
-static void update_nmv(vp8_reader *bc, vp8_prob *const p,
-                       const vp8_prob upd_p) {
-  if (vp8_read(bc, upd_p)) {
+static void update_nmv(vp9_reader *bc, vp9_prob *const p,
+                       const vp9_prob upd_p) {
+  if (vp9_read(bc, upd_p)) {
 #ifdef LOW_PRECISION_MV_UPDATE
-    *p = (vp8_read_literal(bc, 7) << 1) | 1;
+    *p = (vp9_read_literal(bc, 7) << 1) | 1;
 #else
-    *p = (vp8_read_literal(bc, 8));
+    *p = (vp9_read_literal(bc, 8));
 #endif
   }
 }
 
-static void read_nmvprobs(vp8_reader *bc, nmv_context *mvctx,
+static void read_nmvprobs(vp9_reader *bc, nmv_context *mvctx,
                           int usehp) {
   int i, j, k;
 #ifdef MV_GROUP_UPDATE
-  if (!vp8_read_bit(bc)) return;
+  if (!vp9_read_bit(bc)) return;
 #endif
   for (j = 0; j < MV_JOINTS - 1; ++j) {
     update_nmv(bc, &mvctx->joints[j],
-               VP8_NMV_UPDATE_PROB);
+               VP9_NMV_UPDATE_PROB);
   }
   for (i = 0; i < 2; ++i) {
     update_nmv(bc, &mvctx->comps[i].sign,
-               VP8_NMV_UPDATE_PROB);
+               VP9_NMV_UPDATE_PROB);
     for (j = 0; j < MV_CLASSES - 1; ++j) {
       update_nmv(bc, &mvctx->comps[i].classes[j],
-                 VP8_NMV_UPDATE_PROB);
+                 VP9_NMV_UPDATE_PROB);
     }
     for (j = 0; j < CLASS0_SIZE - 1; ++j) {
       update_nmv(bc, &mvctx->comps[i].class0[j],
-                 VP8_NMV_UPDATE_PROB);
+                 VP9_NMV_UPDATE_PROB);
     }
     for (j = 0; j < MV_OFFSET_BITS; ++j) {
       update_nmv(bc, &mvctx->comps[i].bits[j],
-                 VP8_NMV_UPDATE_PROB);
+                 VP9_NMV_UPDATE_PROB);
     }
   }
 
@@ -334,27 +332,27 @@
     for (j = 0; j < CLASS0_SIZE; ++j) {
       for (k = 0; k < 3; ++k)
         update_nmv(bc, &mvctx->comps[i].class0_fp[j][k],
-                   VP8_NMV_UPDATE_PROB);
+                   VP9_NMV_UPDATE_PROB);
     }
     for (j = 0; j < 3; ++j) {
       update_nmv(bc, &mvctx->comps[i].fp[j],
-                 VP8_NMV_UPDATE_PROB);
+                 VP9_NMV_UPDATE_PROB);
     }
   }
 
   if (usehp) {
     for (i = 0; i < 2; ++i) {
       update_nmv(bc, &mvctx->comps[i].class0_hp,
-                 VP8_NMV_UPDATE_PROB);
+                 VP9_NMV_UPDATE_PROB);
       update_nmv(bc, &mvctx->comps[i].hp,
-                 VP8_NMV_UPDATE_PROB);
+                 VP9_NMV_UPDATE_PROB);
     }
   }
 }
 
 // Read the referncence frame
 static MV_REFERENCE_FRAME read_ref_frame(VP9D_COMP *pbi,
-                                         vp8_reader *const bc,
+                                         vp9_reader *const bc,
                                          unsigned char segment_id) {
   MV_REFERENCE_FRAME ref_frame;
   int seg_ref_active;
@@ -381,14 +379,14 @@
   if (!seg_ref_active || (seg_ref_count > 1)) {
     // Values used in prediction model coding
     unsigned char prediction_flag;
-    vp8_prob pred_prob;
+    vp9_prob pred_prob;
     MV_REFERENCE_FRAME pred_ref;
 
     // Get the context probability the prediction flag
     pred_prob = vp9_get_pred_prob(cm, xd, PRED_REF);
 
     // Read the prediction status flag
-    prediction_flag = (unsigned char)vp8_read(bc, pred_prob);
+    prediction_flag = (unsigned char)vp9_read(bc, pred_prob);
 
     // Store the prediction flag.
     vp9_set_pred_flag(xd, PRED_REF, prediction_flag);
@@ -402,7 +400,7 @@
     }
     // else decode the explicitly coded value
     else {
-      vp8_prob mod_refprobs[PREDICTION_PROBS];
+      vp9_prob mod_refprobs[PREDICTION_PROBS];
       vpx_memcpy(mod_refprobs,
                  cm->mod_refprobs[pred_ref], sizeof(mod_refprobs));
 
@@ -423,21 +421,21 @@
 
       // Do we need to decode the Intra/Inter branch
       if (mod_refprobs[0])
-        ref_frame = (MV_REFERENCE_FRAME) vp8_read(bc, mod_refprobs[0]);
+        ref_frame = (MV_REFERENCE_FRAME) vp9_read(bc, mod_refprobs[0]);
       else
         ref_frame++;
 
       if (ref_frame) {
         // Do we need to decode the Last/Gf_Arf branch
         if (mod_refprobs[1])
-          ref_frame += vp8_read(bc, mod_refprobs[1]);
+          ref_frame += vp9_read(bc, mod_refprobs[1]);
         else
           ref_frame++;
 
         if (ref_frame > 1) {
           // Do we need to decode the GF/Arf branch
           if (mod_refprobs[2])
-            ref_frame += vp8_read(bc, mod_refprobs[2]);
+            ref_frame += vp9_read(bc, mod_refprobs[2]);
           else {
             if (seg_ref_active) {
               if ((pred_ref == GOLDEN_FRAME) ||
@@ -467,17 +465,17 @@
 }
 
 #if CONFIG_SUPERBLOCKS
-static MB_PREDICTION_MODE read_sb_mv_ref(vp8_reader *bc, const vp8_prob *p) {
-  return (MB_PREDICTION_MODE) vp8_treed_read(bc, vp9_sb_mv_ref_tree, p);
+static MB_PREDICTION_MODE read_sb_mv_ref(vp9_reader *bc, const vp9_prob *p) {
+  return (MB_PREDICTION_MODE) treed_read(bc, vp9_sb_mv_ref_tree, p);
 }
 #endif
 
-static MB_PREDICTION_MODE read_mv_ref(vp8_reader *bc, const vp8_prob *p) {
-  return (MB_PREDICTION_MODE) vp8_treed_read(bc, vp9_mv_ref_tree, p);
+static MB_PREDICTION_MODE read_mv_ref(vp9_reader *bc, const vp9_prob *p) {
+  return (MB_PREDICTION_MODE) treed_read(bc, vp9_mv_ref_tree, p);
 }
 
-static B_PREDICTION_MODE sub_mv_ref(vp8_reader *bc, const vp8_prob *p) {
-  return (B_PREDICTION_MODE) vp8_treed_read(bc, vp9_sub_mv_ref_tree, p);
+static B_PREDICTION_MODE sub_mv_ref(vp9_reader *bc, const vp9_prob *p) {
+  return (B_PREDICTION_MODE) treed_read(bc, vp9_sub_mv_ref_tree, p);
 }
 
 #ifdef VPX_MODE_COUNT
@@ -502,56 +500,56 @@
                                          BOOL_DECODER* const bc) {
   VP9_COMMON *const cm = &pbi->common;
   int i, j;
-  for (j = 0; j <= VP8_SWITCHABLE_FILTERS; ++j) {
-    for (i = 0; i < VP8_SWITCHABLE_FILTERS - 1; ++i) {
-      cm->fc.switchable_interp_prob[j][i] = vp8_read_literal(bc, 8);
+  for (j = 0; j <= VP9_SWITCHABLE_FILTERS; ++j) {
+    for (i = 0; i < VP9_SWITCHABLE_FILTERS - 1; ++i) {
+      cm->fc.switchable_interp_prob[j][i] = vp9_read_literal(bc, 8);
     }
   }
   //printf("DECODER: %d %d\n", cm->fc.switchable_interp_prob[0],
   //cm->fc.switchable_interp_prob[1]);
 }
 
-static void mb_mode_mv_init(VP9D_COMP *pbi, vp8_reader *bc) {
+static void mb_mode_mv_init(VP9D_COMP *pbi, vp9_reader *bc) {
   VP9_COMMON *const cm = &pbi->common;
   nmv_context *const nmvc = &pbi->common.fc.nmvc;
   MACROBLOCKD *const xd  = &pbi->mb;
 
   if (cm->frame_type == KEY_FRAME) {
     if (!cm->kf_ymode_probs_update)
-      cm->kf_ymode_probs_index = vp8_read_literal(bc, 3);
+      cm->kf_ymode_probs_index = vp9_read_literal(bc, 3);
   } else {
 #if CONFIG_PRED_FILTER
-    cm->pred_filter_mode = (vp8_prob)vp8_read_literal(bc, 2);
+    cm->pred_filter_mode = (vp9_prob)vp9_read_literal(bc, 2);
 
     if (cm->pred_filter_mode == 2)
-      cm->prob_pred_filter_off = (vp8_prob)vp8_read_literal(bc, 8);
+      cm->prob_pred_filter_off = (vp9_prob)vp9_read_literal(bc, 8);
 #endif
     if (cm->mcomp_filter_type == SWITCHABLE)
       read_switchable_interp_probs(pbi, bc);
     // Decode the baseline probabilities for decoding reference frame
-    cm->prob_intra_coded = (vp8_prob)vp8_read_literal(bc, 8);
-    cm->prob_last_coded  = (vp8_prob)vp8_read_literal(bc, 8);
-    cm->prob_gf_coded    = (vp8_prob)vp8_read_literal(bc, 8);
+    cm->prob_intra_coded = (vp9_prob)vp9_read_literal(bc, 8);
+    cm->prob_last_coded  = (vp9_prob)vp9_read_literal(bc, 8);
+    cm->prob_gf_coded    = (vp9_prob)vp9_read_literal(bc, 8);
 
     // Computes a modified set of probabilities for use when reference
     // frame prediction fails.
     vp9_compute_mod_refprobs(cm);
 
-    pbi->common.comp_pred_mode = vp8_read(bc, 128);
+    pbi->common.comp_pred_mode = vp9_read(bc, 128);
     if (cm->comp_pred_mode)
-      cm->comp_pred_mode += vp8_read(bc, 128);
+      cm->comp_pred_mode += vp9_read(bc, 128);
     if (cm->comp_pred_mode == HYBRID_PREDICTION) {
       int i;
       for (i = 0; i < COMP_PRED_CONTEXTS; i++)
-        cm->prob_comppred[i] = (vp8_prob)vp8_read_literal(bc, 8);
+        cm->prob_comppred[i] = (vp9_prob)vp9_read_literal(bc, 8);
     }
 
-    if (vp8_read_bit(bc)) {
+    if (vp9_read_bit(bc)) {
       int i = 0;
 
       do {
-        cm->fc.ymode_prob[i] = (vp8_prob) vp8_read_literal(bc, 8);
-      } while (++i < VP8_YMODES - 1);
+        cm->fc.ymode_prob[i] = (vp9_prob) vp9_read_literal(bc, 8);
+      } while (++i < VP9_YMODES - 1);
     }
 
 #if CONFIG_NEW_MVREF
@@ -581,12 +579,12 @@
       if (cm->temporal_update) {
         // Get the context based probability for reading the
         // prediction status flag
-        vp8_prob pred_prob =
+        vp9_prob pred_prob =
           vp9_get_pred_prob(cm, xd, PRED_SEG_ID);
 
         // Read the prediction status flag
         unsigned char seg_pred_flag =
-          (unsigned char)vp8_read(bc, pred_prob);
+          (unsigned char)vp9_read(bc, pred_prob);
 
         // Store the prediction flag.
         vp9_set_pred_flag(xd, PRED_SEG_ID, seg_pred_flag);
@@ -598,12 +596,12 @@
         }
         // Else .... decode it explicitly
         else {
-          vp8_read_mb_segid(bc, mbmi, xd);
+          read_mb_segid(bc, mbmi, xd);
         }
       }
       // Normal unpredicted coding mode
       else {
-        vp8_read_mb_segid(bc, mbmi, xd);
+        read_mb_segid(bc, mbmi, xd);
       }
 #if CONFIG_SUPERBLOCKS
       if (mbmi->encoded_as_sb) {
@@ -694,7 +692,7 @@
        (vp9_get_segdata(xd, mbmi->segment_id, SEG_LVL_EOB) != 0))) {
     // Read the macroblock coeff skip flag if this feature is in use,
     // else default to 0
-    mbmi->mb_skip_coeff = vp8_read(bc, vp9_get_pred_prob(cm, xd, PRED_MBSKIP));
+    mbmi->mb_skip_coeff = vp9_read(bc, vp9_get_pred_prob(cm, xd, PRED_MBSKIP));
   } else {
     if (vp9_segfeature_active(xd,
                               mbmi->segment_id, SEG_LVL_EOB) &&
@@ -712,7 +710,7 @@
     int rct[4];
     int_mv nearest, nearby, best_mv;
     int_mv nearest_second, nearby_second, best_mv_second;
-    vp8_prob mv_ref_p [VP8_MVREFS - 1];
+    vp9_prob mv_ref_p [VP9_MVREFS - 1];
 
 #if CONFIG_NEWBESTREFMV
     int recon_y_stride, recon_yoffset;
@@ -751,7 +749,7 @@
                        ref_frame, mbmi->ref_mvs[ref_frame],
                        cm->ref_frame_sign_bias);
 
-      vp8_find_best_ref_mvs(xd,
+      vp9_find_best_ref_mvs(xd,
                             xd->pre.y_buffer,
                             recon_y_stride,
                             mbmi->ref_mvs[ref_frame],
@@ -781,7 +779,7 @@
       // Is the prediction filter enabled
       if (cm->pred_filter_mode == 2)
         mbmi->pred_filter_enabled =
-          vp8_read(bc, cm->prob_pred_filter_off);
+          vp9_read(bc, cm->prob_pred_filter_off);
       else
         mbmi->pred_filter_enabled = cm->pred_filter_mode;
     }
@@ -790,8 +788,8 @@
     {
       if (cm->mcomp_filter_type == SWITCHABLE) {
         mbmi->interp_filter = vp9_switchable_interp[
-            vp8_treed_read(bc, vp9_switchable_interp_tree,
-                           vp9_get_pred_probs(cm, xd, PRED_SWITCHABLE_INTERP))];
+            treed_read(bc, vp9_switchable_interp_tree,
+                       vp9_get_pred_probs(cm, xd, PRED_SWITCHABLE_INTERP))];
       } else {
         mbmi->interp_filter = cm->mcomp_filter_type;
       }
@@ -799,7 +797,7 @@
 
     if (cm->comp_pred_mode == COMP_PREDICTION_ONLY ||
         (cm->comp_pred_mode == HYBRID_PREDICTION &&
-         vp8_read(bc, vp9_get_pred_prob(cm, xd, PRED_COMP)))) {
+         vp9_read(bc, vp9_get_pred_prob(cm, xd, PRED_COMP)))) {
       /* Since we have 3 reference frames, we can only have 3 unique
        * combinations of combinations of 2 different reference frames
        * (A-G, G-L or A-L). In the bitstream, we use this to simply
@@ -839,7 +837,7 @@
                          mbmi->ref_mvs[mbmi->second_ref_frame],
                          cm->ref_frame_sign_bias);
 
-        vp8_find_best_ref_mvs(xd,
+        vp9_find_best_ref_mvs(xd,
                               xd->second_pre.y_buffer,
                               recon_y_stride,
                               mbmi->ref_mvs[mbmi->second_ref_frame],
@@ -862,7 +860,7 @@
     switch (mbmi->mode) {
       case SPLITMV: {
         const int s = mbmi->partitioning =
-                        vp8_treed_read(bc, vp9_mbsplit_tree, cm->fc.mbsplit_prob);
+                        treed_read(bc, vp9_mbsplit_tree, cm->fc.mbsplit_prob);
         const int num_p = vp9_mbsplit_count [s];
         int j = 0;
         cm->fc.mbsplit_counts[s]++;
@@ -938,17 +936,17 @@
               break;
           }
 
-          mbmi->need_to_clamp_mvs |= vp8_check_mv_bounds(&blockmv,
-                                                         mb_to_left_edge,
-                                                         mb_to_right_edge,
-                                                         mb_to_top_edge,
-                                                         mb_to_bottom_edge);
+          mbmi->need_to_clamp_mvs |= check_mv_bounds(&blockmv,
+                                                     mb_to_left_edge,
+                                                     mb_to_right_edge,
+                                                     mb_to_top_edge,
+                                                     mb_to_bottom_edge);
           if (mbmi->second_ref_frame) {
-            mbmi->need_to_clamp_mvs |= vp8_check_mv_bounds(&secondmv,
-                                                           mb_to_left_edge,
-                                                           mb_to_right_edge,
-                                                           mb_to_top_edge,
-                                                           mb_to_bottom_edge);
+            mbmi->need_to_clamp_mvs |= check_mv_bounds(&secondmv,
+                                                       mb_to_left_edge,
+                                                       mb_to_right_edge,
+                                                       mb_to_top_edge,
+                                                       mb_to_bottom_edge);
           }
 
           {
@@ -979,24 +977,24 @@
       case NEARMV:
         mv->as_int = nearby.as_int;
         /* Clip "next_nearest" so that it does not extend to far out of image */
-        vp8_clamp_mv(mv, mb_to_left_edge, mb_to_right_edge,
-                     mb_to_top_edge, mb_to_bottom_edge);
+        clamp_mv(mv, mb_to_left_edge, mb_to_right_edge,
+                 mb_to_top_edge, mb_to_bottom_edge);
         if (mbmi->second_ref_frame) {
           mbmi->mv[1].as_int = nearby_second.as_int;
-          vp8_clamp_mv(&mbmi->mv[1], mb_to_left_edge, mb_to_right_edge,
-                       mb_to_top_edge, mb_to_bottom_edge);
+          clamp_mv(&mbmi->mv[1], mb_to_left_edge, mb_to_right_edge,
+                   mb_to_top_edge, mb_to_bottom_edge);
         }
         break;
 
       case NEARESTMV:
         mv->as_int = nearest.as_int;
         /* Clip "next_nearest" so that it does not extend to far out of image */
-        vp8_clamp_mv(mv, mb_to_left_edge, mb_to_right_edge,
-                     mb_to_top_edge, mb_to_bottom_edge);
+        clamp_mv(mv, mb_to_left_edge, mb_to_right_edge,
+                 mb_to_top_edge, mb_to_bottom_edge);
         if (mbmi->second_ref_frame) {
           mbmi->mv[1].as_int = nearest_second.as_int;
-          vp8_clamp_mv(&mbmi->mv[1], mb_to_left_edge, mb_to_right_edge,
-                       mb_to_top_edge, mb_to_bottom_edge);
+          clamp_mv(&mbmi->mv[1], mb_to_left_edge, mb_to_right_edge,
+                   mb_to_top_edge, mb_to_bottom_edge);
         }
         break;
 
@@ -1015,7 +1013,7 @@
 
           // Encode the index of the choice.
           best_index =
-            vp8_read_mv_ref_id(bc, xd->mb_mv_ref_id_probs[ref_frame]);
+            vp9_read_mv_ref_id(bc, xd->mb_mv_ref_id_probs[ref_frame]);
 
           best_mv.as_int = mbmi->ref_mvs[ref_frame][best_index].as_int;
         }
@@ -1035,11 +1033,11 @@
          * so signal to the prediction stage whether special
          * handling may be required.
          */
-        mbmi->need_to_clamp_mvs = vp8_check_mv_bounds(mv,
-                                                      mb_to_left_edge,
-                                                      mb_to_right_edge,
-                                                      mb_to_top_edge,
-                                                      mb_to_bottom_edge);
+        mbmi->need_to_clamp_mvs = check_mv_bounds(mv,
+                                                  mb_to_left_edge,
+                                                  mb_to_right_edge,
+                                                  mb_to_top_edge,
+                                                  mb_to_bottom_edge);
 
         if (mbmi->second_ref_frame) {
 #if CONFIG_NEW_MVREF
@@ -1049,7 +1047,7 @@
 
           // Encode the index of the choice.
           best_index =
-            vp8_read_mv_ref_id(bc, xd->mb_mv_ref_id_probs[ref_frame]);
+            vp9_read_mv_ref_id(bc, xd->mb_mv_ref_id_probs[ref_frame]);
           best_mv_second.as_int = mbmi->ref_mvs[ref_frame][best_index].as_int;
         }
 #endif
@@ -1062,9 +1060,9 @@
           mbmi->mv[1].as_mv.row += best_mv_second.as_mv.row;
           mbmi->mv[1].as_mv.col += best_mv_second.as_mv.col;
           mbmi->need_to_clamp_secondmv |=
-            vp8_check_mv_bounds(&mbmi->mv[1],
-                                mb_to_left_edge, mb_to_right_edge,
-                                mb_to_top_edge, mb_to_bottom_edge);
+            check_mv_bounds(&mbmi->mv[1],
+                            mb_to_left_edge, mb_to_right_edge,
+                            mb_to_top_edge, mb_to_bottom_edge);
         }
         break;
       default:
@@ -1083,7 +1081,7 @@
     else {
       // FIXME write using SB mode tree
       mbmi->mode = (MB_PREDICTION_MODE)
-                   vp8_read_ymode(bc, pbi->common.fc.ymode_prob);
+                   read_ymode(bc, pbi->common.fc.ymode_prob);
       pbi->common.fc.ymode_counts[mbmi->mode]++;
     }
 #if CONFIG_COMP_INTRA_PRED
@@ -1094,14 +1092,14 @@
     if (mbmi->mode == B_PRED) {
       int j = 0;
 #if CONFIG_COMP_INTRA_PRED
-      int use_comp_pred = vp8_read(bc, 128);
+      int use_comp_pred = vp9_read(bc, 128);
 #endif
       do {
-        mi->bmi[j].as_mode.first = (B_PREDICTION_MODE)vp8_read_bmode(bc, pbi->common.fc.bmode_prob);
+        mi->bmi[j].as_mode.first = (B_PREDICTION_MODE)read_bmode(bc, pbi->common.fc.bmode_prob);
         /*
         {
           int p;
-          for (p = 0; p < VP8_BINTRAMODES - 1; ++p)
+          for (p = 0; p < VP9_BINTRAMODES - 1; ++p)
             printf(" %d", pbi->common.fc.bmode_prob[p]);
           printf("\nbmode[%d][%d]: %d\n", pbi->common.current_video_frame, j, mi->bmi[j].as_mode.first);
         }
@@ -1109,7 +1107,7 @@
         pbi->common.fc.bmode_counts[mi->bmi[j].as_mode.first]++;
 #if CONFIG_COMP_INTRA_PRED
         if (use_comp_pred) {
-          mi->bmi[j].as_mode.second = (B_PREDICTION_MODE)vp8_read_bmode(bc, pbi->common.fc.bmode_prob);
+          mi->bmi[j].as_mode.second = (B_PREDICTION_MODE)read_bmode(bc, pbi->common.fc.bmode_prob);
         } else {
           mi->bmi[j].as_mode.second = (B_PREDICTION_MODE)(B_DC_PRED - 1);
         }
@@ -1122,7 +1120,7 @@
       int mode8x8;
       for (i = 0; i < 4; i++) {
         int ib = vp9_i8x8_block[i];
-        mode8x8 = vp8_read_i8x8_mode(bc, pbi->common.fc.i8x8_mode_prob);
+        mode8x8 = read_i8x8_mode(bc, pbi->common.fc.i8x8_mode_prob);
         mi->bmi[ib + 0].as_mode.first = mode8x8;
         mi->bmi[ib + 1].as_mode.first = mode8x8;
         mi->bmi[ib + 4].as_mode.first = mode8x8;
@@ -1136,7 +1134,7 @@
 #endif
       }
     } else {
-      mbmi->uv_mode = (MB_PREDICTION_MODE)vp8_read_uv_mode(
+      mbmi->uv_mode = (MB_PREDICTION_MODE)read_uv_mode(
         bc, pbi->common.fc.uv_mode_prob[mbmi->mode]);
       pbi->common.fc.uv_mode_counts[mbmi->mode][mbmi->uv_mode]++;
     }
@@ -1156,10 +1154,10 @@
        (mbmi->ref_frame != INTRA_FRAME && !(mbmi->mode == SPLITMV &&
                            mbmi->partitioning == PARTITIONING_4X4)))) {
     // FIXME(rbultje) code ternary symbol once all experiments are merged
-    mbmi->txfm_size = vp8_read(bc, cm->prob_tx[0]);
+    mbmi->txfm_size = vp9_read(bc, cm->prob_tx[0]);
     if (mbmi->txfm_size != TX_4X4 && mbmi->mode != I8X8_PRED &&
         mbmi->mode != SPLITMV)
-      mbmi->txfm_size += vp8_read(bc, cm->prob_tx[1]);
+      mbmi->txfm_size += vp9_read(bc, cm->prob_tx[1]);
   } else if (cm->txfm_mode >= ALLOW_16X16 &&
       ((mbmi->ref_frame == INTRA_FRAME && mbmi->mode <= TM_PRED) ||
        (mbmi->ref_frame != INTRA_FRAME && mbmi->mode != SPLITMV))) {
@@ -1181,7 +1179,7 @@
   if (pbi->common.mb_no_coeff_skip) {
     int k;
     for (k = 0; k < MBSKIP_CONTEXTS; ++k)
-      cm->mbskip_pred_probs[k] = (vp8_prob)vp8_read_literal(bc, 8);
+      cm->mbskip_pred_probs[k] = (vp9_prob)vp9_read_literal(bc, 8);
   }
 
   mb_mode_mv_init(pbi, bc);
diff --git a/vp8/decoder/decodframe.c b/vp8/decoder/decodframe.c
index 7e7334c..dee3b59 100644
--- a/vp8/decoder/decodframe.c
+++ b/vp8/decoder/decodframe.c
@@ -67,9 +67,9 @@
   return i;
 }
 
-static vp8_prob read_prob_diff_update(vp8_reader *const bc, int oldp) {
+static vp9_prob read_prob_diff_update(vp9_reader *const bc, int oldp) {
   int delp = vp9_decode_term_subexp(bc, SUBEXP_PARAM, 255);
-  return (vp8_prob)inv_remap_prob(delp, oldp);
+  return (vp9_prob)inv_remap_prob(delp, oldp);
 }
 
 void vp9_init_de_quantizer(VP9D_COMP *pbi) {
@@ -241,7 +241,7 @@
         xd->left_context--;
     }
 #endif
-  } else if (!vp8dx_bool_error(bc)) {
+  } else if (!bool_error(bc)) {
     for (i = 0; i < 25; i++) {
       xd->block[i].eob = 0;
       xd->eobs[i] = 0;
@@ -262,7 +262,7 @@
 
   if (eobtotal == 0 && mode != B_PRED && mode != SPLITMV
       && mode != I8X8_PRED
-      && !vp8dx_bool_error(bc)) {
+      && !bool_error(bc)) {
     /* Special case:  Force the loopfilter to skip when eobtotal and
      * mb_skip_coeff are zero.
      * */
@@ -364,7 +364,7 @@
         vp9_intra4x4_predict(b, b_mode, b->predictor);
 #if CONFIG_COMP_INTRA_PRED
       } else {
-        vp8_comp_intra4x4_predict(b, b_mode, b_mode2, b->predictor);
+        vp9_comp_intra4x4_predict(b, b_mode, b_mode2, b->predictor);
       }
 #endif
 
@@ -511,13 +511,13 @@
 }
 
 
-static int get_delta_q(vp8_reader *bc, int prev, int *q_update) {
+static int get_delta_q(vp9_reader *bc, int prev, int *q_update) {
   int ret_val = 0;
 
-  if (vp8_read_bit(bc)) {
-    ret_val = vp8_read_literal(bc, 4);
+  if (vp9_read_bit(bc)) {
+    ret_val = vp9_read_literal(bc, 4);
 
-    if (vp8_read_bit(bc))
+    if (vp9_read_bit(bc))
       ret_val = -ret_val;
   }
 
@@ -559,7 +559,7 @@
     MODE_INFO *mi = xd->mode_info_context;
 
 #if CONFIG_SUPERBLOCKS
-    mi->mbmi.encoded_as_sb = vp8_read(bc, pc->sb_coded);
+    mi->mbmi.encoded_as_sb = vp9_read(bc, pc->sb_coded);
 #endif
 
     // Process the 4 MBs within the SB in the order:
@@ -666,7 +666,7 @@
       decode_macroblock(pbi, xd, mb_row, mb_col, bc);
 
       /* check if the boolean decoder has suffered an error */
-      xd->corrupted |= vp8dx_bool_error(bc);
+      xd->corrupted |= bool_error(bc);
 
 #if CONFIG_SUPERBLOCKS
       if (mi->mbmi.encoded_as_sb) {
@@ -811,12 +811,12 @@
 
 #if 0
 static void read_coef_probs2(VP9D_COMP *pbi) {
-  const vp8_prob grpupd = 192;
+  const vp9_prob grpupd = 192;
   int i, j, k, l;
-  vp8_reader *const bc = &pbi->bc;
+  vp9_reader *const bc = &pbi->bc;
   VP9_COMMON *const pc = &pbi->common;
   for (l = 0; l < ENTROPY_NODES; l++) {
-    if (vp8_read(bc, grpupd)) {
+    if (vp9_read(bc, grpupd)) {
       // printf("Decoding %d\n", l);
       for (i = 0; i < BLOCK_TYPES; i++)
         for (j = !i; j < COEF_BANDS; j++)
@@ -825,8 +825,8 @@
                            (i > 0 && j == 0)))
               continue;
             {
-              vp8_prob *const p = pc->fc.coef_probs [i][j][k] + l;
-              int u = vp8_read(bc, COEF_UPDATE_PROB);
+              vp9_prob *const p = pc->fc.coef_probs [i][j][k] + l;
+              int u = vp9_read(bc, COEF_UPDATE_PROB);
               if (u) *p = read_prob_diff_update(bc, *p);
             }
           }
@@ -834,7 +834,7 @@
   }
   if (pbi->common.txfm_mode == ALLOW_8X8) {
     for (l = 0; l < ENTROPY_NODES; l++) {
-      if (vp8_read(bc, grpupd)) {
+      if (vp9_read(bc, grpupd)) {
         for (i = 0; i < BLOCK_TYPES_8X8; i++)
           for (j = !i; j < COEF_BANDS; j++)
             for (k = 0; k < PREV_COEF_CONTEXTS; k++) {
@@ -842,9 +842,9 @@
                              (i > 0 && j == 0)))
                 continue;
               {
-                vp8_prob *const p = pc->fc.coef_probs_8x8 [i][j][k] + l;
+                vp9_prob *const p = pc->fc.coef_probs_8x8 [i][j][k] + l;
 
-                int u = vp8_read(bc, COEF_UPDATE_PROB_8X8);
+                int u = vp9_read(bc, COEF_UPDATE_PROB_8X8);
                 if (u) *p = read_prob_diff_update(bc, *p);
               }
             }
@@ -856,11 +856,11 @@
 
 static void read_coef_probs_common(
     BOOL_DECODER* const bc,
-    vp8_prob coef_probs[BLOCK_TYPES][COEF_BANDS]
+    vp9_prob coef_probs[BLOCK_TYPES][COEF_BANDS]
                        [PREV_COEF_CONTEXTS][ENTROPY_NODES]) {
   int i, j, k, l;
 
-  if (vp8_read_bit(bc)) {
+  if (vp9_read_bit(bc)) {
     for (i = 0; i < BLOCK_TYPES; i++) {
       for (j = !i; j < COEF_BANDS; j++) {
         /* NB: This j loop starts from 1 on block type i == 0 */
@@ -869,9 +869,9 @@
                          (i > 0 && j == 0)))
             continue;
           for (l = 0; l < ENTROPY_NODES; l++) {
-            vp8_prob *const p = coef_probs[i][j][k] + l;
+            vp9_prob *const p = coef_probs[i][j][k] + l;
 
-            if (vp8_read(bc, COEF_UPDATE_PROB)) {
+            if (vp9_read(bc, COEF_UPDATE_PROB)) {
               *p = read_prob_diff_update(bc, *p);
             }
           }
@@ -990,17 +990,17 @@
     vpx_internal_error(&pc->error, VPX_CODEC_MEM_ERROR,
                        "Failed to allocate bool decoder 0");
   if (pc->frame_type == KEY_FRAME) {
-    pc->clr_type    = (YUV_TYPE)vp8_read_bit(&header_bc);
-    pc->clamp_type  = (CLAMP_TYPE)vp8_read_bit(&header_bc);
+    pc->clr_type    = (YUV_TYPE)vp9_read_bit(&header_bc);
+    pc->clamp_type  = (CLAMP_TYPE)vp9_read_bit(&header_bc);
   }
 
   /* Is segmentation enabled */
-  xd->segmentation_enabled = (unsigned char)vp8_read_bit(&header_bc);
+  xd->segmentation_enabled = (unsigned char)vp9_read_bit(&header_bc);
 
   if (xd->segmentation_enabled) {
     // Read whether or not the segmentation map is being explicitly
     // updated this frame.
-    xd->update_mb_segmentation_map = (unsigned char)vp8_read_bit(&header_bc);
+    xd->update_mb_segmentation_map = (unsigned char)vp9_read_bit(&header_bc);
 
     // If so what method will be used.
     if (xd->update_mb_segmentation_map) {
@@ -1009,28 +1009,28 @@
       // Read the probs used to decode the segment id for each macro
       // block.
       for (i = 0; i < MB_FEATURE_TREE_PROBS; i++) {
-          xd->mb_segment_tree_probs[i] = vp8_read_bit(&header_bc) ?
-              (vp8_prob)vp8_read_literal(&header_bc, 8) : 255;
+          xd->mb_segment_tree_probs[i] = vp9_read_bit(&header_bc) ?
+              (vp9_prob)vp9_read_literal(&header_bc, 8) : 255;
       }
 
       // Read the prediction probs needed to decode the segment id
-      pc->temporal_update = (unsigned char)vp8_read_bit(&header_bc);
+      pc->temporal_update = (unsigned char)vp9_read_bit(&header_bc);
       for (i = 0; i < PREDICTION_PROBS; i++) {
         if (pc->temporal_update) {
-          pc->segment_pred_probs[i] = vp8_read_bit(&header_bc) ?
-              (vp8_prob)vp8_read_literal(&header_bc, 8) : 255;
+          pc->segment_pred_probs[i] = vp9_read_bit(&header_bc) ?
+              (vp9_prob)vp9_read_literal(&header_bc, 8) : 255;
         } else {
           pc->segment_pred_probs[i] = 255;
         }
       }
     }
     // Is the segment data being updated
-    xd->update_mb_segmentation_data = (unsigned char)vp8_read_bit(&header_bc);
+    xd->update_mb_segmentation_data = (unsigned char)vp9_read_bit(&header_bc);
 
     if (xd->update_mb_segmentation_data) {
       int data;
 
-      xd->mb_segment_abs_delta = (unsigned char)vp8_read_bit(&header_bc);
+      xd->mb_segment_abs_delta = (unsigned char)vp9_read_bit(&header_bc);
 
       vp9_clearall_segfeatures(xd);
 
@@ -1039,16 +1039,16 @@
         // For each of the segments features...
         for (j = 0; j < SEG_LVL_MAX; j++) {
           // Is the feature enabled
-          if (vp8_read_bit(&header_bc)) {
+          if (vp9_read_bit(&header_bc)) {
             // Update the feature data and mask
             vp9_enable_segfeature(xd, i, j);
 
-            data = (signed char)vp8_read_literal(
+            data = (signed char)vp9_read_literal(
                      &header_bc, vp9_seg_feature_data_bits(j));
 
             // Is the segment data signed..
             if (vp9_is_segfeature_signed(j)) {
-              if (vp8_read_bit(&header_bc))
+              if (vp9_read_bit(&header_bc))
                 data = - data;
             }
           } else
@@ -1069,53 +1069,53 @@
     pc->ref_pred_probs[2] = 40;
   } else {
     for (i = 0; i < PREDICTION_PROBS; i++) {
-      if (vp8_read_bit(&header_bc))
-        pc->ref_pred_probs[i] = (vp8_prob)vp8_read_literal(&header_bc, 8);
+      if (vp9_read_bit(&header_bc))
+        pc->ref_pred_probs[i] = (vp9_prob)vp9_read_literal(&header_bc, 8);
     }
   }
 
 #if CONFIG_SUPERBLOCKS
-  pc->sb_coded = vp8_read_literal(&header_bc, 8);
+  pc->sb_coded = vp9_read_literal(&header_bc, 8);
 #endif
 
   /* Read the loop filter level and type */
-  pc->txfm_mode = vp8_read_literal(&header_bc, 2);
+  pc->txfm_mode = vp9_read_literal(&header_bc, 2);
   if (pc->txfm_mode == TX_MODE_SELECT) {
-    pc->prob_tx[0] = vp8_read_literal(&header_bc, 8);
-    pc->prob_tx[1] = vp8_read_literal(&header_bc, 8);
+    pc->prob_tx[0] = vp9_read_literal(&header_bc, 8);
+    pc->prob_tx[1] = vp9_read_literal(&header_bc, 8);
   }
 
-  pc->filter_type = (LOOPFILTERTYPE) vp8_read_bit(&header_bc);
-  pc->filter_level = vp8_read_literal(&header_bc, 6);
-  pc->sharpness_level = vp8_read_literal(&header_bc, 3);
+  pc->filter_type = (LOOPFILTERTYPE) vp9_read_bit(&header_bc);
+  pc->filter_level = vp9_read_literal(&header_bc, 6);
+  pc->sharpness_level = vp9_read_literal(&header_bc, 3);
 
   /* Read in loop filter deltas applied at the MB level based on mode or ref frame. */
   xd->mode_ref_lf_delta_update = 0;
-  xd->mode_ref_lf_delta_enabled = (unsigned char)vp8_read_bit(&header_bc);
+  xd->mode_ref_lf_delta_enabled = (unsigned char)vp9_read_bit(&header_bc);
 
   if (xd->mode_ref_lf_delta_enabled) {
     /* Do the deltas need to be updated */
-    xd->mode_ref_lf_delta_update = (unsigned char)vp8_read_bit(&header_bc);
+    xd->mode_ref_lf_delta_update = (unsigned char)vp9_read_bit(&header_bc);
 
     if (xd->mode_ref_lf_delta_update) {
       /* Send update */
       for (i = 0; i < MAX_REF_LF_DELTAS; i++) {
-        if (vp8_read_bit(&header_bc)) {
-          /*sign = vp8_read_bit( &header_bc );*/
-          xd->ref_lf_deltas[i] = (signed char)vp8_read_literal(&header_bc, 6);
+        if (vp9_read_bit(&header_bc)) {
+          /*sign = vp9_read_bit( &header_bc );*/
+          xd->ref_lf_deltas[i] = (signed char)vp9_read_literal(&header_bc, 6);
 
-          if (vp8_read_bit(&header_bc))        /* Apply sign */
+          if (vp9_read_bit(&header_bc))        /* Apply sign */
             xd->ref_lf_deltas[i] = xd->ref_lf_deltas[i] * -1;
         }
       }
 
       /* Send update */
       for (i = 0; i < MAX_MODE_LF_DELTAS; i++) {
-        if (vp8_read_bit(&header_bc)) {
-          /*sign = vp8_read_bit( &header_bc );*/
-          xd->mode_lf_deltas[i] = (signed char)vp8_read_literal(&header_bc, 6);
+        if (vp9_read_bit(&header_bc)) {
+          /*sign = vp9_read_bit( &header_bc );*/
+          xd->mode_lf_deltas[i] = (signed char)vp9_read_literal(&header_bc, 6);
 
-          if (vp8_read_bit(&header_bc))        /* Apply sign */
+          if (vp9_read_bit(&header_bc))        /* Apply sign */
             xd->mode_lf_deltas[i] = xd->mode_lf_deltas[i] * -1;
         }
       }
@@ -1123,7 +1123,7 @@
   }
 
   // Dummy read for now
-  vp8_read_literal(&header_bc, 2);
+  vp9_read_literal(&header_bc, 2);
 
   setup_token_decoder(pbi, data + first_partition_length_in_bytes,
                       &residual_bc);
@@ -1132,7 +1132,7 @@
   {
     int Q, q_update;
 
-    Q = vp8_read_literal(&header_bc, QINDEX_BITS);
+    Q = vp9_read_literal(&header_bc, QINDEX_BITS);
     pc->base_qindex = Q;
     q_update = 0;
     /* AC 1st order Q = default */
@@ -1155,8 +1155,8 @@
    */
   if (pc->frame_type != KEY_FRAME) {
     /* Should the GF or ARF be updated from the current frame */
-    pc->refresh_golden_frame = vp8_read_bit(&header_bc);
-    pc->refresh_alt_ref_frame = vp8_read_bit(&header_bc);
+    pc->refresh_golden_frame = vp9_read_bit(&header_bc);
+    pc->refresh_alt_ref_frame = vp9_read_bit(&header_bc);
 
     if (pc->refresh_alt_ref_frame) {
       vpx_memcpy(&pc->fc, &pc->lfc_a, sizeof(pc->fc));
@@ -1174,35 +1174,35 @@
     pc->copy_buffer_to_gf = 0;
 
     if (!pc->refresh_golden_frame)
-      pc->copy_buffer_to_gf = vp8_read_literal(&header_bc, 2);
+      pc->copy_buffer_to_gf = vp9_read_literal(&header_bc, 2);
 
     pc->copy_buffer_to_arf = 0;
 
     if (!pc->refresh_alt_ref_frame)
-      pc->copy_buffer_to_arf = vp8_read_literal(&header_bc, 2);
+      pc->copy_buffer_to_arf = vp9_read_literal(&header_bc, 2);
 
-    pc->ref_frame_sign_bias[GOLDEN_FRAME] = vp8_read_bit(&header_bc);
-    pc->ref_frame_sign_bias[ALTREF_FRAME] = vp8_read_bit(&header_bc);
+    pc->ref_frame_sign_bias[GOLDEN_FRAME] = vp9_read_bit(&header_bc);
+    pc->ref_frame_sign_bias[ALTREF_FRAME] = vp9_read_bit(&header_bc);
 
     /* Is high precision mv allowed */
-    xd->allow_high_precision_mv = (unsigned char)vp8_read_bit(&header_bc);
+    xd->allow_high_precision_mv = (unsigned char)vp9_read_bit(&header_bc);
     // Read the type of subpel filter to use
-    if (vp8_read_bit(&header_bc)) {
+    if (vp9_read_bit(&header_bc)) {
       pc->mcomp_filter_type = SWITCHABLE;
     } else {
-      pc->mcomp_filter_type = vp8_read_literal(&header_bc, 2);
+      pc->mcomp_filter_type = vp9_read_literal(&header_bc, 2);
     }
     /* To enable choice of different interploation filters */
     vp9_setup_interp_filters(xd, pc->mcomp_filter_type, pc);
   }
 
-  pc->refresh_entropy_probs = vp8_read_bit(&header_bc);
+  pc->refresh_entropy_probs = vp9_read_bit(&header_bc);
   if (pc->refresh_entropy_probs == 0) {
     vpx_memcpy(&pc->lfc, &pc->fc, sizeof(pc->fc));
   }
 
   pc->refresh_last_frame = (pc->frame_type == KEY_FRAME)
-                           || vp8_read_bit(&header_bc);
+                           || vp9_read_bit(&header_bc);
 
   if (0) {
     FILE *z = fopen("decodestats.stt", "a");
@@ -1216,40 +1216,40 @@
     fclose(z);
   }
 
-  vp8_copy(pbi->common.fc.pre_coef_probs,
+  vp9_copy(pbi->common.fc.pre_coef_probs,
            pbi->common.fc.coef_probs);
-  vp8_copy(pbi->common.fc.pre_hybrid_coef_probs,
+  vp9_copy(pbi->common.fc.pre_hybrid_coef_probs,
            pbi->common.fc.hybrid_coef_probs);
-  vp8_copy(pbi->common.fc.pre_coef_probs_8x8,
+  vp9_copy(pbi->common.fc.pre_coef_probs_8x8,
            pbi->common.fc.coef_probs_8x8);
-  vp8_copy(pbi->common.fc.pre_hybrid_coef_probs_8x8,
+  vp9_copy(pbi->common.fc.pre_hybrid_coef_probs_8x8,
            pbi->common.fc.hybrid_coef_probs_8x8);
-  vp8_copy(pbi->common.fc.pre_coef_probs_16x16,
+  vp9_copy(pbi->common.fc.pre_coef_probs_16x16,
            pbi->common.fc.coef_probs_16x16);
-  vp8_copy(pbi->common.fc.pre_hybrid_coef_probs_16x16,
+  vp9_copy(pbi->common.fc.pre_hybrid_coef_probs_16x16,
            pbi->common.fc.hybrid_coef_probs_16x16);
-  vp8_copy(pbi->common.fc.pre_ymode_prob, pbi->common.fc.ymode_prob);
-  vp8_copy(pbi->common.fc.pre_uv_mode_prob, pbi->common.fc.uv_mode_prob);
-  vp8_copy(pbi->common.fc.pre_bmode_prob, pbi->common.fc.bmode_prob);
-  vp8_copy(pbi->common.fc.pre_i8x8_mode_prob, pbi->common.fc.i8x8_mode_prob);
-  vp8_copy(pbi->common.fc.pre_sub_mv_ref_prob, pbi->common.fc.sub_mv_ref_prob);
-  vp8_copy(pbi->common.fc.pre_mbsplit_prob, pbi->common.fc.mbsplit_prob);
+  vp9_copy(pbi->common.fc.pre_ymode_prob, pbi->common.fc.ymode_prob);
+  vp9_copy(pbi->common.fc.pre_uv_mode_prob, pbi->common.fc.uv_mode_prob);
+  vp9_copy(pbi->common.fc.pre_bmode_prob, pbi->common.fc.bmode_prob);
+  vp9_copy(pbi->common.fc.pre_i8x8_mode_prob, pbi->common.fc.i8x8_mode_prob);
+  vp9_copy(pbi->common.fc.pre_sub_mv_ref_prob, pbi->common.fc.sub_mv_ref_prob);
+  vp9_copy(pbi->common.fc.pre_mbsplit_prob, pbi->common.fc.mbsplit_prob);
   pbi->common.fc.pre_nmvc = pbi->common.fc.nmvc;
-  vp8_zero(pbi->common.fc.coef_counts);
-  vp8_zero(pbi->common.fc.hybrid_coef_counts);
-  vp8_zero(pbi->common.fc.coef_counts_8x8);
-  vp8_zero(pbi->common.fc.hybrid_coef_counts_8x8);
-  vp8_zero(pbi->common.fc.coef_counts_16x16);
-  vp8_zero(pbi->common.fc.hybrid_coef_counts_16x16);
-  vp8_zero(pbi->common.fc.ymode_counts);
-  vp8_zero(pbi->common.fc.uv_mode_counts);
-  vp8_zero(pbi->common.fc.bmode_counts);
-  vp8_zero(pbi->common.fc.i8x8_mode_counts);
-  vp8_zero(pbi->common.fc.sub_mv_ref_counts);
-  vp8_zero(pbi->common.fc.mbsplit_counts);
-  vp8_zero(pbi->common.fc.NMVcount);
-  vp8_zero(pbi->common.fc.mv_ref_ct);
-  vp8_zero(pbi->common.fc.mv_ref_ct_a);
+  vp9_zero(pbi->common.fc.coef_counts);
+  vp9_zero(pbi->common.fc.hybrid_coef_counts);
+  vp9_zero(pbi->common.fc.coef_counts_8x8);
+  vp9_zero(pbi->common.fc.hybrid_coef_counts_8x8);
+  vp9_zero(pbi->common.fc.coef_counts_16x16);
+  vp9_zero(pbi->common.fc.hybrid_coef_counts_16x16);
+  vp9_zero(pbi->common.fc.ymode_counts);
+  vp9_zero(pbi->common.fc.uv_mode_counts);
+  vp9_zero(pbi->common.fc.bmode_counts);
+  vp9_zero(pbi->common.fc.i8x8_mode_counts);
+  vp9_zero(pbi->common.fc.sub_mv_ref_counts);
+  vp9_zero(pbi->common.fc.mbsplit_counts);
+  vp9_zero(pbi->common.fc.NMVcount);
+  vp9_zero(pbi->common.fc.mv_ref_ct);
+  vp9_zero(pbi->common.fc.mv_ref_ct_a);
 
   read_coef_probs(pbi, &header_bc);
 
@@ -1272,7 +1272,7 @@
   vpx_memset(xd->qcoeff, 0, sizeof(xd->qcoeff));
 
   /* Read the mb_no_coeff_skip flag */
-  pc->mb_no_coeff_skip = (int)vp8_read_bit(&header_bc);
+  pc->mb_no_coeff_skip = (int)vp9_read_bit(&header_bc);
 
   vp9_decode_mode_mvs_init(pbi, &header_bc);
 
@@ -1290,7 +1290,7 @@
 
   /* Collect information about decoder corruption. */
   /* 1. Check first boolean decoder for errors. */
-  pc->yv12_fb[pc->new_fb_idx].corrupted = vp8dx_bool_error(&header_bc);
+  pc->yv12_fb[pc->new_fb_idx].corrupted = bool_error(&header_bc);
   /* 2. Check the macroblock information */
   pc->yv12_fb[pc->new_fb_idx].corrupted |= corrupt_tokens;
 
diff --git a/vp8/decoder/detokenize.c b/vp8/decoder/detokenize.c
index 19534f8..41dbf0e 100644
--- a/vp8/decoder/detokenize.c
+++ b/vp8/decoder/detokenize.c
@@ -157,7 +157,7 @@
       break;
   }
 
-  VP8_COMBINEENTROPYCONTEXTS(pt, *a, *l);
+  VP9_COMBINEENTROPYCONTEXTS(pt, *a, *l);
   for (c = !type; c < eob; ++c) {
     int rc = scan[c];
     int v = qcoeff_ptr[rc];
@@ -183,7 +183,7 @@
                          ENTROPY_CONTEXT *a, ENTROPY_CONTEXT *l,
                          int eob, int seg_eob, FRAME_CONTEXT *const fc) {
   int c, pt, token, band;
-  VP8_COMBINEENTROPYCONTEXTS(pt, *a, *l);
+  VP9_COMBINEENTROPYCONTEXTS(pt, *a, *l);
   for (c = !type; c < eob; ++c) {
     int rc = vp9_default_zig_zag1d[c];
     int v = qcoeff_ptr[rc];
@@ -203,7 +203,7 @@
                              ENTROPY_CONTEXT *a, ENTROPY_CONTEXT *l,
                              int eob, int seg_eob, FRAME_CONTEXT *fc) {
   int c, pt, token, band;
-  VP8_COMBINEENTROPYCONTEXTS(pt, *a, *l);
+  VP9_COMBINEENTROPYCONTEXTS(pt, *a, *l);
   for (c = !type; c < eob; ++c) {
     int rc = (type == 1 ? vp9_default_zig_zag1d[c] : vp9_default_zig_zag1d_8x8[c]);
     int v = qcoeff_ptr[rc];
@@ -229,7 +229,7 @@
                                ENTROPY_CONTEXT *a, ENTROPY_CONTEXT *l,
                                int eob, int seg_eob, FRAME_CONTEXT *fc) {
   int c, pt, token;
-  VP8_COMBINEENTROPYCONTEXTS(pt, *a, *l);
+  VP9_COMBINEENTROPYCONTEXTS(pt, *a, *l);
   for (c = !type; c < eob; ++c) {
     int rc = vp9_default_zig_zag1d_16x16[c];
     int v = qcoeff_ptr[rc];
@@ -250,9 +250,9 @@
   }
 }
 
-static int vp8_get_signed(BOOL_DECODER *br, int value_to_sign) {
+static int get_signed(BOOL_DECODER *br, int value_to_sign) {
   const int split = (br->range + 1) >> 1;
-  const VP8_BD_VALUE bigsplit = (VP8_BD_VALUE)split << (VP8_BD_VALUE_SIZE - 8);
+  const VP9_BD_VALUE bigsplit = (VP9_BD_VALUE)split << (VP9_BD_VALUE_SIZE - 8);
   int v;
 
   if (br->count < 0)
@@ -276,14 +276,14 @@
 #define WRITE_COEF_CONTINUE(val)                              \
   {                                                           \
     prob = coef_probs + (ENTROPY_NODES*PREV_CONTEXT_INC(val));\
-    qcoeff_ptr[scan[c]] = (INT16) vp8_get_signed(br, val);    \
+    qcoeff_ptr[scan[c]] = (INT16) get_signed(br, val);        \
     c++;                                                      \
     continue;                                                 \
   }
 
 #define ADJUST_COEF(prob, bits_count)  \
   do {                                 \
-    if (vp8_read(br, prob))            \
+    if (vp9_read(br, prob))            \
       val += (UINT16)(1 << bits_count);\
   } while (0);
 
@@ -297,7 +297,7 @@
                         const int *coef_bands) {
   FRAME_CONTEXT *const fc = &dx->common.fc;
   int tmp, c = (type == PLANE_TYPE_Y_NO_DC);
-  const vp8_prob *prob, *coef_probs;
+  const vp9_prob *prob, *coef_probs;
 
   switch (block_type) {
     default:
@@ -318,7 +318,7 @@
       break;
   }
 
-  VP8_COMBINEENTROPYCONTEXTS(tmp, *a, *l);
+  VP9_COMBINEENTROPYCONTEXTS(tmp, *a, *l);
   prob = coef_probs + tmp * ENTROPY_NODES;
 
   while (1) {
@@ -326,35 +326,35 @@
     const uint8_t *cat6 = cat6_prob;
     if (c == seg_eob) break;
     prob += coef_bands[c];
-    if (!vp8_read(br, prob[EOB_CONTEXT_NODE]))
+    if (!vp9_read(br, prob[EOB_CONTEXT_NODE]))
       break;
 SKIP_START:
     if (c == seg_eob) break;
-    if (!vp8_read(br, prob[ZERO_CONTEXT_NODE])) {
+    if (!vp9_read(br, prob[ZERO_CONTEXT_NODE])) {
       ++c;
       prob = coef_probs + coef_bands[c];
       goto SKIP_START;
     }
     // ONE_CONTEXT_NODE_0_
-    if (!vp8_read(br, prob[ONE_CONTEXT_NODE])) {
+    if (!vp9_read(br, prob[ONE_CONTEXT_NODE])) {
       prob = coef_probs + ENTROPY_NODES;
-      qcoeff_ptr[scan[c]] = (INT16) vp8_get_signed(br, 1);
+      qcoeff_ptr[scan[c]] = (INT16) get_signed(br, 1);
       ++c;
       continue;
     }
     // LOW_VAL_CONTEXT_NODE_0_
-    if (!vp8_read(br, prob[LOW_VAL_CONTEXT_NODE])) {
-      if (!vp8_read(br, prob[TWO_CONTEXT_NODE])) {
+    if (!vp9_read(br, prob[LOW_VAL_CONTEXT_NODE])) {
+      if (!vp9_read(br, prob[TWO_CONTEXT_NODE])) {
         WRITE_COEF_CONTINUE(2);
       }
-      if (!vp8_read(br, prob[THREE_CONTEXT_NODE])) {
+      if (!vp9_read(br, prob[THREE_CONTEXT_NODE])) {
         WRITE_COEF_CONTINUE(3);
       }
       WRITE_COEF_CONTINUE(4);
     }
     // HIGH_LOW_CONTEXT_NODE_0_
-    if (!vp8_read(br, prob[HIGH_LOW_CONTEXT_NODE])) {
-      if (!vp8_read(br, prob[CAT_ONE_CONTEXT_NODE])) {
+    if (!vp9_read(br, prob[HIGH_LOW_CONTEXT_NODE])) {
+      if (!vp9_read(br, prob[CAT_ONE_CONTEXT_NODE])) {
         val = CAT1_MIN_VAL;
         ADJUST_COEF(CAT1_PROB0, 0);
         WRITE_COEF_CONTINUE(val);
@@ -365,8 +365,8 @@
       WRITE_COEF_CONTINUE(val);
     }
     // CAT_THREEFOUR_CONTEXT_NODE_0_
-    if (!vp8_read(br, prob[CAT_THREEFOUR_CONTEXT_NODE])) {
-      if (!vp8_read(br, prob[CAT_THREE_CONTEXT_NODE])) {
+    if (!vp9_read(br, prob[CAT_THREEFOUR_CONTEXT_NODE])) {
+      if (!vp9_read(br, prob[CAT_THREE_CONTEXT_NODE])) {
         val = CAT3_MIN_VAL;
         ADJUST_COEF(CAT3_PROB2, 2);
         ADJUST_COEF(CAT3_PROB1, 1);
@@ -381,7 +381,7 @@
       WRITE_COEF_CONTINUE(val);
     }
     // CAT_FIVE_CONTEXT_NODE_0_:
-    if (!vp8_read(br, prob[CAT_FIVE_CONTEXT_NODE])) {
+    if (!vp9_read(br, prob[CAT_FIVE_CONTEXT_NODE])) {
       val = CAT5_MIN_VAL;
       ADJUST_COEF(CAT5_PROB4, 4);
       ADJUST_COEF(CAT5_PROB3, 3);
@@ -392,7 +392,7 @@
     }
     val = 0;
     while (*cat6) {
-      val = (val << 1) | vp8_read(br, *cat6++);
+      val = (val << 1) | vp9_read(br, *cat6++);
     }
     val += CAT6_MIN_VAL;
     WRITE_COEF_CONTINUE(val);
diff --git a/vp8/decoder/ec_types.h b/vp8/decoder/ec_types.h
deleted file mode 100644
index 983af70..0000000
--- a/vp8/decoder/ec_types.h
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- *  Copyright (c) 2011 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 VP8_DEC_EC_TYPES_H
-#define VP8_DEC_EC_TYPES_H
-
-#define MAX_OVERLAPS 16
-
-
-
-/* The area (pixel area in Q6) the block pointed to by bmi overlaps
- * another block with.
- */
-typedef struct {
-  int overlap;
-  union b_mode_info *bmi;
-} OVERLAP_NODE;
-
-/* Structure to keep track of overlapping blocks on a block level. */
-typedef struct {
-  /* TODO(holmer): This array should be exchanged for a linked list */
-  OVERLAP_NODE overlaps[MAX_OVERLAPS];
-} B_OVERLAP;
-
-/* Structure used to hold all the overlaps of a macroblock. The overlaps of a
- * macroblock is further divided into block overlaps.
- */
-typedef struct {
-  B_OVERLAP overlaps[16];
-} MB_OVERLAP;
-
-/* Structure for keeping track of motion vectors and which reference frame they
- * refer to. Used for motion vector interpolation.
- */
-typedef struct {
-  MV mv;
-  MV_REFERENCE_FRAME ref_frame;
-} EC_BLOCK;
-
-#endif /* VP8_DEC_EC_TYPES_H */
diff --git a/vp8/decoder/onyxd_if.c b/vp8/decoder/onyxd_if.c
index c2a5e48..bce5075 100644
--- a/vp8/decoder/onyxd_if.c
+++ b/vp8/decoder/onyxd_if.c
@@ -33,13 +33,12 @@
 #include "vpx_ports/arm.h"
 #endif
 
-extern void vp8_init_loop_filter(VP9_COMMON *cm);
 extern void vp9_init_de_quantizer(VP9D_COMP *pbi);
 static int get_free_fb(VP9_COMMON *cm);
 static void ref_cnt_fb(int *buf, int *idx, int new_idx);
 
 #if CONFIG_DEBUG
-void vp8_recon_write_yuv_frame(char *name, YV12_BUFFER_CONFIG *s) {
+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;
   int h = s->y_height;
@@ -115,7 +114,7 @@
   }
 }
 
-VP8D_PTR vp9_create_decompressor(VP8D_CONFIG *oxcf) {
+VP9D_PTR vp9_create_decompressor(VP9D_CONFIG *oxcf) {
   VP9D_COMP *pbi = vpx_memalign(32, sizeof(VP9D_COMP));
 
   if (!pbi)
@@ -149,10 +148,10 @@
 
   pbi->decoded_key_frame = 0;
 
-  return (VP8D_PTR) pbi;
+  return (VP9D_PTR) pbi;
 }
 
-void vp9_remove_decompressor(VP8D_PTR ptr) {
+void vp9_remove_decompressor(VP9D_PTR ptr) {
   VP9D_COMP *pbi = (VP9D_COMP *) ptr;
 
   if (!pbi)
@@ -168,17 +167,17 @@
 }
 
 
-vpx_codec_err_t vp9_get_reference_dec(VP8D_PTR ptr, VP8_REFFRAME ref_frame_flag,
+vpx_codec_err_t vp9_get_reference_dec(VP9D_PTR ptr, VP9_REFFRAME ref_frame_flag,
                                       YV12_BUFFER_CONFIG *sd) {
   VP9D_COMP *pbi = (VP9D_COMP *) ptr;
   VP9_COMMON *cm = &pbi->common;
   int ref_fb_idx;
 
-  if (ref_frame_flag == VP8_LAST_FLAG)
+  if (ref_frame_flag == VP9_LAST_FLAG)
     ref_fb_idx = cm->lst_fb_idx;
-  else if (ref_frame_flag == VP8_GOLD_FLAG)
+  else if (ref_frame_flag == VP9_GOLD_FLAG)
     ref_fb_idx = cm->gld_fb_idx;
-  else if (ref_frame_flag == VP8_ALT_FLAG)
+  else if (ref_frame_flag == VP9_ALT_FLAG)
     ref_fb_idx = cm->alt_fb_idx;
   else {
     vpx_internal_error(&pbi->common.error, VPX_CODEC_ERROR,
@@ -199,18 +198,18 @@
 }
 
 
-vpx_codec_err_t vp9_set_reference_dec(VP8D_PTR ptr, VP8_REFFRAME ref_frame_flag,
+vpx_codec_err_t vp9_set_reference_dec(VP9D_PTR ptr, VP9_REFFRAME ref_frame_flag,
                                       YV12_BUFFER_CONFIG *sd) {
   VP9D_COMP *pbi = (VP9D_COMP *) ptr;
   VP9_COMMON *cm = &pbi->common;
   int *ref_fb_ptr = NULL;
   int free_fb;
 
-  if (ref_frame_flag == VP8_LAST_FLAG)
+  if (ref_frame_flag == VP9_LAST_FLAG)
     ref_fb_ptr = &cm->lst_fb_idx;
-  else if (ref_frame_flag == VP8_GOLD_FLAG)
+  else if (ref_frame_flag == VP9_GOLD_FLAG)
     ref_fb_ptr = &cm->gld_fb_idx;
-  else if (ref_frame_flag == VP8_ALT_FLAG)
+  else if (ref_frame_flag == VP9_ALT_FLAG)
     ref_fb_ptr = &cm->alt_fb_idx;
   else {
     vpx_internal_error(&pbi->common.error, VPX_CODEC_ERROR,
@@ -241,8 +240,8 @@
 
 /*For ARM NEON, d8-d15 are callee-saved registers, and need to be saved by us.*/
 #if HAVE_ARMV7
-extern void vp8_push_neon(int64_t *store);
-extern void vp8_pop_neon(int64_t *store);
+extern void vp9_push_neon(int64_t *store);
+extern void vp9_pop_neon(int64_t *store);
 #endif
 
 static int get_free_fb(VP9_COMMON *cm) {
@@ -318,23 +317,7 @@
   return err;
 }
 
-/*
-static void vp8_print_yuv_rec_mb(VP9_COMMON *cm, int mb_row, int mb_col)
-{
-  YV12_BUFFER_CONFIG *s = cm->frame_to_show;
-  unsigned char *src = s->y_buffer;
-  int i, j;
-
-  printf("After loop filter\n");
-  for (i=0;i<16;i++) {
-    for (j=0;j<16;j++)
-      printf("%3d ", src[(mb_row*16+i)*s->y_stride + mb_col*16+j]);
-    printf("\n");
-  }
-}
-*/
-
-int vp9_receive_compressed_data(VP8D_PTR ptr, unsigned long size,
+int vp9_receive_compressed_data(VP9D_PTR ptr, unsigned long size,
                                 const unsigned char *source,
                                 int64_t time_stamp) {
 #if HAVE_ARMV7
@@ -370,7 +353,7 @@
   if (cm->rtcd.flags & HAS_NEON)
 #endif
   {
-    vp8_push_neon(dx_store_reg);
+    vp9_push_neon(dx_store_reg);
   }
 #endif
 
@@ -382,7 +365,7 @@
     if (cm->rtcd.flags & HAS_NEON)
 #endif
     {
-      vp8_pop_neon(dx_store_reg);
+      vp9_pop_neon(dx_store_reg);
     }
 #endif
     pbi->common.error.setjmp = 0;
@@ -408,7 +391,7 @@
     if (cm->rtcd.flags & HAS_NEON)
 #endif
     {
-      vp8_pop_neon(dx_store_reg);
+      vp9_pop_neon(dx_store_reg);
     }
 #endif
     pbi->common.error.error_code = VPX_CODEC_ERROR;
@@ -425,7 +408,7 @@
       if (cm->rtcd.flags & HAS_NEON)
 #endif
       {
-        vp8_pop_neon(dx_store_reg);
+        vp9_pop_neon(dx_store_reg);
       }
 #endif
       pbi->common.error.error_code = VPX_CODEC_ERROR;
@@ -451,10 +434,10 @@
 
 #if CONFIG_DEBUG
   if (cm->show_frame)
-    vp8_recon_write_yuv_frame("recon.yuv", cm->frame_to_show);
+    recon_write_yuv_frame("recon.yuv", cm->frame_to_show);
 #endif
 
-  vp8_clear_system_state();
+  vp9_clear_system_state();
 
   if (cm->show_frame) {
     vpx_memcpy(cm->prev_mip, cm->mip,
@@ -479,16 +462,16 @@
   if (cm->rtcd.flags & HAS_NEON)
 #endif
   {
-    vp8_pop_neon(dx_store_reg);
+    vp9_pop_neon(dx_store_reg);
   }
 #endif
   pbi->common.error.setjmp = 0;
   return retcode;
 }
 
-int vp9_get_raw_frame(VP8D_PTR ptr, YV12_BUFFER_CONFIG *sd,
+int vp9_get_raw_frame(VP9D_PTR ptr, YV12_BUFFER_CONFIG *sd,
                       int64_t *time_stamp, int64_t *time_end_stamp,
-                      vp8_ppflags_t *flags) {
+                      vp9_ppflags_t *flags) {
   int ret = -1;
   VP9D_COMP *pbi = (VP9D_COMP *) ptr;
 
@@ -519,6 +502,6 @@
   }
 
 #endif /*!CONFIG_POSTPROC*/
-  vp8_clear_system_state();
+  vp9_clear_system_state();
   return ret;
 }
diff --git a/vp8/decoder/onyxd_int.h b/vp8/decoder/onyxd_int.h
index de5f705..2fb9e90 100644
--- a/vp8/decoder/onyxd_int.h
+++ b/vp8/decoder/onyxd_int.h
@@ -9,8 +9,8 @@
  */
 
 
-#ifndef __INC_VP8D_INT_H
-#define __INC_VP8D_INT_H
+#ifndef __INC_ONYXD_INT_H
+#define __INC_ONYXD_INT_H
 #include "vpx_ports/config.h"
 #include "vp8/common/onyxd.h"
 #include "treereader.h"
@@ -36,7 +36,7 @@
   int const *scan;
   int const *scan_8x8;
   UINT8 const *ptr_block2leftabove;
-  vp8_tree_index const *vp9_coef_tree_ptr;
+  vp9_tree_index const *vp9_coef_tree_ptr;
   unsigned char *norm_ptr;
   UINT8 *ptr_coef_bands_x;
   UINT8 *ptr_coef_bands_x_8x8;
@@ -46,9 +46,9 @@
 
   INT16 *qcoeff_start_ptr;
 
-  vp8_prob const *coef_probs[BLOCK_TYPES];
-  vp8_prob const *coef_probs_8x8[BLOCK_TYPES_8X8];
-  vp8_prob const *coef_probs_16X16[BLOCK_TYPES_16X16];
+  vp9_prob const *coef_probs[BLOCK_TYPES];
+  vp9_prob const *coef_probs_8x8[BLOCK_TYPES_8X8];
+  vp9_prob const *coef_probs_16X16[BLOCK_TYPES_16X16];
 
   UINT8 eob[25];
 
@@ -59,13 +59,13 @@
 
   DECLARE_ALIGNED(16, VP9_COMMON, common);
 
-  VP8D_CONFIG oxcf;
+  VP9D_CONFIG oxcf;
 
 
   const unsigned char *Source;
   unsigned int   source_sz;
 
-  vp8_reader *mbc;
+  vp9_reader *mbc;
   int64_t last_time_stamp;
   int   ready_for_new_data;
 
@@ -77,7 +77,7 @@
   vp9_dequant_idct_add_y_block_fn_t    idct_add_y_block;
   vp9_dequant_idct_add_uv_block_fn_t   idct_add_uv_block;
 
-  vp8_prob prob_skip_false;
+  vp9_prob prob_skip_false;
 
   int decoded_key_frame;
 
@@ -103,4 +103,4 @@
   } while(0)
 #endif
 
-#endif
+#endif  // __INC_ONYXD_INT_H
diff --git a/vp8/decoder/reconintra_mt.c b/vp8/decoder/reconintra_mt.c
deleted file mode 100644
index 23c8f45..0000000
--- a/vp8/decoder/reconintra_mt.c
+++ /dev/null
@@ -1,843 +0,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.
- */
-
-
-#include "vpx_ports/config.h"
-#include "vp8/common/reconintra.h"
-#include "vpx_mem/vpx_mem.h"
-#include "onyxd_int.h"
-
-/* For skip_recon_mb(), add vp9_build_intra_predictors_mby_s(MACROBLOCKD *xd)
- * and vp9_build_intra_predictors_mbuv_s(MACROBLOCKD *xd).
- */
-
-void vp8mt_build_intra_predictors_mby(VP9D_COMP *pbi, MACROBLOCKD *xd,
-                                      int mb_row, int mb_col) {
-  unsigned char *yabove_row;    /* = xd->dst.y_buffer - xd->dst.y_stride; */
-  unsigned char *yleft_col;
-  unsigned char yleft_buf[16];
-  unsigned char ytop_left;      /* = yabove_row[-1]; */
-  unsigned char *ypred_ptr = xd->predictor;
-  int r, c, i;
-
-  if (pbi->common.filter_level) {
-    yabove_row = pbi->mt_yabove_row[mb_row] + mb_col * 16 + 32;
-    yleft_col = pbi->mt_yleft_col[mb_row];
-  } else {
-    yabove_row = xd->dst.y_buffer - xd->dst.y_stride;
-
-    for (i = 0; i < 16; i++)
-      yleft_buf[i] = xd->dst.y_buffer [i * xd->dst.y_stride - 1];
-    yleft_col = yleft_buf;
-  }
-
-  ytop_left = yabove_row[-1];
-
-  /* for Y */
-  switch (xd->mode_info_context->mbmi.mode) {
-    case DC_PRED: {
-      int expected_dc;
-      int i;
-      int shift;
-      int average = 0;
-
-
-      if (xd->up_available || xd->left_available) {
-        if (xd->up_available) {
-          for (i = 0; i < 16; i++) {
-            average += yabove_row[i];
-          }
-        }
-
-        if (xd->left_available) {
-
-          for (i = 0; i < 16; i++) {
-            average += yleft_col[i];
-          }
-
-        }
-
-
-
-        shift = 3 + xd->up_available + xd->left_available;
-        expected_dc = (average + (1 << (shift - 1))) >> shift;
-      } else {
-        expected_dc = 128;
-      }
-
-      vpx_memset(ypred_ptr, expected_dc, 256);
-    }
-    break;
-    case V_PRED: {
-
-      for (r = 0; r < 16; r++) {
-
-        ((int *)ypred_ptr)[0] = ((int *)yabove_row)[0];
-        ((int *)ypred_ptr)[1] = ((int *)yabove_row)[1];
-        ((int *)ypred_ptr)[2] = ((int *)yabove_row)[2];
-        ((int *)ypred_ptr)[3] = ((int *)yabove_row)[3];
-        ypred_ptr += 16;
-      }
-    }
-    break;
-    case H_PRED: {
-
-      for (r = 0; r < 16; r++) {
-
-        vpx_memset(ypred_ptr, yleft_col[r], 16);
-        ypred_ptr += 16;
-      }
-
-    }
-    break;
-    case TM_PRED: {
-
-      for (r = 0; r < 16; r++) {
-        for (c = 0; c < 16; c++) {
-          int pred =  yleft_col[r] + yabove_row[ c] - ytop_left;
-
-          if (pred < 0)
-            pred = 0;
-
-          if (pred > 255)
-            pred = 255;
-
-          ypred_ptr[c] = pred;
-        }
-
-        ypred_ptr += 16;
-      }
-
-    }
-    break;
-    case B_PRED:
-    case NEARESTMV:
-    case NEARMV:
-    case ZEROMV:
-    case NEWMV:
-    case SPLITMV:
-    case MB_MODE_COUNT:
-      break;
-  }
-}
-
-void vp8mt_build_intra_predictors_mby_s(VP9D_COMP *pbi, MACROBLOCKD *xd,
-                                        int mb_row, int mb_col) {
-  unsigned char *yabove_row;    /* = xd->dst.y_buffer - xd->dst.y_stride; */
-  unsigned char *yleft_col;
-  unsigned char yleft_buf[16];
-  unsigned char ytop_left;      /* = yabove_row[-1]; */
-  unsigned char *ypred_ptr = xd->predictor;
-  int r, c, i;
-
-  int y_stride = xd->dst.y_stride;
-  ypred_ptr = xd->dst.y_buffer; /*xd->predictor;*/
-
-  if (pbi->common.filter_level) {
-    yabove_row = pbi->mt_yabove_row[mb_row] + mb_col * 16 + 32;
-    yleft_col = pbi->mt_yleft_col[mb_row];
-  } else {
-    yabove_row = xd->dst.y_buffer - xd->dst.y_stride;
-
-    for (i = 0; i < 16; i++)
-      yleft_buf[i] = xd->dst.y_buffer [i * xd->dst.y_stride - 1];
-    yleft_col = yleft_buf;
-  }
-
-  ytop_left = yabove_row[-1];
-
-  /* for Y */
-  switch (xd->mode_info_context->mbmi.mode) {
-    case DC_PRED: {
-      int expected_dc;
-      int i;
-      int shift;
-      int average = 0;
-
-
-      if (xd->up_available || xd->left_available) {
-        if (xd->up_available) {
-          for (i = 0; i < 16; i++) {
-            average += yabove_row[i];
-          }
-        }
-
-        if (xd->left_available) {
-
-          for (i = 0; i < 16; i++) {
-            average += yleft_col[i];
-          }
-
-        }
-
-
-
-        shift = 3 + xd->up_available + xd->left_available;
-        expected_dc = (average + (1 << (shift - 1))) >> shift;
-      } else {
-        expected_dc = 128;
-      }
-
-      /*vpx_memset(ypred_ptr, expected_dc, 256);*/
-      for (r = 0; r < 16; r++) {
-        vpx_memset(ypred_ptr, expected_dc, 16);
-        ypred_ptr += y_stride; /*16;*/
-      }
-    }
-    break;
-    case V_PRED: {
-
-      for (r = 0; r < 16; r++) {
-
-        ((int *)ypred_ptr)[0] = ((int *)yabove_row)[0];
-        ((int *)ypred_ptr)[1] = ((int *)yabove_row)[1];
-        ((int *)ypred_ptr)[2] = ((int *)yabove_row)[2];
-        ((int *)ypred_ptr)[3] = ((int *)yabove_row)[3];
-        ypred_ptr += y_stride; /*16;*/
-      }
-    }
-    break;
-    case H_PRED: {
-
-      for (r = 0; r < 16; r++) {
-
-        vpx_memset(ypred_ptr, yleft_col[r], 16);
-        ypred_ptr += y_stride;  /*16;*/
-      }
-
-    }
-    break;
-    case TM_PRED: {
-
-      for (r = 0; r < 16; r++) {
-        for (c = 0; c < 16; c++) {
-          int pred =  yleft_col[r] + yabove_row[ c] - ytop_left;
-
-          if (pred < 0)
-            pred = 0;
-
-          if (pred > 255)
-            pred = 255;
-
-          ypred_ptr[c] = pred;
-        }
-
-        ypred_ptr += y_stride;  /*16;*/
-      }
-
-    }
-    break;
-    case B_PRED:
-    case NEARESTMV:
-    case NEARMV:
-    case ZEROMV:
-    case NEWMV:
-    case SPLITMV:
-    case MB_MODE_COUNT:
-      break;
-  }
-}
-
-void vp8mt_build_intra_predictors_mbuv(VP9D_COMP *pbi, MACROBLOCKD *xd,
-                                       int mb_row, int mb_col) {
-  unsigned char *uabove_row;   /* = xd->dst.u_buffer - xd->dst.uv_stride; */
-  unsigned char *uleft_col;    /*[16];*/
-  unsigned char uleft_buf[8];
-  unsigned char utop_left;     /* = uabove_row[-1]; */
-  unsigned char *vabove_row;   /* = xd->dst.v_buffer - xd->dst.uv_stride; */
-  unsigned char *vleft_col;    /*[20];*/
-  unsigned char vleft_buf[8];
-  unsigned char vtop_left;     /* = vabove_row[-1]; */
-  unsigned char *upred_ptr = &xd->predictor[256];
-  unsigned char *vpred_ptr = &xd->predictor[320];
-  int i, j;
-
-  if (pbi->common.filter_level) {
-    uabove_row = pbi->mt_uabove_row[mb_row] + mb_col * 8 + 16;
-    vabove_row = pbi->mt_vabove_row[mb_row] + mb_col * 8 + 16;
-    uleft_col = pbi->mt_uleft_col[mb_row];
-    vleft_col = pbi->mt_vleft_col[mb_row];
-  } else {
-    uabove_row = xd->dst.u_buffer - xd->dst.uv_stride;
-    vabove_row = xd->dst.v_buffer - xd->dst.uv_stride;
-
-    for (i = 0; i < 8; i++) {
-      uleft_buf[i] = xd->dst.u_buffer [i * xd->dst.uv_stride - 1];
-      vleft_buf[i] = xd->dst.v_buffer [i * xd->dst.uv_stride - 1];
-    }
-    uleft_col = uleft_buf;
-    vleft_col = vleft_buf;
-  }
-  utop_left = uabove_row[-1];
-  vtop_left = vabove_row[-1];
-
-  switch (xd->mode_info_context->mbmi.uv_mode) {
-    case DC_PRED: {
-      int expected_udc;
-      int expected_vdc;
-      int i;
-      int shift;
-      int Uaverage = 0;
-      int Vaverage = 0;
-
-      if (xd->up_available) {
-        for (i = 0; i < 8; i++) {
-          Uaverage += uabove_row[i];
-          Vaverage += vabove_row[i];
-        }
-      }
-
-      if (xd->left_available) {
-        for (i = 0; i < 8; i++) {
-          Uaverage += uleft_col[i];
-          Vaverage += vleft_col[i];
-        }
-      }
-
-      if (!xd->up_available && !xd->left_available) {
-        expected_udc = 128;
-        expected_vdc = 128;
-      } else {
-        shift = 2 + xd->up_available + xd->left_available;
-        expected_udc = (Uaverage + (1 << (shift - 1))) >> shift;
-        expected_vdc = (Vaverage + (1 << (shift - 1))) >> shift;
-      }
-
-
-      vpx_memset(upred_ptr, expected_udc, 64);
-      vpx_memset(vpred_ptr, expected_vdc, 64);
-
-
-    }
-    break;
-    case V_PRED: {
-      int i;
-
-      for (i = 0; i < 8; i++) {
-        vpx_memcpy(upred_ptr, uabove_row, 8);
-        vpx_memcpy(vpred_ptr, vabove_row, 8);
-        upred_ptr += 8;
-        vpred_ptr += 8;
-      }
-
-    }
-    break;
-    case H_PRED: {
-      int i;
-
-      for (i = 0; i < 8; i++) {
-        vpx_memset(upred_ptr, uleft_col[i], 8);
-        vpx_memset(vpred_ptr, vleft_col[i], 8);
-        upred_ptr += 8;
-        vpred_ptr += 8;
-      }
-    }
-
-    break;
-    case TM_PRED: {
-      int i;
-
-      for (i = 0; i < 8; i++) {
-        for (j = 0; j < 8; j++) {
-          int predu = uleft_col[i] + uabove_row[j] - utop_left;
-          int predv = vleft_col[i] + vabove_row[j] - vtop_left;
-
-          if (predu < 0)
-            predu = 0;
-
-          if (predu > 255)
-            predu = 255;
-
-          if (predv < 0)
-            predv = 0;
-
-          if (predv > 255)
-            predv = 255;
-
-          upred_ptr[j] = predu;
-          vpred_ptr[j] = predv;
-        }
-
-        upred_ptr += 8;
-        vpred_ptr += 8;
-      }
-
-    }
-    break;
-    case B_PRED:
-    case NEARESTMV:
-    case NEARMV:
-    case ZEROMV:
-    case NEWMV:
-    case SPLITMV:
-    case MB_MODE_COUNT:
-      break;
-  }
-}
-
-void vp8mt_build_intra_predictors_mbuv_s(VP9D_COMP *pbi, MACROBLOCKD *xd,
-                                         int mb_row, int mb_col) {
-  unsigned char *uabove_row;  /* = xd->dst.u_buffer - xd->dst.uv_stride; */
-  unsigned char *uleft_col;   /*[16];*/
-  unsigned char uleft_buf[8];
-  unsigned char utop_left;    /* = uabove_row[-1]; */
-  unsigned char *vabove_row;  /* = xd->dst.v_buffer - xd->dst.uv_stride; */
-  unsigned char *vleft_col;   /*[20];*/
-  unsigned char vleft_buf[8];
-  unsigned char vtop_left;    /* = vabove_row[-1]; */
-  unsigned char *upred_ptr = xd->dst.u_buffer; /*&xd->predictor[256];*/
-  unsigned char *vpred_ptr = xd->dst.v_buffer; /*&xd->predictor[320];*/
-  int uv_stride = xd->dst.uv_stride;
-  int i, j;
-
-  if (pbi->common.filter_level) {
-    uabove_row = pbi->mt_uabove_row[mb_row] + mb_col * 8 + 16;
-    vabove_row = pbi->mt_vabove_row[mb_row] + mb_col * 8 + 16;
-    uleft_col = pbi->mt_uleft_col[mb_row];
-    vleft_col = pbi->mt_vleft_col[mb_row];
-  } else {
-    uabove_row = xd->dst.u_buffer - xd->dst.uv_stride;
-    vabove_row = xd->dst.v_buffer - xd->dst.uv_stride;
-
-    for (i = 0; i < 8; i++) {
-      uleft_buf[i] = xd->dst.u_buffer [i * xd->dst.uv_stride - 1];
-      vleft_buf[i] = xd->dst.v_buffer [i * xd->dst.uv_stride - 1];
-    }
-    uleft_col = uleft_buf;
-    vleft_col = vleft_buf;
-  }
-  utop_left = uabove_row[-1];
-  vtop_left = vabove_row[-1];
-
-  switch (xd->mode_info_context->mbmi.uv_mode) {
-    case DC_PRED: {
-      int expected_udc;
-      int expected_vdc;
-      int i;
-      int shift;
-      int Uaverage = 0;
-      int Vaverage = 0;
-
-      if (xd->up_available) {
-        for (i = 0; i < 8; i++) {
-          Uaverage += uabove_row[i];
-          Vaverage += vabove_row[i];
-        }
-      }
-
-      if (xd->left_available) {
-        for (i = 0; i < 8; i++) {
-          Uaverage += uleft_col[i];
-          Vaverage += vleft_col[i];
-        }
-      }
-
-      if (!xd->up_available && !xd->left_available) {
-        expected_udc = 128;
-        expected_vdc = 128;
-      } else {
-        shift = 2 + xd->up_available + xd->left_available;
-        expected_udc = (Uaverage + (1 << (shift - 1))) >> shift;
-        expected_vdc = (Vaverage + (1 << (shift - 1))) >> shift;
-      }
-
-
-      /*vpx_memset(upred_ptr,expected_udc,64);
-      vpx_memset(vpred_ptr,expected_vdc,64);*/
-      for (i = 0; i < 8; i++) {
-        vpx_memset(upred_ptr, expected_udc, 8);
-        vpx_memset(vpred_ptr, expected_vdc, 8);
-        upred_ptr += uv_stride; /*8;*/
-        vpred_ptr += uv_stride; /*8;*/
-      }
-    }
-    break;
-    case V_PRED: {
-      int i;
-
-      for (i = 0; i < 8; i++) {
-        vpx_memcpy(upred_ptr, uabove_row, 8);
-        vpx_memcpy(vpred_ptr, vabove_row, 8);
-        upred_ptr += uv_stride; /*8;*/
-        vpred_ptr += uv_stride; /*8;*/
-      }
-
-    }
-    break;
-    case H_PRED: {
-      int i;
-
-      for (i = 0; i < 8; i++) {
-        vpx_memset(upred_ptr, uleft_col[i], 8);
-        vpx_memset(vpred_ptr, vleft_col[i], 8);
-        upred_ptr += uv_stride; /*8;*/
-        vpred_ptr += uv_stride; /*8;*/
-      }
-    }
-
-    break;
-    case TM_PRED: {
-      int i;
-
-      for (i = 0; i < 8; i++) {
-        for (j = 0; j < 8; j++) {
-          int predu = uleft_col[i] + uabove_row[j] - utop_left;
-          int predv = vleft_col[i] + vabove_row[j] - vtop_left;
-
-          if (predu < 0)
-            predu = 0;
-
-          if (predu > 255)
-            predu = 255;
-
-          if (predv < 0)
-            predv = 0;
-
-          if (predv > 255)
-            predv = 255;
-
-          upred_ptr[j] = predu;
-          vpred_ptr[j] = predv;
-        }
-
-        upred_ptr += uv_stride; /*8;*/
-        vpred_ptr += uv_stride; /*8;*/
-      }
-
-    }
-    break;
-    case B_PRED:
-    case NEARESTMV:
-    case NEARMV:
-    case ZEROMV:
-    case NEWMV:
-    case SPLITMV:
-    case MB_MODE_COUNT:
-      break;
-  }
-}
-
-
-void vp8mt_predict_intra4x4(VP9D_COMP *pbi,
-                            MACROBLOCKD *xd,
-                            int b_mode,
-                            unsigned char *predictor,
-                            int mb_row,
-                            int mb_col,
-                            int num) {
-  int i, r, c;
-
-  unsigned char *Above;   /* = *(xd->base_dst) + xd->dst - xd->dst_stride; */
-  unsigned char Left[4];
-  unsigned char top_left; /* = Above[-1]; */
-
-  BLOCKD *blockd = &xd->block[num];
-
-  /*Caution: For some b_mode, it needs 8 pixels (4 above + 4 above-right).*/
-  if (num < 4 && pbi->common.filter_level)
-    Above = pbi->mt_yabove_row[mb_row] + mb_col * 16 + num * 4 + 32;
-  else
-    Above = *(blockd->base_dst) + blockd->dst - blockd->dst_stride;
-
-  if (num % 4 == 0 && pbi->common.filter_level) {
-    for (i = 0; i < 4; i++)
-      Left[i] = pbi->mt_yleft_col[mb_row][num + i];
-  } else {
-    Left[0] = (*(blockd->base_dst))[blockd->dst - 1];
-    Left[1] = (*(blockd->base_dst))[blockd->dst - 1 + blockd->dst_stride];
-    Left[2] = (*(blockd->base_dst))[blockd->dst - 1 + 2 * blockd->dst_stride];
-    Left[3] = (*(blockd->base_dst))[blockd->dst - 1 + 3 * blockd->dst_stride];
-  }
-
-  if ((num == 4 || num == 8 || num == 12) && pbi->common.filter_level)
-    top_left = pbi->mt_yleft_col[mb_row][num - 1];
-  else
-    top_left = Above[-1];
-
-  switch (b_mode) {
-    case B_DC_PRED: {
-      int expected_dc = 0;
-
-      for (i = 0; i < 4; i++) {
-        expected_dc += Above[i];
-        expected_dc += Left[i];
-      }
-
-      expected_dc = (expected_dc + 4) >> 3;
-
-      for (r = 0; r < 4; r++) {
-        for (c = 0; c < 4; c++) {
-          predictor[c] = expected_dc;
-        }
-
-        predictor += 16;
-      }
-    }
-    break;
-    case B_TM_PRED: {
-      /* prediction similar to true_motion prediction */
-      for (r = 0; r < 4; r++) {
-        for (c = 0; c < 4; c++) {
-          int pred = Above[c] - top_left + Left[r];
-
-          if (pred < 0)
-            pred = 0;
-
-          if (pred > 255)
-            pred = 255;
-
-          predictor[c] = pred;
-        }
-
-        predictor += 16;
-      }
-    }
-    break;
-
-    case B_VE_PRED: {
-
-      unsigned int ap[4];
-      ap[0] = (top_left  + 2 * Above[0] + Above[1] + 2) >> 2;
-      ap[1] = (Above[0] + 2 * Above[1] + Above[2] + 2) >> 2;
-      ap[2] = (Above[1] + 2 * Above[2] + Above[3] + 2) >> 2;
-      ap[3] = (Above[2] + 2 * Above[3] + Above[4] + 2) >> 2;
-
-      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] = (top_left + 2 * Left[0] + Left[1] + 2) >> 2;
-      lp[1] = (Left[0] + 2 * Left[1] + Left[2] + 2) >> 2;
-      lp[2] = (Left[1] + 2 * Left[2] + Left[3] + 2) >> 2;
-      lp[3] = (Left[2] + 2 * Left[3] + Left[3] + 2) >> 2;
-
-      for (r = 0; r < 4; r++) {
-        for (c = 0; c < 4; c++) {
-          predictor[c] = lp[r];
-        }
-
-        predictor += 16;
-      }
-    }
-    break;
-    case B_LD_PRED: {
-      unsigned char *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;
-      predictor[0 * 16 + 2] =
-        predictor[1 * 16 + 1] =
-          predictor[2 * 16 + 0] = (ptr[2] + ptr[3] * 2 + ptr[4] + 2) >> 2;
-      predictor[0 * 16 + 3] =
-        predictor[1 * 16 + 2] =
-          predictor[2 * 16 + 1] =
-            predictor[3 * 16 + 0] = (ptr[3] + ptr[4] * 2 + ptr[5] + 2) >> 2;
-      predictor[1 * 16 + 3] =
-        predictor[2 * 16 + 2] =
-          predictor[3 * 16 + 1] = (ptr[4] + ptr[5] * 2 + ptr[6] + 2) >> 2;
-      predictor[2 * 16 + 3] =
-        predictor[3 * 16 + 2] = (ptr[5] + ptr[6] * 2 + ptr[7] + 2) >> 2;
-      predictor[3 * 16 + 3] = (ptr[6] + ptr[7] * 2 + ptr[7] + 2) >> 2;
-
-    }
-    break;
-    case B_RD_PRED: {
-
-      unsigned char pp[9];
-
-      pp[0] = Left[3];
-      pp[1] = Left[2];
-      pp[2] = Left[1];
-      pp[3] = Left[0];
-      pp[4] = top_left;
-      pp[5] = Above[0];
-      pp[6] = Above[1];
-      pp[7] = Above[2];
-      pp[8] = Above[3];
-
-      predictor[3 * 16 + 0] = (pp[0] + pp[1] * 2 + pp[2] + 2) >> 2;
-      predictor[3 * 16 + 1] =
-        predictor[2 * 16 + 0] = (pp[1] + pp[2] * 2 + pp[3] + 2) >> 2;
-      predictor[3 * 16 + 2] =
-        predictor[2 * 16 + 1] =
-          predictor[1 * 16 + 0] = (pp[2] + pp[3] * 2 + pp[4] + 2) >> 2;
-      predictor[3 * 16 + 3] =
-        predictor[2 * 16 + 2] =
-          predictor[1 * 16 + 1] =
-            predictor[0 * 16 + 0] = (pp[3] + pp[4] * 2 + pp[5] + 2) >> 2;
-      predictor[2 * 16 + 3] =
-        predictor[1 * 16 + 2] =
-          predictor[0 * 16 + 1] = (pp[4] + pp[5] * 2 + pp[6] + 2) >> 2;
-      predictor[1 * 16 + 3] =
-        predictor[0 * 16 + 2] = (pp[5] + pp[6] * 2 + pp[7] + 2) >> 2;
-      predictor[0 * 16 + 3] = (pp[6] + pp[7] * 2 + pp[8] + 2) >> 2;
-
-    }
-    break;
-    case B_VR_PRED: {
-
-      unsigned char pp[9];
-
-      pp[0] = Left[3];
-      pp[1] = Left[2];
-      pp[2] = Left[1];
-      pp[3] = Left[0];
-      pp[4] = top_left;
-      pp[5] = Above[0];
-      pp[6] = Above[1];
-      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] =
-        predictor[1 * 16 + 0] = (pp[3] + pp[4] * 2 + pp[5] + 2) >> 2;
-      predictor[2 * 16 + 1] =
-        predictor[0 * 16 + 0] = (pp[4] + pp[5] + 1) >> 1;
-      predictor[3 * 16 + 2] =
-        predictor[1 * 16 + 1] = (pp[4] + pp[5] * 2 + pp[6] + 2) >> 2;
-      predictor[2 * 16 + 2] =
-        predictor[0 * 16 + 1] = (pp[5] + pp[6] + 1) >> 1;
-      predictor[3 * 16 + 3] =
-        predictor[1 * 16 + 2] = (pp[5] + pp[6] * 2 + pp[7] + 2) >> 2;
-      predictor[2 * 16 + 3] =
-        predictor[0 * 16 + 2] = (pp[6] + pp[7] + 1) >> 1;
-      predictor[1 * 16 + 3] = (pp[6] + pp[7] * 2 + pp[8] + 2) >> 2;
-      predictor[0 * 16 + 3] = (pp[7] + pp[8] + 1) >> 1;
-
-    }
-    break;
-    case B_VL_PRED: {
-
-      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] =
-        predictor[0 * 16 + 1] = (pp[1] + pp[2] + 1) >> 1;
-      predictor[1 * 16 + 1] =
-        predictor[3 * 16 + 0] = (pp[1] + pp[2] * 2 + pp[3] + 2) >> 2;
-      predictor[2 * 16 + 1] =
-        predictor[0 * 16 + 2] = (pp[2] + pp[3] + 1) >> 1;
-      predictor[3 * 16 + 1] =
-        predictor[1 * 16 + 2] = (pp[2] + pp[3] * 2 + pp[4] + 2) >> 2;
-      predictor[0 * 16 + 3] =
-        predictor[2 * 16 + 2] = (pp[3] + pp[4] + 1) >> 1;
-      predictor[1 * 16 + 3] =
-        predictor[3 * 16 + 2] = (pp[3] + pp[4] * 2 + pp[5] + 2) >> 2;
-      predictor[2 * 16 + 3] = (pp[4] + pp[5] * 2 + pp[6] + 2) >> 2;
-      predictor[3 * 16 + 3] = (pp[5] + pp[6] * 2 + pp[7] + 2) >> 2;
-    }
-    break;
-
-    case B_HD_PRED: {
-      unsigned char pp[9];
-      pp[0] = Left[3];
-      pp[1] = Left[2];
-      pp[2] = Left[1];
-      pp[3] = Left[0];
-      pp[4] = top_left;
-      pp[5] = Above[0];
-      pp[6] = Above[1];
-      pp[7] = Above[2];
-      pp[8] = Above[3];
-
-
-      predictor[3 * 16 + 0] = (pp[0] + pp[1] + 1) >> 1;
-      predictor[3 * 16 + 1] = (pp[0] + pp[1] * 2 + pp[2] + 2) >> 2;
-      predictor[2 * 16 + 0] =
-        predictor[3 * 16 + 2] = (pp[1] + pp[2] + 1) >> 1;
-      predictor[2 * 16 + 1] =
-        predictor[3 * 16 + 3] = (pp[1] + pp[2] * 2 + pp[3] + 2) >> 2;
-      predictor[2 * 16 + 2] =
-        predictor[1 * 16 + 0] = (pp[2] + pp[3] + 1) >> 1;
-      predictor[2 * 16 + 3] =
-        predictor[1 * 16 + 1] = (pp[2] + pp[3] * 2 + pp[4] + 2) >> 2;
-      predictor[1 * 16 + 2] =
-        predictor[0 * 16 + 0] = (pp[3] + pp[4] + 1) >> 1;
-      predictor[1 * 16 + 3] =
-        predictor[0 * 16 + 1] = (pp[3] + pp[4] * 2 + pp[5] + 2) >> 2;
-      predictor[0 * 16 + 2] = (pp[4] + pp[5] * 2 + pp[6] + 2) >> 2;
-      predictor[0 * 16 + 3] = (pp[5] + pp[6] * 2 + pp[7] + 2) >> 2;
-    }
-    break;
-
-
-    case B_HU_PRED: {
-      unsigned char *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] =
-        predictor[1 * 16 + 0] = (pp[1] + pp[2] + 1) >> 1;
-      predictor[0 * 16 + 3] =
-        predictor[1 * 16 + 1] = (pp[1] + pp[2] * 2 + pp[3] + 2) >> 2;
-      predictor[1 * 16 + 2] =
-        predictor[2 * 16 + 0] = (pp[2] + pp[3] + 1) >> 1;
-      predictor[1 * 16 + 3] =
-        predictor[2 * 16 + 1] = (pp[2] + pp[3] * 2 + pp[3] + 2) >> 2;
-      predictor[2 * 16 + 2] =
-        predictor[2 * 16 + 3] =
-          predictor[3 * 16 + 0] =
-            predictor[3 * 16 + 1] =
-              predictor[3 * 16 + 2] =
-                predictor[3 * 16 + 3] = pp[3];
-    }
-    break;
-
-
-  }
-}
-
-/* copy 4 bytes from the above right down so that the 4x4 prediction modes using pixels above and
- * to the right prediction have filled in pixels to use.
- */
-void vp8mt_intra_prediction_down_copy(VP9D_COMP *pbi, MACROBLOCKD *xd,
-                                      int mb_row, int mb_col) {
-  unsigned char *above_right;   // = *(xd->block[0].base_dst) +
-                                //     xd->block[0].dst -
-                                //     xd->block[0].dst_stride + 16; */
-  unsigned int *src_ptr;
-  unsigned int *dst_ptr0;
-  unsigned int *dst_ptr1;
-  unsigned int *dst_ptr2;
-
-  if (pbi->common.filter_level)
-    above_right = pbi->mt_yabove_row[mb_row] + mb_col * 16 + 32 + 16;
-  else
-    above_right = *(xd->block[0].base_dst) + xd->block[0].dst -
-                  xd->block[0].dst_stride + 16;
-
-  src_ptr = (unsigned int *)above_right;
-  /*dst_ptr0 = (unsigned int *)(above_right + 4 * xd->block[0].dst_stride);
-  dst_ptr1 = (unsigned int *)(above_right + 8 * xd->block[0].dst_stride);
-  dst_ptr2 = (unsigned int *)(above_right + 12 * xd->block[0].dst_stride);*/
-  dst_ptr0 = (unsigned int *)(*(xd->block[0].base_dst) + xd->block[0].dst +
-                              16 + 3 * xd->block[0].dst_stride);
-  dst_ptr1 = (unsigned int *)(*(xd->block[0].base_dst) + xd->block[0].dst +
-                              16 + 7 * xd->block[0].dst_stride);
-  dst_ptr2 = (unsigned int *)(*(xd->block[0].base_dst) + xd->block[0].dst +
-                              16 + 11 * xd->block[0].dst_stride);
-  *dst_ptr0 = *src_ptr;
-  *dst_ptr1 = *src_ptr;
-  *dst_ptr2 = *src_ptr;
-}
diff --git a/vp8/decoder/treereader.h b/vp8/decoder/treereader.h
index 89f5299..ecd007a 100644
--- a/vp8/decoder/treereader.h
+++ b/vp8/decoder/treereader.h
@@ -16,23 +16,20 @@
 
 #include "dboolhuff.h"
 
-typedef BOOL_DECODER vp8_reader;
+typedef BOOL_DECODER vp9_reader;
 
-#define vp8_read vp8dx_decode_bool
-#define vp8_read_literal vp8_decode_value
-#define vp8_read_bit( R) vp8_read( R, vp8_prob_half)
-
+#define vp9_read decode_bool
+#define vp9_read_literal decode_value
+#define vp9_read_bit(R) vp9_read(R, vp9_prob_half)
 
 /* Intent of tree data structure is to make decoding trivial. */
 
-static int vp8_treed_read(
-  vp8_reader *const r,        /* !!! must return a 0 or 1 !!! */
-  vp8_tree t,
-  const vp8_prob *const p
-) {
-  register vp8_tree_index i = 0;
+static int treed_read(vp9_reader *const r, /* !!! must return a 0 or 1 !!! */
+                      vp9_tree t,
+                      const vp9_prob *const p) {
+  register vp9_tree_index i = 0;
 
-  while ((i = t[ i + vp8_read(r, p[i >> 1])]) > 0);
+  while ((i = t[ i + vp9_read(r, p[i >> 1])]) > 0);
 
   return -i;
 }
diff --git a/vp8/encoder/arm/arm_csystemdependent.c b/vp8/encoder/arm/arm_csystemdependent.c
index 1d73768..1a93bc3 100644
--- a/vp8/encoder/arm/arm_csystemdependent.c
+++ b/vp8/encoder/arm/arm_csystemdependent.c
@@ -18,7 +18,7 @@
 extern void vp9_yv12_copy_partial_frame(YV12_BUFFER_CONFIG *src_ybc, YV12_BUFFER_CONFIG *dst_ybc, int Fraction);
 extern void vpxyv12_copy_partial_frame_neon(YV12_BUFFER_CONFIG *src_ybc, YV12_BUFFER_CONFIG *dst_ybc, int Fraction);
 
-void vp8_arch_arm_encoder_init(VP9_COMP *cpi) {
+void vp9_arch_arm_encoder_init(VP9_COMP *cpi) {
 #if CONFIG_RUNTIME_CPU_DETECT
   int flags = cpi->common.rtcd.flags;
 
diff --git a/vp8/encoder/arm/armv5te/boolhuff_armv5te.asm b/vp8/encoder/arm/armv5te/boolhuff_armv5te.asm
index 138ed46..180637e 100644
--- a/vp8/encoder/arm/armv5te/boolhuff_armv5te.asm
+++ b/vp8/encoder/arm/armv5te/boolhuff_armv5te.asm
@@ -10,7 +10,7 @@
 
 
     EXPORT |vp8_start_encode|
-    EXPORT |vp8_encode_bool|
+    EXPORT |vp9_encode_bool|
     EXPORT |vp8_stop_encode|
     EXPORT |vp8_encode_value|
 
@@ -29,26 +29,26 @@
     mov     r12, #0
     mov     r3,  #255
     mvn     r2,  #23
-    str     r12, [r0, #vp8_writer_lowvalue]
-    str     r3,  [r0, #vp8_writer_range]
-    str     r12, [r0, #vp8_writer_value]
-    str     r2,  [r0, #vp8_writer_count]
-    str     r12, [r0, #vp8_writer_pos]
-    str     r1,  [r0, #vp8_writer_buffer]
+    str     r12, [r0, #vp9_writer_lowvalue]
+    str     r3,  [r0, #vp9_writer_range]
+    str     r12, [r0, #vp9_writer_value]
+    str     r2,  [r0, #vp9_writer_count]
+    str     r12, [r0, #vp9_writer_pos]
+    str     r1,  [r0, #vp9_writer_buffer]
     bx      lr
     ENDP
 
 ; r0 BOOL_CODER *br
 ; r1 int bit
 ; r2 int probability
-|vp8_encode_bool| PROC
+|vp9_encode_bool| PROC
     push    {r4-r9, lr}
 
     mov     r4, r2
 
-    ldr     r2, [r0, #vp8_writer_lowvalue]
-    ldr     r5, [r0, #vp8_writer_range]
-    ldr     r3, [r0, #vp8_writer_count]
+    ldr     r2, [r0, #vp9_writer_lowvalue]
+    ldr     r5, [r0, #vp9_writer_range]
+    ldr     r3, [r0, #vp9_writer_count]
 
     sub     r7, r5, #1                  ; range-1
 
@@ -76,7 +76,7 @@
     lsls    r4, r2, r4                  ; if((lowvalue<<(offset-1)) & 0x80000000 )
     bpl     token_high_bit_not_set
 
-    ldr     r4, [r0, #vp8_writer_pos]   ; x
+    ldr     r4, [r0, #vp9_writer_pos]   ; x
     sub     r4, r4, #1                  ; x = w->pos-1
     b       token_zero_while_start
 token_zero_while_loop
@@ -85,34 +85,34 @@
     sub     r4, r4, #1                  ; x--
 token_zero_while_start
     cmp     r4, #0
-    ldrge   r7, [r0, #vp8_writer_buffer]
+    ldrge   r7, [r0, #vp9_writer_buffer]
     ldrb    r1, [r7, r4]
     cmpge   r1, #0xff
     beq     token_zero_while_loop
 
-    ldr     r7, [r0, #vp8_writer_buffer]
+    ldr     r7, [r0, #vp9_writer_buffer]
     ldrb    r9, [r7, r4]                ; w->buffer[x]
     add     r9, r9, #1
     strb    r9, [r7, r4]                ; w->buffer[x] + 1
 token_high_bit_not_set
     rsb     r4, r6, #24                 ; 24-offset
-    ldr     r9, [r0, #vp8_writer_buffer]
+    ldr     r9, [r0, #vp9_writer_buffer]
     lsr     r7, r2, r4                  ; lowvalue >> (24-offset)
-    ldr     r4, [r0, #vp8_writer_pos]   ; w->pos
+    ldr     r4, [r0, #vp9_writer_pos]   ; w->pos
     lsl     r2, r2, r6                  ; lowvalue <<= offset
     mov     r6, r3                      ; shift = count
     add     r1, r4, #1                  ; w->pos++
     bic     r2, r2, #0xff000000         ; lowvalue &= 0xffffff
-    str     r1, [r0, #vp8_writer_pos]
+    str     r1, [r0, #vp9_writer_pos]
     sub     r3, r3, #8                  ; count -= 8
     strb    r7, [r9, r4]                ; w->buffer[w->pos++]
 
 token_count_lt_zero
     lsl     r2, r2, r6                  ; lowvalue <<= shift
 
-    str     r2, [r0, #vp8_writer_lowvalue]
-    str     r5, [r0, #vp8_writer_range]
-    str     r3, [r0, #vp8_writer_count]
+    str     r2, [r0, #vp9_writer_lowvalue]
+    str     r5, [r0, #vp9_writer_range]
+    str     r3, [r0, #vp9_writer_count]
     pop     {r4-r9, pc}
     ENDP
 
@@ -120,9 +120,9 @@
 |vp8_stop_encode| PROC
     push    {r4-r10, lr}
 
-    ldr     r2, [r0, #vp8_writer_lowvalue]
-    ldr     r5, [r0, #vp8_writer_range]
-    ldr     r3, [r0, #vp8_writer_count]
+    ldr     r2, [r0, #vp9_writer_lowvalue]
+    ldr     r5, [r0, #vp9_writer_range]
+    ldr     r3, [r0, #vp9_writer_count]
 
     mov     r10, #32
 
@@ -149,7 +149,7 @@
     lsls    r4, r2, r4                  ; if((lowvalue<<(offset-1)) & 0x80000000 )
     bpl     token_high_bit_not_set_se
 
-    ldr     r4, [r0, #vp8_writer_pos]   ; x
+    ldr     r4, [r0, #vp9_writer_pos]   ; x
     sub     r4, r4, #1                  ; x = w->pos-1
     b       token_zero_while_start_se
 token_zero_while_loop_se
@@ -158,25 +158,25 @@
     sub     r4, r4, #1                  ; x--
 token_zero_while_start_se
     cmp     r4, #0
-    ldrge   r7, [r0, #vp8_writer_buffer]
+    ldrge   r7, [r0, #vp9_writer_buffer]
     ldrb    r1, [r7, r4]
     cmpge   r1, #0xff
     beq     token_zero_while_loop_se
 
-    ldr     r7, [r0, #vp8_writer_buffer]
+    ldr     r7, [r0, #vp9_writer_buffer]
     ldrb    r9, [r7, r4]                ; w->buffer[x]
     add     r9, r9, #1
     strb    r9, [r7, r4]                ; w->buffer[x] + 1
 token_high_bit_not_set_se
     rsb     r4, r6, #24                 ; 24-offset
-    ldr     r9, [r0, #vp8_writer_buffer]
+    ldr     r9, [r0, #vp9_writer_buffer]
     lsr     r7, r2, r4                  ; lowvalue >> (24-offset)
-    ldr     r4, [r0, #vp8_writer_pos]   ; w->pos
+    ldr     r4, [r0, #vp9_writer_pos]   ; w->pos
     lsl     r2, r2, r6                  ; lowvalue <<= offset
     mov     r6, r3                      ; shift = count
     add     r1, r4, #1                  ; w->pos++
     bic     r2, r2, #0xff000000         ; lowvalue &= 0xffffff
-    str     r1, [r0, #vp8_writer_pos]
+    str     r1, [r0, #vp9_writer_pos]
     sub     r3, r3, #8                  ; count -= 8
     strb    r7, [r9, r4]                ; w->buffer[w->pos++]
 
@@ -186,9 +186,9 @@
     subs    r10, r10, #1
     bne     stop_encode_loop
 
-    str     r2, [r0, #vp8_writer_lowvalue]
-    str     r5, [r0, #vp8_writer_range]
-    str     r3, [r0, #vp8_writer_count]
+    str     r2, [r0, #vp9_writer_lowvalue]
+    str     r5, [r0, #vp9_writer_range]
+    str     r3, [r0, #vp9_writer_count]
     pop     {r4-r10, pc}
 
     ENDP
@@ -201,9 +201,9 @@
 
     mov     r10, r2
 
-    ldr     r2, [r0, #vp8_writer_lowvalue]
-    ldr     r5, [r0, #vp8_writer_range]
-    ldr     r3, [r0, #vp8_writer_count]
+    ldr     r2, [r0, #vp9_writer_lowvalue]
+    ldr     r5, [r0, #vp9_writer_range]
+    ldr     r3, [r0, #vp9_writer_count]
 
     rsb     r4, r10, #32                 ; 32-n
 
@@ -240,7 +240,7 @@
     lsls    r4, r2, r4                  ; if((lowvalue<<(offset-1)) & 0x80000000 )
     bpl     token_high_bit_not_set_ev
 
-    ldr     r4, [r0, #vp8_writer_pos]   ; x
+    ldr     r4, [r0, #vp9_writer_pos]   ; x
     sub     r4, r4, #1                  ; x = w->pos-1
     b       token_zero_while_start_ev
 token_zero_while_loop_ev
@@ -249,25 +249,25 @@
     sub     r4, r4, #1                  ; x--
 token_zero_while_start_ev
     cmp     r4, #0
-    ldrge   r7, [r0, #vp8_writer_buffer]
+    ldrge   r7, [r0, #vp9_writer_buffer]
     ldrb    r11, [r7, r4]
     cmpge   r11, #0xff
     beq     token_zero_while_loop_ev
 
-    ldr     r7, [r0, #vp8_writer_buffer]
+    ldr     r7, [r0, #vp9_writer_buffer]
     ldrb    r9, [r7, r4]                ; w->buffer[x]
     add     r9, r9, #1
     strb    r9, [r7, r4]                ; w->buffer[x] + 1
 token_high_bit_not_set_ev
     rsb     r4, r6, #24                 ; 24-offset
-    ldr     r9, [r0, #vp8_writer_buffer]
+    ldr     r9, [r0, #vp9_writer_buffer]
     lsr     r7, r2, r4                  ; lowvalue >> (24-offset)
-    ldr     r4, [r0, #vp8_writer_pos]   ; w->pos
+    ldr     r4, [r0, #vp9_writer_pos]   ; w->pos
     lsl     r2, r2, r6                  ; lowvalue <<= offset
     mov     r6, r3                      ; shift = count
     add     r11, r4, #1                 ; w->pos++
     bic     r2, r2, #0xff000000         ; lowvalue &= 0xffffff
-    str     r11, [r0, #vp8_writer_pos]
+    str     r11, [r0, #vp9_writer_pos]
     sub     r3, r3, #8                  ; count -= 8
     strb    r7, [r9, r4]                ; w->buffer[w->pos++]
 
@@ -277,9 +277,9 @@
     subs    r10, r10, #1
     bne     encode_value_loop
 
-    str     r2, [r0, #vp8_writer_lowvalue]
-    str     r5, [r0, #vp8_writer_range]
-    str     r3, [r0, #vp8_writer_count]
+    str     r2, [r0, #vp9_writer_lowvalue]
+    str     r5, [r0, #vp9_writer_range]
+    str     r3, [r0, #vp9_writer_count]
     pop     {r4-r11, pc}
     ENDP
 
diff --git a/vp8/encoder/arm/armv5te/vp8_packtokens_armv5.asm b/vp8/encoder/arm/armv5te/vp8_packtokens_armv5.asm
index 933717c..bf29977 100644
--- a/vp8/encoder/arm/armv5te/vp8_packtokens_armv5.asm
+++ b/vp8/encoder/arm/armv5te/vp8_packtokens_armv5.asm
@@ -19,7 +19,7 @@
 
     AREA    |.text|, CODE, READONLY
 
-; r0 vp8_writer *w
+; r0 vp9_writer *w
 ; r1 const TOKENEXTRA *p
 ; r2 int xcount
 ; r3 vp8_coef_encodings
@@ -34,9 +34,9 @@
     add     r2, r1, r2, lsl #3          ; stop = p + xcount*sizeof(TOKENEXTRA)
     str     r2, [sp, #0]
     str     r3, [sp, #8]                ; save vp8_coef_encodings
-    ldr     r2, [r0, #vp8_writer_lowvalue]
-    ldr     r5, [r0, #vp8_writer_range]
-    ldr     r3, [r0, #vp8_writer_count]
+    ldr     r2, [r0, #vp9_writer_lowvalue]
+    ldr     r5, [r0, #vp9_writer_range]
+    ldr     r3, [r0, #vp9_writer_count]
     b       check_p_lt_stop
 
 while_p_lt_stop
@@ -48,8 +48,8 @@
 
     ldrb    r7, [r1, #tokenextra_skip_eob_node]
 
-    ldr     r6, [r4, #vp8_token_value]  ; v
-    ldr     r8, [r4, #vp8_token_len]    ; n
+    ldr     r6, [r4, #vp9_token_value]  ; v
+    ldr     r8, [r4, #vp9_token_len]    ; n
 
     ; vp8 specific skip_eob_node
     cmp     r7, #0
@@ -99,7 +99,7 @@
     lsls    r4, r2, r4                  ; if((lowvalue<<(offset-1)) & 0x80000000 )
     bpl     token_high_bit_not_set
 
-    ldr     r4, [r0, #vp8_writer_pos]   ; x
+    ldr     r4, [r0, #vp9_writer_pos]   ; x
     sub     r4, r4, #1                  ; x = w->pos-1
     b       token_zero_while_start
 token_zero_while_loop
@@ -108,25 +108,25 @@
     sub     r4, r4, #1                  ; x--
 token_zero_while_start
     cmp     r4, #0
-    ldrge   r7, [r0, #vp8_writer_buffer]
+    ldrge   r7, [r0, #vp9_writer_buffer]
     ldrb    r11, [r7, r4]
     cmpge   r11, #0xff
     beq     token_zero_while_loop
 
-    ldr     r7, [r0, #vp8_writer_buffer]
+    ldr     r7, [r0, #vp9_writer_buffer]
     ldrb    r10, [r7, r4]               ; w->buffer[x]
     add     r10, r10, #1
     strb    r10, [r7, r4]               ; w->buffer[x] + 1
 token_high_bit_not_set
     rsb     r4, r6, #24                 ; 24-offset
-    ldr     r10, [r0, #vp8_writer_buffer]
+    ldr     r10, [r0, #vp9_writer_buffer]
     lsr     r7, r2, r4                  ; lowvalue >> (24-offset)
-    ldr     r4, [r0, #vp8_writer_pos]   ; w->pos
+    ldr     r4, [r0, #vp9_writer_pos]   ; w->pos
     lsl     r2, r2, r6                  ; lowvalue <<= offset
     mov     r6, r3                      ; shift = count
     add     r11, r4, #1                 ; w->pos++
     bic     r2, r2, #0xff000000         ; lowvalue &= 0xffffff
-    str     r11, [r0, #vp8_writer_pos]
+    str     r11, [r0, #vp9_writer_pos]
     sub     r3, r3, #8                  ; count -= 8
     strb    r7, [r10, r4]               ; w->buffer[w->pos++]
 
@@ -143,24 +143,24 @@
 
     ldrb    r6, [r1, #tokenextra_token] ; t
     ldr     r7, [sp, #48]               ; vp8_extra_bits
-    ; Add t * sizeof (vp8_extra_bit_struct) to get the desired
-    ;  element.  Here vp8_extra_bit_struct == 16
+    ; Add t * sizeof (vp9_extra_bit_struct) to get the desired
+    ;  element.  Here vp9_extra_bit_struct == 16
     add     r12, r7, r6, lsl #4         ; b = vp8_extra_bits + t
 
-    ldr     r4, [r12, #vp8_extra_bit_struct_base_val]
+    ldr     r4, [r12, #vp9_extra_bit_struct_base_val]
     cmp     r4, #0
     beq     skip_extra_bits
 
 ;   if( b->base_val)
-    ldr     r8, [r12, #vp8_extra_bit_struct_len] ; L
+    ldr     r8, [r12, #vp9_extra_bit_struct_len] ; L
     ldrsh   lr, [r1, #tokenextra_extra] ; e = p->Extra
     cmp     r8, #0                      ; if( L)
     beq     no_extra_bits
 
-    ldr     r9, [r12, #vp8_extra_bit_struct_prob]
+    ldr     r9, [r12, #vp9_extra_bit_struct_prob]
     asr     r7, lr, #1                  ; v=e>>1
 
-    ldr     r10, [r12, #vp8_extra_bit_struct_tree]
+    ldr     r10, [r12, #vp9_extra_bit_struct_tree]
     str     r10, [sp, #4]               ; b->tree
 
     rsb     r4, r8, #32
@@ -194,7 +194,7 @@
     lsls    r4, r2, r4                  ; if((lowvalue<<(offset-1)) & 0x80000000 )
     bpl     extra_high_bit_not_set
 
-    ldr     r4, [r0, #vp8_writer_pos]   ; x
+    ldr     r4, [r0, #vp9_writer_pos]   ; x
     sub     r4, r4, #1                  ; x = w->pos - 1
     b       extra_zero_while_start
 extra_zero_while_loop
@@ -203,25 +203,25 @@
     sub     r4, r4, #1                  ; x--
 extra_zero_while_start
     cmp     r4, #0
-    ldrge   r7, [r0, #vp8_writer_buffer]
+    ldrge   r7, [r0, #vp9_writer_buffer]
     ldrb    r11, [r7, r4]
     cmpge   r11, #0xff
     beq     extra_zero_while_loop
 
-    ldr     r7, [r0, #vp8_writer_buffer]
+    ldr     r7, [r0, #vp9_writer_buffer]
     ldrb    r10, [r7, r4]
     add     r10, r10, #1
     strb    r10, [r7, r4]
 extra_high_bit_not_set
     rsb     r4, r6, #24                 ; 24-offset
-    ldr     r10, [r0, #vp8_writer_buffer]
+    ldr     r10, [r0, #vp9_writer_buffer]
     lsr     r7, r2, r4                  ; lowvalue >> (24-offset)
-    ldr     r4, [r0, #vp8_writer_pos]
+    ldr     r4, [r0, #vp9_writer_pos]
     lsl     r2, r2, r6                  ; lowvalue <<= offset
     mov     r6, r3                      ; shift = count
     add     r11, r4, #1                 ; w->pos++
     bic     r2, r2, #0xff000000         ; lowvalue &= 0xffffff
-    str     r11, [r0, #vp8_writer_pos]
+    str     r11, [r0, #vp9_writer_pos]
     sub     r3, r3, #8                  ; count -= 8
     strb    r7, [r10, r4]               ; w->buffer[w->pos++]=(lowvalue >> (24-offset))
     ldr     r10, [sp, #4]               ; b->tree
@@ -242,7 +242,7 @@
     lsl     r5, r4, #1                  ; range <<= 1
     beq     end_high_bit_not_set
 
-    ldr     r4, [r0, #vp8_writer_pos]
+    ldr     r4, [r0, #vp9_writer_pos]
     mov     r7, #0
     sub     r4, r4, #1
     b       end_zero_while_start
@@ -251,12 +251,12 @@
     sub     r4, r4, #1                  ; x--
 end_zero_while_start
     cmp     r4, #0
-    ldrge   r6, [r0, #vp8_writer_buffer]
+    ldrge   r6, [r0, #vp9_writer_buffer]
     ldrb    r12, [r6, r4]
     cmpge   r12, #0xff
     beq     end_zero_while_loop
 
-    ldr     r6, [r0, #vp8_writer_buffer]
+    ldr     r6, [r0, #vp9_writer_buffer]
     ldrb    r7, [r6, r4]
     add     r7, r7, #1
     strb    r7, [r6, r4]
@@ -265,9 +265,9 @@
     lsl     r2, r2, #1                  ; lowvalue  <<= 1
     bne     end_count_zero
 
-    ldr     r4, [r0, #vp8_writer_pos]
+    ldr     r4, [r0, #vp9_writer_pos]
     mvn     r3, #7
-    ldr     r7, [r0, #vp8_writer_buffer]
+    ldr     r7, [r0, #vp9_writer_buffer]
     lsr     r6, r2, #24                 ; lowvalue >> 24
     add     r12, r4, #1                 ; w->pos++
     bic     r2, r2, #0xff000000         ; lowvalue &= 0xffffff
@@ -281,9 +281,9 @@
     cmp     r1, r4                      ; while( p < stop)
     bcc     while_p_lt_stop
 
-    str     r2, [r0, #vp8_writer_lowvalue]
-    str     r5, [r0, #vp8_writer_range]
-    str     r3, [r0, #vp8_writer_count]
+    str     r2, [r0, #vp9_writer_lowvalue]
+    str     r5, [r0, #vp9_writer_range]
+    str     r3, [r0, #vp9_writer_count]
     add     sp, sp, #12
     pop     {r4-r11, pc}
     ENDP
diff --git a/vp8/encoder/arm/armv5te/vp8_packtokens_mbrow_armv5.asm b/vp8/encoder/arm/armv5te/vp8_packtokens_mbrow_armv5.asm
index 82bf71f..a1c647d 100644
--- a/vp8/encoder/arm/armv5te/vp8_packtokens_mbrow_armv5.asm
+++ b/vp8/encoder/arm/armv5te/vp8_packtokens_mbrow_armv5.asm
@@ -20,7 +20,7 @@
     AREA    |.text|, CODE, READONLY
 
 ; r0 VP8_COMP *cpi
-; r1 vp8_writer *w
+; r1 vp9_writer *w
 ; r2 vp8_coef_encodings
 ; r3 vp8_extra_bits
 ; s0 vp8_coef_tree
@@ -46,9 +46,9 @@
 
     mov     r0, r1                      ; keep same as other loops
 
-    ldr     r2, [r0, #vp8_writer_lowvalue]
-    ldr     r5, [r0, #vp8_writer_range]
-    ldr     r3, [r0, #vp8_writer_count]
+    ldr     r2, [r0, #vp9_writer_lowvalue]
+    ldr     r5, [r0, #vp9_writer_range]
+    ldr     r3, [r0, #vp9_writer_count]
 
 mb_row_loop
 
@@ -70,8 +70,8 @@
 
     ldrb    r7, [r1, #tokenextra_skip_eob_node]
 
-    ldr     r6, [r4, #vp8_token_value]  ; v
-    ldr     r8, [r4, #vp8_token_len]    ; n
+    ldr     r6, [r4, #vp9_token_value]  ; v
+    ldr     r8, [r4, #vp9_token_len]    ; n
 
     ; vp8 specific skip_eob_node
     cmp     r7, #0
@@ -121,7 +121,7 @@
     lsls    r4, r2, r4                  ; if((lowvalue<<(offset-1)) & 0x80000000 )
     bpl     token_high_bit_not_set
 
-    ldr     r4, [r0, #vp8_writer_pos]   ; x
+    ldr     r4, [r0, #vp9_writer_pos]   ; x
     sub     r4, r4, #1                  ; x = w->pos-1
     b       token_zero_while_start
 token_zero_while_loop
@@ -130,25 +130,25 @@
     sub     r4, r4, #1                  ; x--
 token_zero_while_start
     cmp     r4, #0
-    ldrge   r7, [r0, #vp8_writer_buffer]
+    ldrge   r7, [r0, #vp9_writer_buffer]
     ldrb    r11, [r7, r4]
     cmpge   r11, #0xff
     beq     token_zero_while_loop
 
-    ldr     r7, [r0, #vp8_writer_buffer]
+    ldr     r7, [r0, #vp9_writer_buffer]
     ldrb    r10, [r7, r4]               ; w->buffer[x]
     add     r10, r10, #1
     strb    r10, [r7, r4]               ; w->buffer[x] + 1
 token_high_bit_not_set
     rsb     r4, r6, #24                 ; 24-offset
-    ldr     r10, [r0, #vp8_writer_buffer]
+    ldr     r10, [r0, #vp9_writer_buffer]
     lsr     r7, r2, r4                  ; lowvalue >> (24-offset)
-    ldr     r4, [r0, #vp8_writer_pos]   ; w->pos
+    ldr     r4, [r0, #vp9_writer_pos]   ; w->pos
     lsl     r2, r2, r6                  ; lowvalue <<= offset
     mov     r6, r3                      ; shift = count
     add     r11, r4, #1                 ; w->pos++
     bic     r2, r2, #0xff000000         ; lowvalue &= 0xffffff
-    str     r11, [r0, #vp8_writer_pos]
+    str     r11, [r0, #vp9_writer_pos]
     sub     r3, r3, #8                  ; count -= 8
     strb    r7, [r10, r4]               ; w->buffer[w->pos++]
 
@@ -165,24 +165,24 @@
 
     ldrb    r6, [r1, #tokenextra_token] ; t
     ldr     r7, [sp, #8]                ; vp8_extra_bits
-    ; Add t * sizeof (vp8_extra_bit_struct) to get the desired
-    ;  element.  Here vp8_extra_bit_struct == 16
+    ; Add t * sizeof (vp9_extra_bit_struct) to get the desired
+    ;  element.  Here vp9_extra_bit_struct == 16
     add     r12, r7, r6, lsl #4         ; b = vp8_extra_bits + t
 
-    ldr     r4, [r12, #vp8_extra_bit_struct_base_val]
+    ldr     r4, [r12, #vp9_extra_bit_struct_base_val]
     cmp     r4, #0
     beq     skip_extra_bits
 
 ;   if( b->base_val)
-    ldr     r8, [r12, #vp8_extra_bit_struct_len] ; L
+    ldr     r8, [r12, #vp9_extra_bit_struct_len] ; L
     ldrsh   lr, [r1, #tokenextra_extra] ; e = p->Extra
     cmp     r8, #0                      ; if( L)
     beq     no_extra_bits
 
-    ldr     r9, [r12, #vp8_extra_bit_struct_prob]
+    ldr     r9, [r12, #vp9_extra_bit_struct_prob]
     asr     r7, lr, #1                  ; v=e>>1
 
-    ldr     r10, [r12, #vp8_extra_bit_struct_tree]
+    ldr     r10, [r12, #vp9_extra_bit_struct_tree]
     str     r10, [sp, #4]               ; b->tree
 
     rsb     r4, r8, #32
@@ -216,7 +216,7 @@
     lsls    r4, r2, r4                  ; if((lowvalue<<(offset-1)) & 0x80000000 )
     bpl     extra_high_bit_not_set
 
-    ldr     r4, [r0, #vp8_writer_pos]   ; x
+    ldr     r4, [r0, #vp9_writer_pos]   ; x
     sub     r4, r4, #1                  ; x = w->pos - 1
     b       extra_zero_while_start
 extra_zero_while_loop
@@ -225,25 +225,25 @@
     sub     r4, r4, #1                  ; x--
 extra_zero_while_start
     cmp     r4, #0
-    ldrge   r7, [r0, #vp8_writer_buffer]
+    ldrge   r7, [r0, #vp9_writer_buffer]
     ldrb    r11, [r7, r4]
     cmpge   r11, #0xff
     beq     extra_zero_while_loop
 
-    ldr     r7, [r0, #vp8_writer_buffer]
+    ldr     r7, [r0, #vp9_writer_buffer]
     ldrb    r10, [r7, r4]
     add     r10, r10, #1
     strb    r10, [r7, r4]
 extra_high_bit_not_set
     rsb     r4, r6, #24                 ; 24-offset
-    ldr     r10, [r0, #vp8_writer_buffer]
+    ldr     r10, [r0, #vp9_writer_buffer]
     lsr     r7, r2, r4                  ; lowvalue >> (24-offset)
-    ldr     r4, [r0, #vp8_writer_pos]
+    ldr     r4, [r0, #vp9_writer_pos]
     lsl     r2, r2, r6                  ; lowvalue <<= offset
     mov     r6, r3                      ; shift = count
     add     r11, r4, #1                 ; w->pos++
     bic     r2, r2, #0xff000000         ; lowvalue &= 0xffffff
-    str     r11, [r0, #vp8_writer_pos]
+    str     r11, [r0, #vp9_writer_pos]
     sub     r3, r3, #8                  ; count -= 8
     strb    r7, [r10, r4]               ; w->buffer[w->pos++]=(lowvalue >> (24-offset))
     ldr     r10, [sp, #4]               ; b->tree
@@ -264,7 +264,7 @@
     lsl     r5, r4, #1                  ; range <<= 1
     beq     end_high_bit_not_set
 
-    ldr     r4, [r0, #vp8_writer_pos]
+    ldr     r4, [r0, #vp9_writer_pos]
     mov     r7, #0
     sub     r4, r4, #1
     b       end_zero_while_start
@@ -273,12 +273,12 @@
     sub     r4, r4, #1                  ; x--
 end_zero_while_start
     cmp     r4, #0
-    ldrge   r6, [r0, #vp8_writer_buffer]
+    ldrge   r6, [r0, #vp9_writer_buffer]
     ldrb    r12, [r6, r4]
     cmpge   r12, #0xff
     beq     end_zero_while_loop
 
-    ldr     r6, [r0, #vp8_writer_buffer]
+    ldr     r6, [r0, #vp9_writer_buffer]
     ldrb    r7, [r6, r4]
     add     r7, r7, #1
     strb    r7, [r6, r4]
@@ -287,9 +287,9 @@
     lsl     r2, r2, #1                  ; lowvalue  <<= 1
     bne     end_count_zero
 
-    ldr     r4, [r0, #vp8_writer_pos]
+    ldr     r4, [r0, #vp9_writer_pos]
     mvn     r3, #7
-    ldr     r7, [r0, #vp8_writer_buffer]
+    ldr     r7, [r0, #vp9_writer_buffer]
     lsr     r6, r2, #24                 ; lowvalue >> 24
     add     r12, r4, #1                 ; w->pos++
     bic     r2, r2, #0xff000000         ; lowvalue &= 0xffffff
@@ -310,9 +310,9 @@
     str     r6, [sp, #12]
     bne     mb_row_loop
 
-    str     r2, [r0, #vp8_writer_lowvalue]
-    str     r5, [r0, #vp8_writer_range]
-    str     r3, [r0, #vp8_writer_count]
+    str     r2, [r0, #vp9_writer_lowvalue]
+    str     r5, [r0, #vp9_writer_range]
+    str     r3, [r0, #vp9_writer_count]
     add     sp, sp, #24
     pop     {r4-r11, pc}
     ENDP
diff --git a/vp8/encoder/arm/armv5te/vp8_packtokens_partitions_armv5.asm b/vp8/encoder/arm/armv5te/vp8_packtokens_partitions_armv5.asm
index c00375e..86c2feb 100644
--- a/vp8/encoder/arm/armv5te/vp8_packtokens_partitions_armv5.asm
+++ b/vp8/encoder/arm/armv5te/vp8_packtokens_partitions_armv5.asm
@@ -25,7 +25,7 @@
 ; r3 *size
 ; s0 vp8_coef_encodings
 ; s1 vp8_extra_bits,
-; s2 const vp8_tree_index *,
+; s2 const vp9_tree_index *,
 
 |vp8cx_pack_tokens_into_partitions_armv5| PROC
     push    {r4-r11, lr}
@@ -56,7 +56,7 @@
     ldr     r7, [r4, #0]                ; dereference cpi->tp_list
     str     r7, [sp, #32]               ; store start of cpi->tp_list
 
-    ldr     r11, _VP8_COMP_bc2_         ; load up vp8_writer out of cpi
+    ldr     r11, _VP8_COMP_bc2_         ; load up vp9_writer out of cpi
     add     r0, r0, r11
 
     mov     r11, #0
@@ -72,13 +72,13 @@
     ; Reset all of the VP8 Writer data for each partition that
     ; is processed.
     ; start_encode
-    mov     r2, #0                      ; vp8_writer_lowvalue
-    mov     r5, #255                    ; vp8_writer_range
-    mvn     r3, #23                     ; vp8_writer_count
+    mov     r2, #0                      ; vp9_writer_lowvalue
+    mov     r5, #255                    ; vp9_writer_range
+    mvn     r3, #23                     ; vp9_writer_count
 
-    str     r2,  [r0, #vp8_writer_value]
-    str     r2,  [r0, #vp8_writer_pos]
-    str     r10, [r0, #vp8_writer_buffer]
+    str     r2,  [r0, #vp9_writer_value]
+    str     r2,  [r0, #vp9_writer_pos]
+    str     r10, [r0, #vp9_writer_buffer]
 
 mb_row_loop
 
@@ -100,8 +100,8 @@
 
     ldrb    r7, [r1, #tokenextra_skip_eob_node]
 
-    ldr     r6, [r4, #vp8_token_value]  ; v
-    ldr     r8, [r4, #vp8_token_len]    ; n
+    ldr     r6, [r4, #vp9_token_value]  ; v
+    ldr     r8, [r4, #vp9_token_len]    ; n
 
     ; vp8 specific skip_eob_node
     cmp     r7, #0
@@ -151,7 +151,7 @@
     lsls    r4, r2, r4                  ; if((lowvalue<<(offset-1)) & 0x80000000 )
     bpl     token_high_bit_not_set
 
-    ldr     r4, [r0, #vp8_writer_pos]   ; x
+    ldr     r4, [r0, #vp9_writer_pos]   ; x
     sub     r4, r4, #1                  ; x = w->pos-1
     b       token_zero_while_start
 token_zero_while_loop
@@ -160,25 +160,25 @@
     sub     r4, r4, #1                  ; x--
 token_zero_while_start
     cmp     r4, #0
-    ldrge   r7, [r0, #vp8_writer_buffer]
+    ldrge   r7, [r0, #vp9_writer_buffer]
     ldrb    r11, [r7, r4]
     cmpge   r11, #0xff
     beq     token_zero_while_loop
 
-    ldr     r7, [r0, #vp8_writer_buffer]
+    ldr     r7, [r0, #vp9_writer_buffer]
     ldrb    r10, [r7, r4]               ; w->buffer[x]
     add     r10, r10, #1
     strb    r10, [r7, r4]               ; w->buffer[x] + 1
 token_high_bit_not_set
     rsb     r4, r6, #24                 ; 24-offset
-    ldr     r10, [r0, #vp8_writer_buffer]
+    ldr     r10, [r0, #vp9_writer_buffer]
     lsr     r7, r2, r4                  ; lowvalue >> (24-offset)
-    ldr     r4, [r0, #vp8_writer_pos]   ; w->pos
+    ldr     r4, [r0, #vp9_writer_pos]   ; w->pos
     lsl     r2, r2, r6                  ; lowvalue <<= offset
     mov     r6, r3                      ; shift = count
     add     r11, r4, #1                 ; w->pos++
     bic     r2, r2, #0xff000000         ; lowvalue &= 0xffffff
-    str     r11, [r0, #vp8_writer_pos]
+    str     r11, [r0, #vp9_writer_pos]
     sub     r3, r3, #8                  ; count -= 8
     strb    r7, [r10, r4]               ; w->buffer[w->pos++]
 
@@ -195,24 +195,24 @@
 
     ldrb    r6, [r1, #tokenextra_token] ; t
     ldr     r7, [sp, #84]                ; vp8_extra_bits
-    ; Add t * sizeof (vp8_extra_bit_struct) to get the desired
-    ;  element.  Here vp8_extra_bit_struct == 16
+    ; Add t * sizeof (vp9_extra_bit_struct) to get the desired
+    ;  element.  Here vp9_extra_bit_struct == 16
     add     r12, r7, r6, lsl #4         ; b = vp8_extra_bits + t
 
-    ldr     r4, [r12, #vp8_extra_bit_struct_base_val]
+    ldr     r4, [r12, #vp9_extra_bit_struct_base_val]
     cmp     r4, #0
     beq     skip_extra_bits
 
 ;   if( b->base_val)
-    ldr     r8, [r12, #vp8_extra_bit_struct_len] ; L
+    ldr     r8, [r12, #vp9_extra_bit_struct_len] ; L
     ldrsh   lr, [r1, #tokenextra_extra] ; e = p->Extra
     cmp     r8, #0                      ; if( L)
     beq     no_extra_bits
 
-    ldr     r9, [r12, #vp8_extra_bit_struct_prob]
+    ldr     r9, [r12, #vp9_extra_bit_struct_prob]
     asr     r7, lr, #1                  ; v=e>>1
 
-    ldr     r10, [r12, #vp8_extra_bit_struct_tree]
+    ldr     r10, [r12, #vp9_extra_bit_struct_tree]
     str     r10, [sp, #4]               ; b->tree
 
     rsb     r4, r8, #32
@@ -246,7 +246,7 @@
     lsls    r4, r2, r4                  ; if((lowvalue<<(offset-1)) & 0x80000000 )
     bpl     extra_high_bit_not_set
 
-    ldr     r4, [r0, #vp8_writer_pos]   ; x
+    ldr     r4, [r0, #vp9_writer_pos]   ; x
     sub     r4, r4, #1                  ; x = w->pos - 1
     b       extra_zero_while_start
 extra_zero_while_loop
@@ -255,25 +255,25 @@
     sub     r4, r4, #1                  ; x--
 extra_zero_while_start
     cmp     r4, #0
-    ldrge   r7, [r0, #vp8_writer_buffer]
+    ldrge   r7, [r0, #vp9_writer_buffer]
     ldrb    r11, [r7, r4]
     cmpge   r11, #0xff
     beq     extra_zero_while_loop
 
-    ldr     r7, [r0, #vp8_writer_buffer]
+    ldr     r7, [r0, #vp9_writer_buffer]
     ldrb    r10, [r7, r4]
     add     r10, r10, #1
     strb    r10, [r7, r4]
 extra_high_bit_not_set
     rsb     r4, r6, #24                 ; 24-offset
-    ldr     r10, [r0, #vp8_writer_buffer]
+    ldr     r10, [r0, #vp9_writer_buffer]
     lsr     r7, r2, r4                  ; lowvalue >> (24-offset)
-    ldr     r4, [r0, #vp8_writer_pos]
+    ldr     r4, [r0, #vp9_writer_pos]
     lsl     r2, r2, r6                  ; lowvalue <<= offset
     mov     r6, r3                      ; shift = count
     add     r11, r4, #1                 ; w->pos++
     bic     r2, r2, #0xff000000         ; lowvalue &= 0xffffff
-    str     r11, [r0, #vp8_writer_pos]
+    str     r11, [r0, #vp9_writer_pos]
     sub     r3, r3, #8                  ; count -= 8
     strb    r7, [r10, r4]               ; w->buffer[w->pos++]=(lowvalue >> (24-offset))
     ldr     r10, [sp, #4]               ; b->tree
@@ -294,7 +294,7 @@
     lsl     r5, r4, #1                  ; range <<= 1
     beq     end_high_bit_not_set
 
-    ldr     r4, [r0, #vp8_writer_pos]
+    ldr     r4, [r0, #vp9_writer_pos]
     mov     r7, #0
     sub     r4, r4, #1
     b       end_zero_while_start
@@ -303,12 +303,12 @@
     sub     r4, r4, #1                  ; x--
 end_zero_while_start
     cmp     r4, #0
-    ldrge   r6, [r0, #vp8_writer_buffer]
+    ldrge   r6, [r0, #vp9_writer_buffer]
     ldrb    r12, [r6, r4]
     cmpge   r12, #0xff
     beq     end_zero_while_loop
 
-    ldr     r6, [r0, #vp8_writer_buffer]
+    ldr     r6, [r0, #vp9_writer_buffer]
     ldrb    r7, [r6, r4]
     add     r7, r7, #1
     strb    r7, [r6, r4]
@@ -317,9 +317,9 @@
     lsl     r2, r2, #1                  ; lowvalue  <<= 1
     bne     end_count_zero
 
-    ldr     r4, [r0, #vp8_writer_pos]
+    ldr     r4, [r0, #vp9_writer_pos]
     mvn     r3, #7
-    ldr     r7, [r0, #vp8_writer_buffer]
+    ldr     r7, [r0, #vp9_writer_buffer]
     lsr     r6, r2, #24                 ; lowvalue >> 24
     add     r12, r4, #1                 ; w->pos++
     bic     r2, r2, #0xff000000         ; lowvalue &= 0xffffff
@@ -369,7 +369,7 @@
     lsls    r4, r2, r4                  ; if((lowvalue<<(offset-1)) & 0x80000000 )
     bpl     token_high_bit_not_set_se
 
-    ldr     r4, [r0, #vp8_writer_pos]   ; x
+    ldr     r4, [r0, #vp9_writer_pos]   ; x
     sub     r4, r4, #1                  ; x = w->pos-1
     b       token_zero_while_start_se
 token_zero_while_loop_se
@@ -378,25 +378,25 @@
     sub     r4, r4, #1                  ; x--
 token_zero_while_start_se
     cmp     r4, #0
-    ldrge   r7, [r0, #vp8_writer_buffer]
+    ldrge   r7, [r0, #vp9_writer_buffer]
     ldrb    r11, [r7, r4]
     cmpge   r11, #0xff
     beq     token_zero_while_loop_se
 
-    ldr     r7, [r0, #vp8_writer_buffer]
+    ldr     r7, [r0, #vp9_writer_buffer]
     ldrb    r10, [r7, r4]               ; w->buffer[x]
     add     r10, r10, #1
     strb    r10, [r7, r4]               ; w->buffer[x] + 1
 token_high_bit_not_set_se
     rsb     r4, r6, #24                 ; 24-offset
-    ldr     r10, [r0, #vp8_writer_buffer]
+    ldr     r10, [r0, #vp9_writer_buffer]
     lsr     r7, r2, r4                  ; lowvalue >> (24-offset)
-    ldr     r4, [r0, #vp8_writer_pos]   ; w->pos
+    ldr     r4, [r0, #vp9_writer_pos]   ; w->pos
     lsl     r2, r2, r6                  ; lowvalue <<= offset
     mov     r6, r3                      ; shift = count
     add     r11, r4, #1                 ; w->pos++
     bic     r2, r2, #0xff000000         ; lowvalue &= 0xffffff
-    str     r11, [r0, #vp8_writer_pos]
+    str     r11, [r0, #vp9_writer_pos]
     sub     r3, r3, #8                  ; count -= 8
     strb    r7, [r10, r4]               ; w->buffer[w->pos++]
 
@@ -408,7 +408,7 @@
 
     ldr     r10, [sp, #8]               ; *size
     ldr     r11, [r10]
-    ldr     r4,  [r0, #vp8_writer_pos]  ; w->pos
+    ldr     r4,  [r0, #vp9_writer_pos]  ; w->pos
     add     r11, r11, r4                ; *size += w->pos
     str     r11, [r10]
 
diff --git a/vp8/encoder/arm/armv6/vp8_mse16x16_armv6.asm b/vp8/encoder/arm/armv6/vp8_mse16x16_armv6.asm
index 000805d..8e72836 100644
--- a/vp8/encoder/arm/armv6/vp8_mse16x16_armv6.asm
+++ b/vp8/encoder/arm/armv6/vp8_mse16x16_armv6.asm
@@ -21,7 +21,7 @@
 ; r3    int  recon_stride
 ; stack unsigned int *sse
 ;
-;note: Based on vp8_variance16x16_armv6. In this function, sum is never used.
+;note: Based on vp9_variance16x16_armv6. In this function, sum is never used.
 ;      So, we can remove this part of calculation.
 
 |vp8_mse16x16_armv6| PROC
diff --git a/vp8/encoder/arm/armv6/vp8_variance16x16_armv6.asm b/vp8/encoder/arm/armv6/vp8_variance16x16_armv6.asm
index 5feaa8b..110db30 100644
--- a/vp8/encoder/arm/armv6/vp8_variance16x16_armv6.asm
+++ b/vp8/encoder/arm/armv6/vp8_variance16x16_armv6.asm
@@ -9,7 +9,7 @@
 ;
 
 
-    EXPORT  |vp8_variance16x16_armv6|
+    EXPORT  |vp9_variance16x16_armv6|
 
     ARM
     REQUIRE8
@@ -22,7 +22,7 @@
 ; r2    unsigned char *ref_ptr
 ; r3    int  recon_stride
 ; stack unsigned int *sse
-|vp8_variance16x16_armv6| PROC
+|vp9_variance16x16_armv6| PROC
 
     stmfd   sp!, {r4-r12, lr}
 
diff --git a/vp8/encoder/arm/armv6/vp8_variance8x8_armv6.asm b/vp8/encoder/arm/armv6/vp8_variance8x8_armv6.asm
index adc353d..101f683 100644
--- a/vp8/encoder/arm/armv6/vp8_variance8x8_armv6.asm
+++ b/vp8/encoder/arm/armv6/vp8_variance8x8_armv6.asm
@@ -9,7 +9,7 @@
 ;
 
 
-    EXPORT  |vp8_variance8x8_armv6|
+    EXPORT  |vp9_variance8x8_armv6|
 
     ARM
 
@@ -20,7 +20,7 @@
 ; r2    unsigned char *ref_ptr
 ; r3    int  recon_stride
 ; stack unsigned int *sse
-|vp8_variance8x8_armv6| PROC
+|vp9_variance8x8_armv6| PROC
 
     push    {r4-r10, lr}
 
diff --git a/vp8/encoder/arm/armv6/vp8_variance_halfpixvar16x16_h_armv6.asm b/vp8/encoder/arm/armv6/vp8_variance_halfpixvar16x16_h_armv6.asm
index 1b54897..7a8cafd 100644
--- a/vp8/encoder/arm/armv6/vp8_variance_halfpixvar16x16_h_armv6.asm
+++ b/vp8/encoder/arm/armv6/vp8_variance_halfpixvar16x16_h_armv6.asm
@@ -9,7 +9,7 @@
 ;
 
 
-    EXPORT  |vp8_variance_halfpixvar16x16_h_armv6|
+    EXPORT  |vp9_variance_halfpixvar16x16_h_armv6|
 
     ARM
     REQUIRE8
@@ -22,7 +22,7 @@
 ; r2    unsigned char *ref_ptr
 ; r3    int  recon_stride
 ; stack unsigned int *sse
-|vp8_variance_halfpixvar16x16_h_armv6| PROC
+|vp9_variance_halfpixvar16x16_h_armv6| PROC
 
     stmfd   sp!, {r4-r12, lr}
 
diff --git a/vp8/encoder/arm/armv6/vp8_variance_halfpixvar16x16_hv_armv6.asm b/vp8/encoder/arm/armv6/vp8_variance_halfpixvar16x16_hv_armv6.asm
index 38c55ed..6ad5e90 100644
--- a/vp8/encoder/arm/armv6/vp8_variance_halfpixvar16x16_hv_armv6.asm
+++ b/vp8/encoder/arm/armv6/vp8_variance_halfpixvar16x16_hv_armv6.asm
@@ -9,7 +9,7 @@
 ;
 
 
-    EXPORT  |vp8_variance_halfpixvar16x16_hv_armv6|
+    EXPORT  |vp9_variance_halfpixvar16x16_hv_armv6|
 
     ARM
     REQUIRE8
@@ -22,7 +22,7 @@
 ; r2    unsigned char *ref_ptr
 ; r3    int  recon_stride
 ; stack unsigned int *sse
-|vp8_variance_halfpixvar16x16_hv_armv6| PROC
+|vp9_variance_halfpixvar16x16_hv_armv6| PROC
 
     stmfd   sp!, {r4-r12, lr}
 
diff --git a/vp8/encoder/arm/armv6/vp8_variance_halfpixvar16x16_v_armv6.asm b/vp8/encoder/arm/armv6/vp8_variance_halfpixvar16x16_v_armv6.asm
index 22a50eb..0471d3d 100644
--- a/vp8/encoder/arm/armv6/vp8_variance_halfpixvar16x16_v_armv6.asm
+++ b/vp8/encoder/arm/armv6/vp8_variance_halfpixvar16x16_v_armv6.asm
@@ -9,7 +9,7 @@
 ;
 
 
-    EXPORT  |vp8_variance_halfpixvar16x16_v_armv6|
+    EXPORT  |vp9_variance_halfpixvar16x16_v_armv6|
 
     ARM
     REQUIRE8
@@ -22,7 +22,7 @@
 ; r2    unsigned char *ref_ptr
 ; r3    int  recon_stride
 ; stack unsigned int *sse
-|vp8_variance_halfpixvar16x16_v_armv6| PROC
+|vp9_variance_halfpixvar16x16_v_armv6| PROC
 
     stmfd   sp!, {r4-r12, lr}
 
diff --git a/vp8/encoder/arm/boolhuff_arm.c b/vp8/encoder/arm/boolhuff_arm.c
index 0704207..bc6fb47 100644
--- a/vp8/encoder/arm/boolhuff_arm.c
+++ b/vp8/encoder/arm/boolhuff_arm.c
@@ -12,7 +12,7 @@
 #include "vp8/encoder/boolhuff.h"
 #include "vp8/common/blockd.h"
 
-const unsigned int vp8_prob_cost[256] = {
+const unsigned int vp9_prob_cost[256] = {
   2047, 2047, 1791, 1641, 1535, 1452, 1385, 1328, 1279, 1235, 1196, 1161, 1129, 1099, 1072, 1046,
   1023, 1000,  979,  959,  940,  922,  905,  889,  873,  858,  843,  829,  816,  803,  790,  778,
   767,  755,  744,  733,  723,  713,  703,  693,  684,  675,  666,  657,  649,  641,  633,  625,
diff --git a/vp8/encoder/arm/neon/variance_neon.asm b/vp8/encoder/arm/neon/variance_neon.asm
index e1a4686..901934c 100644
--- a/vp8/encoder/arm/neon/variance_neon.asm
+++ b/vp8/encoder/arm/neon/variance_neon.asm
@@ -9,10 +9,10 @@
 ;
 
 
-    EXPORT  |vp8_variance16x16_neon|
-    EXPORT  |vp8_variance16x8_neon|
-    EXPORT  |vp8_variance8x16_neon|
-    EXPORT  |vp8_variance8x8_neon|
+    EXPORT  |vp9_variance16x16_neon|
+    EXPORT  |vp9_variance16x8_neon|
+    EXPORT  |vp9_variance8x16_neon|
+    EXPORT  |vp9_variance8x8_neon|
 
     ARM
     REQUIRE8
@@ -25,7 +25,7 @@
 ; r2    unsigned char *ref_ptr
 ; r3    int  recon_stride
 ; stack unsigned int *sse
-|vp8_variance16x16_neon| PROC
+|vp9_variance16x16_neon| PROC
     vmov.i8         q8, #0                      ;q8 - sum
     vmov.i8         q9, #0                      ;q9, q10 - sse
     vmov.i8         q10, #0
@@ -92,13 +92,13 @@
     ENDP
 
 ;================================
-;unsigned int vp8_variance16x8_c(
+;unsigned int vp9_variance16x8_c(
 ;    unsigned char *src_ptr,
 ;    int  source_stride,
 ;    unsigned char *ref_ptr,
 ;    int  recon_stride,
 ;   unsigned int *sse)
-|vp8_variance16x8_neon| PROC
+|vp9_variance16x8_neon| PROC
     vmov.i8         q8, #0                      ;q8 - sum
     vmov.i8         q9, #0                      ;q9, q10 - sse
     vmov.i8         q10, #0
@@ -154,14 +154,14 @@
     ENDP
 
 ;=================================
-;unsigned int vp8_variance8x16_c(
+;unsigned int vp9_variance8x16_c(
 ;    unsigned char *src_ptr,
 ;    int  source_stride,
 ;    unsigned char *ref_ptr,
 ;    int  recon_stride,
 ;   unsigned int *sse)
 
-|vp8_variance8x16_neon| PROC
+|vp9_variance8x16_neon| PROC
     vmov.i8         q8, #0                      ;q8 - sum
     vmov.i8         q9, #0                      ;q9, q10 - sse
     vmov.i8         q10, #0
@@ -214,7 +214,7 @@
 ; r2    unsigned char *ref_ptr
 ; r3    int  recon_stride
 ; stack unsigned int *sse
-|vp8_variance8x8_neon| PROC
+|vp9_variance8x8_neon| PROC
     vmov.i8         q8, #0                      ;q8 - sum
     vmov.i8         q9, #0                      ;q9, q10 - sse
     vmov.i8         q10, #0
diff --git a/vp8/encoder/arm/neon/vp8_mse16x16_neon.asm b/vp8/encoder/arm/neon/vp8_mse16x16_neon.asm
index 55edbf5..4d1512d 100644
--- a/vp8/encoder/arm/neon/vp8_mse16x16_neon.asm
+++ b/vp8/encoder/arm/neon/vp8_mse16x16_neon.asm
@@ -24,7 +24,7 @@
 ; r3    int  recon_stride
 ; stack unsigned int *sse
 ;note: in this function, sum is never used. So, we can remove this part of calculation
-;from vp8_variance().
+;from vp9_variance().
 
 |vp8_mse16x16_neon| PROC
     vmov.i8         q7, #0                      ;q7, q8, q9, q10 - sse
diff --git a/vp8/encoder/arm/neon/vp8_subpixelvariance16x16_neon.asm b/vp8/encoder/arm/neon/vp8_subpixelvariance16x16_neon.asm
index 5107d8b..8bb0734 100644
--- a/vp8/encoder/arm/neon/vp8_subpixelvariance16x16_neon.asm
+++ b/vp8/encoder/arm/neon/vp8_subpixelvariance16x16_neon.asm
@@ -9,7 +9,7 @@
 ;
 
 
-    EXPORT  |vp8_sub_pixel_variance16x16_neon_func|
+    EXPORT  |vp9_sub_pixel_variance16x16_neon_func|
     ARM
     REQUIRE8
     PRESERVE8
@@ -22,9 +22,9 @@
 ; stack(r4) unsigned char *dst_ptr,
 ; stack(r5) int dst_pixels_per_line,
 ; stack(r6) unsigned int *sse
-;note: most of the code is copied from bilinear_predict16x16_neon and vp8_variance16x16_neon.
+;note: most of the code is copied from bilinear_predict16x16_neon and vp9_variance16x16_neon.
 
-|vp8_sub_pixel_variance16x16_neon_func| PROC
+|vp9_sub_pixel_variance16x16_neon_func| PROC
     push            {r4-r6, lr}
 
     ldr             r12, _BilinearTaps_coeff_
diff --git a/vp8/encoder/arm/neon/vp8_subpixelvariance16x16s_neon.asm b/vp8/encoder/arm/neon/vp8_subpixelvariance16x16s_neon.asm
index 0a2b71c..a3faf9a 100644
--- a/vp8/encoder/arm/neon/vp8_subpixelvariance16x16s_neon.asm
+++ b/vp8/encoder/arm/neon/vp8_subpixelvariance16x16s_neon.asm
@@ -9,10 +9,10 @@
 ;
 
 
-    EXPORT  |vp8_variance_halfpixvar16x16_h_neon|
-    EXPORT  |vp8_variance_halfpixvar16x16_v_neon|
-    EXPORT  |vp8_variance_halfpixvar16x16_hv_neon|
-    EXPORT  |vp8_sub_pixel_variance16x16s_neon|
+    EXPORT  |vp9_variance_halfpixvar16x16_h_neon|
+    EXPORT  |vp9_variance_halfpixvar16x16_v_neon|
+    EXPORT  |vp9_variance_halfpixvar16x16_hv_neon|
+    EXPORT  |vp9_sub_pixel_variance16x16s_neon|
     ARM
     REQUIRE8
     PRESERVE8
@@ -20,7 +20,7 @@
     AREA ||.text||, CODE, READONLY, ALIGN=2
 
 ;================================================
-;unsigned int vp8_variance_halfpixvar16x16_h_neon
+;unsigned int vp9_variance_halfpixvar16x16_h_neon
 ;(
 ;    unsigned char  *src_ptr, r0
 ;    int  src_pixels_per_line,  r1
@@ -29,7 +29,7 @@
 ;    unsigned int *sse
 ;);
 ;================================================
-|vp8_variance_halfpixvar16x16_h_neon| PROC
+|vp9_variance_halfpixvar16x16_h_neon| PROC
     push            {lr}
 
     mov             r12, #4                  ;loop counter
@@ -120,7 +120,7 @@
     ENDP
 
 ;================================================
-;unsigned int vp8_variance_halfpixvar16x16_v_neon
+;unsigned int vp9_variance_halfpixvar16x16_v_neon
 ;(
 ;    unsigned char  *src_ptr, r0
 ;    int  src_pixels_per_line,  r1
@@ -129,7 +129,7 @@
 ;    unsigned int *sse
 ;);
 ;================================================
-|vp8_variance_halfpixvar16x16_v_neon| PROC
+|vp9_variance_halfpixvar16x16_v_neon| PROC
     push            {lr}
 
     mov             r12, #4                     ;loop counter
@@ -216,7 +216,7 @@
     ENDP
 
 ;================================================
-;unsigned int vp8_variance_halfpixvar16x16_hv_neon
+;unsigned int vp9_variance_halfpixvar16x16_hv_neon
 ;(
 ;    unsigned char  *src_ptr, r0
 ;    int  src_pixels_per_line,  r1
@@ -225,7 +225,7 @@
 ;    unsigned int *sse
 ;);
 ;================================================
-|vp8_variance_halfpixvar16x16_hv_neon| PROC
+|vp9_variance_halfpixvar16x16_hv_neon| PROC
     push            {lr}
 
     vld1.u8         {d0, d1, d2, d3}, [r0], r1      ;load src data
@@ -347,7 +347,7 @@
 ;or filter coeff is {64, 64}. This simplified program only works in this situation.
 ;note: It happens that both xoffset and yoffset are zero. This can be handled in c code later.
 
-|vp8_sub_pixel_variance16x16s_neon| PROC
+|vp9_sub_pixel_variance16x16s_neon| PROC
     push            {r4, lr}
 
     ldr             r4, [sp, #8]            ;load *dst_ptr from stack
diff --git a/vp8/encoder/arm/neon/vp8_subpixelvariance8x8_neon.asm b/vp8/encoder/arm/neon/vp8_subpixelvariance8x8_neon.asm
index 38b5878..29975f1 100644
--- a/vp8/encoder/arm/neon/vp8_subpixelvariance8x8_neon.asm
+++ b/vp8/encoder/arm/neon/vp8_subpixelvariance8x8_neon.asm
@@ -9,7 +9,7 @@
 ;
 
 
-    EXPORT  |vp8_sub_pixel_variance8x8_neon|
+    EXPORT  |vp9_sub_pixel_variance8x8_neon|
     ARM
     REQUIRE8
     PRESERVE8
@@ -22,9 +22,9 @@
 ; stack(r4) unsigned char *dst_ptr,
 ; stack(r5) int dst_pixels_per_line,
 ; stack(r6) unsigned int *sse
-;note: most of the code is copied from bilinear_predict8x8_neon and vp8_variance8x8_neon.
+;note: most of the code is copied from bilinear_predict8x8_neon and vp9_variance8x8_neon.
 
-|vp8_sub_pixel_variance8x8_neon| PROC
+|vp9_sub_pixel_variance8x8_neon| PROC
     push            {r4-r5, lr}
 
     ldr             r12, _BilinearTaps_coeff_
@@ -154,7 +154,7 @@
     b               secondpass_filter
 
 ;----------------------
-;vp8_variance8x8_neon
+;vp9_variance8x8_neon
 sub_pixel_variance8x8_neon
     vmov.i8         q8, #0                      ;q8 - sum
     vmov.i8         q9, #0                      ;q9, q10 - sse
diff --git a/vp8/encoder/arm/variance_arm.c b/vp8/encoder/arm/variance_arm.c
index 80696e4..097c73e 100644
--- a/vp8/encoder/arm/variance_arm.c
+++ b/vp8/encoder/arm/variance_arm.c
@@ -34,10 +34,10 @@
   HFilter = vp8_bilinear_filters[xoffset];
   VFilter = vp8_bilinear_filters[yoffset];
 
-  vp8_filter_block2d_bil_first_pass_armv6(src_ptr, first_pass,
+  vp9_filter_block2d_bil_first_pass_armv6(src_ptr, first_pass,
                                           src_pixels_per_line,
                                           9, 8, HFilter);
-  vp8_filter_block2d_bil_second_pass_armv6(first_pass, second_pass,
+  vp9_filter_block2d_bil_second_pass_armv6(first_pass, second_pass,
                                            8, 8, 8, VFilter);
 
   return vp9_variance8x8_armv6(second_pass, 8, dst_ptr,
@@ -72,10 +72,10 @@
     HFilter = vp8_bilinear_filters[xoffset];
     VFilter = vp8_bilinear_filters[yoffset];
 
-    vp8_filter_block2d_bil_first_pass_armv6(src_ptr, first_pass,
+    vp9_filter_block2d_bil_first_pass_armv6(src_ptr, first_pass,
                                             src_pixels_per_line,
                                             17, 16, HFilter);
-    vp8_filter_block2d_bil_second_pass_armv6(first_pass, second_pass,
+    vp9_filter_block2d_bil_second_pass_armv6(first_pass, second_pass,
                                              16, 16, 16, VFilter);
 
     var = vp9_variance16x16_armv6(second_pass, 16, dst_ptr,
diff --git a/vp8/encoder/arm/variance_arm.h b/vp8/encoder/arm/variance_arm.h
index 8ca4026..c2c208a 100644
--- a/vp8/encoder/arm/variance_arm.h
+++ b/vp8/encoder/arm/variance_arm.h
@@ -26,23 +26,23 @@
 
 #if !CONFIG_RUNTIME_CPU_DETECT
 
-#undef  vp8_variance_sad16x16
-#define vp8_variance_sad16x16 vp9_sad16x16_armv6
+#undef  vp9_variance_sad16x16
+#define vp9_variance_sad16x16 vp9_sad16x16_armv6
 
-#undef  vp8_variance_subpixvar16x16
-#define vp8_variance_subpixvar16x16 vp9_sub_pixel_variance16x16_armv6
+#undef  vp9_variance_subpixvar16x16
+#define vp9_variance_subpixvar16x16 vp9_sub_pixel_variance16x16_armv6
 
-#undef  vp8_variance_subpixvar8x8
-#define vp8_variance_subpixvar8x8 vp9_sub_pixel_variance8x8_armv6
+#undef  vp9_variance_subpixvar8x8
+#define vp9_variance_subpixvar8x8 vp9_sub_pixel_variance8x8_armv6
 
-#undef  vp8_variance_var16x16
-#define vp8_variance_var16x16 vp9_variance16x16_armv6
+#undef  vp9_variance_var16x16
+#define vp9_variance_var16x16 vp9_variance16x16_armv6
 
-#undef  vp8_variance_mse16x16
-#define vp8_variance_mse16x16 vp9_mse16x16_armv6
+#undef  vp9_variance_mse16x16
+#define vp9_variance_mse16x16 vp9_mse16x16_armv6
 
-#undef  vp8_variance_var8x8
-#define vp8_variance_var8x8 vp9_variance8x8_armv6
+#undef  vp9_variance_var8x8
+#define vp9_variance_var8x8 vp9_variance8x8_armv6
 
 #undef  vp9_variance_halfpixvar16x16_h
 #define vp9_variance_halfpixvar16x16_h vp9_variance_halfpixvar16x16_h_armv6
@@ -65,70 +65,53 @@
 extern prototype_sad(vp9_sad16x8_neon);
 extern prototype_sad(vp9_sad16x16_neon);
 
-// extern prototype_variance(vp9_variance4x4_c);
 extern prototype_variance(vp9_variance8x8_neon);
 extern prototype_variance(vp9_variance8x16_neon);
 extern prototype_variance(vp9_variance16x8_neon);
 extern prototype_variance(vp9_variance16x16_neon);
 
-// extern prototype_subpixvariance(vp9_sub_pixel_variance4x4_c);
 extern prototype_subpixvariance(vp9_sub_pixel_variance8x8_neon);
-// extern prototype_subpixvariance(vp9_sub_pixel_variance8x16_c);
-// extern prototype_subpixvariance(vp9_sub_pixel_variance16x8_c);
 extern prototype_subpixvariance(vp9_sub_pixel_variance16x16_neon);
 extern prototype_subpixvariance(vp9_sub_pixel_variance16x16_neon_func);
 extern prototype_variance(vp9_variance_halfpixvar16x16_h_neon);
 extern prototype_variance(vp9_variance_halfpixvar16x16_v_neon);
 extern prototype_variance(vp9_variance_halfpixvar16x16_hv_neon);
 
-// extern prototype_getmbss(vp9_get_mb_ss_c);
 extern prototype_variance(vp9_mse16x16_neon);
 
 #if !CONFIG_RUNTIME_CPU_DETECT
-#undef  vp8_variance_sad4x4
-#define vp8_variance_sad4x4 vp9_sad4x4_neon
+#undef  vp9_variance_sad4x4
+#define vp9_variance_sad4x4 vp9_sad4x4_neon
 
-#undef  vp8_variance_sad8x8
-#define vp8_variance_sad8x8 vp9_sad8x8_neon
+#undef  vp9_variance_sad8x8
+#define vp9_variance_sad8x8 vp9_sad8x8_neon
 
-#undef  vp8_variance_sad8x16
-#define vp8_variance_sad8x16 vp9_sad8x16_neon
+#undef  vp9_variance_sad8x16
+#define vp9_variance_sad8x16 vp9_sad8x16_neon
 
-#undef  vp8_variance_sad16x8
-#define vp8_variance_sad16x8 vp9_sad16x8_neon
+#undef  vp9_variance_sad16x8
+#define vp9_variance_sad16x8 vp9_sad16x8_neon
 
-#undef  vp8_variance_sad16x16
-#define vp8_variance_sad16x16 vp9_sad16x16_neon
+#undef  vp9_variance_sad16x16
+#define vp9_variance_sad16x16 vp9_sad16x16_neon
 
-// #undef  vp8_variance_var4x4
-// #define vp8_variance_var4x4 vp9_variance4x4_c
+#undef  vp9_variance_var8x8
+#define vp9_variance_var8x8 vp9_variance8x8_neon
 
-#undef  vp8_variance_var8x8
-#define vp8_variance_var8x8 vp9_variance8x8_neon
+#undef  vp9_variance_var8x16
+#define vp9_variance_var8x16 vp9_variance8x16_neon
 
-#undef  vp8_variance_var8x16
-#define vp8_variance_var8x16 vp9_variance8x16_neon
+#undef  vp9_variance_var16x8
+#define vp9_variance_var16x8 vp9_variance16x8_neon
 
-#undef  vp8_variance_var16x8
-#define vp8_variance_var16x8 vp9_variance16x8_neon
+#undef  vp9_variance_var16x16
+#define vp9_variance_var16x16 vp9_variance16x16_neon
 
-#undef  vp8_variance_var16x16
-#define vp8_variance_var16x16 vp9_variance16x16_neon
+#undef  vp9_variance_subpixvar8x8
+#define vp9_variance_subpixvar8x8 vp9_sub_pixel_variance8x8_neon
 
-// #undef  vp8_variance_subpixvar4x4
-// #define vp8_variance_subpixvar4x4 vp9_sub_pixel_variance4x4_c
-
-#undef  vp8_variance_subpixvar8x8
-#define vp8_variance_subpixvar8x8 vp9_sub_pixel_variance8x8_neon
-
-// #undef  vp8_variance_subpixvar8x16
-// #define vp8_variance_subpixvar8x16 vp9_sub_pixel_variance8x16_c
-
-// #undef  vp8_variance_subpixvar16x8
-// #define vp8_variance_subpixvar16x8 vp9_sub_pixel_variance16x8_c
-
-#undef  vp8_variance_subpixvar16x16
-#define vp8_variance_subpixvar16x16 vp9_sub_pixel_variance16x16_neon
+#undef  vp9_variance_subpixvar16x16
+#define vp9_variance_subpixvar16x16 vp9_sub_pixel_variance16x16_neon
 
 #undef  vp9_variance_halfpixvar16x16_h
 #define vp9_variance_halfpixvar16x16_h vp9_variance_halfpixvar16x16_h_neon
@@ -139,11 +122,8 @@
 #undef  vp9_variance_halfpixvar16x16_hv
 #define vp9_variance_halfpixvar16x16_hv vp9_variance_halfpixvar16x16_hv_neon
 
-// #undef  vp8_variance_getmbss
-// #define vp8_variance_getmbss vp9_get_mb_ss_c
-
-#undef  vp8_variance_mse16x16
-#define vp8_variance_mse16x16 vp9_mse16x16_neon
+#undef  vp9_variance_mse16x16
+#define vp9_variance_mse16x16 vp9_mse16x16_neon
 
 #endif
 
diff --git a/vp8/encoder/asm_enc_offsets.c b/vp8/encoder/asm_enc_offsets.c
index 7543371..345240f 100644
--- a/vp8/encoder/asm_enc_offsets.c
+++ b/vp8/encoder/asm_enc_offsets.c
@@ -43,12 +43,12 @@
 DEFINE(vp9_blockd_predictor,                    offsetof(BLOCKD, predictor));
 
 /* pack tokens */
-DEFINE(vp9_writer_lowvalue,                     offsetof(vp8_writer, lowvalue));
-DEFINE(vp9_writer_range,                        offsetof(vp8_writer, range));
-DEFINE(vp9_writer_value,                        offsetof(vp8_writer, value));
-DEFINE(vp9_writer_count,                        offsetof(vp8_writer, count));
-DEFINE(vp9_writer_pos,                          offsetof(vp8_writer, pos));
-DEFINE(vp9_writer_buffer,                       offsetof(vp8_writer, buffer));
+DEFINE(vp9_writer_lowvalue,                     offsetof(vp9_writer, lowvalue));
+DEFINE(vp9_writer_range,                        offsetof(vp9_writer, range));
+DEFINE(vp9_writer_value,                        offsetof(vp9_writer, value));
+DEFINE(vp9_writer_count,                        offsetof(vp9_writer, count));
+DEFINE(vp9_writer_pos,                          offsetof(vp9_writer, pos));
+DEFINE(vp9_writer_buffer,                       offsetof(vp9_writer, buffer));
 
 DEFINE(tokenextra_token,                        offsetof(TOKENEXTRA, Token));
 DEFINE(tokenextra_extra,                        offsetof(TOKENEXTRA, Extra));
@@ -56,15 +56,15 @@
 DEFINE(tokenextra_skip_eob_node,                offsetof(TOKENEXTRA, skip_eob_node));
 DEFINE(TOKENEXTRA_SZ,                           sizeof(TOKENEXTRA));
 
-DEFINE(vp9_extra_bit_struct_sz,                 sizeof(vp8_extra_bit_struct));
+DEFINE(vp9_extra_bit_struct_sz,                 sizeof(vp9_extra_bit_struct));
 
-DEFINE(vp9_token_value,                         offsetof(vp8_token, value));
-DEFINE(vp9_token_len,                           offsetof(vp8_token, Len));
+DEFINE(vp9_token_value,                         offsetof(vp9_token, value));
+DEFINE(vp9_token_len,                           offsetof(vp9_token, Len));
 
-DEFINE(vp9_extra_bit_struct_tree,               offsetof(vp8_extra_bit_struct, tree));
-DEFINE(vp9_extra_bit_struct_prob,               offsetof(vp8_extra_bit_struct, prob));
-DEFINE(vp9_extra_bit_struct_len,                offsetof(vp8_extra_bit_struct, Len));
-DEFINE(vp9_extra_bit_struct_base_val,           offsetof(vp8_extra_bit_struct, base_val));
+DEFINE(vp9_extra_bit_struct_tree,               offsetof(vp9_extra_bit_struct, tree));
+DEFINE(vp9_extra_bit_struct_prob,               offsetof(vp9_extra_bit_struct, prob));
+DEFINE(vp9_extra_bit_struct_len,                offsetof(vp9_extra_bit_struct, Len));
+DEFINE(vp9_extra_bit_struct_base_val,           offsetof(vp9_extra_bit_struct, base_val));
 
 DEFINE(vp9_comp_tplist,                         offsetof(VP9_COMP, tplist));
 DEFINE(vp9_comp_common,                         offsetof(VP9_COMP, common));
@@ -86,5 +86,5 @@
 
 #if HAVE_ARMV5TE
 ct_assert(TOKENEXTRA_SZ, sizeof(TOKENEXTRA) == 8)
-ct_assert(vp9_extra_bit_struct_sz, sizeof(vp8_extra_bit_struct) == 16)
+ct_assert(vp9_extra_bit_struct_sz, sizeof(vp9_extra_bit_struct) == 16)
 #endif
diff --git a/vp8/encoder/bitstream.c b/vp8/encoder/bitstream.c
index 598fc85..3bfd515 100644
--- a/vp8/encoder/bitstream.c
+++ b/vp8/encoder/bitstream.c
@@ -38,10 +38,8 @@
 unsigned __int64 Sectionbits[500];
 #endif
 
-//int final_packing = 0;
-
 #ifdef ENTROPY_STATS
-int intra_mode_stats [VP8_BINTRAMODES] [VP8_BINTRAMODES] [VP8_BINTRAMODES];
+int intra_mode_stats [VP9_BINTRAMODES] [VP9_BINTRAMODES] [VP9_BINTRAMODES];
 unsigned int tree_update_hist [BLOCK_TYPES]
                               [COEF_BANDS]
                               [PREV_COEF_CONTEXTS]
@@ -74,8 +72,8 @@
 int count_mb_seg[4] = { 0, 0, 0, 0 };
 #endif
 
-#define vp8_cost_upd  ((int)(vp8_cost_one(upd) - vp8_cost_zero(upd)) >> 8)
-#define vp8_cost_upd256  ((int)(vp8_cost_one(upd) - vp8_cost_zero(upd)))
+#define vp9_cost_upd  ((int)(vp9_cost_one(upd) - vp9_cost_zero(upd)) >> 8)
+#define vp9_cost_upd256  ((int)(vp9_cost_one(upd) - vp9_cost_zero(upd)))
 
 #define SEARCH_NEWP
 static int update_bits[255];
@@ -106,24 +104,24 @@
   return i;
 }
 
-static void write_prob_diff_update(vp8_writer *const bc,
-                                   vp8_prob newp, vp8_prob oldp) {
+static void write_prob_diff_update(vp9_writer *const bc,
+                                   vp9_prob newp, vp9_prob oldp) {
   int delp = remap_prob(newp, oldp);
   vp9_encode_term_subexp(bc, delp, SUBEXP_PARAM, 255);
 }
 
-static int prob_diff_update_cost(vp8_prob newp, vp8_prob oldp) {
+static int prob_diff_update_cost(vp9_prob newp, vp9_prob oldp) {
   int delp = remap_prob(newp, oldp);
   return update_bits[delp] * 256;
 }
 
 static void update_mode(
-  vp8_writer *const bc,
+  vp9_writer *const bc,
   int n,
-  vp8_token tok               [/* n */],
-  vp8_tree tree,
-  vp8_prob Pnew               [/* n-1 */],
-  vp8_prob Pcur               [/* n-1 */],
+  vp9_token tok               [/* n */],
+  vp9_tree tree,
+  vp9_prob Pnew               [/* n-1 */],
+  vp9_prob Pcur               [/* n-1 */],
   unsigned int bct            [/* n-1 */] [2],
   const unsigned int num_events[/* n */]
 ) {
@@ -137,34 +135,34 @@
   );
 
   do {
-    new_b += vp8_cost_branch(bct[i], Pnew[i]);
-    old_b += vp8_cost_branch(bct[i], Pcur[i]);
+    new_b += cost_branch(bct[i], Pnew[i]);
+    old_b += cost_branch(bct[i], Pcur[i]);
   } while (++i < n);
 
   if (new_b + (n << 8) < old_b) {
     int i = 0;
 
-    vp8_write_bit(bc, 1);
+    vp9_write_bit(bc, 1);
 
     do {
-      const vp8_prob p = Pnew[i];
+      const vp9_prob p = Pnew[i];
 
-      vp8_write_literal(bc, Pcur[i] = p ? p : 1, 8);
+      vp9_write_literal(bc, Pcur[i] = p ? p : 1, 8);
     } while (++i < n);
   } else
-    vp8_write_bit(bc, 0);
+    vp9_write_bit(bc, 0);
 }
 
 static void update_mbintra_mode_probs(VP9_COMP* const cpi,
-                                      vp8_writer* const bc) {
+                                      vp9_writer* const bc) {
   VP9_COMMON *const cm = &cpi->common;
 
   {
-    vp8_prob Pnew   [VP8_YMODES - 1];
-    unsigned int bct [VP8_YMODES - 1] [2];
+    vp9_prob Pnew   [VP9_YMODES - 1];
+    unsigned int bct [VP9_YMODES - 1] [2];
 
     update_mode(
-      bc, VP8_YMODES, vp9_ymode_encodings, vp9_ymode_tree,
+      bc, VP9_YMODES, vp9_ymode_encodings, vp9_ymode_tree,
       Pnew, cm->fc.ymode_prob, bct, (unsigned int *)cpi->ymode_count
     );
   }
@@ -198,20 +196,20 @@
 }
 
 static void update_switchable_interp_probs(VP9_COMP *cpi,
-                                           vp8_writer* const bc) {
+                                           vp9_writer* const bc) {
   VP9_COMMON *const pc = &cpi->common;
   unsigned int branch_ct[32][2];
   int i, j;
-  for (j = 0; j <= VP8_SWITCHABLE_FILTERS; ++j) {
+  for (j = 0; j <= VP9_SWITCHABLE_FILTERS; ++j) {
     vp9_tree_probs_from_distribution(
-        VP8_SWITCHABLE_FILTERS,
+        VP9_SWITCHABLE_FILTERS,
         vp9_switchable_interp_encodings, vp9_switchable_interp_tree,
         pc->fc.switchable_interp_prob[j], branch_ct,
         cpi->switchable_interp_count[j], 256, 1);
-    for (i = 0; i < VP8_SWITCHABLE_FILTERS - 1; ++i) {
+    for (i = 0; i < VP9_SWITCHABLE_FILTERS - 1; ++i) {
       if (pc->fc.switchable_interp_prob[j][i] < 1)
         pc->fc.switchable_interp_prob[j][i] = 1;
-      vp8_write_literal(bc, pc->fc.switchable_interp_prob[j][i], 8);
+      vp9_write_literal(bc, pc->fc.switchable_interp_prob[j][i], 8);
     }
   }
 }
@@ -221,7 +219,7 @@
   VP9_COMMON *const cm = &cpi->common;
   int i;
   int tot_count;
-  vp8_prob new_pred_probs[PREDICTION_PROBS];
+  vp9_prob new_pred_probs[PREDICTION_PROBS];
   int old_cost, new_cost;
 
   // Set the prediction probability structures to defaults
@@ -242,12 +240,12 @@
       // Decide whether or not to update the reference frame probs.
       // Returned costs are in 1/256 bit units.
       old_cost =
-        (cpi->ref_pred_count[i][0] * vp8_cost_zero(cm->ref_pred_probs[i])) +
-        (cpi->ref_pred_count[i][1] * vp8_cost_one(cm->ref_pred_probs[i]));
+        (cpi->ref_pred_count[i][0] * vp9_cost_zero(cm->ref_pred_probs[i])) +
+        (cpi->ref_pred_count[i][1] * vp9_cost_one(cm->ref_pred_probs[i]));
 
       new_cost =
-        (cpi->ref_pred_count[i][0] * vp8_cost_zero(new_pred_probs[i])) +
-        (cpi->ref_pred_count[i][1] * vp8_cost_one(new_pred_probs[i]));
+        (cpi->ref_pred_count[i][0] * vp9_cost_zero(new_pred_probs[i])) +
+        (cpi->ref_pred_count[i][1] * vp9_cost_one(new_pred_probs[i]));
 
       // Cost saving must be >= 8 bits (2048 in these units)
       if ((old_cost - new_cost) >= 2048) {
@@ -324,72 +322,70 @@
   }
 }
 
-static void write_ymode(vp8_writer *bc, int m, const vp8_prob *p) {
-  vp8_write_token(bc, vp9_ymode_tree, p, vp9_ymode_encodings + m);
+static void write_ymode(vp9_writer *bc, int m, const vp9_prob *p) {
+  write_token(bc, vp9_ymode_tree, p, vp9_ymode_encodings + m);
 }
 
-static void kfwrite_ymode(vp8_writer *bc, int m, const vp8_prob *p) {
-  vp8_write_token(bc, vp9_kf_ymode_tree, p, vp9_kf_ymode_encodings + m);
+static void kfwrite_ymode(vp9_writer *bc, int m, const vp9_prob *p) {
+  write_token(bc, vp9_kf_ymode_tree, p, vp9_kf_ymode_encodings + m);
 }
 
 #if CONFIG_SUPERBLOCKS
-static void sb_kfwrite_ymode(vp8_writer *bc, int m, const vp8_prob *p) {
-  vp8_write_token(bc, vp9_uv_mode_tree, p, vp9_sb_kf_ymode_encodings + m);
+static void sb_kfwrite_ymode(vp9_writer *bc, int m, const vp9_prob *p) {
+  write_token(bc, vp9_uv_mode_tree, p, vp9_sb_kf_ymode_encodings + m);
 }
 #endif
 
-static void write_i8x8_mode(vp8_writer *bc, int m, const vp8_prob *p) {
-  vp8_write_token(bc, vp9_i8x8_mode_tree, p, vp9_i8x8_mode_encodings + m);
+static void write_i8x8_mode(vp9_writer *bc, int m, const vp9_prob *p) {
+  write_token(bc, vp9_i8x8_mode_tree, p, vp9_i8x8_mode_encodings + m);
 }
 
-static void write_uv_mode(vp8_writer *bc, int m, const vp8_prob *p) {
-  vp8_write_token(bc, vp9_uv_mode_tree, p, vp9_uv_mode_encodings + m);
+static void write_uv_mode(vp9_writer *bc, int m, const vp9_prob *p) {
+  write_token(bc, vp9_uv_mode_tree, p, vp9_uv_mode_encodings + m);
 }
 
 
-static void write_bmode(vp8_writer *bc, int m, const vp8_prob *p) {
-  vp8_write_token(bc, vp9_bmode_tree, p, vp9_bmode_encodings + m);
+static void write_bmode(vp9_writer *bc, int m, const vp9_prob *p) {
+  write_token(bc, vp9_bmode_tree, p, vp9_bmode_encodings + m);
 }
 
-static void write_split(vp8_writer *bc, int x, const vp8_prob *p) {
-  vp8_write_token(
-    bc, vp9_mbsplit_tree, p, vp9_mbsplit_encodings + x
-  );
+static void write_split(vp9_writer *bc, int x, const vp9_prob *p) {
+  write_token(bc, vp9_mbsplit_tree, p, vp9_mbsplit_encodings + x);
 }
 
 static int prob_update_savings(const unsigned int *ct,
-                               const vp8_prob oldp, const vp8_prob newp,
-                               const vp8_prob upd) {
-  const int old_b = vp8_cost_branch256(ct, oldp);
-  const int new_b = vp8_cost_branch256(ct, newp);
-  const int update_b = 2048 + vp8_cost_upd256;
+                               const vp9_prob oldp, const vp9_prob newp,
+                               const vp9_prob upd) {
+  const int old_b = cost_branch256(ct, oldp);
+  const int new_b = cost_branch256(ct, newp);
+  const int update_b = 2048 + vp9_cost_upd256;
   return (old_b - new_b - update_b);
 }
 
 static int prob_diff_update_savings(const unsigned int *ct,
-                                    const vp8_prob oldp, const vp8_prob newp,
-                                    const vp8_prob upd) {
-  const int old_b = vp8_cost_branch256(ct, oldp);
-  const int new_b = vp8_cost_branch256(ct, newp);
+                                    const vp9_prob oldp, const vp9_prob newp,
+                                    const vp9_prob upd) {
+  const int old_b = cost_branch256(ct, oldp);
+  const int new_b = cost_branch256(ct, newp);
   const int update_b = (newp == oldp ? 0 :
-                        prob_diff_update_cost(newp, oldp) + vp8_cost_upd256);
+                        prob_diff_update_cost(newp, oldp) + vp9_cost_upd256);
   return (old_b - new_b - update_b);
 }
 
 static int prob_diff_update_savings_search(const unsigned int *ct,
-                                           const vp8_prob oldp, vp8_prob *bestp,
-                                           const vp8_prob upd) {
-  const int old_b = vp8_cost_branch256(ct, oldp);
+                                           const vp9_prob oldp, vp9_prob *bestp,
+                                           const vp9_prob upd) {
+  const int old_b = cost_branch256(ct, oldp);
   int new_b, update_b, savings, bestsavings, step;
-  vp8_prob newp, bestnewp;
+  vp9_prob newp, bestnewp;
 
   bestsavings = 0;
   bestnewp = oldp;
 
   step = (*bestp > oldp ? -1 : 1);
   for (newp = *bestp; newp != oldp; newp += step) {
-    new_b = vp8_cost_branch256(ct, newp);
-    update_b = prob_diff_update_cost(newp, oldp) + vp8_cost_upd256;
+    new_b = cost_branch256(ct, newp);
+    update_b = prob_diff_update_cost(newp, oldp) + vp9_cost_upd256;
     savings = old_b - new_b - update_b;
     if (savings > bestsavings) {
       bestsavings = savings;
@@ -400,7 +396,7 @@
   return bestsavings;
 }
 
-static void pack_mb_tokens(vp8_writer* const bc,
+static void pack_mb_tokens(vp9_writer* const bc,
                            TOKENEXTRA **tp,
                            const TOKENEXTRA *const stop) {
   unsigned int split;
@@ -412,8 +408,8 @@
 
   while (p < stop) {
     const int t = p->Token;
-    vp8_token *const a = vp9_coef_encodings + t;
-    const vp8_extra_bit_struct *const b = vp9_extra_bits + t;
+    vp9_token *const a = vp9_coef_encodings + t;
+    const vp9_extra_bit_struct *const b = vp9_extra_bits + t;
     int i = 0;
     const unsigned char *pp = p->context_tree;
     int v = a->value;
@@ -581,38 +577,38 @@
 
 static void write_mv_ref
 (
-  vp8_writer *bc, MB_PREDICTION_MODE m, const vp8_prob *p
+  vp9_writer *bc, MB_PREDICTION_MODE m, const vp9_prob *p
 ) {
 #if CONFIG_DEBUG
   assert(NEARESTMV <= m  &&  m <= SPLITMV);
 #endif
-  vp8_write_token(bc, vp9_mv_ref_tree, p,
-                  vp9_mv_ref_encoding_array - NEARESTMV + m);
+  write_token(bc, vp9_mv_ref_tree, p,
+              vp9_mv_ref_encoding_array - NEARESTMV + m);
 }
 
 #if CONFIG_SUPERBLOCKS
-static void write_sb_mv_ref(vp8_writer *bc, MB_PREDICTION_MODE m,
-                            const vp8_prob *p) {
+static void write_sb_mv_ref(vp9_writer *bc, MB_PREDICTION_MODE m,
+                            const vp9_prob *p) {
 #if CONFIG_DEBUG
   assert(NEARESTMV <= m  &&  m < SPLITMV);
 #endif
-  vp8_write_token(bc, vp9_sb_mv_ref_tree, p,
-                  vp9_sb_mv_ref_encoding_array - NEARESTMV + m);
+  write_token(bc, vp9_sb_mv_ref_tree, p,
+              vp9_sb_mv_ref_encoding_array - NEARESTMV + m);
 }
 #endif
 
 static void write_sub_mv_ref
 (
-  vp8_writer *bc, B_PREDICTION_MODE m, const vp8_prob *p
+  vp9_writer *bc, B_PREDICTION_MODE m, const vp9_prob *p
 ) {
 #if CONFIG_DEBUG
   assert(LEFT4X4 <= m  &&  m <= NEW4X4);
 #endif
-  vp8_write_token(bc, vp9_sub_mv_ref_tree, p,
-                  vp9_sub_mv_ref_encoding_array - LEFT4X4 + m);
+  write_token(bc, vp9_sub_mv_ref_tree, p,
+              vp9_sub_mv_ref_encoding_array - LEFT4X4 + m);
 }
 
-static void write_nmv(vp8_writer *bc, const MV *mv, const int_mv *ref,
+static void write_nmv(vp9_writer *bc, const MV *mv, const int_mv *ref,
                       const nmv_context *nmvc, int usehp) {
   MV e;
   e.row = mv->row - ref->as_mv.row;
@@ -623,27 +619,27 @@
 }
 
 #if CONFIG_NEW_MVREF
-static int vp9_cost_mv_ref_id(vp8_prob * ref_id_probs, int mv_ref_id) {
+static int vp9_cost_mv_ref_id(vp9_prob * ref_id_probs, int mv_ref_id) {
   int cost;
 
   // Encode the index for the MV reference.
   switch (mv_ref_id) {
     case 0:
-      cost = vp8_cost_zero(ref_id_probs[0]);
+      cost = vp9_cost_zero(ref_id_probs[0]);
       break;
     case 1:
-      cost = vp8_cost_one(ref_id_probs[0]);
-      cost += vp8_cost_zero(ref_id_probs[1]);
+      cost = vp9_cost_one(ref_id_probs[0]);
+      cost += vp9_cost_zero(ref_id_probs[1]);
       break;
     case 2:
-      cost = vp8_cost_one(ref_id_probs[0]);
-      cost += vp8_cost_one(ref_id_probs[1]);
-      cost += vp8_cost_zero(ref_id_probs[2]);
+      cost = vp9_cost_one(ref_id_probs[0]);
+      cost += vp9_cost_one(ref_id_probs[1]);
+      cost += vp9_cost_zero(ref_id_probs[2]);
       break;
     case 3:
-      cost = vp8_cost_one(ref_id_probs[0]);
-      cost += vp8_cost_one(ref_id_probs[1]);
-      cost += vp8_cost_one(ref_id_probs[2]);
+      cost = vp9_cost_one(ref_id_probs[0]);
+      cost += vp9_cost_one(ref_id_probs[1]);
+      cost += vp9_cost_one(ref_id_probs[2]);
       break;
 
       // TRAP.. This should not happen
@@ -655,27 +651,27 @@
   return cost;
 }
 
-static void vp8_write_mv_ref_id(vp8_writer *w,
-                                vp8_prob * ref_id_probs,
+static void vp9_write_mv_ref_id(vp9_writer *w,
+                                vp9_prob * ref_id_probs,
                                 int mv_ref_id) {
   // Encode the index for the MV reference.
   switch (mv_ref_id) {
     case 0:
-      vp8_write(w, 0, ref_id_probs[0]);
+      vp9_write(w, 0, ref_id_probs[0]);
       break;
     case 1:
-      vp8_write(w, 1, ref_id_probs[0]);
-      vp8_write(w, 0, ref_id_probs[1]);
+      vp9_write(w, 1, ref_id_probs[0]);
+      vp9_write(w, 0, ref_id_probs[1]);
       break;
     case 2:
-      vp8_write(w, 1, ref_id_probs[0]);
-      vp8_write(w, 1, ref_id_probs[1]);
-      vp8_write(w, 0, ref_id_probs[2]);
+      vp9_write(w, 1, ref_id_probs[0]);
+      vp9_write(w, 1, ref_id_probs[1]);
+      vp9_write(w, 0, ref_id_probs[2]);
       break;
     case 3:
-      vp8_write(w, 1, ref_id_probs[0]);
-      vp8_write(w, 1, ref_id_probs[1]);
-      vp8_write(w, 1, ref_id_probs[2]);
+      vp9_write(w, 1, ref_id_probs[0]);
+      vp9_write(w, 1, ref_id_probs[1]);
+      vp9_write(w, 1, ref_id_probs[2]);
       break;
 
       // TRAP.. This should not happen
@@ -742,7 +738,7 @@
 
 // This function writes the current macro block's segnment id to the bitstream
 // It should only be called if a segment map update is indicated.
-static void write_mb_segid(vp8_writer *bc,
+static void write_mb_segid(vp9_writer *bc,
                            const MB_MODE_INFO *mi, const MACROBLOCKD *xd) {
   // Encode the MB segment id.
   int seg_id = mi->segment_id;
@@ -762,33 +758,33 @@
   if (xd->segmentation_enabled && xd->update_mb_segmentation_map) {
     switch (seg_id) {
       case 0:
-        vp8_write(bc, 0, xd->mb_segment_tree_probs[0]);
-        vp8_write(bc, 0, xd->mb_segment_tree_probs[1]);
+        vp9_write(bc, 0, xd->mb_segment_tree_probs[0]);
+        vp9_write(bc, 0, xd->mb_segment_tree_probs[1]);
         break;
       case 1:
-        vp8_write(bc, 0, xd->mb_segment_tree_probs[0]);
-        vp8_write(bc, 1, xd->mb_segment_tree_probs[1]);
+        vp9_write(bc, 0, xd->mb_segment_tree_probs[0]);
+        vp9_write(bc, 1, xd->mb_segment_tree_probs[1]);
         break;
       case 2:
-        vp8_write(bc, 1, xd->mb_segment_tree_probs[0]);
-        vp8_write(bc, 0, xd->mb_segment_tree_probs[2]);
+        vp9_write(bc, 1, xd->mb_segment_tree_probs[0]);
+        vp9_write(bc, 0, xd->mb_segment_tree_probs[2]);
         break;
       case 3:
-        vp8_write(bc, 1, xd->mb_segment_tree_probs[0]);
-        vp8_write(bc, 1, xd->mb_segment_tree_probs[2]);
+        vp9_write(bc, 1, xd->mb_segment_tree_probs[0]);
+        vp9_write(bc, 1, xd->mb_segment_tree_probs[2]);
         break;
 
         // TRAP.. This should not happen
       default:
-        vp8_write(bc, 0, xd->mb_segment_tree_probs[0]);
-        vp8_write(bc, 0, xd->mb_segment_tree_probs[1]);
+        vp9_write(bc, 0, xd->mb_segment_tree_probs[0]);
+        vp9_write(bc, 0, xd->mb_segment_tree_probs[1]);
         break;
     }
   }
 }
 
 // This function encodes the reference frame
-static void encode_ref_frame(vp8_writer *const bc,
+static void encode_ref_frame(vp9_writer *const bc,
                              VP9_COMMON *const cm,
                              MACROBLOCKD *xd,
                              int segment_id,
@@ -811,7 +807,7 @@
   if (!seg_ref_active || (seg_ref_count > 1)) {
     // Values used in prediction model coding
     unsigned char prediction_flag;
-    vp8_prob pred_prob;
+    vp9_prob pred_prob;
     MV_REFERENCE_FRAME pred_rf;
 
     // Get the context probability the prediction flag
@@ -825,11 +821,11 @@
       (xd->mode_info_context->mbmi.ref_frame == pred_rf);
 
     vp9_set_pred_flag(xd, PRED_REF, prediction_flag);
-    vp8_write(bc, prediction_flag, pred_prob);
+    vp9_write(bc, prediction_flag, pred_prob);
 
     // If not predicted correctly then code value explicitly
     if (!prediction_flag) {
-      vp8_prob mod_refprobs[PREDICTION_PROBS];
+      vp9_prob mod_refprobs[PREDICTION_PROBS];
 
       vpx_memcpy(mod_refprobs,
                  cm->mod_refprobs[pred_rf], sizeof(mod_refprobs));
@@ -847,18 +843,18 @@
       }
 
       if (mod_refprobs[0]) {
-        vp8_write(bc, (rf != INTRA_FRAME), mod_refprobs[0]);
+        vp9_write(bc, (rf != INTRA_FRAME), mod_refprobs[0]);
       }
 
       // Inter coded
       if (rf != INTRA_FRAME) {
         if (mod_refprobs[1]) {
-          vp8_write(bc, (rf != LAST_FRAME), mod_refprobs[1]);
+          vp9_write(bc, (rf != LAST_FRAME), mod_refprobs[1]);
         }
 
         if (rf != LAST_FRAME) {
           if (mod_refprobs[2]) {
-            vp8_write(bc, (rf != GOLDEN_FRAME), mod_refprobs[2]);
+            vp9_write(bc, (rf != GOLDEN_FRAME), mod_refprobs[2]);
           }
         }
       }
@@ -887,7 +883,7 @@
   vp9_compute_mod_refprobs(cm);
 }
 
-static void pack_inter_mode_mvs(VP9_COMP *const cpi, vp8_writer *const bc) {
+static void pack_inter_mode_mvs(VP9_COMP *const cpi, vp9_writer *const bc) {
   int i;
   VP9_COMMON *const pc = &cpi->common;
   const nmv_context *nmvc = &pc->fc.nmvc;
@@ -903,14 +899,12 @@
   int row, col;
 
   // Values used in prediction model coding
-  vp8_prob pred_prob;
+  vp9_prob pred_prob;
   unsigned char prediction_flag;
 
   int row_delta[4] = { 0, +1,  0, -1};
   int col_delta[4] = { +1, -1, +1, +1};
 
-  //final_packing = !cpi->dummy_packing;
-
   cpi->mb.partition_info = cpi->mb.pi;
 
   mb_row = 0;
@@ -925,7 +919,7 @@
       // Process the 4 MBs in the order:
       // top-left, top-right, bottom-left, bottom-right
 #if CONFIG_SUPERBLOCKS
-      vp8_write(bc, m->mbmi.encoded_as_sb, pc->sb_coded);
+      vp9_write(bc, m->mbmi.encoded_as_sb, pc->sb_coded);
 #endif
       for (i = 0; i < 4; i++) {
         MB_MODE_INFO *mi;
@@ -974,7 +968,7 @@
             pred_prob = vp9_get_pred_prob(pc, xd, PRED_SEG_ID);
 
             // Code the segment id prediction flag for this mb
-            vp8_write(bc, prediction_flag, pred_prob);
+            vp9_write(bc, prediction_flag, pred_prob);
 
             // If the mb segment id wasn't predicted code explicitly
             if (!prediction_flag)
@@ -996,8 +990,8 @@
             skip_coeff &= m[mis + 1].mbmi.mb_skip_coeff;
           }
 #endif
-          vp8_encode_bool(bc, skip_coeff,
-                          vp9_get_pred_prob(pc, xd, PRED_MBSKIP));
+          vp9_write(bc, skip_coeff,
+                    vp9_get_pred_prob(pc, xd, PRED_MBSKIP));
         }
 
         // Encode the reference frame.
@@ -1020,7 +1014,7 @@
             int uses_second =
               m->bmi[0].as_mode.second !=
               (B_PREDICTION_MODE)(B_DC_PRED - 1);
-            vp8_write(bc, uses_second, 128);
+            vp9_write(bc, uses_second, 128);
 #endif
             do {
 #if CONFIG_COMP_INTRA_PRED
@@ -1031,7 +1025,7 @@
               /*
               if (!cpi->dummy_packing) {
                 int p;
-                for (p = 0; p < VP8_BINTRAMODES - 1; ++p)
+                for (p = 0; p < VP9_BINTRAMODES - 1; ++p)
                   printf(" %d", pc->fc.bmode_prob[p]);
                 printf("\nbmode[%d][%d]: %d\n", pc->current_video_frame, j, m->bmi[j].as_mode.first);
               }
@@ -1060,7 +1054,7 @@
           int_mv best_mv, best_second_mv;
           int ct[4];
 
-          vp8_prob mv_ref_p [VP8_MVREFS - 1];
+          vp9_prob mv_ref_p [VP9_MVREFS - 1];
 
           {
             int_mv n1, n2;
@@ -1100,7 +1094,7 @@
           // Is the prediction filter enabled
           if (mode >= NEARESTMV && mode < SPLITMV) {
             if (cpi->common.pred_filter_mode == 2)
-              vp8_write(bc, mi->pred_filter_enabled,
+              vp9_write(bc, mi->pred_filter_enabled,
                         pc->prob_pred_filter_off);
             else
               assert(mi->pred_filter_enabled ==
@@ -1110,10 +1104,10 @@
           if (mode >= NEARESTMV && mode <= SPLITMV)
           {
             if (cpi->common.mcomp_filter_type == SWITCHABLE) {
-              vp8_write_token(bc, vp9_switchable_interp_tree,
-                              vp9_get_pred_probs(&cpi->common, xd,
-                                                 PRED_SWITCHABLE_INTERP),
-                              vp9_switchable_interp_encodings +
+              write_token(bc, vp9_switchable_interp_tree,
+                          vp9_get_pred_probs(&cpi->common, xd,
+                                             PRED_SWITCHABLE_INTERP),
+                          vp9_switchable_interp_encodings +
                               vp9_switchable_interp_map[mi->interp_filter]);
             } else {
               assert (mi->interp_filter ==
@@ -1139,7 +1133,7 @@
           // does the feature use compound prediction or not
           // (if not specified at the frame/segment level)
           if (cpi->common.comp_pred_mode == HYBRID_PREDICTION) {
-            vp8_write(bc, mi->second_ref_frame != INTRA_FRAME,
+            vp9_write(bc, mi->second_ref_frame != INTRA_FRAME,
                       vp9_get_pred_prob(pc, xd, PRED_COMP));
           }
 
@@ -1159,7 +1153,7 @@
                                                 mi->ref_mvs[rf], &best_mv);
 
                   // Encode the index of the choice.
-                  vp8_write_mv_ref_id(bc,
+                  vp9_write_mv_ref_id(bc,
                                       xd->mb_mv_ref_id_probs[rf], best_index);
 
                   cpi->best_ref_index_counts[rf][best_index]++;
@@ -1182,7 +1176,7 @@
                                      &best_second_mv);
 
                   // Encode the index of the choice.
-                  vp8_write_mv_ref_id(bc,
+                  vp9_write_mv_ref_id(bc,
                                       xd->mb_mv_ref_id_probs[sec_ref_frame],
                                       best_index);
 
@@ -1272,9 +1266,9 @@
                vp9_get_segdata(xd, segment_id, SEG_LVL_EOB) == 0))) {
           TX_SIZE sz = mi->txfm_size;
           // FIXME(rbultje) code ternary symbol once all experiments are merged
-          vp8_write(bc, sz != TX_4X4, pc->prob_tx[0]);
+          vp9_write(bc, sz != TX_4X4, pc->prob_tx[0]);
           if (sz != TX_4X4 && mode != I8X8_PRED && mode != SPLITMV)
-            vp8_write(bc, sz != TX_8X8, pc->prob_tx[1]);
+            vp9_write(bc, sz != TX_8X8, pc->prob_tx[1]);
         }
 
 #ifdef ENTROPY_STATS
@@ -1320,7 +1314,7 @@
                               const MACROBLOCKD *xd,
                               const MODE_INFO   *m,
                               int                mode_info_stride,
-                              vp8_writer *const  bc) {
+                              vp9_writer *const  bc) {
   const int mis = mode_info_stride;
   int ym;
   int segment_id;
@@ -1343,8 +1337,8 @@
           skip_coeff &= m[mis + 1].mbmi.mb_skip_coeff;
         }
 #endif
-        vp8_encode_bool(bc, skip_coeff,
-                    vp9_get_pred_prob(c, xd, PRED_MBSKIP));
+        vp9_write(bc, skip_coeff,
+                  vp9_get_pred_prob(c, xd, PRED_MBSKIP));
   }
 
 #if CONFIG_SUPERBLOCKS
@@ -1365,7 +1359,7 @@
     int uses_second =
       m->bmi[0].as_mode.second !=
       (B_PREDICTION_MODE)(B_DC_PRED - 1);
-    vp8_write(bc, uses_second, 128);
+    vp9_write(bc, uses_second, 128);
 #endif
     do {
       const B_PREDICTION_MODE A = above_block_mode(m, i, mis);
@@ -1414,13 +1408,13 @@
          vp9_get_segdata(xd, segment_id, SEG_LVL_EOB) == 0))) {
     TX_SIZE sz = m->mbmi.txfm_size;
     // FIXME(rbultje) code ternary symbol once all experiments are merged
-    vp8_write(bc, sz != TX_4X4, c->prob_tx[0]);
+    vp9_write(bc, sz != TX_4X4, c->prob_tx[0]);
     if (sz != TX_4X4 && ym <= TM_PRED)
-      vp8_write(bc, sz != TX_8X8, c->prob_tx[1]);
+      vp9_write(bc, sz != TX_8X8, c->prob_tx[1]);
   }
 }
 
-static void write_kfmodes(VP9_COMP* const cpi, vp8_writer* const bc) {
+static void write_kfmodes(VP9_COMP* const cpi, vp9_writer* const bc) {
   VP9_COMMON *const c = &cpi->common;
   const int mis = c->mode_info_stride;
   MACROBLOCKD *xd = &cpi->mb.e_mbd;
@@ -1440,7 +1434,7 @@
     mb_col = 0;
     for (col = 0; col < c->mb_cols; col += 2) {
 #if CONFIG_SUPERBLOCKS
-      vp8_write(bc, m->mbmi.encoded_as_sb, c->sb_coded);
+      vp9_write(bc, m->mbmi.encoded_as_sb, c->sb_coded);
 #endif
       // Process the 4 MBs in the order:
       // top-left, top-right, bottom-left, bottom-right
@@ -1487,7 +1481,7 @@
 
 
 /* This function is used for debugging probability trees. */
-static void print_prob_tree(vp8_prob
+static void print_prob_tree(vp9_prob
                             coef_probs[BLOCK_TYPES][COEF_BANDS][PREV_COEF_CONTEXTS][ENTROPY_NODES]) {
   /* print coef probability tree */
   int i, j, k, l;
@@ -1565,7 +1559,7 @@
         for (k = 0; k < PREV_COEF_CONTEXTS; ++k) {
           /* at every context */
           /* calc probs and branch cts for this frame only */
-          // vp8_prob new_p           [ENTROPY_NODES];
+          // vp9_prob new_p           [ENTROPY_NODES];
           // unsigned int branch_ct   [ENTROPY_NODES] [2];
           if (k >= 3 && ((i == 0 && j == 1) || (i > 0 && j == 0)))
             continue;
@@ -1589,7 +1583,7 @@
         for (k = 0; k < PREV_COEF_CONTEXTS; ++k) {
           /* at every context */
           /* calc probs and branch cts for this frame only */
-          // vp8_prob new_p           [ENTROPY_NODES];
+          // vp9_prob new_p           [ENTROPY_NODES];
           // unsigned int branch_ct   [ENTROPY_NODES] [2];
           if (k >= 3 && ((i == 0 && j == 1) || (i > 0 && j == 0)))
             continue;
@@ -1651,17 +1645,17 @@
 }
 
 static void update_coef_probs_common(
-    vp8_writer* const bc,
-    vp8_prob new_frame_coef_probs[BLOCK_TYPES][COEF_BANDS]
+    vp9_writer* const bc,
+    vp9_prob new_frame_coef_probs[BLOCK_TYPES][COEF_BANDS]
                                  [PREV_COEF_CONTEXTS][ENTROPY_NODES],
-    vp8_prob old_frame_coef_probs[BLOCK_TYPES][COEF_BANDS]
+    vp9_prob old_frame_coef_probs[BLOCK_TYPES][COEF_BANDS]
                                  [PREV_COEF_CONTEXTS][ENTROPY_NODES],
     unsigned int frame_branch_ct[BLOCK_TYPES][COEF_BANDS]
                                 [PREV_COEF_CONTEXTS][ENTROPY_NODES][2]) {
   int i, j, k, t;
   int update[2] = {0, 0};
   int savings;
-  // vp8_prob bestupd = find_coef_update_prob(cpi);
+  // vp9_prob bestupd = find_coef_update_prob(cpi);
 
   /* dry run to see if there is any udpate at all needed */
   savings = 0;
@@ -1670,9 +1664,9 @@
       int prev_coef_savings[ENTROPY_NODES] = {0};
       for (k = 0; k < PREV_COEF_CONTEXTS; ++k) {
         for (t = 0; t < ENTROPY_NODES; ++t) {
-          vp8_prob newp = new_frame_coef_probs[i][j][k][t];
-          const vp8_prob oldp = old_frame_coef_probs[i][j][k][t];
-          const vp8_prob upd = COEF_UPDATE_PROB;
+          vp9_prob newp = new_frame_coef_probs[i][j][k][t];
+          const vp9_prob oldp = old_frame_coef_probs[i][j][k][t];
+          const vp9_prob upd = COEF_UPDATE_PROB;
           int s = prev_coef_savings[t];
           int u = 0;
           if (k >= 3 && ((i == 0 && j == 1) || (i > 0 && j == 0)))
@@ -1684,9 +1678,9 @@
           if (s > 0 && newp != oldp)
             u = 1;
           if (u)
-            savings += s - (int)(vp8_cost_zero(upd));
+            savings += s - (int)(vp9_cost_zero(upd));
           else
-            savings -= (int)(vp8_cost_zero(upd));
+            savings -= (int)(vp9_cost_zero(upd));
 #else
           s = prob_update_savings(
                 frame_branch_ct[i][j][k][t],
@@ -1706,18 +1700,18 @@
   // printf("Update %d %d, savings %d\n", update[0], update[1], savings);
   /* Is coef updated at all */
   if (update[1] == 0 || savings < 0) {
-    vp8_write_bit(bc, 0);
+    vp9_write_bit(bc, 0);
   } else {
-    vp8_write_bit(bc, 1);
+    vp9_write_bit(bc, 1);
     for (i = 0; i < BLOCK_TYPES; ++i) {
       for (j = !i; j < COEF_BANDS; ++j) {
         int prev_coef_savings[ENTROPY_NODES] = {0};
         for (k = 0; k < PREV_COEF_CONTEXTS; ++k) {
           // calc probs and branch cts for this frame only
           for (t = 0; t < ENTROPY_NODES; ++t) {
-            vp8_prob newp = new_frame_coef_probs[i][j][k][t];
-            vp8_prob *oldp = old_frame_coef_probs[i][j][k] + t;
-            const vp8_prob upd = COEF_UPDATE_PROB;
+            vp9_prob newp = new_frame_coef_probs[i][j][k][t];
+            vp9_prob *oldp = old_frame_coef_probs[i][j][k] + t;
+            const vp9_prob upd = COEF_UPDATE_PROB;
             int s = prev_coef_savings[t];
             int u = 0;
             if (k >= 3 && ((i == 0 && j == 1) || (i > 0 && j == 0)))
@@ -1736,7 +1730,7 @@
             if (s > 0)
               u = 1;
 #endif
-            vp8_write(bc, u, upd);
+            vp9_write(bc, u, upd);
 #ifdef ENTROPY_STATS
             if (!cpi->dummy_packing)
               ++ tree_update_hist [i][j][k][t] [u];
@@ -1753,8 +1747,8 @@
   }
 }
 
-static void update_coef_probs(VP9_COMP* const cpi, vp8_writer* const bc) {
-  vp8_clear_system_state();
+static void update_coef_probs(VP9_COMP* const cpi, vp9_writer* const bc) {
+  vp9_clear_system_state();
 
   // Build the cofficient contexts based on counts collected in encode loop
   build_coeff_contexts(cpi);
@@ -1798,17 +1792,17 @@
 FILE *vpxlogc = 0;
 #endif
 
-static void put_delta_q(vp8_writer *bc, int delta_q) {
+static void put_delta_q(vp9_writer *bc, int delta_q) {
   if (delta_q != 0) {
-    vp8_write_bit(bc, 1);
-    vp8_write_literal(bc, abs(delta_q), 4);
+    vp9_write_bit(bc, 1);
+    vp9_write_literal(bc, abs(delta_q), 4);
 
     if (delta_q < 0)
-      vp8_write_bit(bc, 1);
+      vp9_write_bit(bc, 1);
     else
-      vp8_write_bit(bc, 0);
+      vp9_write_bit(bc, 0);
   } else
-    vp8_write_bit(bc, 0);
+    vp9_write_bit(bc, 0);
 }
 
 static void decide_kf_ymode_entropy(VP9_COMP *cpi) {
@@ -1822,13 +1816,13 @@
   for (i = 0; i < 8; i++) {
     vp9_cost_tokens(mode_cost, cpi->common.kf_ymode_prob[i], vp9_kf_ymode_tree);
     cost = 0;
-    for (j = 0; j < VP8_YMODES; j++) {
+    for (j = 0; j < VP9_YMODES; j++) {
       cost += mode_cost[j] * cpi->ymode_count[j];
     }
 #if CONFIG_SUPERBLOCKS
     vp9_cost_tokens(mode_cost, cpi->common.sb_kf_ymode_prob[i],
-                    vp8_sb_ymode_tree);
-    for (j = 0; j < VP8_I32X32_MODES; j++) {
+                    vp9_sb_ymode_tree);
+    for (j = 0; j < VP9_I32X32_MODES; j++) {
       cost += mode_cost[j] * cpi->sb_ymode_count[j];
     }
 #endif
@@ -1863,9 +1857,9 @@
 void vp9_pack_bitstream(VP9_COMP *cpi, unsigned char *dest,
                         unsigned long *size) {
   int i, j;
-  VP8_HEADER oh;
+  VP9_HEADER oh;
   VP9_COMMON *const pc = &cpi->common;
-  vp8_writer header_bc, residual_bc;
+  vp9_writer header_bc, residual_bc;
   MACROBLOCKD *const xd = &cpi->mb.e_mbd;
   int extra_bytes_packed = 0;
 
@@ -1879,7 +1873,7 @@
   cx_data += 3;
 
 #if defined(SECTIONBITS_OUTPUT)
-  Sectionbits[active_section = 1] += sizeof(VP8_HEADER) * 8 * 256;
+  Sectionbits[active_section = 1] += sizeof(VP9_HEADER) * 8 * 256;
 #endif
 
   compute_update_table();
@@ -1915,20 +1909,20 @@
     vp9_start_encode(&header_bc, cx_data);
 
     // signal clr type
-    vp8_write_bit(&header_bc, pc->clr_type);
-    vp8_write_bit(&header_bc, pc->clamp_type);
+    vp9_write_bit(&header_bc, pc->clr_type);
+    vp9_write_bit(&header_bc, pc->clamp_type);
 
   } else {
     vp9_start_encode(&header_bc, cx_data);
   }
 
   // Signal whether or not Segmentation is enabled
-  vp8_write_bit(&header_bc, (xd->segmentation_enabled) ? 1 : 0);
+  vp9_write_bit(&header_bc, (xd->segmentation_enabled) ? 1 : 0);
 
   // Indicate which features are enabled
   if (xd->segmentation_enabled) {
     // Indicate whether or not the segmentation map is being updated.
-    vp8_write_bit(&header_bc, (xd->update_mb_segmentation_map) ? 1 : 0);
+    vp9_write_bit(&header_bc, (xd->update_mb_segmentation_map) ? 1 : 0);
 
     // If it is, then indicate the method that will be used.
     if (xd->update_mb_segmentation_map) {
@@ -1940,37 +1934,37 @@
         int data = xd->mb_segment_tree_probs[i];
 
         if (data != 255) {
-          vp8_write_bit(&header_bc, 1);
-          vp8_write_literal(&header_bc, data, 8);
+          vp9_write_bit(&header_bc, 1);
+          vp9_write_literal(&header_bc, data, 8);
         } else {
-          vp8_write_bit(&header_bc, 0);
+          vp9_write_bit(&header_bc, 0);
         }
       }
 
       // Write out the chosen coding method.
-      vp8_write_bit(&header_bc, (pc->temporal_update) ? 1 : 0);
+      vp9_write_bit(&header_bc, (pc->temporal_update) ? 1 : 0);
       if (pc->temporal_update) {
         for (i = 0; i < PREDICTION_PROBS; i++) {
           int data = pc->segment_pred_probs[i];
 
           if (data != 255) {
-            vp8_write_bit(&header_bc, 1);
-            vp8_write_literal(&header_bc, data, 8);
+            vp9_write_bit(&header_bc, 1);
+            vp9_write_literal(&header_bc, data, 8);
           } else {
-            vp8_write_bit(&header_bc, 0);
+            vp9_write_bit(&header_bc, 0);
           }
         }
       }
     }
 
-    vp8_write_bit(&header_bc, (xd->update_mb_segmentation_data) ? 1 : 0);
+    vp9_write_bit(&header_bc, (xd->update_mb_segmentation_data) ? 1 : 0);
 
     // segment_reference_frames(cpi);
 
     if (xd->update_mb_segmentation_data) {
       signed char Data;
 
-      vp8_write_bit(&header_bc, (xd->mb_segment_abs_delta) ? 1 : 0);
+      vp9_write_bit(&header_bc, (xd->mb_segment_abs_delta) ? 1 : 0);
 
       // For each segments id...
       for (i = 0; i < MAX_MB_SEGMENTS; i++) {
@@ -1980,28 +1974,28 @@
 
           // If the feature is enabled...
           if (vp9_segfeature_active(xd, i, j)) {
-            vp8_write_bit(&header_bc, 1);
+            vp9_write_bit(&header_bc, 1);
 
             // Is the segment data signed..
             if (vp9_is_segfeature_signed(j)) {
               // Encode the relevant feature data
               if (Data < 0) {
                 Data = - Data;
-                vp8_write_literal(&header_bc, Data,
+                vp9_write_literal(&header_bc, Data,
                                   vp9_seg_feature_data_bits(j));
-                vp8_write_bit(&header_bc, 1);
+                vp9_write_bit(&header_bc, 1);
               } else {
-                vp8_write_literal(&header_bc, Data,
+                vp9_write_literal(&header_bc, Data,
                                   vp9_seg_feature_data_bits(j));
-                vp8_write_bit(&header_bc, 0);
+                vp9_write_bit(&header_bc, 0);
               }
             }
             // Unsigned data element so no sign bit needed
             else
-              vp8_write_literal(&header_bc, Data,
+              vp9_write_literal(&header_bc, Data,
                                 vp9_seg_feature_data_bits(j));
           } else
-            vp8_write_bit(&header_bc, 0);
+            vp9_write_bit(&header_bc, 0);
         }
       }
     }
@@ -2013,10 +2007,10 @@
   if (pc->frame_type != KEY_FRAME) {
     for (i = 0; i < PREDICTION_PROBS; i++) {
       if (cpi->ref_pred_probs_update[i]) {
-        vp8_write_bit(&header_bc, 1);
-        vp8_write_literal(&header_bc, pc->ref_pred_probs[i], 8);
+        vp9_write_bit(&header_bc, 1);
+        vp9_write_literal(&header_bc, pc->ref_pred_probs[i], 8);
       } else {
-        vp8_write_bit(&header_bc, 0);
+        vp9_write_bit(&header_bc, 0);
       }
     }
   }
@@ -2027,7 +2021,7 @@
     const int sb_max = (((pc->mb_rows + 1) >> 1) * ((pc->mb_cols + 1) >> 1));
 
     pc->sb_coded = get_prob(sb_max - cpi->sb_count, sb_max);
-    vp8_write_literal(&header_bc, pc->sb_coded, 8);
+    vp9_write_literal(&header_bc, pc->sb_coded, 8);
   }
 #endif
 
@@ -2041,26 +2035,26 @@
       pc->prob_tx[0] = 128;
       pc->prob_tx[1] = 128;
     }
-    vp8_write_literal(&header_bc, pc->txfm_mode, 2);
+    vp9_write_literal(&header_bc, pc->txfm_mode, 2);
     if (pc->txfm_mode == TX_MODE_SELECT) {
-      vp8_write_literal(&header_bc, pc->prob_tx[0], 8);
-      vp8_write_literal(&header_bc, pc->prob_tx[1], 8);
+      vp9_write_literal(&header_bc, pc->prob_tx[0], 8);
+      vp9_write_literal(&header_bc, pc->prob_tx[1], 8);
     }
   }
 
   // Encode the loop filter level and type
-  vp8_write_bit(&header_bc, pc->filter_type);
-  vp8_write_literal(&header_bc, pc->filter_level, 6);
-  vp8_write_literal(&header_bc, pc->sharpness_level, 3);
+  vp9_write_bit(&header_bc, pc->filter_type);
+  vp9_write_literal(&header_bc, pc->filter_level, 6);
+  vp9_write_literal(&header_bc, pc->sharpness_level, 3);
 
   // Write out loop filter deltas applied at the MB level based on mode or ref frame (if they are enabled).
-  vp8_write_bit(&header_bc, (xd->mode_ref_lf_delta_enabled) ? 1 : 0);
+  vp9_write_bit(&header_bc, (xd->mode_ref_lf_delta_enabled) ? 1 : 0);
 
   if (xd->mode_ref_lf_delta_enabled) {
     // Do the deltas need to be updated
     int send_update = xd->mode_ref_lf_delta_update;
 
-    vp8_write_bit(&header_bc, send_update);
+    vp9_write_bit(&header_bc, send_update);
     if (send_update) {
       int Data;
 
@@ -2071,18 +2065,18 @@
         // Frame level data
         if (xd->ref_lf_deltas[i] != xd->last_ref_lf_deltas[i]) {
           xd->last_ref_lf_deltas[i] = xd->ref_lf_deltas[i];
-          vp8_write_bit(&header_bc, 1);
+          vp9_write_bit(&header_bc, 1);
 
           if (Data > 0) {
-            vp8_write_literal(&header_bc, (Data & 0x3F), 6);
-            vp8_write_bit(&header_bc, 0);    // sign
+            vp9_write_literal(&header_bc, (Data & 0x3F), 6);
+            vp9_write_bit(&header_bc, 0);    // sign
           } else {
             Data = -Data;
-            vp8_write_literal(&header_bc, (Data & 0x3F), 6);
-            vp8_write_bit(&header_bc, 1);    // sign
+            vp9_write_literal(&header_bc, (Data & 0x3F), 6);
+            vp9_write_bit(&header_bc, 1);    // sign
           }
         } else {
-          vp8_write_bit(&header_bc, 0);
+          vp9_write_bit(&header_bc, 0);
         }
       }
 
@@ -2092,29 +2086,29 @@
 
         if (xd->mode_lf_deltas[i] != xd->last_mode_lf_deltas[i]) {
           xd->last_mode_lf_deltas[i] = xd->mode_lf_deltas[i];
-          vp8_write_bit(&header_bc, 1);
+          vp9_write_bit(&header_bc, 1);
 
           if (Data > 0) {
-            vp8_write_literal(&header_bc, (Data & 0x3F), 6);
-            vp8_write_bit(&header_bc, 0);    // sign
+            vp9_write_literal(&header_bc, (Data & 0x3F), 6);
+            vp9_write_bit(&header_bc, 0);    // sign
           } else {
             Data = -Data;
-            vp8_write_literal(&header_bc, (Data & 0x3F), 6);
-            vp8_write_bit(&header_bc, 1);    // sign
+            vp9_write_literal(&header_bc, (Data & 0x3F), 6);
+            vp9_write_bit(&header_bc, 1);    // sign
           }
         } else {
-          vp8_write_bit(&header_bc, 0);
+          vp9_write_bit(&header_bc, 0);
         }
       }
     }
   }
 
   // signal here is multi token partition is enabled
-  // vp8_write_literal(&header_bc, pc->multi_token_partition, 2);
-  vp8_write_literal(&header_bc, 0, 2);
+  // vp9_write_literal(&header_bc, pc->multi_token_partition, 2);
+  vp9_write_literal(&header_bc, 0, 2);
 
   // Frame Q baseline quantizer index
-  vp8_write_literal(&header_bc, pc->base_qindex, QINDEX_BITS);
+  vp9_write_literal(&header_bc, pc->base_qindex, QINDEX_BITS);
 
   // Transmit Dc, Second order and Uv quantizer delta information
   put_delta_q(&header_bc, pc->y1dc_delta_q);
@@ -2126,8 +2120,8 @@
   // When there is a key frame all reference buffers are updated using the new key frame
   if (pc->frame_type != KEY_FRAME) {
     // Should the GF or ARF be updated using the transmitted frame or buffer
-    vp8_write_bit(&header_bc, pc->refresh_golden_frame);
-    vp8_write_bit(&header_bc, pc->refresh_alt_ref_frame);
+    vp9_write_bit(&header_bc, pc->refresh_golden_frame);
+    vp9_write_bit(&header_bc, pc->refresh_alt_ref_frame);
 
     // For inter frames the current default behavior is that when
     // cm->refresh_golden_frame is set we copy the old GF over to
@@ -2137,31 +2131,31 @@
 
     // If not being updated from current frame should either GF or ARF be updated from another buffer
     if (!pc->refresh_golden_frame)
-      vp8_write_literal(&header_bc, pc->copy_buffer_to_gf, 2);
+      vp9_write_literal(&header_bc, pc->copy_buffer_to_gf, 2);
 
     if (!pc->refresh_alt_ref_frame)
-      vp8_write_literal(&header_bc, pc->copy_buffer_to_arf, 2);
+      vp9_write_literal(&header_bc, pc->copy_buffer_to_arf, 2);
 
     // Indicate reference frame sign bias for Golden and ARF frames (always 0 for last frame buffer)
-    vp8_write_bit(&header_bc, pc->ref_frame_sign_bias[GOLDEN_FRAME]);
-    vp8_write_bit(&header_bc, pc->ref_frame_sign_bias[ALTREF_FRAME]);
+    vp9_write_bit(&header_bc, pc->ref_frame_sign_bias[GOLDEN_FRAME]);
+    vp9_write_bit(&header_bc, pc->ref_frame_sign_bias[ALTREF_FRAME]);
 
     // Signal whether to allow high MV precision
-    vp8_write_bit(&header_bc, (xd->allow_high_precision_mv) ? 1 : 0);
+    vp9_write_bit(&header_bc, (xd->allow_high_precision_mv) ? 1 : 0);
     if (pc->mcomp_filter_type == SWITCHABLE) {
       /* Check to see if only one of the filters is actually used */
-      int count[VP8_SWITCHABLE_FILTERS];
+      int count[VP9_SWITCHABLE_FILTERS];
       int i, j, c = 0;
-      for (i = 0; i < VP8_SWITCHABLE_FILTERS; ++i) {
+      for (i = 0; i < VP9_SWITCHABLE_FILTERS; ++i) {
         count[i] = 0;
-        for (j = 0; j <= VP8_SWITCHABLE_FILTERS; ++j) {
+        for (j = 0; j <= VP9_SWITCHABLE_FILTERS; ++j) {
           count[i] += cpi->switchable_interp_count[j][i];
         }
         c += (count[i] > 0);
       }
       if (c == 1) {
         /* Only one filter is used. So set the filter at frame level */
-        for (i = 0; i < VP8_SWITCHABLE_FILTERS; ++i) {
+        for (i = 0; i < VP9_SWITCHABLE_FILTERS; ++i) {
           if (count[i]) {
             pc->mcomp_filter_type = vp9_switchable_interp[i];
             break;
@@ -2170,15 +2164,15 @@
       }
     }
     // Signal the type of subpel filter to use
-    vp8_write_bit(&header_bc, (pc->mcomp_filter_type == SWITCHABLE));
+    vp9_write_bit(&header_bc, (pc->mcomp_filter_type == SWITCHABLE));
     if (pc->mcomp_filter_type != SWITCHABLE)
-      vp8_write_literal(&header_bc, (pc->mcomp_filter_type), 2);
+      vp9_write_literal(&header_bc, (pc->mcomp_filter_type), 2);
   }
 
-  vp8_write_bit(&header_bc, pc->refresh_entropy_probs);
+  vp9_write_bit(&header_bc, pc->refresh_entropy_probs);
 
   if (pc->frame_type != KEY_FRAME)
-    vp8_write_bit(&header_bc, pc->refresh_last_frame);
+    vp9_write_bit(&header_bc, pc->refresh_last_frame);
 
 #ifdef ENTROPY_STATS
   if (pc->frame_type == INTER_FRAME)
@@ -2187,25 +2181,25 @@
     active_section = 7;
 #endif
 
-  vp8_clear_system_state();  // __asm emms;
+  vp9_clear_system_state();  // __asm emms;
 
-  vp8_copy(cpi->common.fc.pre_coef_probs, cpi->common.fc.coef_probs);
-  vp8_copy(cpi->common.fc.pre_hybrid_coef_probs, cpi->common.fc.hybrid_coef_probs);
-  vp8_copy(cpi->common.fc.pre_coef_probs_8x8, cpi->common.fc.coef_probs_8x8);
-  vp8_copy(cpi->common.fc.pre_hybrid_coef_probs_8x8, cpi->common.fc.hybrid_coef_probs_8x8);
-  vp8_copy(cpi->common.fc.pre_coef_probs_16x16, cpi->common.fc.coef_probs_16x16);
-  vp8_copy(cpi->common.fc.pre_hybrid_coef_probs_16x16, cpi->common.fc.hybrid_coef_probs_16x16);
-  vp8_copy(cpi->common.fc.pre_ymode_prob, cpi->common.fc.ymode_prob);
-  vp8_copy(cpi->common.fc.pre_uv_mode_prob, cpi->common.fc.uv_mode_prob);
-  vp8_copy(cpi->common.fc.pre_bmode_prob, cpi->common.fc.bmode_prob);
-  vp8_copy(cpi->common.fc.pre_sub_mv_ref_prob, cpi->common.fc.sub_mv_ref_prob);
-  vp8_copy(cpi->common.fc.pre_mbsplit_prob, cpi->common.fc.mbsplit_prob);
-  vp8_copy(cpi->common.fc.pre_i8x8_mode_prob, cpi->common.fc.i8x8_mode_prob);
+  vp9_copy(cpi->common.fc.pre_coef_probs, cpi->common.fc.coef_probs);
+  vp9_copy(cpi->common.fc.pre_hybrid_coef_probs, cpi->common.fc.hybrid_coef_probs);
+  vp9_copy(cpi->common.fc.pre_coef_probs_8x8, cpi->common.fc.coef_probs_8x8);
+  vp9_copy(cpi->common.fc.pre_hybrid_coef_probs_8x8, cpi->common.fc.hybrid_coef_probs_8x8);
+  vp9_copy(cpi->common.fc.pre_coef_probs_16x16, cpi->common.fc.coef_probs_16x16);
+  vp9_copy(cpi->common.fc.pre_hybrid_coef_probs_16x16, cpi->common.fc.hybrid_coef_probs_16x16);
+  vp9_copy(cpi->common.fc.pre_ymode_prob, cpi->common.fc.ymode_prob);
+  vp9_copy(cpi->common.fc.pre_uv_mode_prob, cpi->common.fc.uv_mode_prob);
+  vp9_copy(cpi->common.fc.pre_bmode_prob, cpi->common.fc.bmode_prob);
+  vp9_copy(cpi->common.fc.pre_sub_mv_ref_prob, cpi->common.fc.sub_mv_ref_prob);
+  vp9_copy(cpi->common.fc.pre_mbsplit_prob, cpi->common.fc.mbsplit_prob);
+  vp9_copy(cpi->common.fc.pre_i8x8_mode_prob, cpi->common.fc.i8x8_mode_prob);
   cpi->common.fc.pre_nmvc = cpi->common.fc.nmvc;
-  vp8_zero(cpi->sub_mv_ref_count);
-  vp8_zero(cpi->mbsplit_count);
-  vp8_zero(cpi->common.fc.mv_ref_ct)
-  vp8_zero(cpi->common.fc.mv_ref_ct_a)
+  vp9_zero(cpi->sub_mv_ref_count);
+  vp9_zero(cpi->mbsplit_count);
+  vp9_zero(cpi->common.fc.mv_ref_ct)
+  vp9_zero(cpi->common.fc.mv_ref_ct_a)
 
   update_coef_probs(cpi, &header_bc);
 
@@ -2214,18 +2208,18 @@
 #endif
 
   // Write out the mb_no_coeff_skip flag
-  vp8_write_bit(&header_bc, pc->mb_no_coeff_skip);
+  vp9_write_bit(&header_bc, pc->mb_no_coeff_skip);
   if (pc->mb_no_coeff_skip) {
     int k;
 
     vp9_update_skip_probs(cpi);
     for (k = 0; k < MBSKIP_CONTEXTS; ++k)
-      vp8_write_literal(&header_bc, pc->mbskip_pred_probs[k], 8);
+      vp9_write_literal(&header_bc, pc->mbskip_pred_probs[k], 8);
   }
 
   if (pc->frame_type == KEY_FRAME) {
     if (!pc->kf_ymode_probs_update) {
-      vp8_write_literal(&header_bc, pc->kf_ymode_probs_index, 3);
+      vp9_write_literal(&header_bc, pc->kf_ymode_probs_index, 3);
     }
   } else {
     // Update the probabilities used to encode reference frame data
@@ -2237,33 +2231,33 @@
 
 #if CONFIG_PRED_FILTER
     // Write the prediction filter mode used for this frame
-    vp8_write_literal(&header_bc, pc->pred_filter_mode, 2);
+    vp9_write_literal(&header_bc, pc->pred_filter_mode, 2);
 
     // Write prediction filter on/off probability if signaling at MB level
     if (pc->pred_filter_mode == 2)
-      vp8_write_literal(&header_bc, pc->prob_pred_filter_off, 8);
+      vp9_write_literal(&header_bc, pc->prob_pred_filter_off, 8);
 
 #endif
     if (pc->mcomp_filter_type == SWITCHABLE)
       update_switchable_interp_probs(cpi, &header_bc);
 
-    vp8_write_literal(&header_bc, pc->prob_intra_coded, 8);
-    vp8_write_literal(&header_bc, pc->prob_last_coded, 8);
-    vp8_write_literal(&header_bc, pc->prob_gf_coded, 8);
+    vp9_write_literal(&header_bc, pc->prob_intra_coded, 8);
+    vp9_write_literal(&header_bc, pc->prob_last_coded, 8);
+    vp9_write_literal(&header_bc, pc->prob_gf_coded, 8);
 
     {
       const int comp_pred_mode = cpi->common.comp_pred_mode;
       const int use_compound_pred = (comp_pred_mode != SINGLE_PREDICTION_ONLY);
       const int use_hybrid_pred = (comp_pred_mode == HYBRID_PREDICTION);
 
-      vp8_write(&header_bc, use_compound_pred, 128);
+      vp9_write(&header_bc, use_compound_pred, 128);
       if (use_compound_pred) {
-        vp8_write(&header_bc, use_hybrid_pred, 128);
+        vp9_write(&header_bc, use_hybrid_pred, 128);
         if (use_hybrid_pred) {
           for (i = 0; i < COMP_PRED_CONTEXTS; i++) {
             pc->prob_comppred[i] = get_binary_prob(cpi->single_pred_count[i],
                                                    cpi->comp_pred_count[i]);
-            vp8_write_literal(&header_bc, pc->prob_comppred[i], 8);
+            vp9_write_literal(&header_bc, pc->prob_comppred[i], 8);
           }
         }
       }
@@ -2295,7 +2289,7 @@
     dest[2] = v >> 16;
   }
 
-  *size = VP8_HEADER_SIZE + extra_bytes_packed + header_bc.pos;
+  *size = VP9_HEADER_SIZE + extra_bytes_packed + header_bc.pos;
   vp9_start_encode(&residual_bc, cx_data + header_bc.pos);
 
   if (pc->frame_type == KEY_FRAME) {
@@ -2320,8 +2314,8 @@
   int Sum;
   fprintf(f, "\n/* Update probabilities for token entropy tree. */\n\n");
 
-  fprintf(f, "const vp8_prob\n"
-          "vp8_coef_update_probs[BLOCK_TYPES]\n"
+  fprintf(f, "const vp9_prob\n"
+          "vp9_coef_update_probs[BLOCK_TYPES]\n"
           "                     [COEF_BANDS]\n"
           "                     [PREV_COEF_CONTEXTS]\n"
           "                     [ENTROPY_NODES] = {\n");
@@ -2344,8 +2338,8 @@
   }
   fprintf(f, "};\n");
 
-  fprintf(f, "const vp8_prob\n"
-          "vp8_coef_update_probs_8x8[BLOCK_TYPES_8X8]\n"
+  fprintf(f, "const vp9_prob\n"
+          "vp9_coef_update_probs_8x8[BLOCK_TYPES_8X8]\n"
           "                         [COEF_BANDS]\n"
           "                         [PREV_COEF_CONTEXTS]\n"
           "                         [ENTROPY_NODES] = {\n");
@@ -2367,8 +2361,8 @@
     fprintf(f, "  },\n");
   }
 
-  fprintf(f, "const vp8_prob\n"
-          "vp8_coef_update_probs_16x16[BLOCK_TYPES_16X16]\n"
+  fprintf(f, "const vp9_prob\n"
+          "vp9_coef_update_probs_16x16[BLOCK_TYPES_16X16]\n"
           "                           [COEF_BANDS]\n"
           "                           [PREV_COEF_CONTEXTS]\n"
           "                           [ENTROPY_NODES] = {\n");
diff --git a/vp8/encoder/block.h b/vp8/encoder/block.h
index 1e70f16..a77017c 100644
--- a/vp8/encoder/block.h
+++ b/vp8/encoder/block.h
@@ -129,11 +129,11 @@
 
   int mbmode_cost[2][MB_MODE_COUNT];
   int intra_uv_mode_cost[2][MB_MODE_COUNT];
-  int bmode_costs[VP8_BINTRAMODES][VP8_BINTRAMODES][VP8_BINTRAMODES];
+  int bmode_costs[VP9_BINTRAMODES][VP9_BINTRAMODES][VP9_BINTRAMODES];
   int i8x8_mode_costs[MB_MODE_COUNT];
   int inter_bmode_costs[B_MODE_COUNT];
-  int switchable_interp_costs[VP8_SWITCHABLE_FILTERS + 1]
-                             [VP8_SWITCHABLE_FILTERS];
+  int switchable_interp_costs[VP9_SWITCHABLE_FILTERS + 1]
+                             [VP9_SWITCHABLE_FILTERS];
 
   // These define limits to motion vector components to prevent them
   // from extending outside the UMV borders
diff --git a/vp8/encoder/boolhuff.c b/vp8/encoder/boolhuff.c
index 1f885d8..0cb4b68 100644
--- a/vp8/encoder/boolhuff.c
+++ b/vp8/encoder/boolhuff.c
@@ -53,7 +53,7 @@
   int i;
 
   for (i = 0; i < 32; i++)
-    vp8_encode_bool(br, 0, 128);
+    encode_bool(br, 0, 128);
 }
 
 
@@ -61,8 +61,7 @@
   int bit;
 
   for (bit = bits - 1; bit >= 0; bit--)
-    vp8_encode_bool(br, (1 & (data >> bit)), 0x80);
-
+    encode_bool(br, (1 & (data >> bit)), 0x80);
 }
 
 int vp9_recenter_nonneg(int v, int m) {
diff --git a/vp8/encoder/boolhuff.h b/vp8/encoder/boolhuff.h
index 3fbe41e..e5fd0fb 100644
--- a/vp8/encoder/boolhuff.h
+++ b/vp8/encoder/boolhuff.h
@@ -49,7 +49,7 @@
 DECLARE_ALIGNED(16, extern const unsigned char, vp9_norm[256]);
 
 
-static void vp8_encode_bool(BOOL_CODER *br, int bit, int probability) {
+static void encode_bool(BOOL_CODER *br, int bit, int probability) {
   unsigned int split;
   int count = br->count;
   unsigned int range = br->range;
diff --git a/vp8/encoder/dct.c b/vp8/encoder/dct.c
index 18d782c..badb135 100644
--- a/vp8/encoder/dct.c
+++ b/vp8/encoder/dct.c
@@ -529,7 +529,7 @@
 
 void vp9_fht_float_c(const int16_t *input, int pitch, int16_t *output,
                TX_TYPE tx_type, int tx_dim) {
-  vp8_clear_system_state();  // Make it simd safe : __asm emms;
+  vp9_clear_system_state();  // Make it simd safe : __asm emms;
   {
     int i, j, k;
     float bufa[256], bufb[256];  // buffers are for floating-point test purpose
@@ -641,7 +641,7 @@
       pfa += tx_dim;
     }
   }
-  vp8_clear_system_state();  // Make it simd safe : __asm emms;
+  vp9_clear_system_state();  // Make it simd safe : __asm emms;
 }
 
 /* Converted the transforms to integer form. */
@@ -918,7 +918,7 @@
 static const double C15 = 0.098017140329561;
 
 static void dct16x16_1d(double input[16], double output[16]) {
-  vp8_clear_system_state(); // Make it simd safe : __asm emms;
+  vp9_clear_system_state(); // Make it simd safe : __asm emms;
   {
     double step[16];
     double intermediate[16];
@@ -1074,11 +1074,11 @@
     temp1 = temp2 + temp1;
     output[ 5] = 2*(temp1*C8);
   }
-  vp8_clear_system_state(); // Make it simd safe : __asm emms;
+  vp9_clear_system_state(); // Make it simd safe : __asm emms;
 }
 
 void vp9_short_fdct16x16_c(short *input, short *out, int pitch) {
-  vp8_clear_system_state(); // Make it simd safe : __asm emms;
+  vp9_clear_system_state(); // Make it simd safe : __asm emms;
   {
     int shortpitch = pitch >> 1;
     int i, j;
@@ -1105,5 +1105,5 @@
     for (i = 0; i < 256; i++)
         out[i] = (short)round(output[i]/2);
   }
-  vp8_clear_system_state(); // Make it simd safe : __asm emms;
+  vp9_clear_system_state(); // Make it simd safe : __asm emms;
 }
diff --git a/vp8/encoder/encodeframe.c b/vp8/encoder/encodeframe.c
index 5eae1f1..8695cb0 100644
--- a/vp8/encoder/encodeframe.c
+++ b/vp8/encoder/encodeframe.c
@@ -88,12 +88,12 @@
 
 #ifdef MODE_STATS
 unsigned int inter_y_modes[MB_MODE_COUNT];
-unsigned int inter_uv_modes[VP8_UV_MODES];
+unsigned int inter_uv_modes[VP9_UV_MODES];
 unsigned int inter_b_modes[B_MODE_COUNT];
-unsigned int y_modes[VP8_YMODES];
-unsigned int i8x8_modes[VP8_I8X8_MODES];
-unsigned int uv_modes[VP8_UV_MODES];
-unsigned int uv_modes_y[VP8_YMODES][VP8_UV_MODES];
+unsigned int y_modes[VP9_YMODES];
+unsigned int i8x8_modes[VP9_I8X8_MODES];
+unsigned int uv_modes[VP9_UV_MODES];
+unsigned int uv_modes_y[VP9_YMODES][VP9_UV_MODES];
 unsigned int b_modes[B_MODE_COUNT];
 #endif
 
@@ -103,14 +103,14 @@
  * This also avoids the need for divide by zero checks in
  *  vp9_activity_masking().
  */
-#define VP8_ACTIVITY_AVG_MIN (64)
+#define VP9_ACTIVITY_AVG_MIN (64)
 
 /* This is used as a reference when computing the source variance for the
  *  purposes of activity masking.
  * Eventually this should be replaced by custom no-reference routines,
  *  which will be faster.
  */
-static const unsigned char VP8_VAR_OFFS[16] = {
+static const unsigned char VP9_VAR_OFFS[16] = {
   128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128
 };
 
@@ -126,7 +126,7 @@
    *  lambda using a non-linear combination (e.g., the smallest, or second
    *  smallest, etc.).
    */
-  act = vp9_variance16x16(x->src.y_buffer, x->src.y_stride, VP8_VAR_OFFS, 0,
+  act = vp9_variance16x16(x->src.y_buffer, x->src.y_stride, VP9_VAR_OFFS, 0,
                           &sse);
   act = act << 4;
 
@@ -161,8 +161,8 @@
     mb_activity = tt_activity_measure(cpi, x);
   }
 
-  if (mb_activity < VP8_ACTIVITY_AVG_MIN)
-    mb_activity = VP8_ACTIVITY_AVG_MIN;
+  if (mb_activity < VP9_ACTIVITY_AVG_MIN)
+    mb_activity = VP9_ACTIVITY_AVG_MIN;
 
   return mb_activity;
 }
@@ -214,8 +214,8 @@
   cpi->activity_avg = (unsigned int)(activity_sum / cpi->common.MBs);
 #endif
 
-  if (cpi->activity_avg < VP8_ACTIVITY_AVG_MIN)
-    cpi->activity_avg = VP8_ACTIVITY_AVG_MIN;
+  if (cpi->activity_avg < VP9_ACTIVITY_AVG_MIN)
+    cpi->activity_avg = VP9_ACTIVITY_AVG_MIN;
 
   // Experimental code: return fixed value normalized for several clips
   if (ALT_ACT_MEASURE)
@@ -1149,7 +1149,7 @@
 #endif
     pick_mb_modes(cpi, cm, mb_row, mb_col, x, xd, tp, &mb_rate, &mb_dist);
 #if CONFIG_SUPERBLOCKS
-    mb_rate += vp8_cost_bit(cm->sb_coded, 0);
+    mb_rate += vp9_cost_bit(cm->sb_coded, 0);
 #endif
 
     x->src.y_buffer -= 32;
@@ -1176,7 +1176,7 @@
       /* Pick a mode assuming that it applies to all 4 of the MBs in the SB */
       xd->mode_info_context->mbmi.encoded_as_sb = 1;
       pick_sb_modes(cpi, cm, mb_row, mb_col, x, xd, tp, &sb_rate, &sb_dist);
-      sb_rate += vp8_cost_bit(cm->sb_coded, 1);
+      sb_rate += vp9_cost_bit(cm->sb_coded, 1);
     }
 
     /* Decide whether to encode as a SB or 4xMBs */
@@ -1276,20 +1276,19 @@
   xd->mode_info_context->mbmi.mode = DC_PRED;
   xd->mode_info_context->mbmi.uv_mode = DC_PRED;
 
-  vp8_zero(cpi->count_mb_ref_frame_usage)
-  vp8_zero(cpi->bmode_count)
-  vp8_zero(cpi->ymode_count)
-  vp8_zero(cpi->i8x8_mode_count)
-  vp8_zero(cpi->y_uv_mode_count)
-  vp8_zero(cpi->sub_mv_ref_count)
-  vp8_zero(cpi->mbsplit_count)
-  vp8_zero(cpi->common.fc.mv_ref_ct)
-  vp8_zero(cpi->common.fc.mv_ref_ct_a)
+  vp9_zero(cpi->count_mb_ref_frame_usage)
+  vp9_zero(cpi->bmode_count)
+  vp9_zero(cpi->ymode_count)
+  vp9_zero(cpi->i8x8_mode_count)
+  vp9_zero(cpi->y_uv_mode_count)
+  vp9_zero(cpi->sub_mv_ref_count)
+  vp9_zero(cpi->mbsplit_count)
+  vp9_zero(cpi->common.fc.mv_ref_ct)
+  vp9_zero(cpi->common.fc.mv_ref_ct_a)
 #if CONFIG_SUPERBLOCKS
-  vp8_zero(cpi->sb_ymode_count)
+  vp9_zero(cpi->sb_ymode_count)
   cpi->sb_count = 0;
 #endif
-  // vp8_zero(cpi->uv_mode_count)
 
   vpx_memset(cm->above_context, 0,
              sizeof(ENTROPY_CONTEXT_PLANES) * cm->mb_cols);
@@ -1317,7 +1316,7 @@
 
 #if CONFIG_NEW_MVREF
   // temp stats reset
-  vp8_zero( cpi->best_ref_index_counts );
+  vp9_zero( cpi->best_ref_index_counts );
 #endif
 
 // debug output
@@ -1353,18 +1352,18 @@
   cpi->pred_filter_on_count = 0;
   cpi->pred_filter_off_count = 0;
 #endif
-  vp8_zero(cpi->switchable_interp_count);
+  vp9_zero(cpi->switchable_interp_count);
 
   xd->mode_info_context = cm->mi;
   xd->prev_mode_info_context = cm->prev_mi;
 
-  vp8_zero(cpi->NMVcount);
-  vp8_zero(cpi->coef_counts);
-  vp8_zero(cpi->hybrid_coef_counts);
-  vp8_zero(cpi->coef_counts_8x8);
-  vp8_zero(cpi->hybrid_coef_counts_8x8);
-  vp8_zero(cpi->coef_counts_16x16);
-  vp8_zero(cpi->hybrid_coef_counts_16x16);
+  vp9_zero(cpi->NMVcount);
+  vp9_zero(cpi->coef_counts);
+  vp9_zero(cpi->hybrid_coef_counts);
+  vp9_zero(cpi->coef_counts_8x8);
+  vp9_zero(cpi->hybrid_coef_counts_8x8);
+  vp9_zero(cpi->coef_counts_16x16);
+  vp9_zero(cpi->hybrid_coef_counts_16x16);
 
   vp9_frame_init_quantizer(cpi);
 
@@ -1430,20 +1429,20 @@
   int ref_flags = cpi->ref_frame_flags;
 
   if (vp9_segfeature_active(xd, 1, SEG_LVL_REF_FRAME)) {
-    if ((ref_flags & (VP8_LAST_FLAG | VP8_GOLD_FLAG)) == (VP8_LAST_FLAG | VP8_GOLD_FLAG) &&
+    if ((ref_flags & (VP9_LAST_FLAG | VP9_GOLD_FLAG)) == (VP9_LAST_FLAG | VP9_GOLD_FLAG) &&
         vp9_check_segref(xd, 1, LAST_FRAME))
       return 1;
-    if ((ref_flags & (VP8_GOLD_FLAG | VP8_ALT_FLAG)) == (VP8_GOLD_FLAG | VP8_ALT_FLAG) &&
+    if ((ref_flags & (VP9_GOLD_FLAG | VP9_ALT_FLAG)) == (VP9_GOLD_FLAG | VP9_ALT_FLAG) &&
         vp9_check_segref(xd, 1, GOLDEN_FRAME))
       return 1;
-    if ((ref_flags & (VP8_ALT_FLAG  | VP8_LAST_FLAG)) == (VP8_ALT_FLAG  | VP8_LAST_FLAG) &&
+    if ((ref_flags & (VP9_ALT_FLAG  | VP9_LAST_FLAG)) == (VP9_ALT_FLAG  | VP9_LAST_FLAG) &&
         vp9_check_segref(xd, 1, ALTREF_FRAME))
       return 1;
     return 0;
   } else {
-    return (!!(ref_flags & VP8_GOLD_FLAG) +
-            !!(ref_flags & VP8_LAST_FLAG) +
-            !!(ref_flags & VP8_ALT_FLAG)) >= 2;
+    return (!!(ref_flags & VP9_GOLD_FLAG) +
+            !!(ref_flags & VP9_LAST_FLAG) +
+            !!(ref_flags & VP9_ALT_FLAG)) >= 2;
   }
 }
 
@@ -1868,7 +1867,7 @@
   uint8_t *vdst = xd->dst.v_buffer;
   int src_y_stride = x->src.y_stride, dst_y_stride = xd->dst.y_stride;
   int src_uv_stride = x->src.uv_stride, dst_uv_stride = xd->dst.uv_stride;
-  const VP8_ENCODER_RTCD *rtcd = IF_RTCD(&cpi->rtcd);
+  const VP9_ENCODER_RTCD *rtcd = IF_RTCD(&cpi->rtcd);
   TOKENEXTRA *tp[4];
   int skip[4];
   MODE_INFO *mi = x->e_mbd.mode_info_context;
@@ -1984,9 +1983,6 @@
     vp9_tokenize_mb(cpi, &x->e_mbd, t, 1);
 #endif
 }
-#ifdef SPEEDSTATS
-extern int cnt_pm;
-#endif
 
 extern void vp9_fix_contexts(MACROBLOCKD *xd);
 
@@ -2190,7 +2186,7 @@
   uint8_t *vdst = xd->dst.v_buffer;
   int src_y_stride = x->src.y_stride, dst_y_stride = xd->dst.y_stride;
   int src_uv_stride = x->src.uv_stride, dst_uv_stride = xd->dst.uv_stride;
-  const VP8_ENCODER_RTCD *rtcd = IF_RTCD(&cpi->rtcd);
+  const VP9_ENCODER_RTCD *rtcd = IF_RTCD(&cpi->rtcd);
   unsigned int segment_id = xd->mode_info_context->mbmi.segment_id;
   int seg_ref_active;
   unsigned char ref_pred_flag;
diff --git a/vp8/encoder/encodeintra.c b/vp8/encoder/encodeintra.c
index 074becd..b935402 100644
--- a/vp8/encoder/encodeintra.c
+++ b/vp8/encoder/encodeintra.c
@@ -52,7 +52,7 @@
   return intra_pred_var;
 }
 
-void vp9_encode_intra4x4block(const VP8_ENCODER_RTCD *rtcd,
+void vp9_encode_intra4x4block(const VP9_ENCODER_RTCD *rtcd,
                               MACROBLOCK *x, int ib) {
   BLOCKD *b = &x->e_mbd.block[ib];
   BLOCK *be = &x->block[ib];
@@ -64,7 +64,7 @@
     vp9_intra4x4_predict(b, b->bmi.as_mode.first, b->predictor);
 #if CONFIG_COMP_INTRA_PRED
   } else {
-    vp8_comp_intra4x4_predict(b, b->bmi.as_mode.first, b->bmi.as_mode.second,
+    vp9_comp_intra4x4_predict(b, b->bmi.as_mode.first, b->bmi.as_mode.second,
                               b->predictor);
   }
 #endif
@@ -85,7 +85,7 @@
   vp9_recon_b(b->predictor, b->diff, *(b->base_dst) + b->dst, b->dst_stride);
 }
 
-void vp9_encode_intra4x4mby(const VP8_ENCODER_RTCD *rtcd, MACROBLOCK *mb) {
+void vp9_encode_intra4x4mby(const VP9_ENCODER_RTCD *rtcd, MACROBLOCK *mb) {
   int i;
 
   for (i = 0; i < 16; i++)
@@ -93,7 +93,7 @@
   return;
 }
 
-void vp9_encode_intra16x16mby(const VP8_ENCODER_RTCD *rtcd, MACROBLOCK *x) {
+void vp9_encode_intra16x16mby(const VP9_ENCODER_RTCD *rtcd, MACROBLOCK *x) {
   MACROBLOCKD *xd = &x->e_mbd;
   BLOCK *b = &x->block[0];
   TX_SIZE tx_size = xd->mode_info_context->mbmi.txfm_size;
@@ -105,7 +105,7 @@
     vp9_build_intra_predictors_mby(xd);
 #if CONFIG_COMP_INTRA_PRED
   else
-    vp8_build_comp_intra_predictors_mby(xd);
+    vp9_build_comp_intra_predictors_mby(xd);
 #endif
 
   vp9_subtract_mby(x->src_diff, *(b->base_src), xd->predictor, b->src_stride);
@@ -143,7 +143,7 @@
   vp9_recon_mby(xd);
 }
 
-void vp9_encode_intra16x16mbuv(const VP8_ENCODER_RTCD *rtcd, MACROBLOCK *x) {
+void vp9_encode_intra16x16mbuv(const VP9_ENCODER_RTCD *rtcd, MACROBLOCK *x) {
   MACROBLOCKD *xd = &x->e_mbd;
   TX_SIZE tx_size = xd->mode_info_context->mbmi.txfm_size;
 
@@ -153,7 +153,7 @@
     vp9_build_intra_predictors_mbuv(xd);
 #if CONFIG_COMP_INTRA_PRED
   } else {
-    vp8_build_comp_intra_predictors_mbuv(xd);
+    vp9_build_comp_intra_predictors_mbuv(xd);
   }
 #endif
 
@@ -177,7 +177,7 @@
   vp9_recon_intra_mbuv(xd);
 }
 
-void vp9_encode_intra8x8(const VP8_ENCODER_RTCD *rtcd,
+void vp9_encode_intra8x8(const VP9_ENCODER_RTCD *rtcd,
                          MACROBLOCK *x, int ib) {
   MACROBLOCKD *xd = &x->e_mbd;
   BLOCKD *b = &xd->block[ib];
@@ -192,7 +192,7 @@
     vp9_intra8x8_predict(b, b->bmi.as_mode.first, b->predictor);
 #if CONFIG_COMP_INTRA_PRED
   } else {
-    vp8_comp_intra8x8_predict(b, b->bmi.as_mode.first, b->bmi.as_mode.second,
+    vp9_comp_intra8x8_predict(b, b->bmi.as_mode.first, b->bmi.as_mode.second,
                               b->predictor);
   }
 #endif
@@ -213,7 +213,7 @@
     } else {
       x->vp9_short_fdct8x8(be->src_diff, (x->block + idx)->coeff, 32);
       x->quantize_b_8x8(x->block + idx, xd->block + idx);
-      vp8_idct_idct8(xd->block[idx].dqcoeff, xd->block[ib].diff, 32);
+      vp9_idct_idct8(xd->block[idx].dqcoeff, xd->block[ib].diff, 32);
     }
   } else {
     for (i = 0; i < 4; i++) {
@@ -234,7 +234,7 @@
   }
 }
 
-void vp9_encode_intra8x8mby(const VP8_ENCODER_RTCD *rtcd, MACROBLOCK *x) {
+void vp9_encode_intra8x8mby(const VP9_ENCODER_RTCD *rtcd, MACROBLOCK *x) {
   int i, ib;
 
   for (i = 0; i < 4; i++) {
@@ -243,7 +243,7 @@
   }
 }
 
-void vp9_encode_intra_uv4x4(const VP8_ENCODER_RTCD *rtcd,
+void vp9_encode_intra_uv4x4(const VP9_ENCODER_RTCD *rtcd,
                             MACROBLOCK *x, int ib,
                             int mode, int second) {
   BLOCKD *b = &x->e_mbd.block[ib];
@@ -255,7 +255,7 @@
     vp9_intra_uv4x4_predict(b, mode, b->predictor);
 #if CONFIG_COMP_INTRA_PRED
   } else {
-    vp8_comp_intra_uv4x4_predict(b, mode, second, b->predictor);
+    vp9_comp_intra_uv4x4_predict(b, mode, second, b->predictor);
   }
 #endif
 
@@ -268,7 +268,7 @@
   vp9_recon_uv_b_c(b->predictor,b->diff, *(b->base_dst) + b->dst, b->dst_stride);
 }
 
-void vp9_encode_intra8x8mbuv(const VP8_ENCODER_RTCD *rtcd, MACROBLOCK *x) {
+void vp9_encode_intra8x8mbuv(const VP9_ENCODER_RTCD *rtcd, MACROBLOCK *x) {
   int i, ib, mode, second;
   BLOCKD *b;
 
diff --git a/vp8/encoder/encodeintra.h b/vp8/encoder/encodeintra.h
index 29ecc0e..905ccc1 100644
--- a/vp8/encoder/encodeintra.h
+++ b/vp8/encoder/encodeintra.h
@@ -14,14 +14,14 @@
 #include "onyx_int.h"
 
 int vp9_encode_intra(VP9_COMP *cpi, MACROBLOCK *x, int use_16x16_pred);
-void vp9_encode_intra16x16mby(const VP8_ENCODER_RTCD *, MACROBLOCK *x);
-void vp9_encode_intra16x16mbuv(const VP8_ENCODER_RTCD *, MACROBLOCK *x);
-void vp9_encode_intra4x4mby(const VP8_ENCODER_RTCD *, MACROBLOCK *mb);
-void vp9_encode_intra4x4block(const VP8_ENCODER_RTCD *rtcd,
+void vp9_encode_intra16x16mby(const VP9_ENCODER_RTCD *, MACROBLOCK *x);
+void vp9_encode_intra16x16mbuv(const VP9_ENCODER_RTCD *, MACROBLOCK *x);
+void vp9_encode_intra4x4mby(const VP9_ENCODER_RTCD *, MACROBLOCK *mb);
+void vp9_encode_intra4x4block(const VP9_ENCODER_RTCD *rtcd,
                               MACROBLOCK *x, int ib);
-void vp9_encode_intra8x8mby(const VP8_ENCODER_RTCD *rtcd, MACROBLOCK *x);
-void vp9_encode_intra8x8mbuv(const VP8_ENCODER_RTCD *rtcd, MACROBLOCK *x);
-void vp9_encode_intra8x8(const VP8_ENCODER_RTCD *rtcd,
+void vp9_encode_intra8x8mby(const VP9_ENCODER_RTCD *rtcd, MACROBLOCK *x);
+void vp9_encode_intra8x8mbuv(const VP9_ENCODER_RTCD *rtcd, MACROBLOCK *x);
+void vp9_encode_intra8x8(const VP9_ENCODER_RTCD *rtcd,
                          MACROBLOCK *x, int ib);
 
 #endif
diff --git a/vp8/encoder/encodemb.c b/vp8/encoder/encodemb.c
index 456468d..d6221da 100644
--- a/vp8/encoder/encodemb.c
+++ b/vp8/encoder/encodemb.c
@@ -26,10 +26,6 @@
 #define IF_RTCD(x) NULL
 #endif
 
-#ifdef ENC_DEBUG
-extern int enc_debug;
-#endif
-
 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;
@@ -123,7 +119,7 @@
   vp9_subtract_mby_s_c(diff, src, stride, pred, 16);
 }
 
-static void vp8_subtract_mb(const VP8_ENCODER_RTCD *rtcd, MACROBLOCK *x) {
+static void subtract_mb(const VP9_ENCODER_RTCD *rtcd, MACROBLOCK *x) {
   BLOCK *b = &x->block[0];
 
   vp9_subtract_mby(x->src_diff, *(b->base_src), x->e_mbd.predictor,
@@ -173,7 +169,7 @@
   vp9_transform_mbuv_4x4(x);
 }
 
-void vp9_build_dcblock_8x8(MACROBLOCK *x) {
+static void build_dcblock_8x8(MACROBLOCK *x) {
   int16_t *src_diff_ptr = x->block[24].src_diff;
   int i;
 
@@ -200,7 +196,7 @@
 
   if (x->e_mbd.mode_info_context->mbmi.mode != SPLITMV) {
     // build dc block from 2x2 y dc values
-    vp9_build_dcblock_8x8(x);
+    build_dcblock_8x8(x);
 
     // do 2nd order transform on the dc block
     x->short_fhaar2x2(&x->block[24].src_diff[0],
@@ -223,7 +219,7 @@
 }
 
 void vp9_transform_mby_16x16(MACROBLOCK *x) {
-  vp8_clear_system_state();
+  vp9_clear_system_state();
   x->vp9_short_fdct16x16(&x->block[0].src_diff[0],
                          &x->block[0].coeff[0], 32);
 }
@@ -235,9 +231,9 @@
 
 #define RDTRUNC(RM,DM,R,D) ( (128+(R)*(RM)) & 0xFF )
 #define RDTRUNC_8x8(RM,DM,R,D) ( (128+(R)*(RM)) & 0xFF )
-typedef struct vp8_token_state vp8_token_state;
+typedef struct vp9_token_state vp9_token_state;
 
-struct vp8_token_state {
+struct vp9_token_state {
   int           rate;
   int           error;
   int           next;
@@ -269,10 +265,10 @@
 
 static void optimize_b(MACROBLOCK *mb, int i, PLANE_TYPE type,
                        ENTROPY_CONTEXT *a, ENTROPY_CONTEXT *l,
-                       const VP8_ENCODER_RTCD *rtcd, int tx_size) {
+                       const VP9_ENCODER_RTCD *rtcd, int tx_size) {
   BLOCK *b;
   BLOCKD *d;
-  vp8_token_state tokens[65][2];
+  vp9_token_state tokens[65][2];
   uint64_t best_mask[2];
   const short *dequant_ptr;
   const short *coeff_ptr;
@@ -475,7 +471,7 @@
 
   /* Now pick the best path through the whole trellis. */
   band = bands[i + 1];
-  VP8_COMBINEENTROPYCONTEXTS(pt, *a, *l);
+  VP9_COMBINEENTROPYCONTEXTS(pt, *a, *l);
   rate0 = tokens[next][0].rate;
   rate1 = tokens[next][1].rate;
   error0 = tokens[next][0].error;
@@ -571,7 +567,7 @@
   }
 }
 
-void vp9_optimize_mby_4x4(MACROBLOCK *x, const VP8_ENCODER_RTCD *rtcd) {
+void vp9_optimize_mby_4x4(MACROBLOCK *x, const VP9_ENCODER_RTCD *rtcd) {
   int b;
   PLANE_TYPE type;
   int has_2nd_order;
@@ -606,7 +602,7 @@
   }
 }
 
-void vp9_optimize_mbuv_4x4(MACROBLOCK *x, const VP8_ENCODER_RTCD *rtcd) {
+void vp9_optimize_mbuv_4x4(MACROBLOCK *x, const VP9_ENCODER_RTCD *rtcd) {
   int b;
   ENTROPY_CONTEXT_PLANES t_above, t_left;
   ENTROPY_CONTEXT *ta;
@@ -627,12 +623,12 @@
   }
 }
 
-static void optimize_mb_4x4(MACROBLOCK *x, const VP8_ENCODER_RTCD *rtcd) {
+static void optimize_mb_4x4(MACROBLOCK *x, const VP9_ENCODER_RTCD *rtcd) {
   vp9_optimize_mby_4x4(x, rtcd);
   vp9_optimize_mbuv_4x4(x, rtcd);
 }
 
-void vp9_optimize_mby_8x8(MACROBLOCK *x, const VP8_ENCODER_RTCD *rtcd) {
+void vp9_optimize_mby_8x8(MACROBLOCK *x, const VP9_ENCODER_RTCD *rtcd) {
   int b;
   PLANE_TYPE type;
   ENTROPY_CONTEXT_PLANES t_above, t_left;
@@ -665,7 +661,7 @@
   }
 }
 
-void vp9_optimize_mbuv_8x8(MACROBLOCK *x, const VP8_ENCODER_RTCD *rtcd) {
+void vp9_optimize_mbuv_8x8(MACROBLOCK *x, const VP9_ENCODER_RTCD *rtcd) {
   int b;
   ENTROPY_CONTEXT_PLANES t_above, t_left;
   ENTROPY_CONTEXT *ta;
@@ -689,17 +685,17 @@
   }
 }
 
-static void optimize_mb_8x8(MACROBLOCK *x, const VP8_ENCODER_RTCD *rtcd) {
+static void optimize_mb_8x8(MACROBLOCK *x, const VP9_ENCODER_RTCD *rtcd) {
   vp9_optimize_mby_8x8(x, rtcd);
   vp9_optimize_mbuv_8x8(x, rtcd);
 }
 
 static void optimize_b_16x16(MACROBLOCK *mb, int i, PLANE_TYPE type,
                              ENTROPY_CONTEXT *a, ENTROPY_CONTEXT *l,
-                             const VP8_ENCODER_RTCD *rtcd) {
+                             const VP9_ENCODER_RTCD *rtcd) {
   BLOCK *b = &mb->block[i];
   BLOCKD *d = &mb->e_mbd.block[i];
-  vp8_token_state tokens[257][2];
+  vp9_token_state tokens[257][2];
   unsigned best_index[257][2];
   const short *dequant_ptr = d->dequant, *coeff_ptr = b->coeff;
   short *qcoeff_ptr = qcoeff_ptr = d->qcoeff;
@@ -838,7 +834,7 @@
 
   /* Now pick the best path through the whole trellis. */
   band = vp9_coef_bands_16x16[i + 1];
-  VP8_COMBINEENTROPYCONTEXTS(pt, *a, *l);
+  VP9_COMBINEENTROPYCONTEXTS(pt, *a, *l);
   rate0 = tokens[next][0].rate;
   rate1 = tokens[next][1].rate;
   error0 = tokens[next][0].error;
@@ -868,7 +864,7 @@
   *a = *l = (d->eob != !type);
 }
 
-void vp9_optimize_mby_16x16(MACROBLOCK *x, const VP8_ENCODER_RTCD *rtcd) {
+void vp9_optimize_mby_16x16(MACROBLOCK *x, const VP9_ENCODER_RTCD *rtcd) {
   ENTROPY_CONTEXT_PLANES t_above, t_left;
   ENTROPY_CONTEXT *ta, *tl;
 
@@ -883,17 +879,17 @@
   optimize_b_16x16(x, 0, PLANE_TYPE_Y_WITH_DC, ta, tl, rtcd);
 }
 
-static void optimize_mb_16x16(MACROBLOCK *x, const VP8_ENCODER_RTCD *rtcd) {
+static void optimize_mb_16x16(MACROBLOCK *x, const VP9_ENCODER_RTCD *rtcd) {
   vp9_optimize_mby_16x16(x, rtcd);
   vp9_optimize_mbuv_8x8(x, rtcd);
 }
 
-void vp9_encode_inter16x16(const VP8_ENCODER_RTCD *rtcd, MACROBLOCK *x) {
+void vp9_encode_inter16x16(const VP9_ENCODER_RTCD *rtcd, MACROBLOCK *x) {
   MACROBLOCKD *xd = &x->e_mbd;
   TX_SIZE tx_size = xd->mode_info_context->mbmi.txfm_size;
 
   vp9_build_inter_predictors_mb(xd);
-  vp8_subtract_mb(rtcd, x);
+  subtract_mb(rtcd, x);
 
   if (tx_size == TX_16X16) {
     vp9_transform_mb_16x16(x);
@@ -933,7 +929,7 @@
 }
 
 /* this function is used by first pass only */
-void vp9_encode_inter16x16y(const VP8_ENCODER_RTCD *rtcd, MACROBLOCK *x) {
+void vp9_encode_inter16x16y(const VP9_ENCODER_RTCD *rtcd, MACROBLOCK *x) {
   MACROBLOCKD *xd = &x->e_mbd;
   BLOCK *b = &x->block[0];
 
diff --git a/vp8/encoder/encodemb.h b/vp8/encoder/encodemb.h
index c524e05..8a3d38f 100644
--- a/vp8/encoder/encodemb.h
+++ b/vp8/encoder/encodemb.h
@@ -28,34 +28,32 @@
 #if CONFIG_RUNTIME_CPU_DETECT
 #define ENCODEMB_INVOKE(ctx,fn) (ctx)->fn
 #else
-#define ENCODEMB_INVOKE(ctx,fn) vp8_encodemb_##fn
+#define ENCODEMB_INVOKE(ctx,fn) vp9_encodemb_##fn
 #endif
 
 
 
 #include "onyx_int.h"
-struct VP8_ENCODER_RTCD;
-void vp9_encode_inter16x16(const struct VP8_ENCODER_RTCD *rtcd, MACROBLOCK *x);
+struct VP9_ENCODER_RTCD;
+void vp9_encode_inter16x16(const struct VP9_ENCODER_RTCD *rtcd, MACROBLOCK *x);
 
-void vp8_build_dcblock(MACROBLOCK *b);
-void vp8_transform_mb_4x4(MACROBLOCK *mb);
 void vp9_transform_mbuv_4x4(MACROBLOCK *x);
 void vp9_transform_mby_4x4(MACROBLOCK *x);
 
-void vp9_optimize_mby_4x4(MACROBLOCK *x, const struct VP8_ENCODER_RTCD *rtcd);
-void vp9_optimize_mbuv_4x4(MACROBLOCK *x, const struct VP8_ENCODER_RTCD *rtcd);
-void vp9_encode_inter16x16y(const struct VP8_ENCODER_RTCD *rtcd, MACROBLOCK *x);
+void vp9_optimize_mby_4x4(MACROBLOCK *x, const struct VP9_ENCODER_RTCD *rtcd);
+void vp9_optimize_mbuv_4x4(MACROBLOCK *x, const struct VP9_ENCODER_RTCD *rtcd);
+void vp9_encode_inter16x16y(const struct VP9_ENCODER_RTCD *rtcd, MACROBLOCK *x);
 
 void vp9_transform_mb_8x8(MACROBLOCK *mb);
 void vp9_transform_mby_8x8(MACROBLOCK *x);
 void vp9_transform_mbuv_8x8(MACROBLOCK *x);
 void vp9_build_dcblock_8x8(MACROBLOCK *b);
-void vp9_optimize_mby_8x8(MACROBLOCK *x, const struct VP8_ENCODER_RTCD *rtcd);
-void vp9_optimize_mbuv_8x8(MACROBLOCK *x, const struct VP8_ENCODER_RTCD *rtcd);
+void vp9_optimize_mby_8x8(MACROBLOCK *x, const struct VP9_ENCODER_RTCD *rtcd);
+void vp9_optimize_mbuv_8x8(MACROBLOCK *x, const struct VP9_ENCODER_RTCD *rtcd);
 
 void vp9_transform_mb_16x16(MACROBLOCK *mb);
 void vp9_transform_mby_16x16(MACROBLOCK *x);
-void vp9_optimize_mby_16x16(MACROBLOCK *x, const struct VP8_ENCODER_RTCD *rtcd);
+void vp9_optimize_mby_16x16(MACROBLOCK *x, const struct VP9_ENCODER_RTCD *rtcd);
 
 void vp9_subtract_4b_c(BLOCK *be, BLOCKD *bd, int pitch);
 
diff --git a/vp8/encoder/encodemv.c b/vp8/encoder/encodemv.c
index 6db356f..675fb0b 100644
--- a/vp8/encoder/encodemv.c
+++ b/vp8/encoder/encodemv.c
@@ -20,41 +20,39 @@
 extern unsigned int active_section;
 #endif
 
-//extern int final_packing;
-
 #ifdef NMV_STATS
 nmv_context_counts tnmvcounts;
 #endif
 
-static void encode_nmv_component(vp8_writer* const bc,
+static void encode_nmv_component(vp9_writer* const bc,
                                  int v,
                                  int r,
                                  const nmv_component* const mvcomp) {
   int s, z, c, o, d;
   assert (v != 0);            /* should not be zero */
   s = v < 0;
-  vp8_write(bc, s, mvcomp->sign);
+  vp9_write(bc, s, mvcomp->sign);
   z = (s ? -v : v) - 1;       /* magnitude - 1 */
 
   c = vp9_get_mv_class(z, &o);
 
-  vp8_write_token(bc, vp9_mv_class_tree, mvcomp->classes,
-                  vp9_mv_class_encodings + c);
+  write_token(bc, vp9_mv_class_tree, mvcomp->classes,
+              vp9_mv_class_encodings + c);
 
   d = (o >> 3);               /* int mv data */
 
   if (c == MV_CLASS_0) {
-    vp8_write_token(bc, vp9_mv_class0_tree, mvcomp->class0,
-                    vp9_mv_class0_encodings + d);
+    write_token(bc, vp9_mv_class0_tree, mvcomp->class0,
+                vp9_mv_class0_encodings + d);
   } else {
     int i, b;
     b = c + CLASS0_BITS - 1;  /* number of bits */
     for (i = 0; i < b; ++i)
-      vp8_write(bc, ((d >> i) & 1), mvcomp->bits[i]);
+      vp9_write(bc, ((d >> i) & 1), mvcomp->bits[i]);
   }
 }
 
-static void encode_nmv_component_fp(vp8_writer *bc,
+static void encode_nmv_component_fp(vp9_writer *bc,
                                     int v,
                                     int r,
                                     const nmv_component* const mvcomp,
@@ -72,18 +70,18 @@
 
   /* Code the fractional pel bits */
   if (c == MV_CLASS_0) {
-    vp8_write_token(bc, vp9_mv_fp_tree, mvcomp->class0_fp[d],
-                    vp9_mv_fp_encodings + f);
+    write_token(bc, vp9_mv_fp_tree, mvcomp->class0_fp[d],
+                vp9_mv_fp_encodings + f);
   } else {
-    vp8_write_token(bc, vp9_mv_fp_tree, mvcomp->fp,
-                    vp9_mv_fp_encodings + f);
+    write_token(bc, vp9_mv_fp_tree, mvcomp->fp,
+                vp9_mv_fp_encodings + f);
   }
   /* Code the high precision bit */
   if (usehp) {
     if (c == MV_CLASS_0) {
-      vp8_write(bc, e, mvcomp->class0_hp);
+      vp9_write(bc, e, mvcomp->class0_hp);
     } else {
-      vp8_write(bc, e, mvcomp->hp);
+      vp9_write(bc, e, mvcomp->hp);
     }
   }
 }
@@ -97,13 +95,13 @@
   int class0_fp_cost[CLASS0_SIZE][4], fp_cost[4];
   int class0_hp_cost[2], hp_cost[2];
 
-  sign_cost[0] = vp8_cost_zero(mvcomp->sign);
-  sign_cost[1] = vp8_cost_one(mvcomp->sign);
+  sign_cost[0] = vp9_cost_zero(mvcomp->sign);
+  sign_cost[1] = vp9_cost_one(mvcomp->sign);
   vp9_cost_tokens(class_cost, mvcomp->classes, vp9_mv_class_tree);
   vp9_cost_tokens(class0_cost, mvcomp->class0, vp9_mv_class0_tree);
   for (i = 0; i < MV_OFFSET_BITS; ++i) {
-    bits_cost[i][0] = vp8_cost_zero(mvcomp->bits[i]);
-    bits_cost[i][1] = vp8_cost_one(mvcomp->bits[i]);
+    bits_cost[i][0] = vp9_cost_zero(mvcomp->bits[i]);
+    bits_cost[i][1] = vp9_cost_one(mvcomp->bits[i]);
   }
 
   for (i = 0; i < CLASS0_SIZE; ++i)
@@ -111,10 +109,10 @@
   vp9_cost_tokens(fp_cost, mvcomp->fp, vp9_mv_fp_tree);
 
   if (usehp) {
-    class0_hp_cost[0] = vp8_cost_zero(mvcomp->class0_hp);
-    class0_hp_cost[1] = vp8_cost_one(mvcomp->class0_hp);
-    hp_cost[0] = vp8_cost_zero(mvcomp->hp);
-    hp_cost[1] = vp8_cost_one(mvcomp->hp);
+    class0_hp_cost[0] = vp9_cost_zero(mvcomp->class0_hp);
+    class0_hp_cost[1] = vp9_cost_one(mvcomp->class0_hp);
+    hp_cost[0] = vp9_cost_zero(mvcomp->hp);
+    hp_cost[1] = vp9_cost_one(mvcomp->hp);
   }
   mvcost[0] = 0;
   for (v = 1; v <= MV_MAX; ++v) {
@@ -151,68 +149,68 @@
 }
 
 static int update_nmv_savings(const unsigned int ct[2],
-                              const vp8_prob cur_p,
-                              const vp8_prob new_p,
-                              const vp8_prob upd_p) {
+                              const vp9_prob cur_p,
+                              const vp9_prob new_p,
+                              const vp9_prob upd_p) {
 
 #ifdef LOW_PRECISION_MV_UPDATE
-  vp8_prob mod_p = new_p | 1;
+  vp9_prob mod_p = new_p | 1;
 #else
-  vp8_prob mod_p = new_p;
+  vp9_prob mod_p = new_p;
 #endif
-  const int cur_b = vp8_cost_branch256(ct, cur_p);
-  const int mod_b = vp8_cost_branch256(ct, mod_p);
+  const int cur_b = cost_branch256(ct, cur_p);
+  const int mod_b = cost_branch256(ct, mod_p);
   const int cost = 7 * 256 +
 #ifndef LOW_PRECISION_MV_UPDATE
       256 +
 #endif
-      (vp8_cost_one(upd_p) - vp8_cost_zero(upd_p));
+      (vp9_cost_one(upd_p) - vp9_cost_zero(upd_p));
   if (cur_b - mod_b - cost > 0) {
     return cur_b - mod_b - cost;
   } else {
-    return -vp8_cost_zero(upd_p);
+    return -vp9_cost_zero(upd_p);
   }
 }
 
 static int update_nmv(
-  vp8_writer *const bc,
+  vp9_writer *const bc,
   const unsigned int ct[2],
-  vp8_prob *const cur_p,
-  const vp8_prob new_p,
-  const vp8_prob upd_p) {
+  vp9_prob *const cur_p,
+  const vp9_prob new_p,
+  const vp9_prob upd_p) {
 
 #ifdef LOW_PRECISION_MV_UPDATE
-  vp8_prob mod_p = new_p | 1;
+  vp9_prob mod_p = new_p | 1;
 #else
-  vp8_prob mod_p = new_p;
+  vp9_prob mod_p = new_p;
 #endif
 
-  const int cur_b = vp8_cost_branch256(ct, *cur_p);
-  const int mod_b = vp8_cost_branch256(ct, mod_p);
+  const int cur_b = cost_branch256(ct, *cur_p);
+  const int mod_b = cost_branch256(ct, mod_p);
   const int cost = 7 * 256 +
 #ifndef LOW_PRECISION_MV_UPDATE
       256 +
 #endif
-      (vp8_cost_one(upd_p) - vp8_cost_zero(upd_p));
+      (vp9_cost_one(upd_p) - vp9_cost_zero(upd_p));
 
   if (cur_b - mod_b > cost) {
     *cur_p = mod_p;
-    vp8_write(bc, 1, upd_p);
+    vp9_write(bc, 1, upd_p);
 #ifdef LOW_PRECISION_MV_UPDATE
-    vp8_write_literal(bc, mod_p >> 1, 7);
+    vp9_write_literal(bc, mod_p >> 1, 7);
 #else
-    vp8_write_literal(bc, mod_p, 8);
+    vp9_write_literal(bc, mod_p, 8);
 #endif
     return 1;
   } else {
-    vp8_write(bc, 0, upd_p);
+    vp9_write(bc, 0, upd_p);
     return 0;
   }
 }
 
 #ifdef NMV_STATS
 void init_nmvstats() {
-  vp8_zero(tnmvcounts);
+  vp9_zero(tnmvcounts);
 }
 
 void print_nmvstats() {
@@ -356,7 +354,7 @@
 }
 #endif
 
-void vp9_write_nmvprobs(VP9_COMP* const cpi, int usehp, vp8_writer* const bc) {
+void vp9_write_nmvprobs(VP9_COMP* const cpi, int usehp, vp9_writer* const bc) {
   int i, j;
   nmv_context prob;
   unsigned int branch_ct_joint[MV_JOINTS - 1][2];
@@ -385,30 +383,30 @@
     savings += update_nmv_savings(branch_ct_joint[j],
                                   cpi->common.fc.nmvc.joints[j],
                                   prob.joints[j],
-                                  VP8_NMV_UPDATE_PROB);
+                                  VP9_NMV_UPDATE_PROB);
   }
   for (i = 0; i < 2; ++i) {
     savings += update_nmv_savings(branch_ct_sign[i],
                                   cpi->common.fc.nmvc.comps[i].sign,
                                   prob.comps[i].sign,
-                                  VP8_NMV_UPDATE_PROB);
+                                  VP9_NMV_UPDATE_PROB);
     for (j = 0; j < MV_CLASSES - 1; ++j) {
       savings += update_nmv_savings(branch_ct_classes[i][j],
                                     cpi->common.fc.nmvc.comps[i].classes[j],
                                     prob.comps[i].classes[j],
-                                    VP8_NMV_UPDATE_PROB);
+                                    VP9_NMV_UPDATE_PROB);
     }
     for (j = 0; j < CLASS0_SIZE - 1; ++j) {
       savings += update_nmv_savings(branch_ct_class0[i][j],
                                     cpi->common.fc.nmvc.comps[i].class0[j],
                                     prob.comps[i].class0[j],
-                                    VP8_NMV_UPDATE_PROB);
+                                    VP9_NMV_UPDATE_PROB);
     }
     for (j = 0; j < MV_OFFSET_BITS; ++j) {
       savings += update_nmv_savings(branch_ct_bits[i][j],
                                     cpi->common.fc.nmvc.comps[i].bits[j],
                                     prob.comps[i].bits[j],
-                                    VP8_NMV_UPDATE_PROB);
+                                    VP9_NMV_UPDATE_PROB);
     }
   }
   for (i = 0; i < 2; ++i) {
@@ -418,14 +416,14 @@
         savings += update_nmv_savings(branch_ct_class0_fp[i][j][k],
                                       cpi->common.fc.nmvc.comps[i].class0_fp[j][k],
                                       prob.comps[i].class0_fp[j][k],
-                                      VP8_NMV_UPDATE_PROB);
+                                      VP9_NMV_UPDATE_PROB);
       }
     }
     for (j = 0; j < 3; ++j) {
       savings += update_nmv_savings(branch_ct_fp[i][j],
                                     cpi->common.fc.nmvc.comps[i].fp[j],
                                     prob.comps[i].fp[j],
-                                    VP8_NMV_UPDATE_PROB);
+                                    VP9_NMV_UPDATE_PROB);
     }
   }
   if (usehp) {
@@ -433,48 +431,48 @@
       savings += update_nmv_savings(branch_ct_class0_hp[i],
                                     cpi->common.fc.nmvc.comps[i].class0_hp,
                                     prob.comps[i].class0_hp,
-                                    VP8_NMV_UPDATE_PROB);
+                                    VP9_NMV_UPDATE_PROB);
       savings += update_nmv_savings(branch_ct_hp[i],
                                     cpi->common.fc.nmvc.comps[i].hp,
                                     prob.comps[i].hp,
-                                    VP8_NMV_UPDATE_PROB);
+                                    VP9_NMV_UPDATE_PROB);
     }
   }
   if (savings <= 0) {
-    vp8_write_bit(bc, 0);
+    vp9_write_bit(bc, 0);
     return;
   }
-  vp8_write_bit(bc, 1);
+  vp9_write_bit(bc, 1);
 #endif
 
   for (j = 0; j < MV_JOINTS - 1; ++j) {
     update_nmv(bc, branch_ct_joint[j],
                &cpi->common.fc.nmvc.joints[j],
                prob.joints[j],
-               VP8_NMV_UPDATE_PROB);
+               VP9_NMV_UPDATE_PROB);
   }
   for (i = 0; i < 2; ++i) {
     update_nmv(bc, branch_ct_sign[i],
                &cpi->common.fc.nmvc.comps[i].sign,
                prob.comps[i].sign,
-               VP8_NMV_UPDATE_PROB);
+               VP9_NMV_UPDATE_PROB);
     for (j = 0; j < MV_CLASSES - 1; ++j) {
       update_nmv(bc, branch_ct_classes[i][j],
                  &cpi->common.fc.nmvc.comps[i].classes[j],
                  prob.comps[i].classes[j],
-                 VP8_NMV_UPDATE_PROB);
+                 VP9_NMV_UPDATE_PROB);
     }
     for (j = 0; j < CLASS0_SIZE - 1; ++j) {
       update_nmv(bc, branch_ct_class0[i][j],
                  &cpi->common.fc.nmvc.comps[i].class0[j],
                  prob.comps[i].class0[j],
-                 VP8_NMV_UPDATE_PROB);
+                 VP9_NMV_UPDATE_PROB);
     }
     for (j = 0; j < MV_OFFSET_BITS; ++j) {
       update_nmv(bc, branch_ct_bits[i][j],
                  &cpi->common.fc.nmvc.comps[i].bits[j],
                  prob.comps[i].bits[j],
-                 VP8_NMV_UPDATE_PROB);
+                 VP9_NMV_UPDATE_PROB);
     }
   }
   for (i = 0; i < 2; ++i) {
@@ -484,14 +482,14 @@
         update_nmv(bc, branch_ct_class0_fp[i][j][k],
                    &cpi->common.fc.nmvc.comps[i].class0_fp[j][k],
                    prob.comps[i].class0_fp[j][k],
-                   VP8_NMV_UPDATE_PROB);
+                   VP9_NMV_UPDATE_PROB);
       }
     }
     for (j = 0; j < 3; ++j) {
       update_nmv(bc, branch_ct_fp[i][j],
                  &cpi->common.fc.nmvc.comps[i].fp[j],
                  prob.comps[i].fp[j],
-                 VP8_NMV_UPDATE_PROB);
+                 VP9_NMV_UPDATE_PROB);
     }
   }
   if (usehp) {
@@ -499,20 +497,20 @@
       update_nmv(bc, branch_ct_class0_hp[i],
                  &cpi->common.fc.nmvc.comps[i].class0_hp,
                  prob.comps[i].class0_hp,
-                 VP8_NMV_UPDATE_PROB);
+                 VP9_NMV_UPDATE_PROB);
       update_nmv(bc, branch_ct_hp[i],
                  &cpi->common.fc.nmvc.comps[i].hp,
                  prob.comps[i].hp,
-                 VP8_NMV_UPDATE_PROB);
+                 VP9_NMV_UPDATE_PROB);
     }
   }
 }
 
-void vp9_encode_nmv(vp8_writer* const bc, const MV* const mv,
+void vp9_encode_nmv(vp9_writer* const bc, const MV* const mv,
                     const MV* const ref, const nmv_context* const mvctx) {
   MV_JOINT_TYPE j = vp9_get_mv_joint(*mv);
-  vp8_write_token(bc, vp9_mv_joint_tree, mvctx->joints,
-                  vp9_mv_joint_encodings + j);
+  write_token(bc, vp9_mv_joint_tree, mvctx->joints,
+              vp9_mv_joint_encodings + j);
   if (j == MV_JOINT_HZVNZ || j == MV_JOINT_HNZVNZ) {
     encode_nmv_component(bc, mv->row, ref->col, &mvctx->comps[0]);
   }
@@ -521,7 +519,7 @@
   }
 }
 
-void vp9_encode_nmv_fp(vp8_writer* const bc, const MV* const mv,
+void vp9_encode_nmv_fp(vp9_writer* const bc, const MV* const mv,
                        const MV* const ref, const nmv_context* const mvctx,
                        int usehp) {
   MV_JOINT_TYPE j = vp9_get_mv_joint(*mv);
@@ -540,7 +538,7 @@
                               int usehp,
                               int mvc_flag_v,
                               int mvc_flag_h) {
-  vp8_clear_system_state();
+  vp9_clear_system_state();
   vp9_cost_tokens(mvjoint, mvctx->joints, vp9_mv_joint_tree);
   if (mvc_flag_v)
     build_nmv_component_cost_table(mvcost[0], &mvctx->comps[0], usehp);
diff --git a/vp8/encoder/encodemv.h b/vp8/encoder/encodemv.h
index 6d96a24..f19613d 100644
--- a/vp8/encoder/encodemv.h
+++ b/vp8/encoder/encodemv.h
@@ -14,10 +14,10 @@
 
 #include "onyx_int.h"
 
-void vp9_write_nmvprobs(VP9_COMP* const, int usehp, vp8_writer* const);
-void vp9_encode_nmv(vp8_writer* const w, const MV* const mv,
+void vp9_write_nmvprobs(VP9_COMP* const, int usehp, vp9_writer* const);
+void vp9_encode_nmv(vp9_writer* const w, const MV* const mv,
                     const MV* const ref, const nmv_context* const mvctx);
-void vp9_encode_nmv_fp(vp8_writer* const w, const MV* const mv,
+void vp9_encode_nmv_fp(vp9_writer* const w, const MV* const mv,
                        const MV* const ref, const nmv_context *mvctx,
                        int usehp);
 void vp9_build_nmv_cost_table(int *mvjoint,
diff --git a/vp8/encoder/firstpass.c b/vp8/encoder/firstpass.c
index 6645523..8d015c4 100644
--- a/vp8/encoder/firstpass.c
+++ b/vp8/encoder/firstpass.c
@@ -389,7 +389,7 @@
   int step_param = 3;
   int further_steps = (MAX_MVSEARCH_STEPS - 1) - step_param;
   int n;
-  vp8_variance_fn_ptr_t v_fn_ptr = cpi->fn_ptr[BLOCK_16X16];
+  vp9_variance_fn_ptr_t v_fn_ptr = cpi->fn_ptr[BLOCK_16X16];
   int new_mv_mode_penalty = 256;
 
   // override the default variance function to use MSE
@@ -472,7 +472,7 @@
 
   zero_ref_mv.as_int = 0;
 
-  vp8_clear_system_state();  // __asm emms;
+  vp9_clear_system_state();  // __asm emms;
 
   x->src = * cpi->Source;
   xd->pre = *lst_yv12;
@@ -693,10 +693,10 @@
 
     // extend the recon for intra prediction
     vp9_extend_mb_row(new_yv12, xd->dst.y_buffer + 16, xd->dst.u_buffer + 8, xd->dst.v_buffer + 8);
-    vp8_clear_system_state();  // __asm emms;
+    vp9_clear_system_state();  // __asm emms;
   }
 
-  vp8_clear_system_state();  // __asm emms;
+  vp9_clear_system_state();  // __asm emms;
   {
     double weight = 0.0;
 
@@ -1555,7 +1555,7 @@
 
   cpi->twopass.gf_group_bits = 0;
 
-  vp8_clear_system_state();  // __asm emms;
+  vp9_clear_system_state();  // __asm emms;
 
   start_pos = cpi->twopass.stats_in;
 
@@ -1971,7 +1971,7 @@
     return;
   }
 
-  vp8_clear_system_state();
+  vp9_clear_system_state();
 
   vpx_memset(&this_frame, 0, sizeof(FIRSTPASS_STATS));
 
@@ -2211,7 +2211,7 @@
 
   vpx_memset(&next_frame, 0, sizeof(next_frame)); // assure clean
 
-  vp8_clear_system_state();  // __asm emms;
+  vp9_clear_system_state();  // __asm emms;
   start_position = cpi->twopass.stats_in;
 
   cpi->common.frame_type = KEY_FRAME;
diff --git a/vp8/encoder/firstpass.h b/vp8/encoder/firstpass.h
index 8deaba3..f90a857 100644
--- a/vp8/encoder/firstpass.h
+++ b/vp8/encoder/firstpass.h
@@ -20,5 +20,4 @@
 extern void vp9_second_pass(VP9_COMP *cpi);
 extern void vp9_end_second_pass(VP9_COMP *cpi);
 
-extern size_t vp8_firstpass_stats_sz(unsigned int mb_count);
 #endif
diff --git a/vp8/encoder/generic/csystemdependent.c b/vp8/encoder/generic/csystemdependent.c
index 4f440fc..03f1add 100644
--- a/vp8/encoder/generic/csystemdependent.c
+++ b/vp8/encoder/generic/csystemdependent.c
@@ -15,7 +15,7 @@
 
 
 void vp9_arch_x86_encoder_init(VP9_COMP *cpi);
-void vp8_arch_arm_encoder_init(VP9_COMP *cpi);
+void vp9_arch_arm_encoder_init(VP9_COMP *cpi);
 
 void (*vp9_yv12_copy_partial_frame_ptr)(YV12_BUFFER_CONFIG *src_ybc,
                                         YV12_BUFFER_CONFIG *dst_ybc,
@@ -41,7 +41,7 @@
 #endif
 
 #if ARCH_ARM
-  vp8_arch_arm_encoder_init(cpi);
+  vp9_arch_arm_encoder_init(cpi);
 #endif
 
 
diff --git a/vp8/encoder/mbgraph.c b/vp8/encoder/mbgraph.c
index 554c14d..df852c7 100644
--- a/vp8/encoder/mbgraph.c
+++ b/vp8/encoder/mbgraph.c
@@ -28,7 +28,7 @@
   MACROBLOCKD *const xd = &x->e_mbd;
   BLOCK *b  = &x->block[0];
   BLOCKD *d = &xd->block[0];
-  vp8_variance_fn_ptr_t v_fn_ptr = cpi->fn_ptr[BLOCK_16X16];
+  vp9_variance_fn_ptr_t v_fn_ptr = cpi->fn_ptr[BLOCK_16X16];
   unsigned int best_err;
   int step_param, further_steps;
 
@@ -477,7 +477,7 @@
                                golden_ref, cpi->Source);
   }
 
-  vp8_clear_system_state();  // __asm emms;
+  vp9_clear_system_state();  // __asm emms;
 
   separate_arf_mbs(cpi);
 }
diff --git a/vp8/encoder/mcomp.c b/vp8/encoder/mcomp.c
index d4daec0..110dbcb 100644
--- a/vp8/encoder/mcomp.c
+++ b/vp8/encoder/mcomp.c
@@ -247,7 +247,7 @@
 int vp9_find_best_sub_pixel_step_iteratively(MACROBLOCK *x, BLOCK *b, BLOCKD *d,
                                              int_mv *bestmv, int_mv *ref_mv,
                                              int error_per_bit,
-                                             const vp8_variance_fn_ptr_t *vfp,
+                                             const vp9_variance_fn_ptr_t *vfp,
                                              DEC_MVCOSTS,
                                              int *distortion,
                                              unsigned int *sse1) {
@@ -446,7 +446,7 @@
 int vp9_find_best_sub_pixel_step(MACROBLOCK *x, BLOCK *b, BLOCKD *d,
                                  int_mv *bestmv, int_mv *ref_mv,
                                  int error_per_bit,
-                                 const vp8_variance_fn_ptr_t *vfp,
+                                 const vp9_variance_fn_ptr_t *vfp,
                                  DEC_MVCOSTS, int *distortion,
                                  unsigned int *sse1) {
   int bestmse = INT_MAX;
@@ -926,7 +926,7 @@
 int vp9_find_best_half_pixel_step(MACROBLOCK *x, BLOCK *b, BLOCKD *d,
                                   int_mv *bestmv, int_mv *ref_mv,
                                   int error_per_bit,
-                                  const vp8_variance_fn_ptr_t *vfp,
+                                  const vp9_variance_fn_ptr_t *vfp,
                                   DEC_MVCOSTS,
                                   int *distortion,
                                   unsigned int *sse1) {
@@ -1108,7 +1108,7 @@
   int_mv *best_mv,
   int search_param,
   int sad_per_bit,
-  const vp8_variance_fn_ptr_t *vfp,
+  const vp9_variance_fn_ptr_t *vfp,
   DEC_MVSADCOSTS,
   DEC_MVCOSTS,
   int_mv *center_mv
@@ -1135,7 +1135,7 @@
   fcenter_mv.as_mv.col = center_mv->as_mv.col >> 3;
 
   // adjust ref_mv to make sure it is within MV range
-  vp8_clamp_mv(ref_mv, x->mv_col_min, x->mv_col_max, x->mv_row_min, x->mv_row_max);
+  clamp_mv(ref_mv, x->mv_col_min, x->mv_col_max, x->mv_row_min, x->mv_row_max);
   br = ref_mv->as_mv.row;
   bc = ref_mv->as_mv.col;
 
@@ -1258,7 +1258,7 @@
 int vp9_diamond_search_sad(MACROBLOCK *x, BLOCK *b, BLOCKD *d,
                            int_mv *ref_mv, int_mv *best_mv,
                            int search_param, int sad_per_bit, int *num00,
-                           vp8_variance_fn_ptr_t *fn_ptr, DEC_MVCOSTS,
+                           vp9_variance_fn_ptr_t *fn_ptr, DEC_MVCOSTS,
                            int_mv *center_mv) {
   int i, j, step;
 
@@ -1290,7 +1290,7 @@
   fcenter_mv.as_mv.row = center_mv->as_mv.row >> 3;
   fcenter_mv.as_mv.col = center_mv->as_mv.col >> 3;
 
-  vp8_clamp_mv(ref_mv, x->mv_col_min, x->mv_col_max, x->mv_row_min, x->mv_row_max);
+  clamp_mv(ref_mv, x->mv_col_min, x->mv_col_max, x->mv_row_min, x->mv_row_max);
   ref_row = ref_mv->as_mv.row;
   ref_col = ref_mv->as_mv.col;
   *num00 = 0;
@@ -1367,7 +1367,7 @@
 int vp9_diamond_search_sadx4(MACROBLOCK *x, BLOCK *b, BLOCKD *d,
                              int_mv *ref_mv, int_mv *best_mv, int search_param,
                              int sad_per_bit, int *num00,
-                             vp8_variance_fn_ptr_t *fn_ptr,
+                             vp9_variance_fn_ptr_t *fn_ptr,
                              DEC_MVCOSTS, int_mv *center_mv) {
   int i, j, step;
 
@@ -1401,7 +1401,7 @@
   fcenter_mv.as_mv.row = center_mv->as_mv.row >> 3;
   fcenter_mv.as_mv.col = center_mv->as_mv.col >> 3;
 
-  vp8_clamp_mv(ref_mv, x->mv_col_min, x->mv_col_max, x->mv_row_min, x->mv_row_max);
+  clamp_mv(ref_mv, x->mv_col_min, x->mv_col_max, x->mv_row_min, x->mv_row_max);
   ref_row = ref_mv->as_mv.row;
   ref_col = ref_mv->as_mv.col;
   *num00 = 0;
@@ -1515,7 +1515,7 @@
 int vp9_full_pixel_diamond(VP9_COMP *cpi, MACROBLOCK *x, BLOCK *b,
                            BLOCKD *d, int_mv *mvp_full, int step_param,
                            int sadpb, int further_steps,
-                           int do_refine, vp8_variance_fn_ptr_t *fn_ptr,
+                           int do_refine, vp9_variance_fn_ptr_t *fn_ptr,
                            int_mv *ref_mv, int_mv *dst_mv) {
   int_mv temp_mv;
   int thissme, n, num00;
@@ -1570,7 +1570,7 @@
 
 int vp9_full_search_sad(MACROBLOCK *x, BLOCK *b, BLOCKD *d, int_mv *ref_mv,
                         int sad_per_bit, int distance,
-                        vp8_variance_fn_ptr_t *fn_ptr, DEC_MVCOSTS,
+                        vp9_variance_fn_ptr_t *fn_ptr, DEC_MVCOSTS,
                         int_mv *center_mv) {
   unsigned char *what = (*(b->base_src) + b->src);
   int what_stride = b->src_stride;
@@ -1664,7 +1664,7 @@
 
 int vp9_full_search_sadx3(MACROBLOCK *x, BLOCK *b, BLOCKD *d, int_mv *ref_mv,
                           int sad_per_bit, int distance,
-                          vp8_variance_fn_ptr_t *fn_ptr, DEC_MVCOSTS,
+                          vp9_variance_fn_ptr_t *fn_ptr, DEC_MVCOSTS,
                           int_mv *center_mv) {
   unsigned char *what = (*(b->base_src) + b->src);
   int what_stride = b->src_stride;
@@ -1791,7 +1791,7 @@
 
 int vp9_full_search_sadx8(MACROBLOCK *x, BLOCK *b, BLOCKD *d, int_mv *ref_mv,
                           int sad_per_bit, int distance,
-                          vp8_variance_fn_ptr_t *fn_ptr,
+                          vp9_variance_fn_ptr_t *fn_ptr,
                           DEC_MVCOSTS,
                           int_mv *center_mv) {
   unsigned char *what = (*(b->base_src) + b->src);
@@ -1945,7 +1945,7 @@
 
 int vp9_refining_search_sad(MACROBLOCK *x, BLOCK *b, BLOCKD *d, int_mv *ref_mv,
                             int error_per_bit, int search_range,
-                            vp8_variance_fn_ptr_t *fn_ptr, DEC_MVCOSTS,
+                            vp9_variance_fn_ptr_t *fn_ptr, DEC_MVCOSTS,
                             int_mv *center_mv) {
   MV neighbors[4] = {{ -1, 0}, {0, -1}, {0, 1}, {1, 0}};
   int i, j;
@@ -2021,7 +2021,7 @@
 
 int vp9_refining_search_sadx4(MACROBLOCK *x, BLOCK *b, BLOCKD *d,
                               int_mv *ref_mv, int error_per_bit,
-                              int search_range, vp8_variance_fn_ptr_t *fn_ptr,
+                              int search_range, vp9_variance_fn_ptr_t *fn_ptr,
                               DEC_MVCOSTS, int_mv *center_mv) {
   MV neighbors[4] = {{ -1, 0}, {0, -1}, {0, 1}, {1, 0}};
   int i, j;
@@ -2133,7 +2133,7 @@
   int i, j;
 
   fprintf(f, "#include \"entropy.h\"\n");
-  fprintf(f, "const int vp8_mode_contexts[6][4] =");
+  fprintf(f, "const int vp9_mode_contexts[6][4] =");
   fprintf(f, "{\n");
   for (j = 0; j < 6; j++) {
     fprintf(f, "  {/* %d */ ", j);
diff --git a/vp8/encoder/mcomp.h b/vp8/encoder/mcomp.h
index eed5982..f754837 100644
--- a/vp8/encoder/mcomp.h
+++ b/vp8/encoder/mcomp.h
@@ -42,7 +42,7 @@
 int vp9_full_pixel_diamond(struct VP9_COMP *cpi, MACROBLOCK *x, BLOCK *b,
                            BLOCKD *d, int_mv *mvp_full, int step_param,
                            int sadpb, int further_steps, int do_refine,
-                           vp8_variance_fn_ptr_t *fn_ptr,
+                           vp9_variance_fn_ptr_t *fn_ptr,
                            int_mv *ref_mv, int_mv *dst_mv);
 
 extern int vp9_hex_search
@@ -54,7 +54,7 @@
   int_mv *best_mv,
   int search_param,
   int error_per_bit,
-  const vp8_variance_fn_ptr_t *vf,
+  const vp9_variance_fn_ptr_t *vf,
   DEC_MVSADCOSTS,
   DEC_MVCOSTS,
   int_mv *center_mv
@@ -62,12 +62,11 @@
 
 typedef int (fractional_mv_step_fp)
 (MACROBLOCK *x, BLOCK *b, BLOCKD *d, int_mv *bestmv, int_mv *ref_mv,
- int error_per_bit, const vp8_variance_fn_ptr_t *vfp, DEC_MVCOSTS,
+ int error_per_bit, const vp9_variance_fn_ptr_t *vfp, DEC_MVCOSTS,
  int *distortion, unsigned int *sse);
 extern fractional_mv_step_fp vp9_find_best_sub_pixel_step_iteratively;
 extern fractional_mv_step_fp vp9_find_best_sub_pixel_step;
 extern fractional_mv_step_fp vp9_find_best_half_pixel_step;
-extern fractional_mv_step_fp vp8_skip_fractional_mv_step;
 
 #define prototype_full_search_sad(sym)\
   int (sym)\
@@ -78,7 +77,7 @@
    int_mv *ref_mv, \
    int sad_per_bit, \
    int distance, \
-   vp8_variance_fn_ptr_t *fn_ptr, \
+   vp9_variance_fn_ptr_t *fn_ptr, \
    DEC_MVSADCOSTS, \
    int_mv *center_mv \
   )
@@ -92,7 +91,7 @@
    int_mv *ref_mv, \
    int sad_per_bit, \
    int distance, \
-   vp8_variance_fn_ptr_t *fn_ptr, \
+   vp9_variance_fn_ptr_t *fn_ptr, \
    DEC_MVSADCOSTS, \
    int_mv *center_mv \
   )
@@ -108,7 +107,7 @@
    int search_param, \
    int sad_per_bit, \
    int *num00, \
-   vp8_variance_fn_ptr_t *fn_ptr, \
+   vp9_variance_fn_ptr_t *fn_ptr, \
    DEC_MVSADCOSTS, \
    int_mv *center_mv \
   )
@@ -117,44 +116,44 @@
 #include "x86/mcomp_x86.h"
 #endif
 
-typedef prototype_full_search_sad(*vp8_full_search_fn_t);
+typedef prototype_full_search_sad(*vp9_full_search_fn_t);
 extern prototype_full_search_sad(vp9_full_search_sad);
 extern prototype_full_search_sad(vp9_full_search_sadx3);
 extern prototype_full_search_sad(vp9_full_search_sadx8);
 
-typedef prototype_refining_search_sad(*vp8_refining_search_fn_t);
+typedef prototype_refining_search_sad(*vp9_refining_search_fn_t);
 extern prototype_refining_search_sad(vp9_refining_search_sad);
 extern prototype_refining_search_sad(vp9_refining_search_sadx4);
 
-typedef prototype_diamond_search_sad(*vp8_diamond_search_fn_t);
+typedef prototype_diamond_search_sad(*vp9_diamond_search_fn_t);
 extern prototype_diamond_search_sad(vp9_diamond_search_sad);
 extern prototype_diamond_search_sad(vp9_diamond_search_sadx4);
 
-#ifndef vp8_search_full_search
-#define vp8_search_full_search vp9_full_search_sad
+#ifndef vp9_search_full_search
+#define vp9_search_full_search vp9_full_search_sad
 #endif
-extern prototype_full_search_sad(vp8_search_full_search);
+extern prototype_full_search_sad(vp9_search_full_search);
 
-#ifndef vp8_search_refining_search
-#define vp8_search_refining_search vp9_refining_search_sad
+#ifndef vp9_search_refining_search
+#define vp9_search_refining_search vp9_refining_search_sad
 #endif
-extern prototype_refining_search_sad(vp8_search_refining_search);
+extern prototype_refining_search_sad(vp9_search_refining_search);
 
-#ifndef vp8_search_diamond_search
-#define vp8_search_diamond_search vp9_diamond_search_sad
+#ifndef vp9_search_diamond_search
+#define vp9_search_diamond_search vp9_diamond_search_sad
 #endif
-extern prototype_diamond_search_sad(vp8_search_diamond_search);
+extern prototype_diamond_search_sad(vp9_search_diamond_search);
 
 typedef struct {
   prototype_full_search_sad(*full_search);
   prototype_refining_search_sad(*refining_search);
   prototype_diamond_search_sad(*diamond_search);
-} vp8_search_rtcd_vtable_t;
+} vp9_search_rtcd_vtable_t;
 
 #if CONFIG_RUNTIME_CPU_DETECT
 #define SEARCH_INVOKE(ctx,fn) (ctx)->fn
 #else
-#define SEARCH_INVOKE(ctx,fn) vp8_search_##fn
+#define SEARCH_INVOKE(ctx,fn) vp9_search_##fn
 #endif
 
 #endif
diff --git a/vp8/encoder/modecosts.c b/vp8/encoder/modecosts.c
index e145e79..57d1ae6 100644
--- a/vp8/encoder/modecosts.c
+++ b/vp8/encoder/modecosts.c
@@ -17,11 +17,11 @@
 
 void vp9_init_mode_costs(VP9_COMP *c) {
   VP9_COMMON *x = &c->common;
-  const vp8_tree_p T = vp9_bmode_tree;
+  const vp9_tree_p T = vp9_bmode_tree;
   int i, j;
 
-  for (i = 0; i < VP8_BINTRAMODES; i++) {
-    for (j = 0; j < VP8_BINTRAMODES; j++) {
+  for (i = 0; i < VP9_BINTRAMODES; i++) {
+    for (j = 0; j < VP9_BINTRAMODES; j++) {
       vp9_cost_tokens((int *)c->mb.bmode_costs[i][j],
                       x->kf_bmode_prob[i][j], T);
     }
@@ -36,13 +36,13 @@
                   x->kf_ymode_prob[c->common.kf_ymode_probs_index],
                   vp9_kf_ymode_tree);
   vp9_cost_tokens(c->mb.intra_uv_mode_cost[1],
-                  x->fc.uv_mode_prob[VP8_YMODES - 1], vp9_uv_mode_tree);
+                  x->fc.uv_mode_prob[VP9_YMODES - 1], vp9_uv_mode_tree);
   vp9_cost_tokens(c->mb.intra_uv_mode_cost[0],
-                  x->kf_uv_mode_prob[VP8_YMODES - 1], vp9_uv_mode_tree);
+                  x->kf_uv_mode_prob[VP9_YMODES - 1], vp9_uv_mode_tree);
   vp9_cost_tokens(c->mb.i8x8_mode_costs,
                   x->fc.i8x8_mode_prob, vp9_i8x8_mode_tree);
 
-  for (i = 0; i <= VP8_SWITCHABLE_FILTERS; ++i)
+  for (i = 0; i <= VP9_SWITCHABLE_FILTERS; ++i)
     vp9_cost_tokens((int *)c->mb.switchable_interp_costs[i],
                     x->fc.switchable_interp_prob[i],
                     vp9_switchable_interp_tree);
diff --git a/vp8/encoder/onyx_if.c b/vp8/encoder/onyx_if.c
index 8f6d220..fbce202 100644
--- a/vp8/encoder/onyx_if.c
+++ b/vp8/encoder/onyx_if.c
@@ -72,16 +72,8 @@
                               YV12_BUFFER_CONFIG *post,
                               int filt_lvl, int low_var_thresh, int flag);
 
-extern void print_parms(VP8_CONFIG *ocf, char *filenam);
-
-extern unsigned int vp8_get_processor_freq();
-
 extern void print_tree_update_probs();
 
-extern void vp8cx_create_encoder_threads(VP9_COMP *cpi);
-
-extern void vp8cx_remove_encoder_threads(VP9_COMP *cpi);
-
 #if HAVE_ARMV7
 extern void vp8_yv12_copy_frame_func_neon(YV12_BUFFER_CONFIG *src_ybc,
                                           YV12_BUFFER_CONFIG *dst_ybc);
@@ -96,8 +88,6 @@
 
 static void set_default_lf_deltas(VP9_COMP *cpi);
 
-extern const int vp8_gf_interval_table[101];
-
 #define DEFAULT_INTERP_FILTER EIGHTTAP  /* SWITCHABLE for better performance */
 #define SEARCH_BEST_FILTER 0            /* to search exhaustively for
                                            best filter */
@@ -149,7 +139,7 @@
 
 
 #ifdef ENTROPY_STATS
-extern int intra_mode_stats[VP8_BINTRAMODES][VP8_BINTRAMODES][VP8_BINTRAMODES];
+extern int intra_mode_stats[VP9_BINTRAMODES][VP9_BINTRAMODES][VP9_BINTRAMODES];
 #endif
 
 #ifdef NMV_STATS
@@ -159,10 +149,6 @@
 
 #ifdef SPEEDSTATS
 unsigned int frames_at_speed[16] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
-unsigned int tot_pm = 0;
-unsigned int cnt_pm = 0;
-unsigned int tot_ef = 0;
-unsigned int cnt_ef = 0;
 #endif
 
 #if defined(SECTIONBITS_OUTPUT)
@@ -170,13 +156,13 @@
 #endif
 #ifdef MODE_STATS
 extern INT64 Sectionbits[500];
-extern unsigned int y_modes[VP8_YMODES];
-extern unsigned int i8x8_modes[VP8_I8X8_MODES];
-extern unsigned int uv_modes[VP8_UV_MODES];
-extern unsigned int uv_modes_y[VP8_YMODES][VP8_UV_MODES];
+extern unsigned int y_modes[VP9_YMODES];
+extern unsigned int i8x8_modes[VP9_I8X8_MODES];
+extern unsigned int uv_modes[VP9_UV_MODES];
+extern unsigned int uv_modes_y[VP9_YMODES][VP9_UV_MODES];
 extern unsigned int b_modes[B_MODE_COUNT];
 extern unsigned int inter_y_modes[MB_MODE_COUNT];
-extern unsigned int inter_uv_modes[VP8_UV_MODES];
+extern unsigned int inter_uv_modes[VP9_UV_MODES];
 extern unsigned int inter_b_modes[B_MODE_COUNT];
 #endif
 
@@ -392,7 +378,7 @@
 
   vp8_yv12_de_alloc_frame_buffer(&cpi->last_frame_uf);
   vp8_yv12_de_alloc_frame_buffer(&cpi->scaled_source);
-#if VP8_TEMPORAL_ALT_REF
+#if VP9_TEMPORAL_ALT_REF
   vp8_yv12_de_alloc_frame_buffer(&cpi->alt_ref_buffer);
 #endif
   vp9_lookahead_destroy(cpi->lookahead);
@@ -971,7 +957,7 @@
         sf->thresh_mult[THR_B_PRED   ] = 5000;
         sf->thresh_mult[THR_I8X8_PRED] = 5000;
 
-        if (cpi->ref_frame_flags & VP8_LAST_FLAG) {
+        if (cpi->ref_frame_flags & VP9_LAST_FLAG) {
           sf->thresh_mult[THR_NEWMV    ] = 2000;
 #if CONFIG_PRED_FILTER
           sf->thresh_mult[THR_NEWMV_FILT    ] = 2000;
@@ -980,7 +966,7 @@
           sf->thresh_mult[THR_COMP_SPLITLG  ] = 20000;
         }
 
-        if (cpi->ref_frame_flags & VP8_GOLD_FLAG) {
+        if (cpi->ref_frame_flags & VP9_GOLD_FLAG) {
           sf->thresh_mult[THR_NEARESTG ] = 1500;
           sf->thresh_mult[THR_ZEROG    ] = 1500;
           sf->thresh_mult[THR_NEARG    ] = 1500;
@@ -995,7 +981,7 @@
           sf->thresh_mult[THR_COMP_SPLITGA  ] = 20000;
         }
 
-        if (cpi->ref_frame_flags & VP8_ALT_FLAG) {
+        if (cpi->ref_frame_flags & VP9_ALT_FLAG) {
           sf->thresh_mult[THR_NEARESTA ] = 1500;
           sf->thresh_mult[THR_ZEROA    ] = 1500;
           sf->thresh_mult[THR_NEARA    ] = 1500;
@@ -1046,7 +1032,7 @@
         sf->thresh_mult[THR_B_PRED   ] = 7500;
         sf->thresh_mult[THR_I8X8_PRED] = 7500;
 
-        if (cpi->ref_frame_flags & VP8_LAST_FLAG) {
+        if (cpi->ref_frame_flags & VP9_LAST_FLAG) {
           sf->thresh_mult[THR_NEWMV    ] = 2000;
 #if CONFIG_PRED_FILTER
           sf->thresh_mult[THR_NEWMV_FILT    ] = 2000;
@@ -1055,7 +1041,7 @@
           sf->thresh_mult[THR_COMP_SPLITLG  ] = 50000;
         }
 
-        if (cpi->ref_frame_flags & VP8_GOLD_FLAG) {
+        if (cpi->ref_frame_flags & VP9_GOLD_FLAG) {
           sf->thresh_mult[THR_NEARESTG ] = 2000;
           sf->thresh_mult[THR_ZEROG    ] = 2000;
           sf->thresh_mult[THR_NEARG    ] = 2000;
@@ -1070,7 +1056,7 @@
           sf->thresh_mult[THR_COMP_SPLITGA  ] = 50000;
         }
 
-        if (cpi->ref_frame_flags & VP8_ALT_FLAG) {
+        if (cpi->ref_frame_flags & VP9_ALT_FLAG) {
           sf->thresh_mult[THR_NEARESTA ] = 2000;
           sf->thresh_mult[THR_ZEROA    ] = 2000;
           sf->thresh_mult[THR_NEARA    ] = 2000;
@@ -1112,7 +1098,7 @@
   }; /* switch */
 
   /* disable frame modes if flags not set */
-  if (!(cpi->ref_frame_flags & VP8_LAST_FLAG)) {
+  if (!(cpi->ref_frame_flags & VP9_LAST_FLAG)) {
     sf->thresh_mult[THR_NEWMV    ] = INT_MAX;
     sf->thresh_mult[THR_NEARESTMV] = INT_MAX;
     sf->thresh_mult[THR_ZEROMV   ] = INT_MAX;
@@ -1126,7 +1112,7 @@
     sf->thresh_mult[THR_SPLITMV  ] = INT_MAX;
   }
 
-  if (!(cpi->ref_frame_flags & VP8_GOLD_FLAG)) {
+  if (!(cpi->ref_frame_flags & VP9_GOLD_FLAG)) {
     sf->thresh_mult[THR_NEARESTG ] = INT_MAX;
     sf->thresh_mult[THR_ZEROG    ] = INT_MAX;
     sf->thresh_mult[THR_NEARG    ] = INT_MAX;
@@ -1140,7 +1126,7 @@
     sf->thresh_mult[THR_SPLITG   ] = INT_MAX;
   }
 
-  if (!(cpi->ref_frame_flags & VP8_ALT_FLAG)) {
+  if (!(cpi->ref_frame_flags & VP9_ALT_FLAG)) {
     sf->thresh_mult[THR_NEARESTA ] = INT_MAX;
     sf->thresh_mult[THR_ZEROA    ] = INT_MAX;
     sf->thresh_mult[THR_NEARA    ] = INT_MAX;
@@ -1154,7 +1140,7 @@
     sf->thresh_mult[THR_SPLITA   ] = INT_MAX;
   }
 
-  if ((cpi->ref_frame_flags & (VP8_LAST_FLAG | VP8_GOLD_FLAG)) != (VP8_LAST_FLAG | VP8_GOLD_FLAG)) {
+  if ((cpi->ref_frame_flags & (VP9_LAST_FLAG | VP9_GOLD_FLAG)) != (VP9_LAST_FLAG | VP9_GOLD_FLAG)) {
     sf->thresh_mult[THR_COMP_ZEROLG   ] = INT_MAX;
     sf->thresh_mult[THR_COMP_NEARESTLG] = INT_MAX;
     sf->thresh_mult[THR_COMP_NEARLG   ] = INT_MAX;
@@ -1162,7 +1148,7 @@
     sf->thresh_mult[THR_COMP_SPLITLG  ] = INT_MAX;
   }
 
-  if ((cpi->ref_frame_flags & (VP8_LAST_FLAG | VP8_ALT_FLAG)) != (VP8_LAST_FLAG | VP8_ALT_FLAG)) {
+  if ((cpi->ref_frame_flags & (VP9_LAST_FLAG | VP9_ALT_FLAG)) != (VP9_LAST_FLAG | VP9_ALT_FLAG)) {
     sf->thresh_mult[THR_COMP_ZEROLA   ] = INT_MAX;
     sf->thresh_mult[THR_COMP_NEARESTLA] = INT_MAX;
     sf->thresh_mult[THR_COMP_NEARLA   ] = INT_MAX;
@@ -1170,7 +1156,7 @@
     sf->thresh_mult[THR_COMP_SPLITLA  ] = INT_MAX;
   }
 
-  if ((cpi->ref_frame_flags & (VP8_GOLD_FLAG | VP8_ALT_FLAG)) != (VP8_GOLD_FLAG | VP8_ALT_FLAG)) {
+  if ((cpi->ref_frame_flags & (VP9_GOLD_FLAG | VP9_ALT_FLAG)) != (VP9_GOLD_FLAG | VP9_ALT_FLAG)) {
     sf->thresh_mult[THR_COMP_ZEROGA   ] = INT_MAX;
     sf->thresh_mult[THR_COMP_NEARESTGA] = INT_MAX;
     sf->thresh_mult[THR_COMP_NEARGA   ] = INT_MAX;
@@ -1251,7 +1237,7 @@
     vpx_internal_error(&cpi->common.error, VPX_CODEC_MEM_ERROR,
                        "Failed to allocate lag buffers");
 
-#if VP8_TEMPORAL_ALT_REF
+#if VP9_TEMPORAL_ALT_REF
 
   if (vp8_yv12_alloc_frame_buffer(&cpi->alt_ref_buffer,
                                   width, height, VP8BORDERINPIXELS))
@@ -1261,7 +1247,7 @@
 #endif
 }
 
-static int vp8_alloc_partition_data(VP9_COMP *cpi) {
+static int alloc_partition_data(VP9_COMP *cpi) {
   vpx_free(cpi->mb.pip);
 
   cpi->mb.pip = vpx_calloc((cpi->common.mb_cols + 1) *
@@ -1285,7 +1271,7 @@
     vpx_internal_error(&cpi->common.error, VPX_CODEC_MEM_ERROR,
                        "Failed to allocate frame buffers");
 
-  if (vp8_alloc_partition_data(cpi))
+  if (alloc_partition_data(cpi))
     vpx_internal_error(&cpi->common.error, VPX_CODEC_MEM_ERROR,
                        "Failed to allocate partition data");
 
@@ -1434,7 +1420,7 @@
 }
 
 
-static void init_config(VP9_PTR ptr, VP8_CONFIG *oxcf) {
+static void init_config(VP9_PTR ptr, VP9_CONFIG *oxcf) {
   VP9_COMP *cpi = (VP9_COMP *)(ptr);
   VP9_COMMON *cm = &cpi->common;
 
@@ -1467,7 +1453,7 @@
 
   cpi->static_mb_pct = 0;
 
-#if VP8_TEMPORAL_ALT_REF
+#if VP9_TEMPORAL_ALT_REF
   {
     int i;
 
@@ -1480,7 +1466,7 @@
 }
 
 
-void vp9_change_config(VP9_PTR ptr, VP8_CONFIG *oxcf) {
+void vp9_change_config(VP9_PTR ptr, VP9_CONFIG *oxcf) {
   VP9_COMP *cpi = (VP9_COMP *)(ptr);
   VP9_COMMON *cm = &cpi->common;
 
@@ -1540,7 +1526,7 @@
 
   cpi->baseline_gf_interval = DEFAULT_GF_INTERVAL;
 
-  cpi->ref_frame_flags = VP8_ALT_FLAG | VP8_GOLD_FLAG | VP8_LAST_FLAG;
+  cpi->ref_frame_flags = VP9_ALT_FLAG | VP9_GOLD_FLAG | VP9_LAST_FLAG;
 
   // cpi->use_golden_frame_only = 0;
   // cpi->use_last_frame_only = 0;
@@ -1726,7 +1712,7 @@
   } while (++i <= MV_MAX);
 }
 
-VP9_PTR vp9_create_compressor(VP8_CONFIG *oxcf) {
+VP9_PTR vp9_create_compressor(VP9_CONFIG *oxcf) {
   int i;
   volatile union {
     VP9_COMP *cpi;
@@ -1830,14 +1816,14 @@
     init_context_counters();
 #endif
 #ifdef MODE_STATS
-  vp8_zero(y_modes);
-  vp8_zero(i8x8_modes);
-  vp8_zero(uv_modes);
-  vp8_zero(uv_modes_y);
-  vp8_zero(b_modes);
-  vp8_zero(inter_y_modes);
-  vp8_zero(inter_uv_modes);
-  vp8_zero(inter_b_modes);
+  vp9_zero(y_modes);
+  vp9_zero(i8x8_modes);
+  vp9_zero(uv_modes);
+  vp9_zero(uv_modes_y);
+  vp9_zero(b_modes);
+  vp9_zero(inter_y_modes);
+  vp9_zero(inter_uv_modes);
+  vp9_zero(inter_b_modes);
 #endif
 #ifdef NMV_STATS
   init_nmvstats();
@@ -2024,7 +2010,7 @@
 
   cpi->common.error.setjmp = 0;
 
-  vp8_zero(cpi->y_uv_mode_count)
+  vp9_zero(cpi->y_uv_mode_count)
 
   return (VP9_PTR) cpi;
 }
@@ -2055,7 +2041,7 @@
 
 #if CONFIG_INTERNAL_STATS
 
-    vp8_clear_system_state();
+    vp9_clear_system_state();
 
     // printf("\n8x8-4x4:%d-%d\n", cpi->t8x8_count, cpi->t4x4_count);
     if (cpi->pass != 1) {
@@ -2111,36 +2097,36 @@
       {
         int i;
         fprintf(f, "Y: ");
-        for (i = 0; i < VP8_YMODES; i++) fprintf(f, " %8d,", y_modes[i]);
+        for (i = 0; i < VP9_YMODES; i++) fprintf(f, " %8d,", y_modes[i]);
         fprintf(f, "\n");
       }
       {
         int i;
         fprintf(f, "I8: ");
-        for (i = 0; i < VP8_I8X8_MODES; i++) fprintf(f, " %8d,", i8x8_modes[i]);
+        for (i = 0; i < VP9_I8X8_MODES; i++) fprintf(f, " %8d,", i8x8_modes[i]);
         fprintf(f, "\n");
       }
       {
         int i;
         fprintf(f, "UV: ");
-        for (i = 0; i < VP8_UV_MODES; i++) fprintf(f, " %8d,", uv_modes[i]);
+        for (i = 0; i < VP9_UV_MODES; i++) fprintf(f, " %8d,", uv_modes[i]);
         fprintf(f, "\n");
       }
       {
         int i, j;
         fprintf(f, "KeyFrame Y-UV:\n");
-        for (i = 0; i < VP8_YMODES; i++) {
+        for (i = 0; i < VP9_YMODES; i++) {
           fprintf(f, "%2d:", i);
-          for (j = 0; j < VP8_UV_MODES; j++) fprintf(f, "%8d, ", uv_modes_y[i][j]);
+          for (j = 0; j < VP9_UV_MODES; j++) fprintf(f, "%8d, ", uv_modes_y[i][j]);
           fprintf(f, "\n");
         }
       }
       {
         int i, j;
         fprintf(f, "Inter Y-UV:\n");
-        for (i = 0; i < VP8_YMODES; i++) {
+        for (i = 0; i < VP9_YMODES; i++) {
           fprintf(f, "%2d:", i);
-          for (j = 0; j < VP8_UV_MODES; j++) fprintf(f, "%8d, ", cpi->y_uv_mode_count[i][j]);
+          for (j = 0; j < VP9_UV_MODES; j++) fprintf(f, "%8d, ", cpi->y_uv_mode_count[i][j]);
           fprintf(f, "\n");
         }
       }
@@ -2148,7 +2134,7 @@
         int i;
 
         fprintf(f, "B: ");
-        for (i = 0; i < VP8_BINTRAMODES; i++)
+        for (i = 0; i < VP9_BINTRAMODES; i++)
           fprintf(f, "%8d, ", b_modes[i]);
 
         fprintf(f, "\n");
@@ -2165,7 +2151,7 @@
       {
         int i;
         fprintf(f, "UV: ");
-        for (i = 0; i < VP8_UV_MODES; i++) fprintf(f, " %8d,", inter_uv_modes[i]);
+        for (i = 0; i < VP9_UV_MODES; i++) fprintf(f, " %8d,", inter_uv_modes[i]);
         fprintf(f, "\n");
       }
       {
@@ -2186,8 +2172,8 @@
       FILE *fmode = fopen("modecontext.c", "w");
 
       fprintf(fmode, "\n#include \"entropymode.h\"\n\n");
-      fprintf(fmode, "const unsigned int vp8_kf_default_bmode_counts ");
-      fprintf(fmode, "[VP8_BINTRAMODES] [VP8_BINTRAMODES] [VP8_BINTRAMODES] =\n{\n");
+      fprintf(fmode, "const unsigned int vp9_kf_default_bmode_counts ");
+      fprintf(fmode, "[VP9_BINTRAMODES] [VP9_BINTRAMODES] [VP9_BINTRAMODES] =\n{\n");
 
       for (i = 0; i < 10; i++) {
 
@@ -2197,7 +2183,7 @@
 
           fprintf(fmode, "        {");
 
-          for (k = 0; k < VP8_BINTRAMODES; k++) {
+          for (k = 0; k < VP9_BINTRAMODES; k++) {
             if (!intra_mode_stats[i][j][k])
               fprintf(fmode, " %5d, ", 1);
             else
@@ -2393,29 +2379,29 @@
   cpi->common.refresh_alt_ref_frame = 0;
   cpi->common.refresh_last_frame   = 0;
 
-  if (ref_frame_flags & VP8_LAST_FLAG)
+  if (ref_frame_flags & VP9_LAST_FLAG)
     cpi->common.refresh_last_frame = 1;
 
-  if (ref_frame_flags & VP8_GOLD_FLAG)
+  if (ref_frame_flags & VP9_GOLD_FLAG)
     cpi->common.refresh_golden_frame = 1;
 
-  if (ref_frame_flags & VP8_ALT_FLAG)
+  if (ref_frame_flags & VP9_ALT_FLAG)
     cpi->common.refresh_alt_ref_frame = 1;
 
   return 0;
 }
 
-int vp9_get_reference_enc(VP9_PTR ptr, VP8_REFFRAME ref_frame_flag,
+int vp9_get_reference_enc(VP9_PTR ptr, VP9_REFFRAME ref_frame_flag,
                           YV12_BUFFER_CONFIG *sd) {
   VP9_COMP *cpi = (VP9_COMP *)(ptr);
   VP9_COMMON *cm = &cpi->common;
   int ref_fb_idx;
 
-  if (ref_frame_flag == VP8_LAST_FLAG)
+  if (ref_frame_flag == VP9_LAST_FLAG)
     ref_fb_idx = cm->lst_fb_idx;
-  else if (ref_frame_flag == VP8_GOLD_FLAG)
+  else if (ref_frame_flag == VP9_GOLD_FLAG)
     ref_fb_idx = cm->gld_fb_idx;
-  else if (ref_frame_flag == VP8_ALT_FLAG)
+  else if (ref_frame_flag == VP9_ALT_FLAG)
     ref_fb_idx = cm->alt_fb_idx;
   else
     return -1;
@@ -2425,18 +2411,18 @@
   return 0;
 }
 
-int vp9_set_reference_enc(VP9_PTR ptr, VP8_REFFRAME ref_frame_flag,
+int vp9_set_reference_enc(VP9_PTR ptr, VP9_REFFRAME ref_frame_flag,
                           YV12_BUFFER_CONFIG *sd) {
   VP9_COMP *cpi = (VP9_COMP *)(ptr);
   VP9_COMMON *cm = &cpi->common;
 
   int ref_fb_idx;
 
-  if (ref_frame_flag == VP8_LAST_FLAG)
+  if (ref_frame_flag == VP9_LAST_FLAG)
     ref_fb_idx = cm->lst_fb_idx;
-  else if (ref_frame_flag == VP8_GOLD_FLAG)
+  else if (ref_frame_flag == VP9_GOLD_FLAG)
     ref_fb_idx = cm->gld_fb_idx;
-  else if (ref_frame_flag == VP8_ALT_FLAG)
+  else if (ref_frame_flag == VP9_ALT_FLAG)
     ref_fb_idx = cm->alt_fb_idx;
   else
     return -1;
@@ -2455,7 +2441,7 @@
 
 
 #ifdef OUTPUT_YUV_SRC
-void vp8_write_yuv_frame(YV12_BUFFER_CONFIG *s) {
+void vp9_write_yuv_frame(YV12_BUFFER_CONFIG *s) {
   unsigned char *src = s->y_buffer;
   int h = s->y_height;
 
@@ -2483,7 +2469,7 @@
 #endif
 
 #ifdef OUTPUT_YUV_REC
-void vp8_write_yuv_rec_frame(VP9_COMMON *cm) {
+void vp9_write_yuv_rec_frame(VP9_COMMON *cm) {
   YV12_BUFFER_CONFIG *s = cm->frame_to_show;
   unsigned char *src = s->y_buffer;
   int h = cm->Height;
@@ -2729,32 +2715,32 @@
   // If any buffer copy / swapping is signaled it should be done here.
 
   if (cm->frame_type == KEY_FRAME) {
-    yv12_fb[cm->new_fb_idx].flags |= VP8_GOLD_FLAG | VP8_ALT_FLAG;
+    yv12_fb[cm->new_fb_idx].flags |= VP9_GOLD_FLAG | VP9_ALT_FLAG;
 
-    yv12_fb[cm->gld_fb_idx].flags &= ~VP8_GOLD_FLAG;
-    yv12_fb[cm->alt_fb_idx].flags &= ~VP8_ALT_FLAG;
+    yv12_fb[cm->gld_fb_idx].flags &= ~VP9_GOLD_FLAG;
+    yv12_fb[cm->alt_fb_idx].flags &= ~VP9_ALT_FLAG;
 
     cm->alt_fb_idx = cm->gld_fb_idx = cm->new_fb_idx;
   } else { /* For non key frames */
     if (cm->refresh_alt_ref_frame) {
       assert(!cm->copy_buffer_to_arf);
 
-      cm->yv12_fb[cm->new_fb_idx].flags |= VP8_ALT_FLAG;
-      cm->yv12_fb[cm->alt_fb_idx].flags &= ~VP8_ALT_FLAG;
+      cm->yv12_fb[cm->new_fb_idx].flags |= VP9_ALT_FLAG;
+      cm->yv12_fb[cm->alt_fb_idx].flags &= ~VP9_ALT_FLAG;
       cm->alt_fb_idx = cm->new_fb_idx;
     } else if (cm->copy_buffer_to_arf) {
       assert(!(cm->copy_buffer_to_arf & ~0x3));
 
       if (cm->copy_buffer_to_arf == 1) {
         if (cm->alt_fb_idx != cm->lst_fb_idx) {
-          yv12_fb[cm->lst_fb_idx].flags |= VP8_ALT_FLAG;
-          yv12_fb[cm->alt_fb_idx].flags &= ~VP8_ALT_FLAG;
+          yv12_fb[cm->lst_fb_idx].flags |= VP9_ALT_FLAG;
+          yv12_fb[cm->alt_fb_idx].flags &= ~VP9_ALT_FLAG;
           cm->alt_fb_idx = cm->lst_fb_idx;
         }
       } else { /* if (cm->copy_buffer_to_arf == 2) */
         if (cm->alt_fb_idx != cm->gld_fb_idx) {
-          yv12_fb[cm->gld_fb_idx].flags |= VP8_ALT_FLAG;
-          yv12_fb[cm->alt_fb_idx].flags &= ~VP8_ALT_FLAG;
+          yv12_fb[cm->gld_fb_idx].flags |= VP9_ALT_FLAG;
+          yv12_fb[cm->alt_fb_idx].flags &= ~VP9_ALT_FLAG;
           cm->alt_fb_idx = cm->gld_fb_idx;
         }
       }
@@ -2763,22 +2749,22 @@
     if (cm->refresh_golden_frame) {
       assert(!cm->copy_buffer_to_gf);
 
-      cm->yv12_fb[cm->new_fb_idx].flags |= VP8_GOLD_FLAG;
-      cm->yv12_fb[cm->gld_fb_idx].flags &= ~VP8_GOLD_FLAG;
+      cm->yv12_fb[cm->new_fb_idx].flags |= VP9_GOLD_FLAG;
+      cm->yv12_fb[cm->gld_fb_idx].flags &= ~VP9_GOLD_FLAG;
       cm->gld_fb_idx = cm->new_fb_idx;
     } else if (cm->copy_buffer_to_gf) {
       assert(!(cm->copy_buffer_to_arf & ~0x3));
 
       if (cm->copy_buffer_to_gf == 1) {
         if (cm->gld_fb_idx != cm->lst_fb_idx) {
-          yv12_fb[cm->lst_fb_idx].flags |= VP8_GOLD_FLAG;
-          yv12_fb[cm->gld_fb_idx].flags &= ~VP8_GOLD_FLAG;
+          yv12_fb[cm->lst_fb_idx].flags |= VP9_GOLD_FLAG;
+          yv12_fb[cm->gld_fb_idx].flags &= ~VP9_GOLD_FLAG;
           cm->gld_fb_idx = cm->lst_fb_idx;
         }
       } else { /* if (cm->copy_buffer_to_gf == 2) */
         if (cm->alt_fb_idx != cm->gld_fb_idx) {
-          yv12_fb[cm->alt_fb_idx].flags |= VP8_GOLD_FLAG;
-          yv12_fb[cm->gld_fb_idx].flags &= ~VP8_GOLD_FLAG;
+          yv12_fb[cm->alt_fb_idx].flags |= VP9_GOLD_FLAG;
+          yv12_fb[cm->gld_fb_idx].flags &= ~VP9_GOLD_FLAG;
           cm->gld_fb_idx = cm->alt_fb_idx;
         }
       }
@@ -2786,8 +2772,8 @@
   }
 
   if (cm->refresh_last_frame) {
-    cm->yv12_fb[cm->new_fb_idx].flags |= VP8_LAST_FLAG;
-    cm->yv12_fb[cm->lst_fb_idx].flags &= ~VP8_LAST_FLAG;
+    cm->yv12_fb[cm->new_fb_idx].flags |= VP9_LAST_FLAG;
+    cm->yv12_fb[cm->lst_fb_idx].flags &= ~VP9_LAST_FLAG;
     cm->lst_fb_idx = cm->new_fb_idx;
   }
 }
@@ -2804,7 +2790,7 @@
   else {
     struct vpx_usec_timer timer;
 
-    vp8_clear_system_state();
+    vp9_clear_system_state();
 
     vpx_usec_timer_start(&timer);
     if (cpi->sf.auto_filter == 0)
@@ -2927,7 +2913,7 @@
   INT64 mcomp_filter_cost[4];
 
   // Clear down mmx registers to allow floating point in what follows
-  vp8_clear_system_state();
+  vp9_clear_system_state();
 
 
   // For an alt ref frame in 2 pass we skip the call to the second
@@ -3004,7 +2990,7 @@
   // Decide how big to make the frame
   vp9_pick_frame_size(cpi);
 
-  vp8_clear_system_state();
+  vp9_clear_system_state();
 
   // Set an active best quality and if necessary active worst quality
   Q = cpi->active_worst_quality;
@@ -3197,7 +3183,7 @@
 #endif
 
 #ifdef OUTPUT_YUV_SRC
-  vp8_write_yuv_frame(cpi->Source);
+  vp9_write_yuv_frame(cpi->Source);
 #endif
 
 #if RESET_FOREACH_FILTER
@@ -3215,7 +3201,7 @@
   }
 #endif
   do {
-    vp8_clear_system_state();  // __asm emms;
+    vp9_clear_system_state();  // __asm emms;
 
     vp9_set_quantizer(cpi, Q);
     this_q = Q;
@@ -3280,7 +3266,7 @@
     // seen in the last encoder iteration.
     update_base_skip_probs(cpi);
 
-    vp8_clear_system_state();  // __asm emms;
+    vp9_clear_system_state();  // __asm emms;
 
 #if CONFIG_PRED_FILTER
     // Update prediction filter on/off probability based on
@@ -3465,24 +3451,24 @@
         !sf->search_best_filter &&
         cm->mcomp_filter_type == SWITCHABLE) {
       int interp_factor = Q / 3;  /* denominator is 256 */
-      int count[VP8_SWITCHABLE_FILTERS];
+      int count[VP9_SWITCHABLE_FILTERS];
       int tot_count = 0, c = 0, thr;
       int i, j;
-      for (i = 0; i < VP8_SWITCHABLE_FILTERS; ++i) {
+      for (i = 0; i < VP9_SWITCHABLE_FILTERS; ++i) {
         count[i] = 0;
-        for (j = 0; j <= VP8_SWITCHABLE_FILTERS; ++j) {
+        for (j = 0; j <= VP9_SWITCHABLE_FILTERS; ++j) {
           count[i] += cpi->switchable_interp_count[j][i];
         }
         tot_count += count[i];
       }
 
       thr = ((tot_count * interp_factor + 128) >> 8);
-      for (i = 0; i < VP8_SWITCHABLE_FILTERS; ++i) {
+      for (i = 0; i < VP9_SWITCHABLE_FILTERS; ++i) {
         c += (count[i] >= thr);
       }
       if (c == 1) {
         /* Mostly one filter is used. So set the filter at frame level */
-        for (i = 0; i < VP8_SWITCHABLE_FILTERS; ++i) {
+        for (i = 0; i < VP9_SWITCHABLE_FILTERS; ++i) {
           if (count[i]) {
             cm->mcomp_filter_type = vp9_switchable_interp[i];
             Loop = TRUE;  /* Make sure to loop since the filter changed */
@@ -3629,21 +3615,21 @@
 #endif
 
   update_reference_frames(cm);
-  vp8_copy(cpi->common.fc.coef_counts, cpi->coef_counts);
-  vp8_copy(cpi->common.fc.hybrid_coef_counts, cpi->hybrid_coef_counts);
-  vp8_copy(cpi->common.fc.coef_counts_8x8, cpi->coef_counts_8x8);
-  vp8_copy(cpi->common.fc.hybrid_coef_counts_8x8, cpi->hybrid_coef_counts_8x8);
-  vp8_copy(cpi->common.fc.coef_counts_16x16, cpi->coef_counts_16x16);
-  vp8_copy(cpi->common.fc.hybrid_coef_counts_16x16,
+  vp9_copy(cpi->common.fc.coef_counts, cpi->coef_counts);
+  vp9_copy(cpi->common.fc.hybrid_coef_counts, cpi->hybrid_coef_counts);
+  vp9_copy(cpi->common.fc.coef_counts_8x8, cpi->coef_counts_8x8);
+  vp9_copy(cpi->common.fc.hybrid_coef_counts_8x8, cpi->hybrid_coef_counts_8x8);
+  vp9_copy(cpi->common.fc.coef_counts_16x16, cpi->coef_counts_16x16);
+  vp9_copy(cpi->common.fc.hybrid_coef_counts_16x16,
            cpi->hybrid_coef_counts_16x16);
   vp9_adapt_coef_probs(&cpi->common);
   if (cpi->common.frame_type != KEY_FRAME) {
-    vp8_copy(cpi->common.fc.ymode_counts, cpi->ymode_count);
-    vp8_copy(cpi->common.fc.uv_mode_counts, cpi->y_uv_mode_count);
-    vp8_copy(cpi->common.fc.bmode_counts, cpi->bmode_count);
-    vp8_copy(cpi->common.fc.i8x8_mode_counts, cpi->i8x8_mode_count);
-    vp8_copy(cpi->common.fc.sub_mv_ref_counts, cpi->sub_mv_ref_count);
-    vp8_copy(cpi->common.fc.mbsplit_counts, cpi->mbsplit_count);
+    vp9_copy(cpi->common.fc.ymode_counts, cpi->ymode_count);
+    vp9_copy(cpi->common.fc.uv_mode_counts, cpi->y_uv_mode_count);
+    vp9_copy(cpi->common.fc.bmode_counts, cpi->bmode_count);
+    vp9_copy(cpi->common.fc.i8x8_mode_counts, cpi->i8x8_mode_count);
+    vp9_copy(cpi->common.fc.sub_mv_ref_counts, cpi->sub_mv_ref_count);
+    vp9_copy(cpi->common.fc.mbsplit_counts, cpi->mbsplit_count);
     vp9_adapt_mode_probs(&cpi->common);
 
     cpi->common.fc.NMVcount = cpi->NMVcount;
@@ -3760,7 +3746,7 @@
     FILE *f = fopen("tmp.stt", "a");
     int recon_err;
 
-    vp8_clear_system_state();  // __asm emms;
+    vp9_clear_system_state();  // __asm emms;
 
     recon_err = vp9_calc_ss_err(cpi->Source,
                                 &cm->yv12_fb[cm->new_fb_idx]);
@@ -3880,16 +3866,16 @@
   else if (cm->refresh_alt_ref_frame ^ cm->refresh_golden_frame) // 1 refreshed but not the other
     cpi->gold_is_alt = 0;
 
-  cpi->ref_frame_flags = VP8_ALT_FLAG | VP8_GOLD_FLAG | VP8_LAST_FLAG;
+  cpi->ref_frame_flags = VP9_ALT_FLAG | VP9_GOLD_FLAG | VP9_LAST_FLAG;
 
   if (cpi->gold_is_last)
-    cpi->ref_frame_flags &= ~VP8_GOLD_FLAG;
+    cpi->ref_frame_flags &= ~VP9_GOLD_FLAG;
 
   if (cpi->alt_is_last)
-    cpi->ref_frame_flags &= ~VP8_ALT_FLAG;
+    cpi->ref_frame_flags &= ~VP9_ALT_FLAG;
 
   if (cpi->gold_is_alt)
-    cpi->ref_frame_flags &= ~VP8_ALT_FLAG;
+    cpi->ref_frame_flags &= ~VP9_ALT_FLAG;
 
   if (cpi->oxcf.play_alternate && cm->refresh_alt_ref_frame && (cm->frame_type != KEY_FRAME))
     // Update the alternate reference frame stats as appropriate.
@@ -3936,7 +3922,7 @@
   }
 #endif
 #ifdef OUTPUT_YUV_REC
-  vp8_write_yuv_rec_frame(cm);
+  vp9_write_yuv_rec_frame(cm);
 #endif
 
   if (cm->show_frame) {
@@ -3971,8 +3957,8 @@
 
 // For ARM NEON, d8-d15 are callee-saved registers, and need to be saved by us.
 #if HAVE_ARMV7
-extern void vp8_push_neon(int64_t *store);
-extern void vp8_pop_neon(int64_t *store);
+extern void vp9_push_neon(int64_t *store);
+extern void vp9_pop_neon(int64_t *store);
 #endif
 
 
@@ -3992,7 +3978,7 @@
   if (cm->rtcd.flags & HAS_NEON)
 #endif
   {
-    vp8_push_neon(store_reg);
+    vp9_push_neon(store_reg);
   }
 #endif
 
@@ -4009,7 +3995,7 @@
   if (cm->rtcd.flags & HAS_NEON)
 #endif
   {
-    vp8_pop_neon(store_reg);
+    vp9_pop_neon(store_reg);
   }
 #endif
 
@@ -4049,7 +4035,7 @@
   if (cm->rtcd.flags & HAS_NEON)
 #endif
   {
-    vp8_push_neon(store_reg);
+    vp9_push_neon(store_reg);
   }
 #endif
 
@@ -4109,7 +4095,7 @@
     if (cm->rtcd.flags & HAS_NEON)
 #endif
     {
-      vp8_pop_neon(store_reg);
+      vp9_pop_neon(store_reg);
     }
 #endif
     return -1;
@@ -4169,7 +4155,7 @@
   *size = 0;
 
   // Clear down mmx registers
-  vp8_clear_system_state();  // __asm emms;
+  vp9_clear_system_state();  // __asm emms;
 
   cm->frame_type = INTER_FRAME;
   cm->frame_flags = *frame_flags;
@@ -4280,7 +4266,7 @@
 #if CONFIG_POSTPROC
           vp9_deblock(cm->frame_to_show, &cm->post_proc_buffer, cm->filter_level * 10 / 6, 1, 0, IF_RTCD(&cm->rtcd.postproc));
 #endif
-          vp8_clear_system_state();
+          vp9_clear_system_state();
 
           ye = calc_plane_error(orig->y_buffer, orig->y_stride,
                                 pp->y_buffer, pp->y_stride, orig->y_width,
@@ -4341,7 +4327,7 @@
   if (cm->rtcd.flags & HAS_NEON)
 #endif
   {
-    vp8_pop_neon(store_reg);
+    vp9_pop_neon(store_reg);
   }
 #endif
 
@@ -4349,7 +4335,7 @@
 }
 
 int vp9_get_preview_raw_frame(VP9_PTR comp, YV12_BUFFER_CONFIG *dest,
-                              vp8_ppflags_t *flags) {
+                              vp9_ppflags_t *flags) {
   VP9_COMP *cpi = (VP9_COMP *) comp;
 
   if (cpi->common.refresh_alt_ref_frame)
@@ -4371,7 +4357,7 @@
     }
 
 #endif // !CONFIG_POSTPROC
-    vp8_clear_system_state();
+    vp9_clear_system_state();
     return ret;
   }
 }
diff --git a/vp8/encoder/onyx_int.h b/vp8/encoder/onyx_int.h
index 22c9ffc..42cb972 100644
--- a/vp8/encoder/onyx_int.h
+++ b/vp8/encoder/onyx_int.h
@@ -9,8 +9,8 @@
  */
 
 
-#ifndef __INC_VP8_INT_H
-#define __INC_VP8_INT_H
+#ifndef __INC_ONYX_INT_H
+#define __INC_ONYX_INT_H
 
 #include <stdio.h>
 #include "vpx_ports/config.h"
@@ -56,7 +56,7 @@
 #define MV_ZBIN_BOOST        4
 #define ZBIN_OQ_MAX 192
 
-#define VP8_TEMPORAL_ALT_REF 1
+#define VP9_TEMPORAL_ALT_REF 1
 
 typedef struct {
   nmv_context nmvc;
@@ -66,19 +66,19 @@
 
 #ifdef MODE_STATS
   // Stats
-  int y_modes[VP8_YMODES];
-  int uv_modes[VP8_UV_MODES];
-  int i8x8_modes[VP8_I8X8_MODES];
+  int y_modes[VP9_YMODES];
+  int uv_modes[VP9_UV_MODES];
+  int i8x8_modes[VP9_I8X8_MODES];
   int b_modes[B_MODE_COUNT];
   int inter_y_modes[MB_MODE_COUNT];
-  int inter_uv_modes[VP8_UV_MODES];
+  int inter_uv_modes[VP9_UV_MODES];
   int inter_b_modes[B_MODE_COUNT];
 #endif
 
-  vp8_prob segment_pred_probs[PREDICTION_PROBS];
+  vp9_prob segment_pred_probs[PREDICTION_PROBS];
   unsigned char ref_pred_probs_update[PREDICTION_PROBS];
-  vp8_prob ref_pred_probs[PREDICTION_PROBS];
-  vp8_prob prob_comppred[COMP_PRED_CONTEXTS];
+  vp9_prob ref_pred_probs[PREDICTION_PROBS];
+  vp9_prob prob_comppred[COMP_PRED_CONTEXTS];
 
   unsigned char *last_frame_seg_map_copy;
 
@@ -87,30 +87,30 @@
   // 0 = BPRED, ZERO_MV, MV, SPLIT
   signed char last_mode_lf_deltas[MAX_MODE_LF_DELTAS];
 
-  vp8_prob coef_probs[BLOCK_TYPES]
+  vp9_prob coef_probs[BLOCK_TYPES]
       [COEF_BANDS][PREV_COEF_CONTEXTS][ENTROPY_NODES];
-  vp8_prob hybrid_coef_probs[BLOCK_TYPES]
+  vp9_prob hybrid_coef_probs[BLOCK_TYPES]
       [COEF_BANDS][PREV_COEF_CONTEXTS][ENTROPY_NODES];
 
-  vp8_prob coef_probs_8x8[BLOCK_TYPES_8X8]
+  vp9_prob coef_probs_8x8[BLOCK_TYPES_8X8]
       [COEF_BANDS][PREV_COEF_CONTEXTS][ENTROPY_NODES];
-  vp8_prob hybrid_coef_probs_8x8[BLOCK_TYPES_8X8]
+  vp9_prob hybrid_coef_probs_8x8[BLOCK_TYPES_8X8]
       [COEF_BANDS][PREV_COEF_CONTEXTS][ENTROPY_NODES];
 
-  vp8_prob coef_probs_16x16[BLOCK_TYPES_16X16]
+  vp9_prob coef_probs_16x16[BLOCK_TYPES_16X16]
       [COEF_BANDS][PREV_COEF_CONTEXTS][ENTROPY_NODES];
-  vp8_prob hybrid_coef_probs_16x16[BLOCK_TYPES_16X16]
+  vp9_prob hybrid_coef_probs_16x16[BLOCK_TYPES_16X16]
       [COEF_BANDS][PREV_COEF_CONTEXTS][ENTROPY_NODES];
 
-  vp8_prob ymode_prob [VP8_YMODES - 1]; /* interframe intra mode probs */
-  vp8_prob uv_mode_prob [VP8_YMODES][VP8_UV_MODES - 1];
-  vp8_prob bmode_prob [VP8_BINTRAMODES - 1];
-  vp8_prob i8x8_mode_prob [VP8_I8X8_MODES - 1];
-  vp8_prob sub_mv_ref_prob [SUBMVREF_COUNT][VP8_SUBMVREFS - 1];
-  vp8_prob mbsplit_prob [VP8_NUMMBSPLITS - 1];
+  vp9_prob ymode_prob [VP9_YMODES - 1]; /* interframe intra mode probs */
+  vp9_prob uv_mode_prob [VP9_YMODES][VP9_UV_MODES - 1];
+  vp9_prob bmode_prob [VP9_BINTRAMODES - 1];
+  vp9_prob i8x8_mode_prob [VP9_I8X8_MODES - 1];
+  vp9_prob sub_mv_ref_prob [SUBMVREF_COUNT][VP9_SUBMVREFS - 1];
+  vp9_prob mbsplit_prob [VP9_NUMMBSPLITS - 1];
 
-  vp8_prob switchable_interp_prob[VP8_SWITCHABLE_FILTERS + 1]
-                                 [VP8_SWITCHABLE_FILTERS - 1];
+  vp9_prob switchable_interp_prob[VP9_SWITCHABLE_FILTERS + 1]
+                                 [VP9_SWITCHABLE_FILTERS - 1];
 
   int mv_ref_ct[6][4][2];
   int mode_context[6][4];
@@ -347,11 +347,11 @@
 } LPFTHREAD_DATA;
 
 
-typedef struct VP8_ENCODER_RTCD {
+typedef struct VP9_ENCODER_RTCD {
   VP9_COMMON_RTCD            *common;
-  vp8_search_rtcd_vtable_t    search;
-  vp8_temporal_rtcd_vtable_t  temporal;
-} VP8_ENCODER_RTCD;
+  vp9_search_rtcd_vtable_t    search;
+  vp9_temporal_rtcd_vtable_t  temporal;
+} VP9_ENCODER_RTCD;
 
 enum BlockSize {
   BLOCK_16X8 = PARTITIONING_16X8,
@@ -401,7 +401,7 @@
 
   MACROBLOCK mb;
   VP9_COMMON common;
-  VP8_CONFIG oxcf;
+  VP9_CONFIG oxcf;
 
   struct lookahead_ctx    *lookahead;
   struct lookahead_entry  *source;
@@ -532,37 +532,37 @@
 
 #if CONFIG_SUPERBLOCKS
   int sb_count;
-  int sb_ymode_count [VP8_I32X32_MODES];
+  int sb_ymode_count [VP9_I32X32_MODES];
 #endif
-  int ymode_count [VP8_YMODES];        /* intra MB type cts this frame */
-  int bmode_count [VP8_BINTRAMODES];
-  int i8x8_mode_count [VP8_I8X8_MODES];
-  int sub_mv_ref_count [SUBMVREF_COUNT][VP8_SUBMVREFS];
-  int mbsplit_count [VP8_NUMMBSPLITS];
-  // int uv_mode_count[VP8_UV_MODES];       /* intra MB type cts this frame */
-  int y_uv_mode_count[VP8_YMODES][VP8_UV_MODES];
+  int ymode_count [VP9_YMODES];        /* intra MB type cts this frame */
+  int bmode_count [VP9_BINTRAMODES];
+  int i8x8_mode_count [VP9_I8X8_MODES];
+  int sub_mv_ref_count [SUBMVREF_COUNT][VP9_SUBMVREFS];
+  int mbsplit_count [VP9_NUMMBSPLITS];
+  // int uv_mode_count[VP9_UV_MODES];       /* intra MB type cts this frame */
+  int y_uv_mode_count[VP9_YMODES][VP9_UV_MODES];
 
   nmv_context_counts NMVcount;
 
   unsigned int coef_counts [BLOCK_TYPES] [COEF_BANDS] [PREV_COEF_CONTEXTS] [MAX_ENTROPY_TOKENS];  /* for this frame */
-  vp8_prob frame_coef_probs [BLOCK_TYPES] [COEF_BANDS] [PREV_COEF_CONTEXTS] [ENTROPY_NODES];
+  vp9_prob frame_coef_probs [BLOCK_TYPES] [COEF_BANDS] [PREV_COEF_CONTEXTS] [ENTROPY_NODES];
   unsigned int frame_branch_ct [BLOCK_TYPES] [COEF_BANDS] [PREV_COEF_CONTEXTS] [ENTROPY_NODES][2];
   unsigned int hybrid_coef_counts [BLOCK_TYPES] [COEF_BANDS] [PREV_COEF_CONTEXTS] [MAX_ENTROPY_TOKENS];  /* for this frame */
-  vp8_prob frame_hybrid_coef_probs [BLOCK_TYPES] [COEF_BANDS] [PREV_COEF_CONTEXTS] [ENTROPY_NODES];
+  vp9_prob frame_hybrid_coef_probs [BLOCK_TYPES] [COEF_BANDS] [PREV_COEF_CONTEXTS] [ENTROPY_NODES];
   unsigned int frame_hybrid_branch_ct [BLOCK_TYPES] [COEF_BANDS] [PREV_COEF_CONTEXTS] [ENTROPY_NODES][2];
 
   unsigned int coef_counts_8x8 [BLOCK_TYPES_8X8] [COEF_BANDS] [PREV_COEF_CONTEXTS] [MAX_ENTROPY_TOKENS];  /* for this frame */
-  vp8_prob frame_coef_probs_8x8 [BLOCK_TYPES_8X8] [COEF_BANDS] [PREV_COEF_CONTEXTS] [ENTROPY_NODES];
+  vp9_prob frame_coef_probs_8x8 [BLOCK_TYPES_8X8] [COEF_BANDS] [PREV_COEF_CONTEXTS] [ENTROPY_NODES];
   unsigned int frame_branch_ct_8x8 [BLOCK_TYPES_8X8] [COEF_BANDS] [PREV_COEF_CONTEXTS] [ENTROPY_NODES][2];
   unsigned int hybrid_coef_counts_8x8 [BLOCK_TYPES_8X8] [COEF_BANDS] [PREV_COEF_CONTEXTS] [MAX_ENTROPY_TOKENS];  /* for this frame */
-  vp8_prob frame_hybrid_coef_probs_8x8 [BLOCK_TYPES_8X8] [COEF_BANDS] [PREV_COEF_CONTEXTS] [ENTROPY_NODES];
+  vp9_prob frame_hybrid_coef_probs_8x8 [BLOCK_TYPES_8X8] [COEF_BANDS] [PREV_COEF_CONTEXTS] [ENTROPY_NODES];
   unsigned int frame_hybrid_branch_ct_8x8 [BLOCK_TYPES_8X8] [COEF_BANDS] [PREV_COEF_CONTEXTS] [ENTROPY_NODES][2];
 
   unsigned int coef_counts_16x16 [BLOCK_TYPES_16X16] [COEF_BANDS] [PREV_COEF_CONTEXTS] [MAX_ENTROPY_TOKENS];  /* for this frame */
-  vp8_prob frame_coef_probs_16x16 [BLOCK_TYPES_16X16] [COEF_BANDS] [PREV_COEF_CONTEXTS] [ENTROPY_NODES];
+  vp9_prob frame_coef_probs_16x16 [BLOCK_TYPES_16X16] [COEF_BANDS] [PREV_COEF_CONTEXTS] [ENTROPY_NODES];
   unsigned int frame_branch_ct_16x16 [BLOCK_TYPES_16X16] [COEF_BANDS] [PREV_COEF_CONTEXTS] [ENTROPY_NODES][2];
   unsigned int hybrid_coef_counts_16x16 [BLOCK_TYPES_16X16] [COEF_BANDS] [PREV_COEF_CONTEXTS] [MAX_ENTROPY_TOKENS];  /* for this frame */
-  vp8_prob frame_hybrid_coef_probs_16x16 [BLOCK_TYPES_16X16] [COEF_BANDS] [PREV_COEF_CONTEXTS] [ENTROPY_NODES];
+  vp9_prob frame_hybrid_coef_probs_16x16 [BLOCK_TYPES_16X16] [COEF_BANDS] [PREV_COEF_CONTEXTS] [ENTROPY_NODES];
   unsigned int frame_hybrid_branch_ct_16x16 [BLOCK_TYPES_16X16] [COEF_BANDS] [PREV_COEF_CONTEXTS] [ENTROPY_NODES][2];
 
   int gfu_boost;
@@ -602,7 +602,7 @@
   int vert_scale;
   int pass;
 
-  vp8_prob last_skip_false_probs[3][MBSKIP_CONTEXTS];
+  vp9_prob last_skip_false_probs[3][MBSKIP_CONTEXTS];
   int last_skip_probs_q[3];
 
   int recent_ref_frame_usage[MAX_REF_FRAMES];
@@ -632,10 +632,10 @@
   TOKENLIST *tplist;
 
   fractional_mv_step_fp *find_fractional_mv_step;
-  vp8_full_search_fn_t full_search_sad;
-  vp8_refining_search_fn_t refining_search_sad;
-  vp8_diamond_search_fn_t diamond_search_sad;
-  vp8_variance_fn_ptr_t fn_ptr[BLOCK_MAX_SB_SEGMENTS];
+  vp9_full_search_fn_t full_search_sad;
+  vp9_refining_search_fn_t refining_search_sad;
+  vp9_diamond_search_fn_t diamond_search_sad;
+  vp9_variance_fn_ptr_t fn_ptr[BLOCK_MAX_SB_SEGMENTS];
   uint64_t time_receive_data;
   uint64_t time_compress_data;
   uint64_t time_pick_lpf;
@@ -682,9 +682,9 @@
   } twopass;
 
 #if CONFIG_RUNTIME_CPU_DETECT
-  VP8_ENCODER_RTCD            rtcd;
+  VP9_ENCODER_RTCD            rtcd;
 #endif
-#if VP8_TEMPORAL_ALT_REF
+#if VP9_TEMPORAL_ALT_REF
   YV12_BUFFER_CONFIG alt_ref_buffer;
   YV12_BUFFER_CONFIG *frames[MAX_LAG_BUFFERS];
   int fixed_divide[512];
@@ -748,8 +748,8 @@
   int pred_filter_on_count;
   int pred_filter_off_count;
 #endif
-  unsigned int switchable_interp_count[VP8_SWITCHABLE_FILTERS + 1]
-                                      [VP8_SWITCHABLE_FILTERS];
+  unsigned int switchable_interp_count[VP9_SWITCHABLE_FILTERS + 1]
+                                      [VP9_SWITCHABLE_FILTERS];
 
 #if CONFIG_NEW_MVREF
   unsigned int best_ref_index_counts[MAX_REF_FRAMES][MAX_MV_REFS];
@@ -785,4 +785,4 @@
                          "Failed to allocate "#lval);\
   } while(0)
 #endif
-#endif
+#endif  // __INC_ONYX_INT_H
diff --git a/vp8/encoder/picklpf.c b/vp8/encoder/picklpf.c
index c993ab0..147a205 100644
--- a/vp8/encoder/picklpf.c
+++ b/vp8/encoder/picklpf.c
@@ -64,8 +64,8 @@
   vpx_memcpy(dst_y, src_y, ystride * (linestocopy + 16));
 }
 
-static int vp8_calc_partial_ssl_err(YV12_BUFFER_CONFIG *source,
-                                    YV12_BUFFER_CONFIG *dest, int Fraction) {
+static int calc_partial_ssl_err(YV12_BUFFER_CONFIG *source,
+                                YV12_BUFFER_CONFIG *dest, int Fraction) {
   int i, j;
   int Total = 0;
   int srcoffset, dstoffset;
@@ -173,7 +173,7 @@
   // Get the err using the previous frame's filter value.
   vp9_loop_filter_partial_frame(cm, &cpi->mb.e_mbd, filt_val);
 
-  best_err = vp8_calc_partial_ssl_err(sd, cm->frame_to_show, 3);
+  best_err = calc_partial_ssl_err(sd, cm->frame_to_show, 3);
 
   //  Re-instate the unfiltered frame
   vp9_yv12_copy_partial_frame_ptr(&cpi->last_frame_uf, cm->frame_to_show, 3);
@@ -186,7 +186,7 @@
     vp9_loop_filter_partial_frame(cm, &cpi->mb.e_mbd, filt_val);
 
     // Get the err for filtered frame
-    filt_err = vp8_calc_partial_ssl_err(sd, cm->frame_to_show, 3);
+    filt_err = calc_partial_ssl_err(sd, cm->frame_to_show, 3);
 
     //  Re-instate the unfiltered frame
     vp9_yv12_copy_partial_frame_ptr(&cpi->last_frame_uf, cm->frame_to_show, 3);
@@ -215,7 +215,7 @@
       vp9_loop_filter_partial_frame(cm, &cpi->mb.e_mbd, filt_val);
 
       // Get the err for filtered frame
-      filt_err = vp8_calc_partial_ssl_err(sd, cm->frame_to_show, 3);
+      filt_err = calc_partial_ssl_err(sd, cm->frame_to_show, 3);
 
       //  Re-instate the unfiltered frame
       vp9_yv12_copy_partial_frame_ptr(&cpi->last_frame_uf,
diff --git a/vp8/encoder/ppc/variance_altivec.asm b/vp8/encoder/ppc/variance_altivec.asm
index a1ebf66..ad26641 100644
--- a/vp8/encoder/ppc/variance_altivec.asm
+++ b/vp8/encoder/ppc/variance_altivec.asm
@@ -12,11 +12,11 @@
     .globl vp8_get8x8var_ppc
     .globl vp8_get16x16var_ppc
     .globl vp8_mse16x16_ppc
-    .globl vp8_variance16x16_ppc
-    .globl vp8_variance16x8_ppc
-    .globl vp8_variance8x16_ppc
-    .globl vp8_variance8x8_ppc
-    .globl vp8_variance4x4_ppc
+    .globl vp9_variance16x16_ppc
+    .globl vp9_variance16x8_ppc
+    .globl vp9_variance8x16_ppc
+    .globl vp9_variance8x8_ppc
+    .globl vp9_variance4x4_ppc
 
 .macro load_aligned_16 V R O
     lvsl    v3,  0, \R          ;# permutate value for alignment
@@ -242,7 +242,7 @@
 ;# r7 unsigned int *sse
 ;#
 ;# r3 return value
-vp8_variance16x16_ppc:
+vp9_variance16x16_ppc:
 
     prologue
 
@@ -262,7 +262,7 @@
 ;# r7 unsigned int *sse
 ;#
 ;# r3 return value
-vp8_variance16x8_ppc:
+vp9_variance16x8_ppc:
 
     prologue
 
@@ -283,7 +283,7 @@
 ;# r7 unsigned int *sse
 ;#
 ;# r3 return value
-vp8_variance8x16_ppc:
+vp9_variance8x16_ppc:
 
     prologue
 
@@ -304,7 +304,7 @@
 ;# r7 unsigned int *sse
 ;#
 ;# r3 return value
-vp8_variance8x8_ppc:
+vp9_variance8x8_ppc:
 
     prologue
 
@@ -343,7 +343,7 @@
 ;# r7 unsigned int *sse
 ;#
 ;# r3 return value
-vp8_variance4x4_ppc:
+vp9_variance4x4_ppc:
 
     prologue
 
diff --git a/vp8/encoder/ppc/variance_subpixel_altivec.asm b/vp8/encoder/ppc/variance_subpixel_altivec.asm
index 301360b..26cc76f 100644
--- a/vp8/encoder/ppc/variance_subpixel_altivec.asm
+++ b/vp8/encoder/ppc/variance_subpixel_altivec.asm
@@ -9,11 +9,11 @@
 ;
 
 
-    .globl vp8_sub_pixel_variance4x4_ppc
-    .globl vp8_sub_pixel_variance8x8_ppc
-    .globl vp8_sub_pixel_variance8x16_ppc
-    .globl vp8_sub_pixel_variance16x8_ppc
-    .globl vp8_sub_pixel_variance16x16_ppc
+    .globl vp9_sub_pixel_variance4x4_ppc
+    .globl vp9_sub_pixel_variance8x8_ppc
+    .globl vp9_sub_pixel_variance8x16_ppc
+    .globl vp9_sub_pixel_variance16x8_ppc
+    .globl vp9_sub_pixel_variance16x16_ppc
 
 .macro load_c V, LABEL, OFF, R0, R1
     lis     \R0, \LABEL@ha
@@ -191,7 +191,7 @@
 ;# r9 unsigned int *sse
 ;#
 ;# r3 return value
-vp8_sub_pixel_variance4x4_ppc:
+vp9_sub_pixel_variance4x4_ppc:
     mfspr   r11, 256            ;# get old VRSAVE
     oris    r12, r11, 0xf830
     ori     r12, r12, 0xfff8
@@ -282,7 +282,7 @@
 ;# r9 unsigned int *sse
 ;#
 ;# r3 return value
-vp8_sub_pixel_variance8x8_ppc:
+vp9_sub_pixel_variance8x8_ppc:
     mfspr   r11, 256            ;# get old VRSAVE
     oris    r12, r11, 0xfff0
     ori     r12, r12, 0xffff
@@ -392,7 +392,7 @@
 ;# r9 unsigned int *sse
 ;#
 ;# r3 return value
-vp8_sub_pixel_variance8x16_ppc:
+vp9_sub_pixel_variance8x16_ppc:
     mfspr   r11, 256            ;# get old VRSAVE
     oris    r12, r11, 0xffff
     ori     r12, r12, 0xfffc
@@ -609,7 +609,7 @@
 ;# r9 unsigned int *sse
 ;#
 ;# r3 return value
-vp8_sub_pixel_variance16x8_ppc:
+vp9_sub_pixel_variance16x8_ppc:
     mfspr   r11, 256            ;# get old VRSAVE
     oris    r12, r11, 0xffff
     ori     r12, r12, 0xfff8
@@ -702,7 +702,7 @@
 ;# r9 unsigned int *sse
 ;#
 ;# r3 return value
-vp8_sub_pixel_variance16x16_ppc:
+vp9_sub_pixel_variance16x16_ppc:
     mfspr   r11, 256            ;# get old VRSAVE
     oris    r12, r11, 0xffff
     ori     r12, r12, 0xfff8
diff --git a/vp8/encoder/psnr.c b/vp8/encoder/psnr.c
index b447871..0485051 100644
--- a/vp8/encoder/psnr.c
+++ b/vp8/encoder/psnr.c
@@ -11,7 +11,7 @@
 
 #include "vpx_scale/yv12config.h"
 #include "math.h"
-#include "vp8/common/systemdependent.h" /* for vp8_clear_system_state() */
+#include "vp8/common/systemdependent.h" /* for vp9_clear_system_state() */
 
 #define MAX_PSNR 100
 
diff --git a/vp8/encoder/quantize.h b/vp8/encoder/quantize.h
index b818543..b7a7761 100644
--- a/vp8/encoder/quantize.h
+++ b/vp8/encoder/quantize.h
@@ -34,30 +34,30 @@
   void (sym)(BLOCK *b, BLOCKD *d, TX_TYPE type)
 extern prototype_quantize_block_type(vp9_ht_quantize_b_4x4);
 
-#ifndef vp8_quantize_quantb_4x4
-#define vp8_quantize_quantb_4x4 vp9_regular_quantize_b_4x4
+#ifndef vp9_quantize_quantb_4x4
+#define vp9_quantize_quantb_4x4 vp9_regular_quantize_b_4x4
 #endif
-extern prototype_quantize_block(vp8_quantize_quantb_4x4);
+extern prototype_quantize_block(vp9_quantize_quantb_4x4);
 
-#ifndef vp8_quantize_quantb_4x4_pair
-#define vp8_quantize_quantb_4x4_pair vp9_regular_quantize_b_4x4_pair
+#ifndef vp9_quantize_quantb_4x4_pair
+#define vp9_quantize_quantb_4x4_pair vp9_regular_quantize_b_4x4_pair
 #endif
-extern prototype_quantize_block_pair(vp8_quantize_quantb_4x4_pair);
+extern prototype_quantize_block_pair(vp9_quantize_quantb_4x4_pair);
 
-#ifndef vp8_quantize_quantb_8x8
-#define vp8_quantize_quantb_8x8 vp9_regular_quantize_b_8x8
+#ifndef vp9_quantize_quantb_8x8
+#define vp9_quantize_quantb_8x8 vp9_regular_quantize_b_8x8
 #endif
-extern prototype_quantize_block(vp8_quantize_quantb_8x8);
+extern prototype_quantize_block(vp9_quantize_quantb_8x8);
 
-#ifndef vp8_quantize_quantb_16x16
-#define vp8_quantize_quantb_16x16 vp9_regular_quantize_b_16x16
+#ifndef vp9_quantize_quantb_16x16
+#define vp9_quantize_quantb_16x16 vp9_regular_quantize_b_16x16
 #endif
-extern prototype_quantize_block(vp8_quantize_quantb_16x16);
+extern prototype_quantize_block(vp9_quantize_quantb_16x16);
 
-#ifndef vp8_quantize_quantb_2x2
-#define vp8_quantize_quantb_2x2 vp9_regular_quantize_b_2x2
+#ifndef vp9_quantize_quantb_2x2
+#define vp9_quantize_quantb_2x2 vp9_regular_quantize_b_2x2
 #endif
-extern prototype_quantize_block(vp8_quantize_quantb_2x2);
+extern prototype_quantize_block(vp9_quantize_quantb_2x2);
 
 #ifndef vp9_quantize_mb_4x4
 #define vp9_quantize_mb_4x4 vp9_quantize_mb_4x4_c
@@ -79,7 +79,7 @@
 extern prototype_quantize_mb(vp9_quantize_mbuv_8x8);
 
 void vp9_quantize_mb_16x16(MACROBLOCK *x);
-extern prototype_quantize_block(vp8_quantize_quantb_16x16);
+extern prototype_quantize_block(vp9_quantize_quantb_16x16);
 extern prototype_quantize_mb(vp9_quantize_mby_16x16);
 
 struct VP9_COMP;
diff --git a/vp8/encoder/ratectrl.c b/vp8/encoder/ratectrl.c
index f1f13bd..1ce5e0e 100644
--- a/vp8/encoder/ratectrl.c
+++ b/vp8/encoder/ratectrl.c
@@ -29,12 +29,12 @@
 #define MAX_BPB_FACTOR          50
 
 #ifdef MODE_STATS
-extern unsigned int y_modes[VP8_YMODES];
-extern unsigned int uv_modes[VP8_UV_MODES];
+extern unsigned int y_modes[VP9_YMODES];
+extern unsigned int uv_modes[VP9_UV_MODES];
 extern unsigned int b_modes[B_MODE_COUNT];
 
 extern unsigned int inter_y_modes[MB_MODE_COUNT];
-extern unsigned int inter_uv_modes[VP8_UV_MODES];
+extern unsigned int inter_uv_modes[VP9_UV_MODES];
 extern unsigned int inter_b_modes[B_MODE_COUNT];
 #endif
 
@@ -127,54 +127,54 @@
 
   // Stores a snapshot of key state variables which can subsequently be
   // restored with a call to vp9_restore_coding_context. These functions are
-  // intended for use in a re-code loop in vp8_compress_frame where the
+  // intended for use in a re-code loop in vp9_compress_frame where the
   // quantizer value is adjusted between loop iterations.
 
   cc->nmvc = cm->fc.nmvc;
-  vp8_copy(cc->nmvjointcost,  cpi->mb.nmvjointcost);
-  vp8_copy(cc->nmvcosts,  cpi->mb.nmvcosts);
-  vp8_copy(cc->nmvcosts_hp,  cpi->mb.nmvcosts_hp);
+  vp9_copy(cc->nmvjointcost,  cpi->mb.nmvjointcost);
+  vp9_copy(cc->nmvcosts,  cpi->mb.nmvcosts);
+  vp9_copy(cc->nmvcosts_hp,  cpi->mb.nmvcosts_hp);
 
-  vp8_copy(cc->mv_ref_ct, cm->fc.mv_ref_ct);
-  vp8_copy(cc->mode_context, cm->fc.mode_context);
-  vp8_copy(cc->mv_ref_ct_a, cm->fc.mv_ref_ct_a);
-  vp8_copy(cc->mode_context_a, cm->fc.mode_context_a);
+  vp9_copy(cc->mv_ref_ct, cm->fc.mv_ref_ct);
+  vp9_copy(cc->mode_context, cm->fc.mode_context);
+  vp9_copy(cc->mv_ref_ct_a, cm->fc.mv_ref_ct_a);
+  vp9_copy(cc->mode_context_a, cm->fc.mode_context_a);
 
-  vp8_copy(cc->ymode_prob, cm->fc.ymode_prob);
-  vp8_copy(cc->bmode_prob, cm->fc.bmode_prob);
-  vp8_copy(cc->uv_mode_prob, cm->fc.uv_mode_prob);
-  vp8_copy(cc->i8x8_mode_prob, cm->fc.i8x8_mode_prob);
-  vp8_copy(cc->sub_mv_ref_prob, cm->fc.sub_mv_ref_prob);
-  vp8_copy(cc->mbsplit_prob, cm->fc.mbsplit_prob);
+  vp9_copy(cc->ymode_prob, cm->fc.ymode_prob);
+  vp9_copy(cc->bmode_prob, cm->fc.bmode_prob);
+  vp9_copy(cc->uv_mode_prob, cm->fc.uv_mode_prob);
+  vp9_copy(cc->i8x8_mode_prob, cm->fc.i8x8_mode_prob);
+  vp9_copy(cc->sub_mv_ref_prob, cm->fc.sub_mv_ref_prob);
+  vp9_copy(cc->mbsplit_prob, cm->fc.mbsplit_prob);
 
   // Stats
 #ifdef MODE_STATS
-  vp8_copy(cc->y_modes,       y_modes);
-  vp8_copy(cc->uv_modes,      uv_modes);
-  vp8_copy(cc->b_modes,       b_modes);
-  vp8_copy(cc->inter_y_modes,  inter_y_modes);
-  vp8_copy(cc->inter_uv_modes, inter_uv_modes);
-  vp8_copy(cc->inter_b_modes,  inter_b_modes);
+  vp9_copy(cc->y_modes,       y_modes);
+  vp9_copy(cc->uv_modes,      uv_modes);
+  vp9_copy(cc->b_modes,       b_modes);
+  vp9_copy(cc->inter_y_modes,  inter_y_modes);
+  vp9_copy(cc->inter_uv_modes, inter_uv_modes);
+  vp9_copy(cc->inter_b_modes,  inter_b_modes);
 #endif
 
-  vp8_copy(cc->segment_pred_probs, cm->segment_pred_probs);
-  vp8_copy(cc->ref_pred_probs_update, cpi->ref_pred_probs_update);
-  vp8_copy(cc->ref_pred_probs, cm->ref_pred_probs);
-  vp8_copy(cc->prob_comppred, cm->prob_comppred);
+  vp9_copy(cc->segment_pred_probs, cm->segment_pred_probs);
+  vp9_copy(cc->ref_pred_probs_update, cpi->ref_pred_probs_update);
+  vp9_copy(cc->ref_pred_probs, cm->ref_pred_probs);
+  vp9_copy(cc->prob_comppred, cm->prob_comppred);
 
   vpx_memcpy(cpi->coding_context.last_frame_seg_map_copy,
              cm->last_frame_seg_map, (cm->mb_rows * cm->mb_cols));
 
-  vp8_copy(cc->last_ref_lf_deltas, xd->last_ref_lf_deltas);
-  vp8_copy(cc->last_mode_lf_deltas, xd->last_mode_lf_deltas);
+  vp9_copy(cc->last_ref_lf_deltas, xd->last_ref_lf_deltas);
+  vp9_copy(cc->last_mode_lf_deltas, xd->last_mode_lf_deltas);
 
-  vp8_copy(cc->coef_probs, cm->fc.coef_probs);
-  vp8_copy(cc->hybrid_coef_probs, cm->fc.hybrid_coef_probs);
-  vp8_copy(cc->coef_probs_8x8, cm->fc.coef_probs_8x8);
-  vp8_copy(cc->hybrid_coef_probs_8x8, cm->fc.hybrid_coef_probs_8x8);
-  vp8_copy(cc->coef_probs_16x16, cm->fc.coef_probs_16x16);
-  vp8_copy(cc->hybrid_coef_probs_16x16, cm->fc.hybrid_coef_probs_16x16);
-  vp8_copy(cc->switchable_interp_prob, cm->fc.switchable_interp_prob);
+  vp9_copy(cc->coef_probs, cm->fc.coef_probs);
+  vp9_copy(cc->hybrid_coef_probs, cm->fc.hybrid_coef_probs);
+  vp9_copy(cc->coef_probs_8x8, cm->fc.coef_probs_8x8);
+  vp9_copy(cc->hybrid_coef_probs_8x8, cm->fc.hybrid_coef_probs_8x8);
+  vp9_copy(cc->coef_probs_16x16, cm->fc.coef_probs_16x16);
+  vp9_copy(cc->hybrid_coef_probs_16x16, cm->fc.hybrid_coef_probs_16x16);
+  vp9_copy(cc->switchable_interp_prob, cm->fc.switchable_interp_prob);
 }
 
 void vp9_restore_coding_context(VP9_COMP *cpi) {
@@ -186,51 +186,51 @@
   // previous call to vp9_save_coding_context.
 
   cm->fc.nmvc = cc->nmvc;
-  vp8_copy(cpi->mb.nmvjointcost, cc->nmvjointcost);
-  vp8_copy(cpi->mb.nmvcosts, cc->nmvcosts);
-  vp8_copy(cpi->mb.nmvcosts_hp, cc->nmvcosts_hp);
+  vp9_copy(cpi->mb.nmvjointcost, cc->nmvjointcost);
+  vp9_copy(cpi->mb.nmvcosts, cc->nmvcosts);
+  vp9_copy(cpi->mb.nmvcosts_hp, cc->nmvcosts_hp);
 
-  vp8_copy(cm->fc.mv_ref_ct, cc->mv_ref_ct);
-  vp8_copy(cm->fc.mode_context, cc->mode_context);
-  vp8_copy(cm->fc.mv_ref_ct_a, cc->mv_ref_ct_a);
-  vp8_copy(cm->fc.mode_context_a, cc->mode_context_a);
+  vp9_copy(cm->fc.mv_ref_ct, cc->mv_ref_ct);
+  vp9_copy(cm->fc.mode_context, cc->mode_context);
+  vp9_copy(cm->fc.mv_ref_ct_a, cc->mv_ref_ct_a);
+  vp9_copy(cm->fc.mode_context_a, cc->mode_context_a);
 
-  vp8_copy(cm->fc.ymode_prob, cc->ymode_prob);
-  vp8_copy(cm->fc.bmode_prob, cc->bmode_prob);
-  vp8_copy(cm->fc.i8x8_mode_prob, cc->i8x8_mode_prob);
-  vp8_copy(cm->fc.uv_mode_prob, cc->uv_mode_prob);
-  vp8_copy(cm->fc.sub_mv_ref_prob, cc->sub_mv_ref_prob);
-  vp8_copy(cm->fc.mbsplit_prob, cc->mbsplit_prob);
+  vp9_copy(cm->fc.ymode_prob, cc->ymode_prob);
+  vp9_copy(cm->fc.bmode_prob, cc->bmode_prob);
+  vp9_copy(cm->fc.i8x8_mode_prob, cc->i8x8_mode_prob);
+  vp9_copy(cm->fc.uv_mode_prob, cc->uv_mode_prob);
+  vp9_copy(cm->fc.sub_mv_ref_prob, cc->sub_mv_ref_prob);
+  vp9_copy(cm->fc.mbsplit_prob, cc->mbsplit_prob);
 
   // Stats
 #ifdef MODE_STATS
-  vp8_copy(y_modes, cc->y_modes);
-  vp8_copy(uv_modes, cc->uv_modes);
-  vp8_copy(b_modes, cc->b_modes);
-  vp8_copy(inter_y_modes, cc->inter_y_modes);
-  vp8_copy(inter_uv_modes, cc->inter_uv_modes);
-  vp8_copy(inter_b_modes, cc->inter_b_modes);
+  vp9_copy(y_modes, cc->y_modes);
+  vp9_copy(uv_modes, cc->uv_modes);
+  vp9_copy(b_modes, cc->b_modes);
+  vp9_copy(inter_y_modes, cc->inter_y_modes);
+  vp9_copy(inter_uv_modes, cc->inter_uv_modes);
+  vp9_copy(inter_b_modes, cc->inter_b_modes);
 #endif
 
-  vp8_copy(cm->segment_pred_probs, cc->segment_pred_probs);
-  vp8_copy(cpi->ref_pred_probs_update, cc->ref_pred_probs_update);
-  vp8_copy(cm->ref_pred_probs, cc->ref_pred_probs);
-  vp8_copy(cm->prob_comppred, cc->prob_comppred);
+  vp9_copy(cm->segment_pred_probs, cc->segment_pred_probs);
+  vp9_copy(cpi->ref_pred_probs_update, cc->ref_pred_probs_update);
+  vp9_copy(cm->ref_pred_probs, cc->ref_pred_probs);
+  vp9_copy(cm->prob_comppred, cc->prob_comppred);
 
   vpx_memcpy(cm->last_frame_seg_map,
              cpi->coding_context.last_frame_seg_map_copy,
              (cm->mb_rows * cm->mb_cols));
 
-  vp8_copy(xd->last_ref_lf_deltas, cc->last_ref_lf_deltas);
-  vp8_copy(xd->last_mode_lf_deltas, cc->last_mode_lf_deltas);
+  vp9_copy(xd->last_ref_lf_deltas, cc->last_ref_lf_deltas);
+  vp9_copy(xd->last_mode_lf_deltas, cc->last_mode_lf_deltas);
 
-  vp8_copy(cm->fc.coef_probs, cc->coef_probs);
-  vp8_copy(cm->fc.hybrid_coef_probs, cc->hybrid_coef_probs);
-  vp8_copy(cm->fc.coef_probs_8x8, cc->coef_probs_8x8);
-  vp8_copy(cm->fc.hybrid_coef_probs_8x8, cc->hybrid_coef_probs_8x8);
-  vp8_copy(cm->fc.coef_probs_16x16, cc->coef_probs_16x16);
-  vp8_copy(cm->fc.hybrid_coef_probs_16x16, cc->hybrid_coef_probs_16x16);
-  vp8_copy(cm->fc.switchable_interp_prob, cc->switchable_interp_prob);
+  vp9_copy(cm->fc.coef_probs, cc->coef_probs);
+  vp9_copy(cm->fc.hybrid_coef_probs, cc->hybrid_coef_probs);
+  vp9_copy(cm->fc.coef_probs_8x8, cc->coef_probs_8x8);
+  vp9_copy(cm->fc.hybrid_coef_probs_8x8, cc->hybrid_coef_probs_8x8);
+  vp9_copy(cm->fc.coef_probs_16x16, cc->coef_probs_16x16);
+  vp9_copy(cm->fc.hybrid_coef_probs_16x16, cc->hybrid_coef_probs_16x16);
+  vp9_copy(cm->fc.switchable_interp_prob, cc->switchable_interp_prob);
 }
 
 
@@ -305,7 +305,7 @@
   int target;
 
   // Clear down mmx registers to allow floating point in what follows
-  vp8_clear_system_state();  // __asm emms;
+  vp9_clear_system_state();  // __asm emms;
 
   // New Two pass RC
   target = cpi->per_frame_bandwidth;
@@ -414,7 +414,7 @@
   int    projected_size_based_on_q = 0;
 
   // Clear down mmx registers to allow floating point in what follows
-  vp8_clear_system_state();  // __asm emms;
+  vp9_clear_system_state();  // __asm emms;
 
   if (cpi->common.frame_type == KEY_FRAME) {
     rate_correction_factor = cpi->key_frame_rate_correction_factor;
@@ -640,7 +640,7 @@
 
 void vp9_adjust_key_frame_context(VP9_COMP *cpi) {
   // Clear down mmx registers to allow floating point in what follows
-  vp8_clear_system_state();
+  vp9_clear_system_state();
 
   cpi->frames_since_key = 0;
   cpi->key_frame_count++;
diff --git a/vp8/encoder/rdopt.c b/vp8/encoder/rdopt.c
index cc25f61..78302d1 100644
--- a/vp8/encoder/rdopt.c
+++ b/vp8/encoder/rdopt.c
@@ -218,7 +218,7 @@
 
 static void fill_token_costs(
   unsigned int (*c)[COEF_BANDS][PREV_COEF_CONTEXTS][MAX_ENTROPY_TOKENS],
-  const vp8_prob(*p)[COEF_BANDS][PREV_COEF_CONTEXTS][ENTROPY_NODES],
+  const vp9_prob(*p)[COEF_BANDS][PREV_COEF_CONTEXTS][ENTROPY_NODES],
   int block_type_counts) {
   int i, j, k;
 
@@ -277,7 +277,7 @@
 void vp9_initialize_rd_consts(VP9_COMP *cpi, int QIndex) {
   int q, i;
 
-  vp8_clear_system_state();  // __asm emms;
+  vp9_clear_system_state();  // __asm emms;
 
   // Further tests required to see if optimum is different
   // for key frames, golden frames and arf frames.
@@ -349,31 +349,31 @@
 
   fill_token_costs(
     cpi->mb.token_costs[TX_4X4],
-    (const vp8_prob( *)[8][PREV_COEF_CONTEXTS][11]) cpi->common.fc.coef_probs,
+    (const vp9_prob( *)[8][PREV_COEF_CONTEXTS][11]) cpi->common.fc.coef_probs,
     BLOCK_TYPES);
   fill_token_costs(
     cpi->mb.hybrid_token_costs[TX_4X4],
-    (const vp8_prob( *)[8][PREV_COEF_CONTEXTS][11])
+    (const vp9_prob( *)[8][PREV_COEF_CONTEXTS][11])
     cpi->common.fc.hybrid_coef_probs,
     BLOCK_TYPES);
 
   fill_token_costs(
     cpi->mb.token_costs[TX_8X8],
-    (const vp8_prob( *)[8][PREV_COEF_CONTEXTS][11]) cpi->common.fc.coef_probs_8x8,
+    (const vp9_prob( *)[8][PREV_COEF_CONTEXTS][11]) cpi->common.fc.coef_probs_8x8,
     BLOCK_TYPES_8X8);
   fill_token_costs(
     cpi->mb.hybrid_token_costs[TX_8X8],
-    (const vp8_prob( *)[8][PREV_COEF_CONTEXTS][11])
+    (const vp9_prob( *)[8][PREV_COEF_CONTEXTS][11])
     cpi->common.fc.hybrid_coef_probs_8x8,
     BLOCK_TYPES_8X8);
 
   fill_token_costs(
     cpi->mb.token_costs[TX_16X16],
-    (const vp8_prob(*)[8][PREV_COEF_CONTEXTS][11]) cpi->common.fc.coef_probs_16x16,
+    (const vp9_prob(*)[8][PREV_COEF_CONTEXTS][11]) cpi->common.fc.coef_probs_16x16,
     BLOCK_TYPES_16X16);
   fill_token_costs(
     cpi->mb.hybrid_token_costs[TX_16X16],
-    (const vp8_prob(*)[8][PREV_COEF_CONTEXTS][11])
+    (const vp9_prob(*)[8][PREV_COEF_CONTEXTS][11])
     cpi->common.fc.hybrid_coef_probs_16x16,
     BLOCK_TYPES_16X16);
 
@@ -549,7 +549,7 @@
   int cost = 0;
   short *qcoeff_ptr = b->qcoeff;
 
-  VP8_COMBINEENTROPYCONTEXTS(pt, *a, *l);
+  VP9_COMBINEENTROPYCONTEXTS(pt, *a, *l);
   assert(eob <= 4);
 
   for (; c < eob; c++) {
@@ -638,7 +638,7 @@
   else
     seg_eob = default_eob;
 
-  VP8_COMBINEENTROPYCONTEXTS(pt, *a, *l);
+  VP9_COMBINEENTROPYCONTEXTS(pt, *a, *l);
 
   if (tx_type != DCT_DCT) {
     for (; c < eob; c++) {
@@ -669,7 +669,7 @@
   return cost;
 }
 
-static int vp8_rdcost_mby(MACROBLOCK *mb) {
+static int rdcost_mby_4x4(MACROBLOCK *mb) {
   int cost = 0;
   int b;
   MACROBLOCKD *xd = &mb->e_mbd;
@@ -698,7 +698,7 @@
 static void macro_block_yrd_4x4(MACROBLOCK *mb,
                                 int *Rate,
                                 int *Distortion,
-                                const VP8_ENCODER_RTCD *rtcd,
+                                const VP9_ENCODER_RTCD *rtcd,
                                 int *skippable) {
   int b;
   MACROBLOCKD *const xd = &mb->e_mbd;
@@ -736,11 +736,11 @@
 
   *Distortion = (d >> 2);
   // rate
-  *Rate = vp8_rdcost_mby(mb);
+  *Rate = rdcost_mby_4x4(mb);
   *skippable = vp9_mby_is_skippable_4x4(&mb->e_mbd, 1);
 }
 
-static int vp8_rdcost_mby_8x8(MACROBLOCK *mb, int backup) {
+static int rdcost_mby_8x8(MACROBLOCK *mb, int backup) {
   int cost = 0;
   int b;
   MACROBLOCKD *xd = &mb->e_mbd;
@@ -772,7 +772,7 @@
 static void macro_block_yrd_8x8(MACROBLOCK *mb,
                                 int *Rate,
                                 int *Distortion,
-                                const VP8_ENCODER_RTCD *rtcd,
+                                const VP9_ENCODER_RTCD *rtcd,
                                 int *skippable) {
   MACROBLOCKD *const xd = &mb->e_mbd;
   BLOCK   *const mb_y2 = mb->block + 24;
@@ -800,11 +800,11 @@
 
   *Distortion = (d >> 2);
   // rate
-  *Rate = vp8_rdcost_mby_8x8(mb, 1);
+  *Rate = rdcost_mby_8x8(mb, 1);
   *skippable = vp9_mby_is_skippable_8x8(&mb->e_mbd, 1);
 }
 
-static int vp8_rdcost_mby_16x16(MACROBLOCK *mb) {
+static int rdcost_mby_16x16(MACROBLOCK *mb) {
   int cost;
   MACROBLOCKD *xd = &mb->e_mbd;
   ENTROPY_CONTEXT_PLANES t_above, t_left;
@@ -821,7 +821,7 @@
 }
 
 static void macro_block_yrd_16x16(MACROBLOCK *mb, int *Rate, int *Distortion,
-                                  const VP8_ENCODER_RTCD *rtcd, int *skippable) {
+                                  const VP9_ENCODER_RTCD *rtcd, int *skippable) {
   int d;
   MACROBLOCKD *xd = &mb->e_mbd;
   BLOCKD *b  = &mb->e_mbd.block[0];
@@ -848,7 +848,7 @@
 
   *Distortion = (d >> 2);
   // rate
-  *Rate = vp8_rdcost_mby_16x16(mb);
+  *Rate = rdcost_mby_16x16(mb);
   *skippable = vp9_mby_is_skippable_16x16(&mb->e_mbd);
 }
 
@@ -860,7 +860,7 @@
 
   MACROBLOCKD *xd = &x->e_mbd;
   int can_skip = cm->mb_no_coeff_skip;
-  vp8_prob skip_prob = can_skip ? vp9_get_pred_prob(cm, xd, PRED_MBSKIP) : 128;
+  vp9_prob skip_prob = can_skip ? vp9_get_pred_prob(cm, xd, PRED_MBSKIP) : 128;
   int s0, s1;
   int r4x4, r4x4s, r8x8, r8x8s, d4x4, d8x8, s4x4, s8x8;
   int64_t rd4x4, rd8x8, rd4x4s, rd8x8s;
@@ -870,8 +870,8 @@
   // FIXME don't do sub x3
   if (skip_prob == 0)
     skip_prob = 1;
-  s0 = vp8_cost_bit(skip_prob, 0);
-  s1 = vp8_cost_bit(skip_prob, 1);
+  s0 = vp9_cost_bit(skip_prob, 0);
+  s1 = vp9_cost_bit(skip_prob, 1);
   macro_block_yrd_16x16(x, &r16x16, &d16x16, IF_RTCD(&cpi->rtcd), &s16x16);
   if (can_skip) {
     if (s16x16) {
@@ -882,7 +882,7 @@
   } else {
     rd16x16 = RDCOST(x->rdmult, x->rddiv, r16x16, d16x16);
   }
-  r16x16s = r16x16 + vp8_cost_one(cm->prob_tx[0]) + vp8_cost_one(cm->prob_tx[1]);
+  r16x16s = r16x16 + vp9_cost_one(cm->prob_tx[0]) + vp9_cost_one(cm->prob_tx[1]);
   if (can_skip) {
     if (s16x16) {
       rd16x16s = RDCOST(x->rdmult, x->rddiv, s1, d16x16);
@@ -902,8 +902,8 @@
   } else {
     rd8x8 = RDCOST(x->rdmult, x->rddiv, r8x8, d8x8);
   }
-  r8x8s = r8x8 + vp8_cost_one(cm->prob_tx[0]);
-  r8x8s += vp8_cost_zero(cm->prob_tx[1]);
+  r8x8s = r8x8 + vp9_cost_one(cm->prob_tx[0]);
+  r8x8s += vp9_cost_zero(cm->prob_tx[1]);
   if (can_skip) {
     if (s8x8) {
       rd8x8s = RDCOST(x->rdmult, x->rddiv, s1, d8x8);
@@ -923,7 +923,7 @@
   } else {
     rd4x4 = RDCOST(x->rdmult, x->rddiv, r4x4, d4x4);
   }
-  r4x4s = r4x4 + vp8_cost_zero(cm->prob_tx[0]);
+  r4x4s = r4x4 + vp9_cost_zero(cm->prob_tx[0]);
   if (can_skip) {
     if (s4x4) {
       rd4x4s = RDCOST(x->rdmult, x->rddiv, s1, d4x4);
@@ -980,7 +980,7 @@
 static void super_block_yrd_8x8(MACROBLOCK *x,
                                 int *rate,
                                 int *distortion,
-                                const VP8_ENCODER_RTCD *rtcd, int *skip)
+                                const VP9_ENCODER_RTCD *rtcd, int *skip)
 {
   MACROBLOCKD *const xd = &x->e_mbd;
   BLOCK *const by2 = x->block + 24;
@@ -1022,7 +1022,7 @@
     d += vp9_block_error(by2->coeff, bdy2->dqcoeff, 16);
     xd->above_context = ta + x_idx;
     xd->left_context = tl + y_idx;
-    r += vp8_rdcost_mby_8x8(x, 0);
+    r += rdcost_mby_8x8(x, 0);
     skippable = skippable && vp9_mby_is_skippable_8x8(xd, 1);
   }
 
@@ -1106,7 +1106,7 @@
         vp9_intra4x4_predict(b, mode, b->predictor);
 #if CONFIG_COMP_INTRA_PRED
       } else {
-        vp8_comp_intra4x4_predict(b, mode, mode2, b->predictor);
+        vp9_comp_intra4x4_predict(b, mode, mode2, b->predictor);
         rate += bmode_costs[mode2];
       }
 #endif
@@ -1241,7 +1241,7 @@
     return INT64_MAX;
 
 #if CONFIG_COMP_INTRA_PRED
-  cost += vp8_cost_bit(128, allow_comp);
+  cost += vp9_cost_bit(128, allow_comp);
 #endif
   *Rate = cost;
   *rate_y += tot_rate_y;
@@ -1331,7 +1331,7 @@
 #if CONFIG_COMP_INTRA_PRED
       } else {
         continue; // i.e. disable for now
-        vp8_build_comp_intra_predictors_mby(&x->e_mbd);
+        vp9_build_comp_intra_predictors_mby(&x->e_mbd);
       }
 #endif
 
@@ -1431,7 +1431,7 @@
 #if CONFIG_COMP_INTRA_PRED
       } else {
         continue; // i.e. disable for now
-        vp8_comp_intra8x8_predict(b, mode, mode2, b->predictor);
+        vp9_comp_intra8x8_predict(b, mode, mode2, b->predictor);
       }
 #endif
 
@@ -1764,7 +1764,7 @@
 #if CONFIG_COMP_INTRA_PRED
       } else {
         continue;
-        vp8_build_comp_intra_predictors_mbuv(&x->e_mbd);
+        vp9_build_comp_intra_predictors_mbuv(&x->e_mbd);
       }
 #endif
 
@@ -1857,7 +1857,7 @@
 static void super_block_uvrd_8x8(MACROBLOCK *x,
                                  int *rate,
                                  int *distortion,
-                                 const VP8_ENCODER_RTCD *rtcd,
+                                 const VP9_ENCODER_RTCD *rtcd,
                                  int *skippable) {
   MACROBLOCKD *const xd = &x->e_mbd;
   int d = 0, r = 0, n, s = 1;
@@ -1956,11 +1956,11 @@
   if (!vp9_segfeature_active(xd, segment_id, SEG_LVL_MODE)) {
     VP9_COMMON *pc = &cpi->common;
 
-    vp8_prob p [VP8_MVREFS - 1];
+    vp9_prob p [VP9_MVREFS - 1];
     assert(NEARESTMV <= m  &&  m <= SPLITMV);
     vp9_mv_ref_probs(pc, p, near_mv_ref_ct);
-    return vp8_cost_token(vp9_mv_ref_tree, p,
-                          vp9_mv_ref_encoding_array - NEARESTMV + m);
+    return cost_token(vp9_mv_ref_tree, p,
+                      vp9_mv_ref_encoding_array - NEARESTMV + m);
   } else
     return 0;
 }
@@ -2080,7 +2080,7 @@
                                        int *distortion,
                                        ENTROPY_CONTEXT *ta,
                                        ENTROPY_CONTEXT *tl,
-                                       const VP8_ENCODER_RTCD *rtcd) {
+                                       const VP9_ENCODER_RTCD *rtcd) {
   int i;
   MACROBLOCKD *xd = &x->e_mbd;
 
@@ -2117,7 +2117,7 @@
                                            int64_t *otherrd,
                                            ENTROPY_CONTEXT *ta,
                                            ENTROPY_CONTEXT *tl,
-                                           const VP8_ENCODER_RTCD *rtcd) {
+                                           const VP9_ENCODER_RTCD *rtcd) {
   int i, j;
   MACROBLOCKD *xd = &x->e_mbd;
   const int iblock[4] = { 0, 1, 4, 5 };
@@ -2267,7 +2267,7 @@
   int segmentyrate = 0;
   int best_eobs[16] = { 0 };
 
-  vp8_variance_fn_ptr_t *v_fn_ptr;
+  vp9_variance_fn_ptr_t *v_fn_ptr;
 
   ENTROPY_CONTEXT_PLANES t_above, t_left;
   ENTROPY_CONTEXT *ta, *tl;
@@ -2293,8 +2293,8 @@
   label_mv_thresh = 1 * bsi->mvthresh / label_count;
 
   // Segmentation method overheads
-  rate = vp8_cost_token(vp9_mbsplit_tree, vp9_mbsplit_probs,
-                        vp9_mbsplit_encodings + segmentation);
+  rate = cost_token(vp9_mbsplit_tree, vp9_mbsplit_probs,
+                    vp9_mbsplit_encodings + segmentation);
   rate += vp9_cost_mv_ref(cpi, SPLITMV, bsi->mdcounts);
   this_segment_rd += RDCOST(x->rdmult, x->rddiv, rate, 0);
   br += rate;
@@ -2379,8 +2379,8 @@
           // Should we do a full search (best quality only)
           if ((cpi->compressor_speed == 0) && (bestsme >> sseshift) > 4000) {
             /* Check if mvp_full is within the range. */
-            vp8_clamp_mv(&mvp_full, x->mv_col_min, x->mv_col_max,
-                         x->mv_row_min, x->mv_row_max);
+            clamp_mv(&mvp_full, x->mv_col_min, x->mv_col_max,
+                     x->mv_row_min, x->mv_row_max);
 
             thissme = cpi->full_search_sad(x, c, e, &mvp_full,
                                            sadpb, 16, v_fn_ptr,
@@ -2536,8 +2536,8 @@
     }
   } else {
     int64_t diff, base_rd;
-    int cost4x4 = vp8_cost_bit(cpi->common.prob_tx[0], 0);
-    int cost8x8 = vp8_cost_bit(cpi->common.prob_tx[0], 1);
+    int cost4x4 = vp9_cost_bit(cpi->common.prob_tx[0], 0);
+    int cost8x8 = vp9_cost_bit(cpi->common.prob_tx[0], 1);
 
     if (cpi->common.txfm_mode == TX_MODE_SELECT) {
       int64_t rd4x4[4], rd8x8[4];
@@ -2610,8 +2610,7 @@
   }
 }
 
-static __inline
-void vp8_cal_step_param(int sr, int *sp) {
+static __inline void cal_step_param(int sr, int *sp) {
   int step = 0;
 
   if (sr > MAX_FIRST_STEP) sr = MAX_FIRST_STEP;
@@ -2691,11 +2690,11 @@
       /* block 8X16 */
       sr = MAXF((abs(bsi.sv_mvp[0].as_mv.row - bsi.sv_mvp[2].as_mv.row)) >> 3,
                 (abs(bsi.sv_mvp[0].as_mv.col - bsi.sv_mvp[2].as_mv.col)) >> 3);
-      vp8_cal_step_param(sr, &bsi.sv_istep[0]);
+      cal_step_param(sr, &bsi.sv_istep[0]);
 
       sr = MAXF((abs(bsi.sv_mvp[1].as_mv.row - bsi.sv_mvp[3].as_mv.row)) >> 3,
                 (abs(bsi.sv_mvp[1].as_mv.col - bsi.sv_mvp[3].as_mv.col)) >> 3);
-      vp8_cal_step_param(sr, &bsi.sv_istep[1]);
+      cal_step_param(sr, &bsi.sv_istep[1]);
 
       rd_check_segment(cpi, x, &bsi, PARTITIONING_8X16,
                        seg_mvs[PARTITIONING_8X16], txfm_cache);
@@ -2703,11 +2702,11 @@
       /* block 16X8 */
       sr = MAXF((abs(bsi.sv_mvp[0].as_mv.row - bsi.sv_mvp[1].as_mv.row)) >> 3,
                 (abs(bsi.sv_mvp[0].as_mv.col - bsi.sv_mvp[1].as_mv.col)) >> 3);
-      vp8_cal_step_param(sr, &bsi.sv_istep[0]);
+      cal_step_param(sr, &bsi.sv_istep[0]);
 
       sr = MAXF((abs(bsi.sv_mvp[2].as_mv.row - bsi.sv_mvp[3].as_mv.row)) >> 3,
                 (abs(bsi.sv_mvp[2].as_mv.col - bsi.sv_mvp[3].as_mv.col)) >> 3);
-      vp8_cal_step_param(sr, &bsi.sv_istep[1]);
+      cal_step_param(sr, &bsi.sv_istep[1]);
 
       rd_check_segment(cpi, x, &bsi, PARTITIONING_16X8,
                        seg_mvs[PARTITIONING_16X8], txfm_cache);
@@ -2937,7 +2936,7 @@
 
   /* Set up return values */
   mvp->as_int = mv.as_int;
-  vp8_clamp_mv2(mvp, xd);
+  clamp_mv2(mvp, xd);
 }
 
 static void cal_sad(VP9_COMP *cpi, MACROBLOCKD *xd, MACROBLOCK *x,
@@ -3042,8 +3041,8 @@
   }
 }
 
-extern void vp9_calc_ref_probs(int *count, vp8_prob *probs);
-static void estimate_curframe_refprobs(VP9_COMP *cpi, vp8_prob mod_refprobs[3], int pred_ref) {
+extern void vp9_calc_ref_probs(int *count, vp9_prob *probs);
+static void estimate_curframe_refprobs(VP9_COMP *cpi, vp9_prob mod_refprobs[3], int pred_ref) {
   int norm_cnt[MAX_REF_FRAMES];
   const int *const rfct = cpi->count_mb_ref_frame_usage;
   int intra_count = rfct[INTRA_FRAME];
@@ -3084,18 +3083,18 @@
   }
 }
 
-static __inline unsigned weighted_cost(vp8_prob *tab0, vp8_prob *tab1, int idx, int val, int weight) {
-  unsigned cost0 = tab0[idx] ? vp8_cost_bit(tab0[idx], val) : 0;
-  unsigned cost1 = tab1[idx] ? vp8_cost_bit(tab1[idx], val) : 0;
+static __inline unsigned weighted_cost(vp9_prob *tab0, vp9_prob *tab1, int idx, int val, int weight) {
+  unsigned cost0 = tab0[idx] ? vp9_cost_bit(tab0[idx], val) : 0;
+  unsigned cost1 = tab1[idx] ? vp9_cost_bit(tab1[idx], val) : 0;
   // weight is 16-bit fixed point, so this basically calculates:
   // 0.5 + weight * cost1 + (1.0 - weight) * cost0
   return (0x8000 + weight * cost1 + (0x10000 - weight) * cost0) >> 16;
 }
 
-static void vp8_estimate_ref_frame_costs(VP9_COMP *cpi, int segment_id, unsigned int *ref_costs) {
+static void estimate_ref_frame_costs(VP9_COMP *cpi, int segment_id, unsigned int *ref_costs) {
   VP9_COMMON *cm = &cpi->common;
   MACROBLOCKD *xd = &cpi->mb.e_mbd;
-  vp8_prob *mod_refprobs;
+  vp9_prob *mod_refprobs;
 
   unsigned int cost;
   int pred_ref;
@@ -3104,7 +3103,7 @@
   int i;
   int tot_count;
 
-  vp8_prob pred_prob, new_pred_prob;
+  vp9_prob pred_prob, new_pred_prob;
   int seg_ref_active;
   int seg_ref_count = 0;
   seg_ref_active = vp9_segfeature_active(xd,
@@ -3151,7 +3150,7 @@
 
       // for incorrectly predicted cases
       if (! pred_flag) {
-        vp8_prob curframe_mod_refprobs[3];
+        vp9_prob curframe_mod_refprobs[3];
 
         if (cpi->seg0_progress) {
           estimate_curframe_refprobs(cpi, curframe_mod_refprobs, pred_ref);
@@ -3271,7 +3270,7 @@
                    mbmi->ref_mvs[frame_type],
                    cpi->common.ref_frame_sign_bias);
 
-  vp8_find_best_ref_mvs(xd, y_buffer[frame_type],
+  vp9_find_best_ref_mvs(xd, y_buffer[frame_type],
                         yv12->y_stride,
                         mbmi->ref_mvs[frame_type],
                         &frame_best_ref_mv[frame_type],
@@ -3394,7 +3393,7 @@
   for (i = 0; i < num_refs; ++i) {
     cur_mv[i] = frame_mv[this_mode][refs[i]];
     // Clip "next_nearest" so that it does not extend to far out of image
-    vp8_clamp_mv2(&cur_mv[i], xd);
+    clamp_mv2(&cur_mv[i], xd);
     if (mv_check_bounds(x, &cur_mv[i]))
       return INT64_MAX;
     mbmi->mv[i].as_int = cur_mv[i].as_int;
@@ -3403,7 +3402,7 @@
 #if CONFIG_PRED_FILTER
   // Filtered prediction:
   mbmi->pred_filter_enabled = vp9_mode_order[mode_index].pred_filter_flag;
-  *rate2 += vp8_cost_bit(cpi->common.prob_pred_filter_off,
+  *rate2 += vp9_cost_bit(cpi->common.prob_pred_filter_off,
                          mbmi->pred_filter_enabled);
 #endif
   if (cpi->common.mcomp_filter_type == SWITCHABLE) {
@@ -3416,7 +3415,7 @@
    * are only three options: Last/Golden, ARF/Last or Golden/ARF, or in other
    * words if you present them in that order, the second one is always known
    * if the first is known */
-  *compmode_cost = vp8_cost_bit(vp9_get_pred_prob(cm, xd, PRED_COMP),
+  *compmode_cost = vp9_cost_bit(vp9_get_pred_prob(cm, xd, PRED_COMP),
                                 is_comp_pred);
   *rate2 += vp9_cost_mv_ref(cpi, this_mode, mdcounts);
 
@@ -3604,21 +3603,21 @@
         seg_mvs[i][j][k].as_int = INVALID_MV;
   }
 
-  if (cpi->ref_frame_flags & VP8_LAST_FLAG) {
+  if (cpi->ref_frame_flags & VP9_LAST_FLAG) {
     setup_buffer_inter(cpi, x, cpi->common.lst_fb_idx, LAST_FRAME,
                        recon_yoffset, recon_uvoffset, frame_mv[NEARESTMV],
                        frame_mv[NEARMV], frame_best_ref_mv,
                        frame_mdcounts, y_buffer, u_buffer, v_buffer);
   }
 
-  if (cpi->ref_frame_flags & VP8_GOLD_FLAG) {
+  if (cpi->ref_frame_flags & VP9_GOLD_FLAG) {
     setup_buffer_inter(cpi, x, cpi->common.gld_fb_idx, GOLDEN_FRAME,
                        recon_yoffset, recon_uvoffset, frame_mv[NEARESTMV],
                        frame_mv[NEARMV], frame_best_ref_mv,
                        frame_mdcounts, y_buffer, u_buffer, v_buffer);
   }
 
-  if (cpi->ref_frame_flags & VP8_ALT_FLAG) {
+  if (cpi->ref_frame_flags & VP9_ALT_FLAG) {
     setup_buffer_inter(cpi, x, cpi->common.alt_fb_idx, ALTREF_FRAME,
                        recon_yoffset, recon_uvoffset, frame_mv[NEARESTMV],
                        frame_mv[NEARMV], frame_best_ref_mv,
@@ -3651,7 +3650,7 @@
 
   // Get estimates of reference frame costs for each reference frame
   // that depend on the current prediction etc.
-  vp8_estimate_ref_frame_costs(cpi, segment_id, ref_costs);
+  estimate_ref_frame_costs(cpi, segment_id, ref_costs);
 
   for (mode_index = 0; mode_index < MAX_MODES;
        mode_index += (!switchable_filter_index)) {
@@ -3680,7 +3679,7 @@
         this_mode >= NEARESTMV && this_mode <= SPLITMV) {
       mbmi->interp_filter =
           vp9_switchable_interp[switchable_filter_index++];
-      if (switchable_filter_index == VP8_SWITCHABLE_FILTERS)
+      if (switchable_filter_index == VP9_SWITCHABLE_FILTERS)
         switchable_filter_index = 0;
     } else {
       mbmi->interp_filter = cpi->common.mcomp_filter_type;
@@ -3825,8 +3824,8 @@
         }
         break;
         case I8X8_PRED: {
-          int cost0 = vp8_cost_bit(cm->prob_tx[0], 0);
-          int cost1 = vp8_cost_bit(cm->prob_tx[0], 1);
+          int cost0 = vp9_cost_bit(cm->prob_tx[0], 0);
+          int cost1 = vp9_cost_bit(cm->prob_tx[0], 1);
           int64_t tmp_rd_4x4s, tmp_rd_8x8s;
           int64_t tmp_rd_4x4, tmp_rd_8x8, tmp_rd;
           int r4x4, tok4x4, d4x4, r8x8, tok8x8, d8x8;
@@ -3968,7 +3967,7 @@
         mode_excluded = cpi->common.comp_pred_mode == COMP_PREDICTION_ONLY;
 
       compmode_cost =
-        vp8_cost_bit(vp9_get_pred_prob(cm, xd, PRED_COMP), is_comp_pred);
+        vp9_cost_bit(vp9_get_pred_prob(cm, xd, PRED_COMP), is_comp_pred);
       mbmi->mode = this_mode;
     }
     else {
@@ -4015,11 +4014,11 @@
             int prob_skip_cost;
 
             // Cost the skip mb case
-            vp8_prob skip_prob =
+            vp9_prob skip_prob =
               vp9_get_pred_prob(cm, &x->e_mbd, PRED_MBSKIP);
 
             if (skip_prob) {
-              prob_skip_cost = vp8_cost_bit(skip_prob, 1);
+              prob_skip_cost = vp9_cost_bit(skip_prob, 1);
               rate2 += prob_skip_cost;
               other_cost += prob_skip_cost;
             }
@@ -4029,7 +4028,7 @@
         else {
           mbmi->mb_skip_coeff = 0;
           if (mb_skip_allowed) {
-            int prob_skip_cost = vp8_cost_bit(
+            int prob_skip_cost = vp9_cost_bit(
                    vp9_get_pred_prob(cm, &x->e_mbd, PRED_MBSKIP), 0);
             rate2 += prob_skip_cost;
             other_cost += prob_skip_cost;
@@ -4298,12 +4297,12 @@
 
   if (cpi->common.mb_no_coeff_skip && y_skip && uv_skip) {
     *returnrate = rate_y + rate_uv - rate_y_tokenonly - rate_uv_tokenonly +
-                  vp8_cost_bit(vp9_get_pred_prob(cm, xd, PRED_MBSKIP), 1);
+                  vp9_cost_bit(vp9_get_pred_prob(cm, xd, PRED_MBSKIP), 1);
     *returndist = dist_y + (dist_uv >> 2);
   } else {
     *returnrate = rate_y + rate_uv;
     if (cpi->common.mb_no_coeff_skip)
-      *returnrate += vp8_cost_bit(vp9_get_pred_prob(cm, xd, PRED_MBSKIP), 0);
+      *returnrate += vp9_cost_bit(vp9_get_pred_prob(cm, xd, PRED_MBSKIP), 0);
     *returndist = dist_y + (dist_uv >> 2);
   }
 }
@@ -4395,7 +4394,7 @@
     mbmi->mode = mode16x16;
     mbmi->uv_mode = modeuv;
     rate = rateuv8x8 + rate16x16 - rateuv8x8_tokenonly - rate16x16_tokenonly +
-           vp8_cost_bit(vp9_get_pred_prob(cm, xd, PRED_MBSKIP), 1);
+           vp9_cost_bit(vp9_get_pred_prob(cm, xd, PRED_MBSKIP), 1);
     dist = dist16x16 + (distuv8x8 >> 2);
     mbmi->txfm_size = txfm_size_16x16;
     memset(x->mb_context[xd->mb_index].txfm_rd_diff, 0,
@@ -4428,7 +4427,7 @@
       }
     }
     if (cpi->common.mb_no_coeff_skip)
-      rate += vp8_cost_bit(vp9_get_pred_prob(cm, xd, PRED_MBSKIP), 0);
+      rate += vp9_cost_bit(vp9_get_pred_prob(cm, xd, PRED_MBSKIP), 0);
   } else {
     if (error4x4 < error8x8) {
       rate = rateuv;
@@ -4458,7 +4457,7 @@
              sizeof(x->mb_context[xd->mb_index].txfm_rd_diff));
     }
     if (cpi->common.mb_no_coeff_skip)
-      rate += vp8_cost_bit(vp9_get_pred_prob(cm, xd, PRED_MBSKIP), 0);
+      rate += vp9_cost_bit(vp9_get_pred_prob(cm, xd, PRED_MBSKIP), 0);
   }
 
   *returnrate = rate;
@@ -4482,8 +4481,8 @@
   unsigned char *y_buffer[4];
   unsigned char *u_buffer[4];
   unsigned char *v_buffer[4];
-  static const int flag_list[4] = { 0, VP8_LAST_FLAG, VP8_GOLD_FLAG,
-                                    VP8_ALT_FLAG };
+  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,
                       cpi->common.alt_fb_idx };
   int mdcounts[4];
@@ -4500,7 +4499,7 @@
 
   x->skip = 0;
   xd->mode_info_context->mbmi.segment_id = segment_id;
-  vp8_estimate_ref_frame_costs(cpi, segment_id, ref_costs);
+  estimate_ref_frame_costs(cpi, segment_id, ref_costs);
   vpx_memset(&best_mbmode, 0, sizeof(best_mbmode));
 
   for (ref_frame = LAST_FRAME; ref_frame <= ALTREF_FRAME; ref_frame++) {
@@ -4641,11 +4640,11 @@
             int prob_skip_cost;
 
             // Cost the skip mb case
-            vp8_prob skip_prob =
+            vp9_prob skip_prob =
               vp9_get_pred_prob(cm, xd, PRED_MBSKIP);
 
             if (skip_prob) {
-              prob_skip_cost = vp8_cost_bit(skip_prob, 1);
+              prob_skip_cost = vp9_cost_bit(skip_prob, 1);
               rate2 += prob_skip_cost;
               other_cost += prob_skip_cost;
             }
@@ -4653,7 +4652,7 @@
         }
         // Add in the cost of the no skip flag.
         else if (mb_skip_allowed) {
-          int prob_skip_cost = vp8_cost_bit(vp9_get_pred_prob(cm, xd,
+          int prob_skip_cost = vp9_cost_bit(vp9_get_pred_prob(cm, xd,
                                                           PRED_MBSKIP), 0);
           rate2 += prob_skip_cost;
           other_cost += prob_skip_cost;
@@ -4845,7 +4844,7 @@
   // else
   // The non rd encode path has been deleted from this code base
   // to simplify development
-  //    vp8_pick_inter_mode
+  //    vp9_pick_inter_mode
 
   // Store metrics so they can be added in to totals if this mode is picked
   x->mb_context[xd->mb_index].distortion  = distortion;
diff --git a/vp8/encoder/segmentation.c b/vp8/encoder/segmentation.c
index 5d537dd..c68925e 100644
--- a/vp8/encoder/segmentation.c
+++ b/vp8/encoder/segmentation.c
@@ -105,7 +105,7 @@
 // Based on set of segment counts calculate a probability tree
 static void calc_segtree_probs(MACROBLOCKD *xd,
                                int *segcounts,
-                               vp8_prob *segment_tree_probs) {
+                               vp9_prob *segment_tree_probs) {
   int count1, count2;
   int tot_count;
   int i;
@@ -137,24 +137,24 @@
 // Based on set of segment counts and probabilities calculate a cost estimate
 static int cost_segmap(MACROBLOCKD *xd,
                        int *segcounts,
-                       vp8_prob *probs) {
+                       vp9_prob *probs) {
   int cost;
   int count1, count2;
 
   // Cost the top node of the tree
   count1 = segcounts[0] + segcounts[1];
   count2 = segcounts[2] + segcounts[3];
-  cost = count1 * vp8_cost_zero(probs[0]) +
-         count2 * vp8_cost_one(probs[0]);
+  cost = count1 * vp9_cost_zero(probs[0]) +
+         count2 * vp9_cost_one(probs[0]);
 
   // Now add the cost of each individual segment branch
   if (count1 > 0)
-    cost += segcounts[0] * vp8_cost_zero(probs[1]) +
-            segcounts[1] * vp8_cost_one(probs[1]);
+    cost += segcounts[0] * vp9_cost_zero(probs[1]) +
+            segcounts[1] * vp9_cost_one(probs[1]);
 
   if (count2 > 0)
-    cost += segcounts[2] * vp8_cost_zero(probs[2]) +
-            segcounts[3] * vp8_cost_one(probs[2]);
+    cost += segcounts[2] * vp9_cost_zero(probs[2]) +
+            segcounts[3] * vp9_cost_one(probs[2]);
 
   return cost;
 
@@ -179,9 +179,9 @@
   int no_pred_segcounts[MAX_MB_SEGMENTS];
   int t_unpred_seg_counts[MAX_MB_SEGMENTS];
 
-  vp8_prob no_pred_tree[MB_FEATURE_TREE_PROBS];
-  vp8_prob t_pred_tree[MB_FEATURE_TREE_PROBS];
-  vp8_prob t_nopred_prob[PREDICTION_PROBS];
+  vp9_prob no_pred_tree[MB_FEATURE_TREE_PROBS];
+  vp9_prob t_pred_tree[MB_FEATURE_TREE_PROBS];
+  vp9_prob t_nopred_prob[PREDICTION_PROBS];
 
   // Set default state for the segment tree probabilities and the
   // temporal coding probabilities
@@ -306,9 +306,9 @@
 
       // Add in the predictor signaling cost
       t_pred_cost += (temporal_predictor_count[i][0] *
-                      vp8_cost_zero(t_nopred_prob[i])) +
+                      vp9_cost_zero(t_nopred_prob[i])) +
                      (temporal_predictor_count[i][1] *
-                      vp8_cost_one(t_nopred_prob[i]));
+                      vp9_cost_one(t_nopred_prob[i]));
     }
   }
 
diff --git a/vp8/encoder/temporal_filter.c b/vp8/encoder/temporal_filter.c
index 0c483ed..276248c 100644
--- a/vp8/encoder/temporal_filter.c
+++ b/vp8/encoder/temporal_filter.c
@@ -34,10 +34,10 @@
 #define ALT_REF_MC_ENABLED 1    // dis/enable MC in AltRef filtering
 #define ALT_REF_SUBPEL_ENABLED 1 // dis/enable subpel in MC AltRef filtering
 
-#if VP8_TEMPORAL_ALT_REF
+#if VP9_TEMPORAL_ALT_REF
 
 
-static void vp8_temporal_filter_predictors_mb_c
+static void temporal_filter_predictors_mb_c
 (
   MACROBLOCKD *xd,
   unsigned char *y_mb_ptr,
@@ -131,7 +131,7 @@
 
 #if ALT_REF_MC_ENABLED
 
-static int vp8_temporal_filter_find_matching_mb_c
+static int temporal_filter_find_matching_mb_c
 (
   VP9_COMP *cpi,
   YV12_BUFFER_CONFIG *arf_frame,
@@ -218,7 +218,7 @@
 }
 #endif
 
-static void vp8_temporal_filter_iterate_c
+static void temporal_filter_iterate_c
 (
   VP9_COMP *cpi,
   int frame_count,
@@ -291,7 +291,7 @@
 #define THRESH_HIGH  20000
 
           // Find best match in this frame by MC
-          err = vp8_temporal_filter_find_matching_mb_c
+          err = temporal_filter_find_matching_mb_c
                 (cpi,
                  cpi->frames[alt_ref_index],
                  cpi->frames[frame],
@@ -307,7 +307,7 @@
 
         if (filter_weight != 0) {
           // Construct the predictors
-          vp8_temporal_filter_predictors_mb_c
+          temporal_filter_predictors_mb_c
           (mbd,
            cpi->frames[frame]->y_buffer + mb_y_offset,
            cpi->frames[frame]->u_buffer + mb_uv_offset,
@@ -508,7 +508,7 @@
     cpi->frames[frames_to_blur - 1 - frame] = &buf->img;
   }
 
-  vp8_temporal_filter_iterate_c(
+  temporal_filter_iterate_c(
     cpi,
     frames_to_blur,
     frames_to_blur_backward,
diff --git a/vp8/encoder/temporal_filter.h b/vp8/encoder/temporal_filter.h
index f82adb3..b396abf 100644
--- a/vp8/encoder/temporal_filter.h
+++ b/vp8/encoder/temporal_filter.h
@@ -9,8 +9,8 @@
  */
 
 
-#ifndef __INC_VP8_TEMPORAL_FILTER_H
-#define __INC_VP8_TEMPORAL_FILTER_H
+#ifndef __INC_TEMPORAL_FILTER_H
+#define __INC_TEMPORAL_FILTER_H
 
 #define prototype_apply(sym)\
   void (sym) \
@@ -36,12 +36,12 @@
 
 typedef struct {
   prototype_apply(*apply);
-} vp8_temporal_rtcd_vtable_t;
+} vp9_temporal_rtcd_vtable_t;
 
 #if CONFIG_RUNTIME_CPU_DETECT
 #define TEMPORAL_INVOKE(ctx,fn) (ctx)->fn
 #else
-#define TEMPORAL_INVOKE(ctx,fn) vp8_temporal_filter_##fn
+#define TEMPORAL_INVOKE(ctx,fn) vp9_temporal_filter_##fn
 #endif
 
-#endif // __INC_VP8_TEMPORAL_FILTER_H
+#endif // __INC_TEMPORAL_FILTER_H
diff --git a/vp8/encoder/tokenize.c b/vp8/encoder/tokenize.c
index be07331..5c5b673 100644
--- a/vp8/encoder/tokenize.c
+++ b/vp8/encoder/tokenize.c
@@ -59,7 +59,7 @@
 static void fill_value_tokens() {
 
   TOKENVALUE *const t = dct_value_tokens + DCT_MAX_VALUE;
-  vp8_extra_bit_struct *const e = vp9_extra_bits;
+  vp9_extra_bit_struct *const e = vp9_extra_bits;
 
   int i = -DCT_MAX_VALUE;
   int sign = 1;
@@ -88,16 +88,16 @@
     // initialize the cost for extra bits for all possible coefficient value.
     {
       int cost = 0;
-      vp8_extra_bit_struct *p = vp9_extra_bits + t[i].Token;
+      vp9_extra_bit_struct *p = vp9_extra_bits + t[i].Token;
 
       if (p->base_val) {
         const int extra = t[i].Extra;
         const int Length = p->Len;
 
         if (Length)
-          cost += vp8_treed_cost(p->tree, p->prob, extra >> 1, Length);
+          cost += treed_cost(p->tree, p->prob, extra >> 1, Length);
 
-        cost += vp8_cost_bit(vp8_prob_half, extra & 1); /* sign */
+        cost += vp9_cost_bit(vp9_prob_half, extra & 1); /* sign */
         dct_value_cost[i + DCT_MAX_VALUE] = cost;
       }
 
@@ -127,11 +127,11 @@
   int segment_id = xd->mode_info_context->mbmi.segment_id;
   const int *bands, *scan;
   unsigned int (*counts)[COEF_BANDS][PREV_COEF_CONTEXTS][MAX_ENTROPY_TOKENS];
-  vp8_prob (*probs)[COEF_BANDS][PREV_COEF_CONTEXTS][ENTROPY_NODES];
+  vp9_prob (*probs)[COEF_BANDS][PREV_COEF_CONTEXTS][ENTROPY_NODES];
   const TX_TYPE tx_type = (type == PLANE_TYPE_Y_WITH_DC) ?
                           get_tx_type(xd, b) : DCT_DCT;
 
-  VP8_COMBINEENTROPYCONTEXTS(pt, *a, *l);
+  VP9_COMBINEENTROPYCONTEXTS(pt, *a, *l);
   switch (tx_size) {
     default:
     case TX_4X4:
@@ -455,7 +455,7 @@
   fprintf(f, "#include \"entropy.h\"\n");
   fprintf(f, "\n/* *** GENERATED FILE: DO NOT EDIT *** */\n\n");
   fprintf(f, "static const unsigned int\n"
-          "vp8_default_coef_counts[BLOCK_TYPES]\n"
+          "vp9_default_coef_counts[BLOCK_TYPES]\n"
           "                      [COEF_BANDS]\n"
           "                      [PREV_COEF_CONTEXTS]\n"
           "                      [MAX_ENTROPY_TOKENS]={\n");
@@ -486,7 +486,7 @@
   } while (++type < BLOCK_TYPES);
   fprintf(f, "\n};\n");
 
-  fprintf(f, "static const unsigned int\nvp8_default_coef_counts_8x8"
+  fprintf(f, "static const unsigned int\nvp9_default_coef_counts_8x8"
           "[BLOCK_TYPES_8X8] [COEF_BANDS]"
           "[PREV_COEF_CONTEXTS] [MAX_ENTROPY_TOKENS] = {");
   type = 0;
@@ -519,7 +519,7 @@
   } while (++type < BLOCK_TYPES_8X8);
   fprintf(f, "\n};\n");
 
-  fprintf(f, "static const unsigned int\nvp8_default_coef_counts_16x16"
+  fprintf(f, "static const unsigned int\nvp9_default_coef_counts_16x16"
           "[BLOCK_TYPES_16X16] [COEF_BANDS]"
           "[PREV_COEF_CONTEXTS] [MAX_ENTROPY_TOKENS] = {");
   type = 0;
@@ -552,7 +552,7 @@
   } while (++type < BLOCK_TYPES_16X16);
   fprintf(f, "\n};\n");
 
-  fprintf(f, "static const vp8_prob\n"
+  fprintf(f, "static const vp9_prob\n"
           "vp9_default_coef_probs[BLOCK_TYPES] [COEF_BANDS] \n"
           "[PREV_COEF_CONTEXTS] [ENTROPY_NODES] = {");
   type = 0;
@@ -565,7 +565,7 @@
       do {
         unsigned int branch_ct [ENTROPY_NODES] [2];
         unsigned int coef_counts[MAX_ENTROPY_TOKENS];
-        vp8_prob coef_probs[ENTROPY_NODES];
+        vp9_prob coef_probs[ENTROPY_NODES];
         for (t = 0; t < MAX_ENTROPY_TOKENS; ++t)
           coef_counts[t] = context_counters [type] [band] [pt] [t];
         vp9_tree_probs_from_distribution(
@@ -587,7 +587,7 @@
   } while (++type < BLOCK_TYPES);
   fprintf(f, "\n};\n");
 
-  fprintf(f, "static const vp8_prob\n"
+  fprintf(f, "static const vp9_prob\n"
           "vp9_default_coef_probs_8x8[BLOCK_TYPES_8X8] [COEF_BANDS]\n"
           "[PREV_COEF_CONTEXTS] [ENTROPY_NODES] = {");
   type = 0;
@@ -600,7 +600,7 @@
       do {
         unsigned int branch_ct [ENTROPY_NODES] [2];
         unsigned int coef_counts[MAX_ENTROPY_TOKENS];
-        vp8_prob coef_probs[ENTROPY_NODES];
+        vp9_prob coef_probs[ENTROPY_NODES];
         for (t = 0; t < MAX_ENTROPY_TOKENS; ++t)
           coef_counts[t] = context_counters_8x8[type] [band] [pt] [t];
         vp9_tree_probs_from_distribution(
@@ -620,7 +620,7 @@
   } while (++type < BLOCK_TYPES_8X8);
   fprintf(f, "\n};\n");
 
-  fprintf(f, "static const vp8_prob\n"
+  fprintf(f, "static const vp9_prob\n"
           "vp9_default_coef_probs_16x16[BLOCK_TYPES_16X16] [COEF_BANDS]\n"
           "[PREV_COEF_CONTEXTS] [ENTROPY_NODES] = {");
   type = 0;
@@ -633,7 +633,7 @@
       do {
         unsigned int branch_ct [ENTROPY_NODES] [2];
         unsigned int coef_counts[MAX_ENTROPY_TOKENS];
-        vp8_prob coef_probs[ENTROPY_NODES];
+        vp9_prob coef_probs[ENTROPY_NODES];
         for (t = 0; t < MAX_ENTROPY_TOKENS; ++t)
           coef_counts[t] = context_counters_16x16[type] [band] [pt] [t];
         vp9_tree_probs_from_distribution(
@@ -678,12 +678,12 @@
                              int dry_run) {
   const int *bands;
   unsigned int (*counts)[COEF_BANDS][PREV_COEF_CONTEXTS][MAX_ENTROPY_TOKENS];
-  vp8_prob (*probs)[COEF_BANDS][PREV_COEF_CONTEXTS][ENTROPY_NODES];
+  vp9_prob (*probs)[COEF_BANDS][PREV_COEF_CONTEXTS][ENTROPY_NODES];
   int pt, band;
   TOKENEXTRA *t = *tp;
   const TX_TYPE tx_type = (type == PLANE_TYPE_Y_WITH_DC) ?
                           get_tx_type(xd, b) : DCT_DCT;
-  VP8_COMBINEENTROPYCONTEXTS(pt, *a, *l);
+  VP9_COMBINEENTROPYCONTEXTS(pt, *a, *l);
 
   switch (tx_size) {
     default:
@@ -730,8 +730,8 @@
   }
 }
 
-static void vp9_stuff_mb_8x8(VP9_COMP *cpi, MACROBLOCKD *xd,
-                             TOKENEXTRA **t, int dry_run) {
+static void stuff_mb_8x8(VP9_COMP *cpi, MACROBLOCKD *xd,
+                         TOKENEXTRA **t, int dry_run) {
   ENTROPY_CONTEXT *A = (ENTROPY_CONTEXT *)xd->above_context;
   ENTROPY_CONTEXT *L = (ENTROPY_CONTEXT *)xd->left_context;
   PLANE_TYPE plane_type;
@@ -765,8 +765,8 @@
   }
 }
 
-static void vp9_stuff_mb_16x16(VP9_COMP *cpi, MACROBLOCKD *xd,
-                               TOKENEXTRA **t, int dry_run) {
+static void stuff_mb_16x16(VP9_COMP *cpi, MACROBLOCKD *xd,
+                           TOKENEXTRA **t, int dry_run) {
   ENTROPY_CONTEXT * A = (ENTROPY_CONTEXT *)xd->above_context;
   ENTROPY_CONTEXT * L = (ENTROPY_CONTEXT *)xd->left_context;
   int b;
@@ -784,8 +784,8 @@
   vpx_memset(&L[8], 0, sizeof(L[8]));
 }
 
-static void vp9_stuff_mb_4x4(VP9_COMP *cpi, MACROBLOCKD *xd,
-                             TOKENEXTRA **t, int dry_run) {
+static void stuff_mb_4x4(VP9_COMP *cpi, MACROBLOCKD *xd,
+                         TOKENEXTRA **t, int dry_run) {
   ENTROPY_CONTEXT *A = (ENTROPY_CONTEXT *)xd->above_context;
   ENTROPY_CONTEXT *L = (ENTROPY_CONTEXT *)xd->left_context;
   int b;
@@ -811,8 +811,8 @@
             L + vp9_block2left[b], TX_4X4, dry_run);
 }
 
-static void vp9_stuff_mb_8x8_4x4uv(VP9_COMP *cpi, MACROBLOCKD *xd,
-                                   TOKENEXTRA **t, int dry_run) {
+static void stuff_mb_8x8_4x4uv(VP9_COMP *cpi, MACROBLOCKD *xd,
+                               TOKENEXTRA **t, int dry_run) {
   ENTROPY_CONTEXT *A = (ENTROPY_CONTEXT *)xd->above_context;
   ENTROPY_CONTEXT *L = (ENTROPY_CONTEXT *)xd->left_context;
   int b;
@@ -835,16 +835,16 @@
   TOKENEXTRA * const t_backup = *t;
 
   if (tx_size == TX_16X16) {
-    vp9_stuff_mb_16x16(cpi, xd, t, dry_run);
+    stuff_mb_16x16(cpi, xd, t, dry_run);
   } else if (tx_size == TX_8X8) {
     if (xd->mode_info_context->mbmi.mode == I8X8_PRED ||
         xd->mode_info_context->mbmi.mode == SPLITMV) {
-      vp9_stuff_mb_8x8_4x4uv(cpi, xd, t, dry_run);
+      stuff_mb_8x8_4x4uv(cpi, xd, t, dry_run);
     } else {
-      vp9_stuff_mb_8x8(cpi, xd, t, dry_run);
+      stuff_mb_8x8(cpi, xd, t, dry_run);
     }
   } else {
-    vp9_stuff_mb_4x4(cpi, xd, t, dry_run);
+    stuff_mb_4x4(cpi, xd, t, dry_run);
   }
 
   if (dry_run) {
diff --git a/vp8/encoder/tokenize.h b/vp8/encoder/tokenize.h
index e02f002..4cca36e 100644
--- a/vp8/encoder/tokenize.h
+++ b/vp8/encoder/tokenize.h
@@ -23,7 +23,7 @@
 } TOKENVALUE;
 
 typedef struct {
-  const vp8_prob *context_tree;
+  const vp9_prob *context_tree;
   short           Extra;
   unsigned char   Token;
   unsigned char   skip_eob_node;
diff --git a/vp8/encoder/treewriter.c b/vp8/encoder/treewriter.c
index 3349394..2fb984b 100644
--- a/vp8/encoder/treewriter.c
+++ b/vp8/encoder/treewriter.c
@@ -13,16 +13,16 @@
 
 static void cost(
   int *const C,
-  vp8_tree T,
-  const vp8_prob *const P,
+  vp9_tree T,
+  const vp9_prob *const P,
   int i,
   int c
 ) {
-  const vp8_prob p = P [i >> 1];
+  const vp9_prob p = P [i >> 1];
 
   do {
-    const vp8_tree_index j = T[i];
-    const int d = c + vp8_cost_bit(p, i & 1);
+    const vp9_tree_index j = T[i];
+    const int d = c + vp9_cost_bit(p, i & 1);
 
     if (j <= 0)
       C[-j] = d;
@@ -30,10 +30,10 @@
       cost(C, T, P, j, d);
   } while (++i & 1);
 }
-void vp9_cost_tokens(int *c, const vp8_prob *p, vp8_tree t) {
+void vp9_cost_tokens(int *c, const vp9_prob *p, vp9_tree t) {
   cost(c, t, p, 0, 0);
 }
 
-void vp9_cost_tokens_skip(int *c, const vp8_prob *p, vp8_tree t) {
+void vp9_cost_tokens_skip(int *c, const vp9_prob *p, vp9_tree t) {
   cost(c, t, p, 2, 0);
 }
diff --git a/vp8/encoder/treewriter.h b/vp8/encoder/treewriter.h
index 1a97f5a..e2a0ee2 100644
--- a/vp8/encoder/treewriter.h
+++ b/vp8/encoder/treewriter.h
@@ -19,104 +19,90 @@
 
 #include "boolhuff.h"       /* for now */
 
-typedef BOOL_CODER vp8_writer;
+typedef BOOL_CODER vp9_writer;
 
-#define vp8_write vp8_encode_bool
-#define vp8_write_literal vp9_encode_value
-#define vp8_write_bit( W, V) vp8_write( W, V, vp8_prob_half)
-
-#define vp8bc_write vp8bc_write_bool
-#define vp8bc_write_literal vp8bc_write_bits
-#define vp8bc_write_bit( W, V) vp8bc_write_bits( W, V, 1)
-
+#define vp9_write encode_bool
+#define vp9_write_literal vp9_encode_value
+#define vp9_write_bit(W, V) vp9_write(W, V, vp9_prob_half)
 
 /* Approximate length of an encoded bool in 256ths of a bit at given prob */
 
-#define vp8_cost_zero( x) ( vp9_prob_cost[x])
-#define vp8_cost_one( x)  vp8_cost_zero( vp8_complement(x))
+#define vp9_cost_zero(x) (vp9_prob_cost[x])
+#define vp9_cost_one(x) vp9_cost_zero(vp9_complement(x))
 
-#define vp8_cost_bit( x, b) vp8_cost_zero( (b)?  vp8_complement(x) : (x) )
+#define vp9_cost_bit(x, b) vp9_cost_zero((b) ? vp9_complement(x) : (x))
 
 /* VP8BC version is scaled by 2^20 rather than 2^8; see bool_coder.h */
 
 
 /* Both of these return bits, not scaled bits. */
 
-static __inline unsigned int vp8_cost_branch(const unsigned int ct[2], vp8_prob p) {
+static __inline unsigned int cost_branch(const unsigned int ct[2],
+                                         vp9_prob p) {
   /* Imitate existing calculation */
-
-  return ((ct[0] * vp8_cost_zero(p))
-          + (ct[1] * vp8_cost_one(p))) >> 8;
+  return ((ct[0] * vp9_cost_zero(p))
+          + (ct[1] * vp9_cost_one(p))) >> 8;
 }
 
-static __inline unsigned int vp8_cost_branch256(const unsigned int ct[2], vp8_prob p) {
+static __inline unsigned int cost_branch256(const unsigned int ct[2],
+                                            vp9_prob p) {
   /* Imitate existing calculation */
-
-  return ((ct[0] * vp8_cost_zero(p))
-          + (ct[1] * vp8_cost_one(p)));
+  return ((ct[0] * vp9_cost_zero(p))
+          + (ct[1] * vp9_cost_one(p)));
 }
 
 /* Small functions to write explicit values and tokens, as well as
    estimate their lengths. */
 
-static __inline void vp8_treed_write
-(
-  vp8_writer *const w,
-  vp8_tree t,
-  const vp8_prob *const p,
-  int v,
-  int n               /* number of bits in v, assumed nonzero */
-) {
-  vp8_tree_index i = 0;
+static __inline void treed_write(vp9_writer *const w,
+                                 vp9_tree t,
+                                 const vp9_prob *const p,
+                                 int v,
+                                 /* number of bits in v, assumed nonzero */
+                                 int n) {
+  vp9_tree_index i = 0;
 
   do {
     const int b = (v >> --n) & 1;
-    vp8_write(w, b, p[i >> 1]);
+    vp9_write(w, b, p[i >> 1]);
     i = t[i + b];
   } while (n);
 }
-static __inline void vp8_write_token
-(
-  vp8_writer *const w,
-  vp8_tree t,
-  const vp8_prob *const p,
-  vp8_token *const x
-) {
-  vp8_treed_write(w, t, p, x->value, x->Len);
+
+static __inline void write_token(vp9_writer *const w,
+                                 vp9_tree t,
+                                 const vp9_prob *const p,
+                                 vp9_token *const x) {
+  treed_write(w, t, p, x->value, x->Len);
 }
 
-static __inline int vp8_treed_cost(
-  vp8_tree t,
-  const vp8_prob *const p,
-  int v,
-  int n               /* number of bits in v, assumed nonzero */
-) {
+static __inline int treed_cost(vp9_tree t,
+                               const vp9_prob *const p,
+                               int v,
+                               /* number of bits in v, assumed nonzero */
+                               int n) {
   int c = 0;
-  vp8_tree_index i = 0;
+  vp9_tree_index i = 0;
 
   do {
     const int b = (v >> --n) & 1;
-    c += vp8_cost_bit(p[i >> 1], b);
+    c += vp9_cost_bit(p[i >> 1], b);
     i = t[i + b];
   } while (n);
 
   return c;
 }
-static __inline int vp8_cost_token
-(
-  vp8_tree t,
-  const vp8_prob *const p,
-  vp8_token *const x
-) {
-  return vp8_treed_cost(t, p, x->value, x->Len);
+
+static __inline int cost_token(vp9_tree t,
+                               const vp9_prob *const p,
+                               vp9_token *const x) {
+  return treed_cost(t, p, x->value, x->Len);
 }
 
 /* Fill array of costs for all possible token values. */
 
-void vp9_cost_tokens(
-  int *Costs, const vp8_prob *, vp8_tree
-);
+void vp9_cost_tokens(int *Costs, const vp9_prob *, vp9_tree);
 
-void vp9_cost_tokens_skip(int *c, const vp8_prob *p, vp8_tree t);
+void vp9_cost_tokens_skip(int *c, const vp9_prob *p, vp9_tree t);
 
 #endif
diff --git a/vp8/encoder/variance.h b/vp8/encoder/variance.h
index 8fb8db0..6afbfb7 100644
--- a/vp8/encoder/variance.h
+++ b/vp8/encoder/variance.h
@@ -12,7 +12,7 @@
 #ifndef VARIANCE_H
 #define VARIANCE_H
 
-typedef unsigned int(*vp8_sad_fn_t)(const unsigned char *src_ptr,
+typedef unsigned int(*vp9_sad_fn_t)(const unsigned char *src_ptr,
                                     int source_stride,
                                     const unsigned char *ref_ptr,
                                     int ref_stride,
@@ -24,30 +24,30 @@
                                   int ref_stride,
                                   int n);
 
-typedef void (*vp8_sad_multi_fn_t)(const unsigned char *src_ptr,
+typedef void (*vp9_sad_multi_fn_t)(const unsigned char *src_ptr,
                                    int source_stride,
                                    const unsigned char *ref_ptr,
                                    int  ref_stride,
                                    unsigned int *sad_array);
 
-typedef void (*vp8_sad_multi1_fn_t)(const unsigned char *src_ptr,
+typedef void (*vp9_sad_multi1_fn_t)(const unsigned char *src_ptr,
                                     int source_stride,
                                     const unsigned char *ref_ptr,
                                     int  ref_stride,
                                     unsigned short *sad_array);
 
-typedef void (*vp8_sad_multi_d_fn_t)(const unsigned char *src_ptr,
+typedef void (*vp9_sad_multi_d_fn_t)(const unsigned char *src_ptr,
                                      int source_stride,
                                      const unsigned char * const ref_ptr[],
                                      int  ref_stride, unsigned int *sad_array);
 
-typedef unsigned int (*vp8_variance_fn_t)(const unsigned char *src_ptr,
+typedef unsigned int (*vp9_variance_fn_t)(const unsigned char *src_ptr,
                                           int source_stride,
                                           const unsigned char *ref_ptr,
                                           int ref_stride,
                                           unsigned int *sse);
 
-typedef unsigned int (*vp8_subpixvariance_fn_t)(const unsigned char  *src_ptr,
+typedef unsigned int (*vp9_subpixvariance_fn_t)(const unsigned char  *src_ptr,
                                                 int source_stride,
                                                 int xoffset,
                                                 int yoffset,
@@ -55,30 +55,30 @@
                                                 int Refstride,
                                                 unsigned int *sse);
 
-typedef void (*vp8_ssimpf_fn_t)(unsigned char *s, int sp, unsigned char *r,
+typedef void (*vp9_ssimpf_fn_t)(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);
 
-typedef unsigned int (*vp8_getmbss_fn_t)(const short *);
+typedef unsigned int (*vp9_getmbss_fn_t)(const short *);
 
-typedef unsigned int (*vp8_get16x16prederror_fn_t)(const unsigned char *src_ptr,
+typedef unsigned int (*vp9_get16x16prederror_fn_t)(const unsigned char *src_ptr,
                                                    int source_stride,
                                                    const unsigned char *ref_ptr,
                                                    int  ref_stride);
 
 typedef struct variance_vtable {
-    vp8_sad_fn_t            sdf;
-    vp8_variance_fn_t       vf;
-    vp8_subpixvariance_fn_t svf;
-    vp8_variance_fn_t       svf_halfpix_h;
-    vp8_variance_fn_t       svf_halfpix_v;
-    vp8_variance_fn_t       svf_halfpix_hv;
-    vp8_sad_multi_fn_t      sdx3f;
-    vp8_sad_multi1_fn_t     sdx8f;
-    vp8_sad_multi_d_fn_t    sdx4df;
+    vp9_sad_fn_t            sdf;
+    vp9_variance_fn_t       vf;
+    vp9_subpixvariance_fn_t svf;
+    vp9_variance_fn_t       svf_halfpix_h;
+    vp9_variance_fn_t       svf_halfpix_v;
+    vp9_variance_fn_t       svf_halfpix_hv;
+    vp9_sad_multi_fn_t      sdx3f;
+    vp9_sad_multi1_fn_t     sdx8f;
+    vp9_sad_multi_d_fn_t    sdx4df;
     vp9_copy32xn_fn_t       copymem;
-} vp8_variance_fn_ptr_t;
+} vp9_variance_fn_ptr_t;
 
 #endif
diff --git a/vp8/encoder/variance_c.c b/vp8/encoder/variance_c.c
index 760c519..4dc554d 100644
--- a/vp8/encoder/variance_c.c
+++ b/vp8/encoder/variance_c.c
@@ -155,7 +155,7 @@
  *                  UINT32 pixel_step        : Offset between filter input samples (see notes).
  *                  UINT32 output_height     : Input block height.
  *                  UINT32 output_width      : Input block width.
- *                  INT32  *vp8_filter          : Array of 2 bi-linear filter taps.
+ *                  INT32  *vp9_filter          : Array of 2 bi-linear filter taps.
  *
  *  OUTPUTS       : INT32 *output_ptr        : Pointer to filtered block.
  *
@@ -167,7 +167,7 @@
  *                  of 2-D separable filter.
  *
  *  SPECIAL NOTES : Produces INT32 output to retain precision for next pass.
- *                  Two filter taps should sum to VP8_FILTER_WEIGHT.
+ *                  Two filter taps should sum to VP9_FILTER_WEIGHT.
  *                  pixel_step defines whether the filter is applied
  *                  horizontally (pixel_step=1) or vertically (pixel_step=stride).
  *                  It defines the offset required to move from one input
@@ -180,15 +180,15 @@
                                               int pixel_step,
                                               unsigned int output_height,
                                               unsigned int output_width,
-                                              const short *vp8_filter) {
+                                              const short *vp9_filter) {
   unsigned int i, j;
 
   for (i = 0; i < output_height; i++) {
     for (j = 0; j < output_width; j++) {
       // Apply bilinear filter
-      output_ptr[j] = (((int)src_ptr[0]          * vp8_filter[0]) +
-                       ((int)src_ptr[pixel_step] * vp8_filter[1]) +
-                       (VP8_FILTER_WEIGHT / 2)) >> VP8_FILTER_SHIFT;
+      output_ptr[j] = (((int)src_ptr[0]          * vp9_filter[0]) +
+                       ((int)src_ptr[pixel_step] * vp9_filter[1]) +
+                       (VP9_FILTER_WEIGHT / 2)) >> VP9_FILTER_SHIFT;
       src_ptr++;
     }
 
@@ -207,7 +207,7 @@
  *                  UINT32 pixel_step        : Offset between filter input samples (see notes).
  *                  UINT32 output_height     : Input block height.
  *                  UINT32 output_width      : Input block width.
- *                  INT32  *vp8_filter          : Array of 2 bi-linear filter taps.
+ *                  INT32  *vp9_filter          : Array of 2 bi-linear filter taps.
  *
  *  OUTPUTS       : UINT16 *output_ptr       : Pointer to filtered block.
  *
@@ -219,7 +219,7 @@
  *                  of 2-D separable filter.
  *
  *  SPECIAL NOTES : Requires 32-bit input as produced by filter_block2d_bil_first_pass.
- *                  Two filter taps should sum to VP8_FILTER_WEIGHT.
+ *                  Two filter taps should sum to VP9_FILTER_WEIGHT.
  *                  pixel_step defines whether the filter is applied
  *                  horizontally (pixel_step=1) or vertically (pixel_step=stride).
  *                  It defines the offset required to move from one input
@@ -232,17 +232,17 @@
                                                unsigned int pixel_step,
                                                unsigned int output_height,
                                                unsigned int output_width,
-                                               const short *vp8_filter) {
+                                               const short *vp9_filter) {
   unsigned int  i, j;
   int  Temp;
 
   for (i = 0; i < output_height; i++) {
     for (j = 0; j < output_width; j++) {
       // Apply filter
-      Temp = ((int)src_ptr[0]         * vp8_filter[0]) +
-             ((int)src_ptr[pixel_step] * vp8_filter[1]) +
-             (VP8_FILTER_WEIGHT / 2);
-      output_ptr[j] = (unsigned int)(Temp >> VP8_FILTER_SHIFT);
+      Temp = ((int)src_ptr[0]         * vp9_filter[0]) +
+             ((int)src_ptr[pixel_step] * vp9_filter[1]) +
+             (VP9_FILTER_WEIGHT / 2);
+      output_ptr[j] = (unsigned int)(Temp >> VP9_FILTER_SHIFT);
       src_ptr++;
     }
 
@@ -470,7 +470,7 @@
 }
 
 #if CONFIG_NEWBESTREFMV
-unsigned int vp8_variance2x16_c(const unsigned char *src_ptr,
+unsigned int vp9_variance2x16_c(const unsigned char *src_ptr,
                                 const int  source_stride,
                                 const unsigned char *ref_ptr,
                                 const int  recon_stride,
@@ -483,7 +483,7 @@
   return (var - ((avg * avg) >> 5));
 }
 
-unsigned int vp8_variance16x2_c(const unsigned char *src_ptr,
+unsigned int vp9_variance16x2_c(const unsigned char *src_ptr,
                                 const int  source_stride,
                                 const unsigned char *ref_ptr,
                                 const int  recon_stride,
@@ -496,7 +496,7 @@
   return (var - ((avg * avg) >> 5));
 }
 
-unsigned int vp8_sub_pixel_variance16x2_c(const unsigned char  *src_ptr,
+unsigned int vp9_sub_pixel_variance16x2_c(const unsigned char  *src_ptr,
                                           const int  src_pixels_per_line,
                                           const int  xoffset,
                                           const int  yoffset,
@@ -514,10 +514,10 @@
                                     src_pixels_per_line, 1, 3, 16, HFilter);
   var_filter_block2d_bil_second_pass(FData3, temp2, 16, 16, 2, 16, VFilter);
 
-  return vp8_variance16x2_c(temp2, 16, dst_ptr, dst_pixels_per_line, sse);
+  return vp9_variance16x2_c(temp2, 16, dst_ptr, dst_pixels_per_line, sse);
 }
 
-unsigned int vp8_sub_pixel_variance2x16_c(const unsigned char  *src_ptr,
+unsigned int vp9_sub_pixel_variance2x16_c(const unsigned char  *src_ptr,
                                           const int  src_pixels_per_line,
                                           const int  xoffset,
                                           const int  yoffset,
@@ -535,6 +535,6 @@
                                     src_pixels_per_line, 1, 17, 2, HFilter);
   var_filter_block2d_bil_second_pass(FData3, temp2, 2, 2, 16, 2, VFilter);
 
-  return vp8_variance2x16_c(temp2, 2, dst_ptr, dst_pixels_per_line, sse);
+  return vp9_variance2x16_c(temp2, 2, dst_ptr, dst_pixels_per_line, sse);
 }
 #endif
diff --git a/vp8/encoder/x86/mcomp_x86.h b/vp8/encoder/x86/mcomp_x86.h
index ea8d1dc..cde9545 100644
--- a/vp8/encoder/x86/mcomp_x86.h
+++ b/vp8/encoder/x86/mcomp_x86.h
@@ -15,14 +15,14 @@
 #if HAVE_SSE3
 #if !CONFIG_RUNTIME_CPU_DETECT
 
-#undef  vp8_search_full_search
-#define vp8_search_full_search vp9_full_search_sadx3
+#undef  vp9_search_full_search
+#define vp9_search_full_search vp9_full_search_sadx3
 
-#undef  vp8_search_refining_search
-#define vp8_search_refining_search vp9_refining_search_sadx4
+#undef  vp9_search_refining_search
+#define vp9_search_refining_search vp9_refining_search_sadx4
 
-#undef  vp8_search_diamond_search
-#define vp8_search_diamond_search vp9_diamond_search_sadx4
+#undef  vp9_search_diamond_search
+#define vp9_search_diamond_search vp9_diamond_search_sadx4
 
 #endif
 #endif
@@ -30,8 +30,8 @@
 #if HAVE_SSE4_1
 #if !CONFIG_RUNTIME_CPU_DETECT
 
-#undef  vp8_search_full_search
-#define vp8_search_full_search vp9_full_search_sadx8
+#undef  vp9_search_full_search
+#define vp9_search_full_search vp9_full_search_sadx8
 
 #endif
 #endif
diff --git a/vp8/encoder/x86/quantize_x86.h b/vp8/encoder/x86/quantize_x86.h
index 33d3a13..6946e7e 100644
--- a/vp8/encoder/x86/quantize_x86.h
+++ b/vp8/encoder/x86/quantize_x86.h
@@ -26,8 +26,8 @@
 extern prototype_quantize_block(vp9_regular_quantize_b_sse2);
 #if !CONFIG_RUNTIME_CPU_DETECT
 
-#undef vp8_quantize_quantb
-#define vp8_quantize_quantb vp9_regular_quantize_b_sse2
+#undef vp9_quantize_quantb
+#define vp9_quantize_quantb vp9_regular_quantize_b_sse2
 #endif /* !CONFIG_RUNTIME_CPU_DETECT */
 
 #endif /* HAVE_SSE2 */
@@ -38,8 +38,8 @@
 
 #if !CONFIG_RUNTIME_CPU_DETECT
 
-#undef vp8_quantize_quantb
-#define vp8_quantize_quantb vp9_regular_quantize_b_sse4
+#undef vp9_quantize_quantb
+#define vp9_quantize_quantb vp9_regular_quantize_b_sse4
 
 #endif /* !CONFIG_RUNTIME_CPU_DETECT */
 
diff --git a/vp8/encoder/x86/temporal_filter_x86.h b/vp8/encoder/x86/temporal_filter_x86.h
index c72c27b..8fae220 100644
--- a/vp8/encoder/x86/temporal_filter_x86.h
+++ b/vp8/encoder/x86/temporal_filter_x86.h
@@ -9,8 +9,8 @@
  */
 
 
-#ifndef __INC_VP8_TEMPORAL_FILTER_X86_H
-#define __INC_VP8_TEMPORAL_FILTER_X86_H
+#ifndef __INC_TEMPORAL_FILTER_X86_H
+#define __INC_TEMPORAL_FILTER_X86_H
 
 #if HAVE_SSE2
 extern prototype_apply(vp9_temporal_filter_apply_sse2);
@@ -24,4 +24,4 @@
 
 #endif
 
-#endif // __INC_VP8_TEMPORAL_FILTER_X86_H
+#endif // __INC_TEMPORAL_FILTER_X86_H
diff --git a/vp8/encoder/x86/variance_impl_sse2.asm b/vp8/encoder/x86/variance_impl_sse2.asm
index 349687c..5b20f3b 100644
--- a/vp8/encoder/x86/variance_impl_sse2.asm
+++ b/vp8/encoder/x86/variance_impl_sse2.asm
@@ -431,7 +431,7 @@
         lea             rsi,            [GLOBAL(xmm_bi_rd)]  ; rounding
         movdqa          xmm4,           XMMWORD PTR [rsi]
 
-        lea             rcx,            [GLOBAL(vp8_bilinear_filters_sse2)]
+        lea             rcx,            [GLOBAL(bilinear_filters_sse2)]
         movsxd          rax,            dword ptr arg(5)     ; xoffset
 
         cmp             rax,            0                    ; skip first_pass filter if xoffset=0
@@ -726,7 +726,7 @@
         add             rsi, r8
 %endif
 
-vp8_half_horiz_vert_variance8x_h_1:
+.half_horiz_vert_variance8x_h_1:
 
         movq            xmm1,           QWORD PTR [rsi]     ;
         movq            xmm2,           QWORD PTR [rsi+1]   ;
@@ -754,7 +754,7 @@
 %endif
 
         sub             rcx,            1                   ;
-        jnz             vp8_half_horiz_vert_variance8x_h_1     ;
+        jnz             .half_horiz_vert_variance8x_h_1     ;
 
         movdq2q         mm6,            xmm6                ;
         movdq2q         mm7,            xmm7                ;
@@ -840,7 +840,7 @@
 
         lea             rsi,            [rsi + rax]
 
-vp8_half_horiz_vert_variance16x_h_1:
+.half_horiz_vert_variance16x_h_1:
         movdqu          xmm1,           XMMWORD PTR [rsi]     ;
         movdqu          xmm2,           XMMWORD PTR [rsi+1]   ;
         pavgb           xmm1,           xmm2                ;  xmm1 = avg(xmm1,xmm3) horizontal line i+1
@@ -872,7 +872,7 @@
         lea             rdi,            [rdi + rdx]
 
         sub             rcx,            1                   ;
-        jnz             vp8_half_horiz_vert_variance16x_h_1     ;
+        jnz             .half_horiz_vert_variance16x_h_1    ;
 
         pxor        xmm1,           xmm1
         pxor        xmm5,           xmm5
@@ -953,7 +953,7 @@
         movsxd          rax,            dword ptr arg(1) ;ref_pixels_per_line
 
         pxor            xmm0,           xmm0                ;
-vp8_half_vert_variance8x_h_1:
+.half_vert_variance8x_h_1:
         movq            xmm5,           QWORD PTR [rsi]     ;  xmm5 = s0,s1,s2..s8
         movq            xmm3,           QWORD PTR [rsi+rax] ;  xmm3 = s1,s2,s3..s9
 
@@ -977,7 +977,7 @@
 %endif
 
         sub             rcx,            1                   ;
-        jnz             vp8_half_vert_variance8x_h_1          ;
+        jnz             .half_vert_variance8x_h_1          ;
 
         movdq2q         mm6,            xmm6                ;
         movdq2q         mm7,            xmm7                ;
@@ -1059,7 +1059,7 @@
         lea             rsi,            [rsi + rax          ]
         pxor            xmm0,           xmm0
 
-vp8_half_vert_variance16x_h_1:
+.half_vert_variance16x_h_1:
         movdqu          xmm3,           XMMWORD PTR [rsi]
 
         pavgb           xmm5,           xmm3                ;  xmm5 = avg(xmm1,xmm3)
@@ -1087,7 +1087,7 @@
         lea             rdi,            [rdi + rdx]
 
         sub             rcx,            1
-        jnz             vp8_half_vert_variance16x_h_1
+        jnz             .half_vert_variance16x_h_1
 
         pxor        xmm1,           xmm1
         pxor        xmm5,           xmm5
@@ -1167,7 +1167,7 @@
         movsxd          rcx,            dword ptr arg(4) ;Height              ;
 
         pxor            xmm0,           xmm0                ;
-vp8_half_horiz_variance8x_h_1:
+.half_horiz_variance8x_h_1:
         movq            xmm5,           QWORD PTR [rsi]     ;  xmm5 = s0,s1,s2..s8
         movq            xmm3,           QWORD PTR [rsi+1]   ;  xmm3 = s1,s2,s3..s9
 
@@ -1190,7 +1190,7 @@
         add             rdi, r9
 %endif
         sub             rcx,            1                   ;
-        jnz             vp8_half_horiz_variance8x_h_1        ;
+        jnz             .half_horiz_variance8x_h_1          ;
 
         movdq2q         mm6,            xmm6                ;
         movdq2q         mm7,            xmm7                ;
@@ -1270,7 +1270,7 @@
 
         pxor            xmm0,           xmm0                ;
 
-vp8_half_horiz_variance16x_h_1:
+.half_horiz_variance16x_h_1:
         movdqu          xmm5,           XMMWORD PTR [rsi]     ;  xmm5 = s0,s1,s2..s15
         movdqu          xmm3,           XMMWORD PTR [rsi+1]   ;  xmm3 = s1,s2,s3..s16
 
@@ -1297,7 +1297,7 @@
         lea             rdi,            [rdi + rdx]
 
         sub             rcx,            1                   ;
-        jnz             vp8_half_horiz_variance16x_h_1        ;
+        jnz             .half_horiz_variance16x_h_1         ;
 
         pxor        xmm1,           xmm1
         pxor        xmm5,           xmm5
@@ -1348,7 +1348,7 @@
 xmm_bi_rd:
     times 8 dw 64
 align 16
-vp8_bilinear_filters_sse2:
+bilinear_filters_sse2:
     dw 128, 128, 128, 128, 128, 128, 128, 128,  0,  0,  0,  0,  0,  0,  0,  0
     dw 120, 120, 120, 120, 120, 120, 120, 120,  8,  8,  8,  8,  8,  8,  8,  8
     dw 112, 112, 112, 112, 112, 112, 112, 112, 16, 16, 16, 16, 16, 16, 16, 16
diff --git a/vp8/encoder/x86/variance_impl_ssse3.asm b/vp8/encoder/x86/variance_impl_ssse3.asm
index ca1a571..30c75a6 100644
--- a/vp8/encoder/x86/variance_impl_ssse3.asm
+++ b/vp8/encoder/x86/variance_impl_ssse3.asm
@@ -43,7 +43,7 @@
         pxor            xmm6,           xmm6
         pxor            xmm7,           xmm7
 
-        lea             rcx,            [GLOBAL(vp8_bilinear_filters_ssse3)]
+        lea             rcx,            [GLOBAL(bilinear_filters_ssse3)]
         movsxd          rax,            dword ptr arg(5)     ; xoffset
 
         cmp             rax,            0                    ; skip first_pass filter if xoffset=0
@@ -353,7 +353,7 @@
 xmm_bi_rd:
     times 8 dw 64
 align 16
-vp8_bilinear_filters_ssse3:
+bilinear_filters_ssse3:
     times 8 db 128, 0
     times 8 db 120, 8
     times 8 db 112, 16
diff --git a/vp8/vp8_cx_iface.c b/vp8/vp8_cx_iface.c
index 9195fd3..3d42ef3 100644
--- a/vp8/vp8_cx_iface.c
+++ b/vp8/vp8_cx_iface.c
@@ -75,7 +75,7 @@
   vpx_codec_priv_t        base;
   vpx_codec_enc_cfg_t     cfg;
   struct vp8_extracfg     vp8_cfg;
-  VP8_CONFIG              oxcf;
+  VP9_CONFIG              oxcf;
   VP9_PTR             cpi;
   unsigned char          *cx_data;
   unsigned int            cx_data_sz;
@@ -216,7 +216,7 @@
 }
 
 
-static vpx_codec_err_t set_vp8e_config(VP8_CONFIG *oxcf,
+static vpx_codec_err_t set_vp8e_config(VP9_CONFIG *oxcf,
                                        vpx_codec_enc_cfg_t cfg,
                                        struct vp8_extracfg vp8_cfg) {
   oxcf->Version               = cfg.g_profile;
@@ -595,13 +595,13 @@
     int ref = 7;
 
     if (flags & VP8_EFLAG_NO_REF_LAST)
-      ref ^= VP8_LAST_FLAG;
+      ref ^= VP9_LAST_FLAG;
 
     if (flags & VP8_EFLAG_NO_REF_GF)
-      ref ^= VP8_GOLD_FLAG;
+      ref ^= VP9_GOLD_FLAG;
 
     if (flags & VP8_EFLAG_NO_REF_ARF)
-      ref ^= VP8_ALT_FLAG;
+      ref ^= VP9_ALT_FLAG;
 
     vp9_use_as_reference(ctx->cpi, ref);
   }
@@ -612,13 +612,13 @@
     int upd = 7;
 
     if (flags & VP8_EFLAG_NO_UPD_LAST)
-      upd ^= VP8_LAST_FLAG;
+      upd ^= VP9_LAST_FLAG;
 
     if (flags & VP8_EFLAG_NO_UPD_GF)
-      upd ^= VP8_GOLD_FLAG;
+      upd ^= VP9_GOLD_FLAG;
 
     if (flags & VP8_EFLAG_NO_UPD_ARF)
-      upd ^= VP8_ALT_FLAG;
+      upd ^= VP9_ALT_FLAG;
 
     vp9_update_reference(ctx->cpi, upd);
   }
@@ -817,7 +817,7 @@
 static vpx_image_t *vp8e_get_preview(vpx_codec_alg_priv_t *ctx) {
 
   YV12_BUFFER_CONFIG sd;
-  vp8_ppflags_t flags = {0};
+  vp9_ppflags_t flags = {0};
 
   if (ctx->preview_ppcfg.post_proc_flag) {
     flags.post_proc_flag        = ctx->preview_ppcfg.post_proc_flag;
diff --git a/vp8/vp8_dx_iface.c b/vp8/vp8_dx_iface.c
index c873ad1..f93c6ef 100644
--- a/vp8/vp8_dx_iface.c
+++ b/vp8/vp8_dx_iface.c
@@ -50,7 +50,7 @@
   vp8_stream_info_t       si;
   int                     defer_alloc;
   int                     decoder_init;
-  VP8D_PTR                pbi;
+  VP9D_PTR                pbi;
   int                     postproc_cfg_set;
   vp8_postproc_cfg_t      postproc_cfg;
 #if CONFIG_POSTPROC_VISUALIZER
@@ -351,8 +351,8 @@
     res = vp8_validate_mmaps(&ctx->si, ctx->mmaps, ctx->base.init_flags);
 
     if (!res) {
-      VP8D_CONFIG oxcf;
-      VP8D_PTR optr;
+      VP9D_CONFIG oxcf;
+      VP9D_PTR optr;
 
       vp9_initialize_dec();
 
@@ -386,16 +386,16 @@
   if (!res && ctx->pbi) {
     YV12_BUFFER_CONFIG sd;
     int64_t time_stamp = 0, time_end_stamp = 0;
-    vp8_ppflags_t flags = {0};
+    vp9_ppflags_t flags = {0};
 
     if (ctx->base.init_flags & VPX_CODEC_USE_POSTPROC) {
       flags.post_proc_flag = ctx->postproc_cfg.post_proc_flag
 #if CONFIG_POSTPROC_VISUALIZER
 
-                             | ((ctx->dbg_color_ref_frame_flag != 0) ? VP8D_DEBUG_CLR_FRM_REF_BLKS : 0)
-                             | ((ctx->dbg_color_mb_modes_flag != 0) ? VP8D_DEBUG_CLR_BLK_MODES : 0)
-                             | ((ctx->dbg_color_b_modes_flag != 0) ? VP8D_DEBUG_CLR_BLK_MODES : 0)
-                             | ((ctx->dbg_display_mv_flag != 0) ? VP8D_DEBUG_DRAW_MV : 0)
+                             | ((ctx->dbg_color_ref_frame_flag != 0) ? VP9D_DEBUG_CLR_FRM_REF_BLKS : 0)
+                             | ((ctx->dbg_color_mb_modes_flag != 0) ? VP9D_DEBUG_CLR_BLK_MODES : 0)
+                             | ((ctx->dbg_color_b_modes_flag != 0) ? VP9D_DEBUG_CLR_BLK_MODES : 0)
+                             | ((ctx->dbg_display_mv_flag != 0) ? VP9D_DEBUG_DRAW_MV : 0)
 #endif
 ;
       flags.deblocking_level      = ctx->postproc_cfg.deblocking_level;