diff --git a/vp9/decoder/vp9_decodframe.c b/vp9/decoder/vp9_decodframe.c
index bb612d12e2f040d74ad4c70acc866f1a0af90166..f8ef6c03093e70c2dbd36c2bc17a8828a519bf8b 100644
--- a/vp9/decoder/vp9_decodframe.c
+++ b/vp9/decoder/vp9_decodframe.c
@@ -86,31 +86,31 @@ static int inv_recenter_nonneg(int v, int m) {
     return m - ((v + 1) >> 1);
 }
 
-static int decode_uniform(BOOL_DECODER *br, int n) {
+static int decode_uniform(vp9_reader *r, int n) {
   int v;
   const int l = get_unsigned_bits(n);
   const int m = (1 << l) - n;
   if (!l)
     return 0;
 
-  v = vp9_read_literal(br, l - 1);
-  return v < m ?  v : (v << 1) - m + vp9_read_bit(br);
+  v = vp9_read_literal(r, l - 1);
+  return v < m ?  v : (v << 1) - m + vp9_read_bit(r);
 }
 
-static int decode_term_subexp(BOOL_DECODER *br, int k, int num_syms) {
+static int decode_term_subexp(vp9_reader *r, int k, int num_syms) {
   int i = 0, mk = 0, word;
   while (1) {
     const int b = i ? k + i - 1 : k;
     const int a = 1 << b;
     if (num_syms <= mk + 3 * a) {
-      word = decode_uniform(br, num_syms - mk) + mk;
+      word = decode_uniform(r, num_syms - mk) + mk;
       break;
     } else {
-      if (vp9_read_bit(br)) {
+      if (vp9_read_bit(r)) {
         i++;
         mk += a;
       } else {
-        word = vp9_read_literal(br, b) + mk;
+        word = vp9_read_literal(r, b) + mk;
         break;
       }
     }
@@ -118,11 +118,11 @@ static int decode_term_subexp(BOOL_DECODER *br, int k, int num_syms) {
   return word;
 }
 
-static int decode_unsigned_max(BOOL_DECODER *br, int max) {
+static int decode_unsigned_max(vp9_reader *r, int max) {
   int data = 0, bit = 0, lmax = max;
 
   while (lmax) {
-    data |= vp9_read_bit(br) << bit++;
+    data |= vp9_read_bit(r) << bit++;
     lmax >>= 1;
   }
   return data > max ? max : data;
@@ -154,8 +154,8 @@ static int inv_remap_prob(int v, int m) {
   }
 }
 
-static vp9_prob read_prob_diff_update(vp9_reader *const bc, int oldp) {
-  int delp = decode_term_subexp(bc, SUBEXP_PARAM, 255);
+static vp9_prob read_prob_diff_update(vp9_reader *r, int oldp) {
+  int delp = decode_term_subexp(r, SUBEXP_PARAM, 255);
   return (vp9_prob)inv_remap_prob(delp, oldp);
 }
 
@@ -246,8 +246,7 @@ static void propagate_nzcs(VP9_COMMON *cm, MACROBLOCKD *xd) {
 }
 #endif
 
-static void decode_16x16(VP9D_COMP *pbi, MACROBLOCKD *xd,
-                         BOOL_DECODER* const bc) {
+static void decode_16x16(MACROBLOCKD *xd) {
   const TX_TYPE tx_type = get_tx_type_16x16(xd, 0);
 
   vp9_dequant_iht_add_16x16_c(tx_type, xd->plane[0].qcoeff,
@@ -263,8 +262,7 @@ static void decode_16x16(VP9D_COMP *pbi, MACROBLOCKD *xd,
                            xd->plane[2].eobs[0]);
 }
 
-static void decode_8x8(VP9D_COMP *pbi, MACROBLOCKD *xd,
-                       BOOL_DECODER* const bc) {
+static void decode_8x8(MACROBLOCKD *xd) {
   const MB_PREDICTION_MODE mode = xd->mode_info_context->mbmi.mode;
   // luma
   // if the first one is DCT_DCT assume all the rest are as well
@@ -347,8 +345,7 @@ static INLINE void dequant_add_y(MACROBLOCKD *xd, TX_TYPE tx_type, int idx) {
 }
 
 
-static void decode_4x4(VP9D_COMP *pbi, MACROBLOCKD *xd,
-                       BOOL_DECODER* const bc) {
+static void decode_4x4(VP9D_COMP *pbi, MACROBLOCKD *xd, vp9_reader *r) {
   TX_TYPE tx_type;
   int i = 0;
   const MB_PREDICTION_MODE mode = xd->mode_info_context->mbmi.mode;
@@ -386,7 +383,7 @@ static void decode_4x4(VP9D_COMP *pbi, MACROBLOCKD *xd,
       xd->mode_info_context->bmi[i].as_mode.context = b->bmi.as_mode.context =
           vp9_find_bpred_context(xd, b);
       if (!xd->mode_info_context->mbmi.mb_skip_coeff)
-        vp9_decode_coefs_4x4(pbi, xd, bc, PLANE_TYPE_Y_WITH_DC, i);
+        vp9_decode_coefs_4x4(pbi, xd, r, PLANE_TYPE_Y_WITH_DC, i);
 #endif
       vp9_intra4x4_predict(xd, b, b_mode, *(b->base_dst) + b->dst,
                            b->dst_stride);
@@ -395,7 +392,7 @@ static void decode_4x4(VP9D_COMP *pbi, MACROBLOCKD *xd,
     }
 #if CONFIG_NEWBINTRAMODES
     if (!xd->mode_info_context->mbmi.mb_skip_coeff)
-      vp9_decode_mb_tokens_4x4_uv(pbi, xd, bc);
+      vp9_decode_mb_tokens_4x4_uv(pbi, xd, r);
 #endif
     vp9_build_intra_predictors_sbuv_s(xd, BLOCK_SIZE_MB16X16);
     xd->itxm_add_uv_block(xd->plane[1].qcoeff, xd->block[16].dequant,
@@ -612,7 +609,7 @@ static void decode_sb_16x16(MACROBLOCKD *mb, BLOCK_SIZE_TYPE bsize) {
 }
 
 static void decode_sb(VP9D_COMP *pbi, MACROBLOCKD *xd, int mb_row, int mb_col,
-                      BOOL_DECODER* const bc, BLOCK_SIZE_TYPE bsize) {
+                      vp9_reader *r, BLOCK_SIZE_TYPE bsize) {
   const int bwl = mb_width_log2(bsize), bhl = mb_height_log2(bsize);
   const int bw = 1 << bwl, bh = 1 << bhl;
   int n, eobtotal;
@@ -644,7 +641,7 @@ static void decode_sb(VP9D_COMP *pbi, MACROBLOCKD *xd, int mb_row, int mb_col,
       mb_init_dequantizer(pbi, xd);
 
     // dequantization and idct
-    eobtotal = vp9_decode_tokens(pbi, xd, bc, bsize);
+    eobtotal = vp9_decode_tokens(pbi, xd, r, bsize);
     if (eobtotal == 0) {  // skip loopfilter
       for (n = 0; n < bw * bh; n++) {
         const int x_idx = n & (bw - 1), y_idx = n >> bwl;
@@ -682,7 +679,7 @@ static void decode_sb(VP9D_COMP *pbi, MACROBLOCKD *xd, int mb_row, int mb_col,
 // couples special handles on I8x8, B_PRED, and splitmv modes.
 static void decode_mb(VP9D_COMP *pbi, MACROBLOCKD *xd,
                      int mb_row, int mb_col,
-                     BOOL_DECODER* const bc) {
+                     vp9_reader *r) {
   int eobtotal = 0;
   const MB_PREDICTION_MODE mode = xd->mode_info_context->mbmi.mode;
   const int tx_size = xd->mode_info_context->mbmi.txfm_size;
@@ -718,11 +715,11 @@ static void decode_mb(VP9D_COMP *pbi, MACROBLOCKD *xd,
     if (xd->segmentation_enabled)
       mb_init_dequantizer(pbi, xd);
 
-    if (!bool_error(bc)) {
+    if (!bool_error(r)) {
 #if CONFIG_NEWBINTRAMODES
     if (mode != I4X4_PRED)
 #endif
-      eobtotal = vp9_decode_tokens(pbi, xd, bc, BLOCK_SIZE_MB16X16);
+      eobtotal = vp9_decode_tokens(pbi, xd, r, BLOCK_SIZE_MB16X16);
     }
   }
 
@@ -730,7 +727,7 @@ static void decode_mb(VP9D_COMP *pbi, MACROBLOCKD *xd,
       mode != I4X4_PRED &&
       mode != SPLITMV &&
       mode != I8X8_PRED &&
-      !bool_error(bc)) {
+      !bool_error(r)) {
     xd->mode_info_context->mbmi.mb_skip_coeff = 1;
   } else {
 #if 0  // def DEC_DEBUG
@@ -739,11 +736,11 @@ static void decode_mb(VP9D_COMP *pbi, MACROBLOCKD *xd,
 #endif
 
     if (tx_size == TX_16X16) {
-      decode_16x16(pbi, xd, bc);
+      decode_16x16(xd);
     } else if (tx_size == TX_8X8) {
-      decode_8x8(pbi, xd, bc);
+      decode_8x8(xd);
     } else {
-      decode_4x4(pbi, xd, bc);
+      decode_4x4(pbi, xd, r);
     }
   }
 
@@ -988,7 +985,7 @@ static void init_frame(VP9D_COMP *pbi) {
 
 #if CONFIG_CODE_NONZEROCOUNT
 static void read_nzc_probs_common(VP9_COMMON *cm,
-                                  BOOL_DECODER* const bc,
+                                  vp9_reader *rd,
                                   TX_SIZE tx_size) {
   int c, r, b, t;
   int tokens, nodes;
@@ -996,7 +993,7 @@ static void read_nzc_probs_common(VP9_COMMON *cm,
   vp9_prob upd;
 
   if (!get_nzc_used(tx_size)) return;
-  if (!vp9_read_bit(bc)) return;
+  if (!vp9_read_bit(rd)) return;
 
   if (tx_size == TX_32X32) {
     tokens = NZC32X32_TOKENS;
@@ -1023,8 +1020,8 @@ static void read_nzc_probs_common(VP9_COMMON *cm,
         int offset_nodes = offset * nodes;
         for (t = 0; t < nodes; ++t) {
           vp9_prob *p = &nzc_probs[offset_nodes + t];
-          if (vp9_read(bc, upd)) {
-            *p = read_prob_diff_update(bc, *p);
+          if (vp9_read(rd, upd)) {
+            *p = read_prob_diff_update(rd, *p);
           }
         }
       }
@@ -1032,13 +1029,13 @@ static void read_nzc_probs_common(VP9_COMMON *cm,
   }
 }
 
-static void read_nzc_pcat_probs(VP9_COMMON *cm, BOOL_DECODER* const bc) {
+static void read_nzc_pcat_probs(VP9_COMMON *cm, vp9_reader *r) {
   int c, t, b;
   vp9_prob upd = NZC_UPDATE_PROB_PCAT;
   if (!(get_nzc_used(TX_4X4) || get_nzc_used(TX_8X8) ||
         get_nzc_used(TX_16X16) || get_nzc_used(TX_32X32)))
     return;
-  if (!vp9_read_bit(bc)) {
+  if (!vp9_read_bit(r)) {
     return;
   }
   for (c = 0; c < MAX_NZC_CONTEXTS; ++c) {
@@ -1046,31 +1043,30 @@ static void read_nzc_pcat_probs(VP9_COMMON *cm, BOOL_DECODER* const bc) {
       int bits = vp9_extranzcbits[t + NZC_TOKENS_NOEXTRA];
       for (b = 0; b < bits; ++b) {
         vp9_prob *p = &cm->fc.nzc_pcat_probs[c][t][b];
-        if (vp9_read(bc, upd)) {
-          *p = read_prob_diff_update(bc, *p);
+        if (vp9_read(r, upd)) {
+          *p = read_prob_diff_update(r, *p);
         }
       }
     }
   }
 }
 
-static void read_nzc_probs(VP9_COMMON *cm,
-                           BOOL_DECODER* const bc) {
-  read_nzc_probs_common(cm, bc, TX_4X4);
+static void read_nzc_probs(VP9_COMMON *cm, vp9_reader *r) {
+  read_nzc_probs_common(cm, r, TX_4X4);
   if (cm->txfm_mode != ONLY_4X4)
-    read_nzc_probs_common(cm, bc, TX_8X8);
+    read_nzc_probs_common(cm, r, TX_8X8);
   if (cm->txfm_mode > ALLOW_8X8)
-    read_nzc_probs_common(cm, bc, TX_16X16);
+    read_nzc_probs_common(cm, r, TX_16X16);
   if (cm->txfm_mode > ALLOW_16X16)
-    read_nzc_probs_common(cm, bc, TX_32X32);
+    read_nzc_probs_common(cm, r, TX_32X32);
 #ifdef NZC_PCAT_UPDATE
-  read_nzc_pcat_probs(cm, bc);
+  read_nzc_pcat_probs(cm, r);
 #endif
 }
 #endif  // CONFIG_CODE_NONZEROCOUNT
 
 static void read_coef_probs_common(VP9D_COMP *pbi,
-                                   BOOL_DECODER* const bc,
+                                   vp9_reader *r,
                                    vp9_coeff_probs *coef_probs,
                                    TX_SIZE tx_size) {
 #if CONFIG_MODELCOEFPROB && MODEL_BASED_UPDATE
@@ -1081,7 +1077,7 @@ static void read_coef_probs_common(VP9D_COMP *pbi,
 
   int i, j, k, l, m;
 
-  if (vp9_read_bit(bc)) {
+  if (vp9_read_bit(r)) {
     for (i = 0; i < BLOCK_TYPES; i++) {
       for (j = 0; j < REF_TYPES; j++) {
         for (k = 0; k < COEF_BANDS; k++) {
@@ -1097,8 +1093,8 @@ static void read_coef_probs_common(VP9D_COMP *pbi,
             for (m = mstart; m < entropy_nodes_update; m++) {
               vp9_prob *const p = coef_probs[i][j][k][l] + m;
 
-              if (vp9_read(bc, vp9_coef_update_prob[m])) {
-                *p = read_prob_diff_update(bc, *p);
+              if (vp9_read(r, vp9_coef_update_prob[m])) {
+                *p = read_prob_diff_update(r, *p);
 #if CONFIG_MODELCOEFPROB && MODEL_BASED_UPDATE
                 if (m == UNCONSTRAINED_NODES - 1)
                   vp9_get_model_distribution(*p, coef_probs[i][j][k][l], i, j);
@@ -1112,19 +1108,20 @@ static void read_coef_probs_common(VP9D_COMP *pbi,
   }
 }
 
-static void read_coef_probs(VP9D_COMP *pbi, BOOL_DECODER* const bc) {
-  VP9_COMMON *const pc = &pbi->common;
+static void read_coef_probs(VP9D_COMP *pbi, vp9_reader *r) {
+  const TXFM_MODE mode = pbi->common.txfm_mode;
+  FRAME_CONTEXT *const fc = &pbi->common.fc;
 
-  read_coef_probs_common(pbi, bc, pc->fc.coef_probs_4x4, TX_4X4);
+  read_coef_probs_common(pbi, r, fc->coef_probs_4x4, TX_4X4);
 
-  if (pbi->common.txfm_mode != ONLY_4X4)
-    read_coef_probs_common(pbi, bc, pc->fc.coef_probs_8x8, TX_8X8);
+  if (mode != ONLY_4X4)
+    read_coef_probs_common(pbi, r, fc->coef_probs_8x8, TX_8X8);
 
-  if (pbi->common.txfm_mode > ALLOW_8X8)
-    read_coef_probs_common(pbi, bc, pc->fc.coef_probs_16x16, TX_16X16);
+  if (mode > ALLOW_8X8)
+    read_coef_probs_common(pbi, r, fc->coef_probs_16x16, TX_16X16);
 
-  if (pbi->common.txfm_mode > ALLOW_16X16)
-    read_coef_probs_common(pbi, bc, pc->fc.coef_probs_32x32, TX_32X32);
+  if (mode > ALLOW_16X16)
+    read_coef_probs_common(pbi, r, fc->coef_probs_32x32, TX_32X32);
 }
 
 static void update_frame_size(VP9D_COMP *pbi) {
@@ -1343,7 +1340,7 @@ static const uint8_t *setup_frame_size(VP9D_COMP *pbi, int scaling_active,
   return data;
 }
 
-static void update_frame_context(VP9D_COMP *pbi, vp9_reader *r) {
+static void update_frame_context(VP9D_COMP *pbi) {
   FRAME_CONTEXT *const fc = &pbi->common.fc;
 
   vp9_copy(fc->pre_coef_probs_4x4, fc->coef_probs_4x4);
@@ -1394,16 +1391,11 @@ static void update_frame_context(VP9D_COMP *pbi, vp9_reader *r) {
   vp9_zero(fc->nzc_counts_32x32);
   vp9_zero(fc->nzc_pcat_counts);
 #endif
-
-  read_coef_probs(pbi, r);
-#if CONFIG_CODE_NONZEROCOUNT
-  read_nzc_probs(&pbi->common, r);
-#endif
 }
 
 static void decode_tiles(VP9D_COMP *pbi,
                          const uint8_t *data, int first_partition_size,
-                         BOOL_DECODER *header_bc, BOOL_DECODER *residual_bc) {
+                         vp9_reader *header_bc, vp9_reader *residual_bc) {
   VP9_COMMON *const pc = &pbi->common;
 
   const uint8_t *data_ptr = data + first_partition_size;
@@ -1429,7 +1421,7 @@ static void decode_tiles(VP9D_COMP *pbi,
   if (pbi->oxcf.inv_tile_order) {
     const int n_cols = pc->tile_columns;
     const uint8_t *data_ptr2[4][1 << 6];
-    BOOL_DECODER UNINITIALIZED_IS_SAFE(bc_bak);
+    vp9_reader UNINITIALIZED_IS_SAFE(bc_bak);
 
     // pre-initialize the offsets, we're going to read in inverse order
     data_ptr2[0][0] = data_ptr;
@@ -1483,7 +1475,7 @@ static void decode_tiles(VP9D_COMP *pbi,
 }
 
 int vp9_decode_frame(VP9D_COMP *pbi, const uint8_t **p_data_end) {
-  BOOL_DECODER header_bc, residual_bc;
+  vp9_reader header_bc, residual_bc;
   VP9_COMMON *const pc = &pbi->common;
   MACROBLOCKD *const xd  = &pbi->mb;
   const uint8_t *data = pbi->source;
@@ -1649,7 +1641,12 @@ int vp9_decode_frame(VP9D_COMP *pbi, const uint8_t **p_data_end) {
     fclose(z);
   }
 
-  update_frame_context(pbi, &header_bc);
+  update_frame_context(pbi);
+
+  read_coef_probs(pbi, &header_bc);
+#if CONFIG_CODE_NONZEROCOUNT
+  read_nzc_probs(&pbi->common, &header_bc);
+#endif
 
   // Initialize xd pointers. Any reference should do for xd->pre, so use 0.
   vpx_memcpy(&xd->pre, &pc->yv12_fb[pc->active_ref_idx[0]],