diff --git a/vp9/common/vp9_blockd.h b/vp9/common/vp9_blockd.h
index cc8b23983180d6f70f17eaaae3c70ebcba2a6ffa..9626540c3afea128ffa6c8d32c54d26a4f7c5cd2 100644
--- a/vp9/common/vp9_blockd.h
+++ b/vp9/common/vp9_blockd.h
@@ -91,6 +91,7 @@ static INLINE int is_inter_mode(MB_PREDICTION_MODE mode) {
   return mode >= NEARESTMV && mode <= SPLITMV;
 }
 
+#define INTRA_MODE_COUNT (TM_PRED + 1)
 
 // Segment level features.
 typedef enum {
@@ -126,25 +127,7 @@ typedef enum {
 
 #define WHT_UPSCALE_FACTOR 2
 
-typedef enum {
-  B_DC_PRED,          /* average of above and left pixels */
-  B_V_PRED,          /* vertical prediction */
-  B_H_PRED,          /* horizontal prediction */
-  B_D45_PRED,
-  B_D135_PRED,
-  B_D117_PRED,
-  B_D153_PRED,
-  B_D27_PRED,
-  B_D63_PRED,
-  B_TM_PRED,
-
-  B_MODE_COUNT
-} B_PREDICTION_MODE;
-
-#define VP9_BINTRAMODES (B_MODE_COUNT)
-
-#define VP9_KF_BINTRAMODES (VP9_BINTRAMODES)   /* 10 */
-#define VP9_NKF_BINTRAMODES (VP9_BINTRAMODES)  /* 10 */
+#define VP9_BINTRAMODES INTRA_MODE_COUNT
 
 /* For keyframes, intra block modes are predicted by the (already decoded)
    modes for the Y blocks to the left and above us; for interframes, there
@@ -532,25 +515,6 @@ static BLOCK_SIZE_TYPE get_subsize(BLOCK_SIZE_TYPE bsize,
   return subsize;
 }
 
-// convert MB_PREDICTION_MODE to B_PREDICTION_MODE
-static MB_PREDICTION_MODE pred_mode_conv(MB_PREDICTION_MODE mode) {
-  switch (mode) {
-    case DC_PRED: return DC_PRED;
-    case V_PRED: return V_PRED;
-    case H_PRED: return H_PRED;
-    case TM_PRED: return TM_PRED;
-    case D45_PRED: return D45_PRED;
-    case D135_PRED: return D135_PRED;
-    case D117_PRED: return D117_PRED;
-    case D153_PRED: return D153_PRED;
-    case D27_PRED: return D27_PRED;
-    case D63_PRED: return D63_PRED;
-    default:
-       assert(0);
-       return MB_MODE_COUNT;  // Dummy value
-  }
-}
-
 // transform mapping
 static TX_TYPE txfm_map(MB_PREDICTION_MODE bmode) {
   switch (bmode) {
@@ -573,7 +537,6 @@ static TX_TYPE txfm_map(MB_PREDICTION_MODE bmode) {
   }
 }
 
-
 static TX_TYPE get_tx_type_4x4(const MACROBLOCKD *xd, int ib) {
   TX_TYPE tx_type = DCT_DCT;
   if (xd->lossless)
@@ -582,7 +545,7 @@ static TX_TYPE get_tx_type_4x4(const MACROBLOCKD *xd, int ib) {
     tx_type = txfm_map(
         xd->mode_info_context->bmi[ib].as_mode.first);
   } else if (xd->mode_info_context->mbmi.mode <= TM_PRED) {
-    tx_type = txfm_map(pred_mode_conv(xd->mode_info_context->mbmi.mode));
+    tx_type = txfm_map(xd->mode_info_context->mbmi.mode);
   }
   return tx_type;
 }
@@ -590,7 +553,7 @@ static TX_TYPE get_tx_type_4x4(const MACROBLOCKD *xd, int ib) {
 static TX_TYPE get_tx_type_8x8(const MACROBLOCKD *xd, int ib) {
   TX_TYPE tx_type = DCT_DCT;
   if (xd->mode_info_context->mbmi.mode <= TM_PRED) {
-    tx_type = txfm_map(pred_mode_conv(xd->mode_info_context->mbmi.mode));
+    tx_type = txfm_map(xd->mode_info_context->mbmi.mode);
   }
   return tx_type;
 }
@@ -598,7 +561,7 @@ static TX_TYPE get_tx_type_8x8(const MACROBLOCKD *xd, int ib) {
 static TX_TYPE get_tx_type_16x16(const MACROBLOCKD *xd, int ib) {
   TX_TYPE tx_type = DCT_DCT;
   if (xd->mode_info_context->mbmi.mode <= TM_PRED) {
-    tx_type = txfm_map(pred_mode_conv(xd->mode_info_context->mbmi.mode));
+    tx_type = txfm_map(xd->mode_info_context->mbmi.mode);
   }
   return tx_type;
 }
diff --git a/vp9/common/vp9_entropymode.c b/vp9/common/vp9_entropymode.c
index ddc7bbd334bcb15d6e6f790a908af35754a4eb4d..622f1dcf4524644319e8cdd6b01730bfcff40a83 100644
--- a/vp9/common/vp9_entropymode.c
+++ b/vp9/common/vp9_entropymode.c
@@ -29,7 +29,7 @@ static const unsigned int kf_y_mode_cts[8][VP9_YMODES] = {
 
 static const unsigned int y_mode_cts  [VP9_YMODES] = {
   /* DC V   H  D45 135 117 153 D27 D63 TM i4X4 */
-  98, 19, 15, 14, 14, 14, 14, 12, 12, 13, 70
+  98, 19, 15, 14, 14, 14, 14, 12, 12, 13, 0
 };
 
 static const unsigned int uv_mode_cts [VP9_YMODES] [VP9_UV_MODES] = {
@@ -62,7 +62,7 @@ static const unsigned int kf_uv_mode_cts [VP9_YMODES] [VP9_UV_MODES] = {
   { 122, 41, 35, 20, 20, 20, 20, 20, 20, 18}, /* I4X4 */
 };
 
-static const unsigned int bmode_cts[VP9_NKF_BINTRAMODES] = {
+static const unsigned int bmode_cts[VP9_BINTRAMODES] = {
   /* DC    V     H    D45   D135  D117  D153   D27   D63   TM  */
   43891, 10036, 3920, 3363, 2546, 5119, 2471, 1723, 3221, 17694
 };
@@ -89,29 +89,16 @@ const vp9_prob vp9_partition_probs[NUM_PARTITION_CONTEXTS]
 };
 
 /* Array indices are identical to previously-existing INTRAMODECONTEXTNODES. */
-
-const vp9_tree_index vp9_kf_bmode_tree[VP9_KF_BINTRAMODES * 2 - 2] = {
-  -B_DC_PRED, 2,                      /* 0 = DC_NODE */
-  -B_TM_PRED, 4,                      /* 1 = TM_NODE */
-  -B_V_PRED, 6,                       /* 2 = V_NODE */
-  8, 12,                              /* 3 = COM_NODE */
-  -B_H_PRED, 10,                      /* 4 = H_NODE */
-  -B_D135_PRED, -B_D117_PRED,         /* 5 = D135_NODE */
-  -B_D45_PRED, 14,                    /* 6 = D45_NODE */
-  -B_D63_PRED, 16,                    /* 7 = D63_NODE */
-  -B_D153_PRED, -B_D27_PRED           /* 8 = D153_NODE */
-};
-
-const vp9_tree_index vp9_bmode_tree[VP9_NKF_BINTRAMODES * 2 - 2] = {
-  -B_DC_PRED, 2,                      /* 0 = DC_NODE */
-  -B_TM_PRED, 4,                      /* 1 = TM_NODE */
-  -B_V_PRED, 6,                       /* 2 = V_NODE */
-  8, 12,                              /* 3 = COM_NODE */
-  -B_H_PRED, 10,                      /* 4 = H_NODE */
-  -B_D135_PRED, -B_D117_PRED,         /* 5 = D135_NODE */
-  -B_D45_PRED, 14,                    /* 6 = D45_NODE */
-  -B_D63_PRED, 16,                    /* 7 = D63_NODE */
-  -B_D153_PRED, -B_D27_PRED           /* 8 = D153_NODE */
+const vp9_tree_index vp9_bmode_tree[VP9_BINTRAMODES * 2 - 2] = {
+  -DC_PRED, 2,                      /* 0 = DC_NODE */
+  -TM_PRED, 4,                      /* 1 = TM_NODE */
+  -V_PRED, 6,                       /* 2 = V_NODE */
+  8, 12,                            /* 3 = COM_NODE */
+  -H_PRED, 10,                      /* 4 = H_NODE */
+  -D135_PRED, -D117_PRED,           /* 5 = D135_NODE */
+  -D45_PRED, 14,                    /* 6 = D45_NODE */
+  -D63_PRED, 16,                    /* 7 = D63_NODE */
+  -D153_PRED, -D27_PRED             /* 8 = D153_NODE */
 };
 
 /* Again, these trees use the same probability indices as their
@@ -173,8 +160,8 @@ const vp9_tree_index vp9_partition_tree[6] = {
   -PARTITION_VERT, -PARTITION_SPLIT
 };
 
-struct vp9_token vp9_bmode_encodings[VP9_NKF_BINTRAMODES];
-struct vp9_token vp9_kf_bmode_encodings[VP9_KF_BINTRAMODES];
+struct vp9_token vp9_bmode_encodings[VP9_BINTRAMODES];
+struct vp9_token vp9_kf_bmode_encodings[VP9_BINTRAMODES];
 struct vp9_token vp9_ymode_encodings[VP9_YMODES];
 struct vp9_token vp9_sb_ymode_encodings[VP9_I32X32_MODES];
 struct vp9_token vp9_sb_kf_ymode_encodings[VP9_I32X32_MODES];
@@ -222,14 +209,14 @@ void vp9_init_mbmode_probs(VP9_COMMON *x) {
 
 
 static void intra_bmode_probs_from_distribution(
-  vp9_prob p[VP9_NKF_BINTRAMODES - 1],
-  unsigned int branch_ct[VP9_NKF_BINTRAMODES - 1][2],
-  const unsigned int events[VP9_NKF_BINTRAMODES]) {
+  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_bmode_tree, p, branch_ct, events, 0);
 }
 
-void vp9_default_bmode_probs(vp9_prob p[VP9_NKF_BINTRAMODES - 1]) {
-  unsigned int branch_ct[VP9_NKF_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);
 }
 
@@ -267,7 +254,7 @@ const int vp9_switchable_interp_map[SWITCHABLE+1] = {-1, 0, 1, -1, -1};
 const int vp9_is_interpolating_filter[SWITCHABLE + 1] = {0, 1, 1, 1, -1};
 
 void vp9_entropy_mode_init() {
-  vp9_tokens_from_tree(vp9_kf_bmode_encodings,   vp9_kf_bmode_tree);
+  vp9_tokens_from_tree(vp9_kf_bmode_encodings,   vp9_bmode_tree);
   vp9_tokens_from_tree(vp9_bmode_encodings,   vp9_bmode_tree);
   vp9_tokens_from_tree(vp9_ymode_encodings,   vp9_ymode_tree);
   vp9_tokens_from_tree(vp9_kf_ymode_encodings, vp9_kf_ymode_tree);
@@ -410,7 +397,7 @@ void vp9_adapt_mode_probs(VP9_COMMON *cm) {
                       fc->uv_mode_counts[i], fc->pre_uv_mode_prob[i],
                       fc->uv_mode_prob[i], 0);
 
-  update_mode_probs(VP9_NKF_BINTRAMODES, vp9_bmode_tree,
+  update_mode_probs(VP9_BINTRAMODES, vp9_bmode_tree,
                     fc->bmode_counts, fc->pre_bmode_prob,
                     fc->bmode_prob, 0);
 
diff --git a/vp9/common/vp9_entropymode.h b/vp9/common/vp9_entropymode.h
index ec3bfeda93043ba29171e76bdab30b3198fac064..8fbc6f20edcfc5d467af31cb34f4109a2fc359cc 100644
--- a/vp9/common/vp9_entropymode.h
+++ b/vp9/common/vp9_entropymode.h
@@ -18,13 +18,12 @@
 
 extern int vp9_mv_cont(const int_mv *l, const int_mv *a);
 
-extern const vp9_prob vp9_kf_default_bmode_probs[VP9_KF_BINTRAMODES]
-                                                [VP9_KF_BINTRAMODES]
-                                                [VP9_KF_BINTRAMODES -1 ];
 
-extern const vp9_tree_index vp9_bmode_tree[];
-extern const vp9_tree_index vp9_kf_bmode_tree[];
+extern const vp9_prob vp9_kf_default_bmode_probs[VP9_BINTRAMODES]
+                                                [VP9_BINTRAMODES]
+                                                [VP9_BINTRAMODES -1 ];
 
+extern const vp9_tree_index vp9_bmode_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[];
@@ -34,8 +33,8 @@ 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 vp9_token vp9_bmode_encodings[VP9_NKF_BINTRAMODES];
-extern struct vp9_token vp9_kf_bmode_encodings[VP9_KF_BINTRAMODES];
+extern struct vp9_token vp9_bmode_encodings[VP9_BINTRAMODES];
+extern struct vp9_token vp9_kf_bmode_encodings[VP9_BINTRAMODES];
 extern struct vp9_token vp9_ymode_encodings[VP9_YMODES];
 extern struct vp9_token vp9_sb_ymode_encodings[VP9_I32X32_MODES];
 extern struct vp9_token vp9_sb_kf_ymode_encodings[VP9_I32X32_MODES];
@@ -68,7 +67,7 @@ extern void vp9_accum_mv_refs(struct VP9Common *pc,
                               MB_PREDICTION_MODE m,
                               const int context);
 
-void vp9_default_bmode_probs(vp9_prob dest[VP9_NKF_BINTRAMODES - 1]);
+void vp9_default_bmode_probs(vp9_prob dest[VP9_BINTRAMODES - 1]);
 
 void vp9_adapt_mode_probs(struct VP9Common *);
 
diff --git a/vp9/common/vp9_findnearmv.h b/vp9/common/vp9_findnearmv.h
index 855ecab6d72697c78a15f39211ad4fff262ef593..bc5afb12d54f60addee70a1934ef8132bbcda9b9 100644
--- a/vp9/common/vp9_findnearmv.h
+++ b/vp9/common/vp9_findnearmv.h
@@ -88,7 +88,7 @@ static MB_PREDICTION_MODE left_block_mode(const MODE_INFO *cur_mb, int b) {
     --cur_mb;
 
     if (cur_mb->mbmi.mode <= TM_PRED) {
-      return pred_mode_conv(cur_mb->mbmi.mode);
+      return cur_mb->mbmi.mode;
     } else if (cur_mb->mbmi.mode == I4X4_PRED) {
       return ((cur_mb->bmi + 1 + b)->as_mode.first);
     } else {
@@ -106,7 +106,7 @@ static MB_PREDICTION_MODE above_block_mode(const MODE_INFO *cur_mb,
     cur_mb -= mi_stride;
 
     if (cur_mb->mbmi.mode <= TM_PRED) {
-      return pred_mode_conv(cur_mb->mbmi.mode);
+      return cur_mb->mbmi.mode;
     } else if (cur_mb->mbmi.mode == I4X4_PRED) {
       return ((cur_mb->bmi + 2 + b)->as_mode.first);
     } else {
diff --git a/vp9/common/vp9_modecontext.c b/vp9/common/vp9_modecontext.c
index 697683ab176bd2da23bdd599fee0c0b6e1e4b919..5f084eadcd88d78431426c4cfb4ba2815ef4ab42 100644
--- a/vp9/common/vp9_modecontext.c
+++ b/vp9/common/vp9_modecontext.c
@@ -11,9 +11,9 @@
 
 #include "vp9/common/vp9_entropymode.h"
 
-const vp9_prob vp9_kf_default_bmode_probs[VP9_KF_BINTRAMODES]
-                                         [VP9_KF_BINTRAMODES]
-                                         [VP9_KF_BINTRAMODES-1] = {
+const vp9_prob vp9_kf_default_bmode_probs[VP9_BINTRAMODES]
+                                         [VP9_BINTRAMODES]
+                                         [VP9_BINTRAMODES-1] = {
   {  // Above 0
     { 231,    9,  124,  138,   96,  200,   76,   42,   88, },  // left 0
     { 152,   11,  187,  112,  170,  139,  130,   91,  113, },  // left 1
diff --git a/vp9/common/vp9_onyxc_int.h b/vp9/common/vp9_onyxc_int.h
index 7140ee693217eba733875534608075f60cc78d75..97d4ed6d1628ff2e14d391833a436a6428994f5f 100644
--- a/vp9/common/vp9_onyxc_int.h
+++ b/vp9/common/vp9_onyxc_int.h
@@ -47,7 +47,7 @@ void vp9_initialize_common(void);
 #define MAX_LAG_BUFFERS 25
 
 typedef struct frame_contexts {
-  vp9_prob bmode_prob[VP9_NKF_BINTRAMODES - 1];
+  vp9_prob bmode_prob[VP9_BINTRAMODES - 1];
   vp9_prob ymode_prob[VP9_YMODES - 1]; /* interframe intra mode probs */
   vp9_prob sb_ymode_prob[VP9_I32X32_MODES - 1];
   vp9_prob uv_mode_prob[VP9_YMODES][VP9_UV_MODES - 1];
@@ -55,12 +55,12 @@ typedef struct frame_contexts {
 
   nmv_context nmvc;
   nmv_context pre_nmvc;
-  vp9_prob pre_bmode_prob[VP9_NKF_BINTRAMODES - 1];
+  vp9_prob pre_bmode_prob[VP9_BINTRAMODES - 1];
   vp9_prob pre_ymode_prob[VP9_YMODES - 1]; /* interframe intra mode probs */
   vp9_prob pre_sb_ymode_prob[VP9_I32X32_MODES - 1];
   vp9_prob pre_uv_mode_prob[VP9_YMODES][VP9_UV_MODES - 1];
   vp9_prob pre_partition_prob[NUM_PARTITION_CONTEXTS][PARTITION_TYPES - 1];
-  unsigned int bmode_counts[VP9_NKF_BINTRAMODES];
+  unsigned int bmode_counts[VP9_BINTRAMODES];
   unsigned int ymode_counts[VP9_YMODES];   /* interframe intra mode probs */
   unsigned int sb_ymode_counts[VP9_I32X32_MODES];
   unsigned int uv_mode_counts[VP9_YMODES][VP9_UV_MODES];
@@ -218,9 +218,9 @@ typedef struct VP9Common {
 
   /* keyframe block modes are predicted by their above, left neighbors */
 
-  vp9_prob kf_bmode_prob[VP9_KF_BINTRAMODES]
-                        [VP9_KF_BINTRAMODES]
-                        [VP9_KF_BINTRAMODES - 1];
+  vp9_prob kf_bmode_prob[VP9_BINTRAMODES]
+                        [VP9_BINTRAMODES]
+                        [VP9_BINTRAMODES - 1];
   vp9_prob kf_ymode_prob[8][VP9_YMODES - 1]; /* keyframe "" */
   vp9_prob sb_kf_ymode_prob[8][VP9_I32X32_MODES - 1];
   int kf_ymode_probs_index;
diff --git a/vp9/common/vp9_postproc.c b/vp9/common/vp9_postproc.c
index d2c52edfd17c684a27bbe75af4daf58f7ce505a6..3aae669bf9bbc51ccfbddf0d6abb2bf84ce2d601 100644
--- a/vp9/common/vp9_postproc.c
+++ b/vp9/common/vp9_postproc.c
@@ -53,7 +53,7 @@ static const unsigned char MB_PREDICTION_MODE_colors[MB_MODE_COUNT][3] = {
   { RGB_TO_YUV(0xCC33FF) },   /* Magenta */
 };
 
-static const unsigned char B_PREDICTION_MODE_colors[B_MODE_COUNT][3] = {
+static const unsigned char B_PREDICTION_MODE_colors[INTRA_MODE_COUNT][3] = {
   { RGB_TO_YUV(0x6633ff) },   /* Purple */
   { RGB_TO_YUV(0xcc33ff) },   /* Magenta */
   { RGB_TO_YUV(0xff33cc) },   /* Pink */
diff --git a/vp9/common/vp9_reconintra.h b/vp9/common/vp9_reconintra.h
index b88761b023fd9387f6b3bd353a38eb1dd940bdab..f5f5f42c4d432efe4a5064735a30b4feea586f39 100644
--- a/vp9/common/vp9_reconintra.h
+++ b/vp9/common/vp9_reconintra.h
@@ -14,12 +14,12 @@
 #include "vpx/vpx_integer.h"
 #include "vp9/common/vp9_blockd.h"
 
-B_PREDICTION_MODE vp9_find_dominant_direction(uint8_t *ptr,
-                                              int stride, int n,
-                                              int tx, int ty);
+MB_PREDICTION_MODE vp9_find_dominant_direction(uint8_t *ptr,
+                                               int stride, int n,
+                                               int tx, int ty);
 
-B_PREDICTION_MODE vp9_find_bpred_context(MACROBLOCKD *xd, int block,
-                                         uint8_t *ptr, int stride);
+MB_PREDICTION_MODE vp9_find_bpred_context(MACROBLOCKD *xd, int block,
+                                          uint8_t *ptr, int stride);
 
 void vp9_predict_intra_block(MACROBLOCKD *xd,
                             int block_idx,
diff --git a/vp9/decoder/vp9_decodemv.c b/vp9/decoder/vp9_decodemv.c
index 2bf30866970bdff36a0ad2afb7528f5ad55a84a1..d9c8d8d440147acf845cb0bb76e7f2d74c72c1a3 100644
--- a/vp9/decoder/vp9_decodemv.c
+++ b/vp9/decoder/vp9_decodemv.c
@@ -35,13 +35,13 @@ int dec_mvcount = 0;
 extern int dec_debug;
 #endif
 
-static B_PREDICTION_MODE read_bmode(vp9_reader *r, const vp9_prob *p) {
-  B_PREDICTION_MODE m = treed_read(r, vp9_bmode_tree, p);
+static MB_PREDICTION_MODE read_bmode(vp9_reader *r, const vp9_prob *p) {
+  MB_PREDICTION_MODE m = treed_read(r, vp9_bmode_tree, p);
   return m;
 }
 
-static B_PREDICTION_MODE read_kf_bmode(vp9_reader *r, const vp9_prob *p) {
-  return (B_PREDICTION_MODE)treed_read(r, vp9_kf_bmode_tree, p);
+static MB_PREDICTION_MODE read_kf_bmode(vp9_reader *r, const vp9_prob *p) {
+  return (MB_PREDICTION_MODE)treed_read(r, vp9_bmode_tree, p);
 }
 
 static MB_PREDICTION_MODE read_ymode(vp9_reader *r, const vp9_prob *p) {
diff --git a/vp9/encoder/vp9_bitstream.c b/vp9/encoder/vp9_bitstream.c
index 49b2d29eca7023c75c824b5032fd7a2da3777ddd..7e6b44a5449288a6f05c592e0223b7ba15ec70e3 100644
--- a/vp9/encoder/vp9_bitstream.c
+++ b/vp9/encoder/vp9_bitstream.c
@@ -370,7 +370,7 @@ static void write_uv_mode(vp9_writer *bc, int m, const vp9_prob *p) {
 }
 
 static void write_kf_bmode(vp9_writer *bc, int m, const vp9_prob *p) {
-  write_token(bc, vp9_kf_bmode_tree, p, vp9_kf_bmode_encodings + m);
+  write_token(bc, vp9_bmode_tree, p, vp9_kf_bmode_encodings + m);
 }
 
 static int prob_update_savings(const unsigned int *ct,
@@ -843,8 +843,8 @@ static void write_mb_modes_kf(const VP9_COMP *cpi,
   }
 
   if (m->mbmi.sb_type >= BLOCK_SIZE_SB8X8) {
-    const B_PREDICTION_MODE A = above_block_mode(m, 0, mis);
-    const B_PREDICTION_MODE L = xd->left_available ?
+    const MB_PREDICTION_MODE A = above_block_mode(m, 0, mis);
+    const MB_PREDICTION_MODE L = xd->left_available ?
                                  left_block_mode(m, 0) : DC_PRED;
     write_kf_bmode(bc, ym, c->kf_bmode_prob[A][L]);
   }
@@ -856,8 +856,8 @@ static void write_mb_modes_kf(const VP9_COMP *cpi,
     for (idy = 0; idy < 2; idy += bh) {
       for (idx = 0; idx < 2; idx += bw) {
         int i = idy * 2 + idx;
-        const B_PREDICTION_MODE A = above_block_mode(m, i, mis);
-        const B_PREDICTION_MODE L = (xd->left_available || idx) ?
+        const MB_PREDICTION_MODE A = above_block_mode(m, i, mis);
+        const MB_PREDICTION_MODE L = (xd->left_available || idx) ?
                                      left_block_mode(m, i) : DC_PRED;
         write_kf_bmode(bc, m->bmi[i].as_mode.first,
                        c->kf_bmode_prob[A][L]);
diff --git a/vp9/encoder/vp9_block.h b/vp9/encoder/vp9_block.h
index b007c658bfb228653f60b470c3d6199a3c3184f0..211eca4b4a760c64b1d77f20bf1261f073eb6dab 100644
--- a/vp9/encoder/vp9_block.h
+++ b/vp9/encoder/vp9_block.h
@@ -116,8 +116,8 @@ struct macroblock {
 
   int mbmode_cost[2][MB_MODE_COUNT];
   int intra_uv_mode_cost[2][MB_MODE_COUNT];
-  int bmode_costs[VP9_KF_BINTRAMODES][VP9_KF_BINTRAMODES][VP9_KF_BINTRAMODES];
-  int inter_bmode_costs[B_MODE_COUNT];
+  int bmode_costs[VP9_BINTRAMODES][VP9_BINTRAMODES][VP9_BINTRAMODES];
+  int inter_bmode_costs[INTRA_MODE_COUNT];
   int switchable_interp_costs[VP9_SWITCHABLE_FILTERS + 1]
                              [VP9_SWITCHABLE_FILTERS];
 
diff --git a/vp9/encoder/vp9_encodeintra.c b/vp9/encoder/vp9_encodeintra.c
index cd67cc4e1feebd2941b221b6aa7c4de5f0c94292..5d7c244f12e2cacdaf95c0e8d92e644611805086 100644
--- a/vp9/encoder/vp9_encodeintra.c
+++ b/vp9/encoder/vp9_encodeintra.c
@@ -31,8 +31,9 @@ int vp9_encode_intra(VP9_COMP *cpi, MACROBLOCK *x, int use_16x16_pred) {
   } else {
     int i;
 
-    for (i = 0; i < 16; i++)
+    for (i = 0; i < 16; i++) {
       encode_intra4x4block(x, i, BLOCK_SIZE_MB16X16);
+    }
   }
 
   return vp9_get_mb_ss(x->plane[0].src_diff);
diff --git a/vp9/encoder/vp9_encodemb.c b/vp9/encoder/vp9_encodemb.c
index 3f2061c643af6d71009b650a30d6787f12915d43..b7f60b1272992b87b0a09386bd94f606d7e94c0a 100644
--- a/vp9/encoder/vp9_encodemb.c
+++ b/vp9/encoder/vp9_encodemb.c
@@ -641,7 +641,7 @@ static void encode_block_intra(int plane, int block, BLOCK_SIZE_TYPE bsize,
   else
     b_mode = mode;
 
-  assert(b_mode >= B_DC_PRED && b_mode <= B_TM_PRED);
+  assert(b_mode >= DC_PRED && b_mode <= TM_PRED);
 
   plane_b_size = b_width_log2(bsize) - xd->plane[plane].subsampling_x;
   vp9_predict_intra_block(xd, tx_ib, plane_b_size, tx_size, b_mode,
diff --git a/vp9/encoder/vp9_modecosts.c b/vp9/encoder/vp9_modecosts.c
index c4b42d6763d59d5af0d736ddc1451ac6128d68ae..171b44bf9283562544d3d18919a32943a38f784b 100644
--- a/vp9/encoder/vp9_modecosts.c
+++ b/vp9/encoder/vp9_modecosts.c
@@ -18,11 +18,11 @@
 void vp9_init_mode_costs(VP9_COMP *c) {
   VP9_COMMON *x = &c->common;
   const vp9_tree_p T = vp9_bmode_tree;
-  const vp9_tree_p KT = vp9_kf_bmode_tree;
+  const vp9_tree_p KT = vp9_bmode_tree;
   int i, j;
 
-  for (i = 0; i < VP9_KF_BINTRAMODES; i++) {
-    for (j = 0; j < VP9_KF_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], KT);
     }
diff --git a/vp9/encoder/vp9_onyx_int.h b/vp9/encoder/vp9_onyx_int.h
index cb0e5daf510158729d71a2ddddbb05f9e6fdd72a..15f9571bb65b2a949aee01cf462c63722ccedbc8 100644
--- a/vp9/encoder/vp9_onyx_int.h
+++ b/vp9/encoder/vp9_onyx_int.h
@@ -84,7 +84,7 @@ typedef struct {
   vp9_prob sb_ymode_prob[VP9_I32X32_MODES - 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_NKF_BINTRAMODES - 1];
+  vp9_prob bmode_prob[VP9_BINTRAMODES - 1];
   vp9_prob partition_prob[NUM_PARTITION_CONTEXTS][PARTITION_TYPES - 1];
 
   vp9_prob switchable_interp_prob[VP9_SWITCHABLE_FILTERS + 1]
@@ -415,7 +415,7 @@ typedef struct VP9_COMP {
 
   int sb_ymode_count [VP9_I32X32_MODES];
   int ymode_count[VP9_YMODES];        /* intra MB type cts this frame */
-  int bmode_count[VP9_NKF_BINTRAMODES];
+  int bmode_count[VP9_BINTRAMODES];
   int y_uv_mode_count[VP9_YMODES][VP9_UV_MODES];
   unsigned int partition_count[NUM_PARTITION_CONTEXTS][PARTITION_TYPES];
 
diff --git a/vp9/encoder/vp9_rdopt.c b/vp9/encoder/vp9_rdopt.c
index 4134818ad10421601e6e2f5a501c8ece4461b582..9fd94c439d70e8138158f809f15e05636a7ec746 100644
--- a/vp9/encoder/vp9_rdopt.c
+++ b/vp9/encoder/vp9_rdopt.c
@@ -576,7 +576,7 @@ static void super_block_yrd(VP9_COMP *cpi,
 }
 
 static int64_t rd_pick_intra4x4block(VP9_COMP *cpi, MACROBLOCK *x, int ib,
-                                     B_PREDICTION_MODE *best_mode,
+                                     MB_PREDICTION_MODE *best_mode,
                                      int *bmode_costs,
                                      ENTROPY_CONTEXT *a, ENTROPY_CONTEXT *l,
                                      int *bestrate, int *bestratey,
@@ -737,7 +737,7 @@ static int64_t rd_pick_intra4x4mby_modes(VP9_COMP *cpi, MACROBLOCK *mb,
     for (idx = 0; idx < 2; idx += bw) {
       MODE_INFO *const mic = xd->mode_info_context;
       const int mis = xd->mode_info_stride;
-      B_PREDICTION_MODE UNINITIALIZED_IS_SAFE(best_mode);
+      MB_PREDICTION_MODE UNINITIALIZED_IS_SAFE(best_mode);
       int UNINITIALIZED_IS_SAFE(r), UNINITIALIZED_IS_SAFE(ry);
       int UNINITIALIZED_IS_SAFE(d);
       i = idy * 2 + idx;
@@ -940,7 +940,7 @@ void vp9_set_mbmode_and_mvs(MACROBLOCK *x, MB_PREDICTION_MODE mb, int_mv *mv) {
 
 static int labels2mode(MACROBLOCK *x,
                        int const *labelings, int which_label,
-                       B_PREDICTION_MODE this_mode,
+                       MB_PREDICTION_MODE this_mode,
                        int_mv *this_mv, int_mv *this_second_mv,
                        int_mv frame_mv[MB_MODE_COUNT][MAX_REF_FRAMES],
                        int_mv seg_mvs[MAX_REF_FRAMES - 1],
@@ -1129,7 +1129,7 @@ typedef struct {
   int r;
   int d;
   int segment_yrate;
-  B_PREDICTION_MODE modes[4];
+  MB_PREDICTION_MODE modes[4];
   int_mv mvs[4], second_mvs[4];
   int eobs[4];
   int mvthresh;