Remove the mb_no_coeff_skip flag
authorJohn Koleszar <jkoleszar@google.com>
Tue, 9 Apr 2013 17:54:19 +0000 (10:54 -0700)
committerJohn Koleszar <jkoleszar@google.com>
Tue, 16 Apr 2013 19:36:16 +0000 (12:36 -0700)
This flag was added to VP8 to allow a mode where MB-level skipping
was not allowed, saving a bit per mb. It was never used in practice,
and hasn't been tested in VP9, so remove it.

Change-Id: Id450ec6904c6d06c1919508e7efc52d05cde5631

vp9/common/vp9_alloccommon.c
vp9/common/vp9_onyxc_int.h
vp9/decoder/vp9_decodemv.c
vp9/decoder/vp9_decodframe.c
vp9/encoder/vp9_bitstream.c
vp9/encoder/vp9_encodeframe.c
vp9/encoder/vp9_onyx_if.c
vp9/encoder/vp9_rdopt.c
vp9/encoder/vp9_tokenize.c

index 48f9be1..0628a88 100644 (file)
@@ -179,7 +179,6 @@ void vp9_create_common(VP9_COMMON *oci) {
   vp9_default_bmode_probs(oci->fc.bmode_prob);
 
   oci->txfm_mode = ONLY_4X4;
-  oci->mb_no_coeff_skip = 1;
   oci->comp_pred_mode = HYBRID_PREDICTION;
   oci->no_lpf = 0;
   oci->filter_type = NORMAL_LOOPFILTER;
index c7ca67e..71a4303 100644 (file)
@@ -220,7 +220,6 @@ typedef struct VP9Common {
 
   /* profile settings */
   int experimental;
-  int mb_no_coeff_skip;
   TXFM_MODE txfm_mode;
   COMPPREDMODE_TYPE comp_pred_mode;
   int no_lpf;
index 8298bd9..109eff8 100644 (file)
@@ -153,15 +153,11 @@ static void kfread_modes(VP9D_COMP *pbi,
     }
   }
 
-  m->mbmi.mb_skip_coeff = 0;
-  if (pbi->common.mb_no_coeff_skip &&
-      (!vp9_segfeature_active(&pbi->mb, m->mbmi.segment_id, SEG_LVL_SKIP))) {
+  m->mbmi.mb_skip_coeff = vp9_segfeature_active(&pbi->mb, m->mbmi.segment_id,
+                                                SEG_LVL_SKIP);
+  if (!m->mbmi.mb_skip_coeff)
     m->mbmi.mb_skip_coeff = vp9_read(bc, vp9_get_pred_prob(cm, &pbi->mb,
                                                            PRED_MBSKIP));
-  } else {
-    m->mbmi.mb_skip_coeff = vp9_segfeature_active(&pbi->mb, m->mbmi.segment_id,
-                                                  SEG_LVL_SKIP);
-  }
 
   y_mode = m->mbmi.sb_type ?
       read_kf_sb_ymode(bc,
@@ -693,15 +689,10 @@ static void read_mb_modes_mv(VP9D_COMP *pbi, MODE_INFO *mi, MB_MODE_INFO *mbmi,
   // Read the macroblock segment id.
   read_mb_segment_id(pbi, mb_row, mb_col, bc);
 
-  if (pbi->common.mb_no_coeff_skip &&
-      (!vp9_segfeature_active(xd, mbmi->segment_id, SEG_LVL_SKIP))) {
-    // Read the macroblock coeff skip flag if this feature is in use,
-    // else default to 0
+  mbmi->mb_skip_coeff = vp9_segfeature_active(xd, mbmi->segment_id,
+                                              SEG_LVL_SKIP);
+  if (!mbmi->mb_skip_coeff)
     mbmi->mb_skip_coeff = vp9_read(bc, vp9_get_pred_prob(cm, xd, PRED_MBSKIP));
-  } else {
-    mbmi->mb_skip_coeff = vp9_segfeature_active(xd, mbmi->segment_id,
-                                                SEG_LVL_SKIP);
-  }
 
   // Read the reference frame
   mbmi->ref_frame = read_ref_frame(pbi, bc, mbmi->segment_id);
@@ -1119,13 +1110,12 @@ static void read_mb_modes_mv(VP9D_COMP *pbi, MODE_INFO *mi, MB_MODE_INFO *mbmi,
 
 void vp9_decode_mode_mvs_init(VP9D_COMP* const pbi, vp9_reader *r) {
   VP9_COMMON *cm = &pbi->common;
+  int k;
 
+  // TODO(jkoleszar): does this clear more than MBSKIP_CONTEXTS? Maybe remove.
   vpx_memset(cm->mbskip_pred_probs, 0, sizeof(cm->mbskip_pred_probs));
-  if (pbi->common.mb_no_coeff_skip) {
-    int k;
-    for (k = 0; k < MBSKIP_CONTEXTS; ++k)
-      cm->mbskip_pred_probs[k] = vp9_read_prob(r);
-  }
+  for (k = 0; k < MBSKIP_CONTEXTS; ++k)
+    cm->mbskip_pred_probs[k] = vp9_read_prob(r);
 
   mb_mode_mv_init(pbi, r);
 }
index 503e005..71854a7 100644 (file)
@@ -1675,8 +1675,7 @@ int vp9_decode_frame(VP9D_COMP *pbi, const uint8_t **p_data_end) {
   vpx_memset(xd->plane[1].qcoeff, 0, sizeof(xd->plane[1].qcoeff));
   vpx_memset(xd->plane[2].qcoeff, 0, sizeof(xd->plane[2].qcoeff));
 
-  // Read the mb_no_coeff_skip flag
-  pc->mb_no_coeff_skip = vp9_read_bit(&header_bc);
+  vp9_read_bit(&header_bc);  // unused
 
   vp9_decode_mode_mvs_init(pbi, &header_bc);
 
index c2ae957..406bfd2 100644 (file)
@@ -801,9 +801,7 @@ static void pack_inter_mode_mvs(VP9_COMP *cpi, MODE_INFO *m,
     }
   }
 
-  if (!pc->mb_no_coeff_skip) {
-    skip_coeff = 0;
-  } else if (vp9_segfeature_active(xd, segment_id, SEG_LVL_SKIP)) {
+  if (vp9_segfeature_active(xd, segment_id, SEG_LVL_SKIP)) {
     skip_coeff = 1;
   } else {
     skip_coeff = m->mbmi.mb_skip_coeff;
@@ -996,8 +994,8 @@ static void pack_inter_mode_mvs(VP9_COMP *cpi, MODE_INFO *m,
        (rf != INTRA_FRAME && !(mode == SPLITMV &&
                                mi->partitioning == PARTITIONING_4X4))) &&
       pc->txfm_mode == TX_MODE_SELECT &&
-      !((pc->mb_no_coeff_skip && skip_coeff) ||
-        (vp9_segfeature_active(xd, segment_id, SEG_LVL_SKIP)))) {
+          !(skip_coeff || vp9_segfeature_active(xd, segment_id,
+                                                SEG_LVL_SKIP))) {
     TX_SIZE sz = mi->txfm_size;
     // FIXME(rbultje) code ternary symbol once all experiments are merged
     vp9_write(bc, sz != TX_4X4, pc->prob_tx[0]);
@@ -1024,9 +1022,7 @@ static void write_mb_modes_kf(const VP9_COMP *cpi,
     write_mb_segid(bc, &m->mbmi, xd);
   }
 
-  if (!c->mb_no_coeff_skip) {
-    skip_coeff = 0;
-  } else if (vp9_segfeature_active(xd, segment_id, SEG_LVL_SKIP)) {
+  if (vp9_segfeature_active(xd, segment_id, SEG_LVL_SKIP)) {
     skip_coeff = 1;
   } else {
     skip_coeff = m->mbmi.mb_skip_coeff;
@@ -1074,8 +1070,7 @@ static void write_mb_modes_kf(const VP9_COMP *cpi,
     write_uv_mode(bc, m->mbmi.uv_mode, c->kf_uv_mode_prob[ym]);
 
   if (ym <= I8X8_PRED && c->txfm_mode == TX_MODE_SELECT &&
-      !((c->mb_no_coeff_skip && skip_coeff) ||
-        (vp9_segfeature_active(xd, segment_id, SEG_LVL_SKIP)))) {
+      !(skip_coeff || vp9_segfeature_active(xd, segment_id, SEG_LVL_SKIP))) {
     TX_SIZE sz = m->mbmi.txfm_size;
     // FIXME(rbultje) code ternary symbol once all experiments are merged
     vp9_write(bc, sz != TX_4X4, c->prob_tx[0]);
@@ -2600,8 +2595,7 @@ void vp9_pack_bitstream(VP9_COMP *cpi, unsigned char *dest,
     }
   }
 
-  // signal here is multi token partition is enabled
-  // vp9_write_literal(&header_bc, pc->multi_token_partition, 2);
+  // TODO(jkoleszar): remove these unused bits
   vp9_write_literal(&header_bc, 0, 2);
 
   // Frame Q baseline quantizer index
@@ -2828,15 +2822,12 @@ void vp9_pack_bitstream(VP9_COMP *cpi, unsigned char *dest,
   active_section = 2;
 #endif
 
-  // Write out the mb_no_coeff_skip flag
-  vp9_write_bit(&header_bc, pc->mb_no_coeff_skip);
-  if (pc->mb_no_coeff_skip) {
-    int k;
+  // TODO(jkoleszar): remove this unused bit
+  vp9_write_bit(&header_bc, 1);
 
-    vp9_update_skip_probs(cpi);
-    for (k = 0; k < MBSKIP_CONTEXTS; ++k) {
-      vp9_write_literal(&header_bc, pc->mbskip_pred_probs[k], 8);
-    }
+  vp9_update_skip_probs(cpi);
+  for (i = 0; i < MBSKIP_CONTEXTS; ++i) {
+    vp9_write_literal(&header_bc, pc->mbskip_pred_probs[i], 8);
   }
 
   if (pc->frame_type == KEY_FRAME) {
index 1396725..b76baf5 100644 (file)
@@ -1348,7 +1348,6 @@ static void reset_skip_txfm_size_sb(VP9_COMP *cpi, MODE_INFO *mi,
   MB_MODE_INFO *const mbmi = &mi->mbmi;
 
   if (mbmi->txfm_size > txfm_max) {
-    VP9_COMMON *const cm = &cpi->common;
     MACROBLOCK *const x = &cpi->mb;
     MACROBLOCKD *const xd = &x->e_mbd;
     const int segment_id = mbmi->segment_id;
@@ -1357,8 +1356,8 @@ static void reset_skip_txfm_size_sb(VP9_COMP *cpi, MODE_INFO *mi,
     const int xmbs = MIN(bw, mb_cols_left);
 
     xd->mode_info_context = mi;
-    assert((vp9_segfeature_active(xd, segment_id, SEG_LVL_SKIP)) ||
-           (cm->mb_no_coeff_skip && get_skip_flag(mi, mis, ymbs, xmbs)));
+    assert(vp9_segfeature_active(xd, segment_id, SEG_LVL_SKIP) ||
+           get_skip_flag(mi, mis, ymbs, xmbs));
     set_txfm_flag(mi, mis, ymbs, xmbs, txfm_max);
   }
 }
@@ -1961,10 +1960,6 @@ static void encode_macroblock(VP9_COMP *cpi, TOKENEXTRA **t,
     if (!x->skip) {
       vp9_encode_inter16x16(cm, x, mb_row, mb_col);
 
-      // Clear mb_skip_coeff if mb_no_coeff_skip is not set
-      if (!cpi->common.mb_no_coeff_skip)
-        mbmi->mb_skip_coeff = 0;
-
     } else {
       vp9_build_inter16x16_predictors_mb(xd,
                                          xd->dst.y_buffer,
@@ -2046,27 +2041,20 @@ static void encode_macroblock(VP9_COMP *cpi, TOKENEXTRA **t,
 
   } else {
     // FIXME(rbultje): not tile-aware (mi - 1)
-    int mb_skip_context = cpi->common.mb_no_coeff_skip ?
-      (mi - 1)->mbmi.mb_skip_coeff + (mi - mis)->mbmi.mb_skip_coeff : 0;
-
-    if (cm->mb_no_coeff_skip) {
-      mbmi->mb_skip_coeff = 1;
-      if (output_enabled)
-        cpi->skip_true_count[mb_skip_context]++;
-      vp9_reset_sb_tokens_context(xd, BLOCK_SIZE_MB16X16);
-    } else {
-      vp9_stuff_mb(cpi, xd, t, !output_enabled);
-      mbmi->mb_skip_coeff = 0;
-      if (output_enabled)
-        cpi->skip_false_count[mb_skip_context]++;
-    }
+    int mb_skip_context =
+      (mi - 1)->mbmi.mb_skip_coeff + (mi - mis)->mbmi.mb_skip_coeff;
+
+    mbmi->mb_skip_coeff = 1;
+    if (output_enabled)
+      cpi->skip_true_count[mb_skip_context]++;
+    vp9_reset_sb_tokens_context(xd, BLOCK_SIZE_MB16X16);
   }
 
   if (output_enabled) {
     int segment_id = mbmi->segment_id;
     if (cpi->common.txfm_mode == TX_MODE_SELECT &&
-        !((cpi->common.mb_no_coeff_skip && mbmi->mb_skip_coeff) ||
-          (vp9_segfeature_active(&x->e_mbd, segment_id, SEG_LVL_SKIP)))) {
+        !(mbmi->mb_skip_coeff ||
+          vp9_segfeature_active(&x->e_mbd, segment_id, SEG_LVL_SKIP))) {
       assert(mbmi->txfm_size <= TX_16X16);
       if (mbmi->mode != I4X4_PRED && mbmi->mode != I8X8_PRED &&
           mbmi->mode != SPLITMV) {
@@ -2279,19 +2267,13 @@ static void encode_superblock(VP9_COMP *cpi, TOKENEXTRA **t,
     vp9_tokenize_sb(cpi, &x->e_mbd, t, !output_enabled, bsize);
   } else {
     // FIXME(rbultje): not tile-aware (mi - 1)
-    int mb_skip_context = cpi->common.mb_no_coeff_skip ?
-        (mi - 1)->mbmi.mb_skip_coeff + (mi - mis)->mbmi.mb_skip_coeff : 0;
+    int mb_skip_context =
+        (mi - 1)->mbmi.mb_skip_coeff + (mi - mis)->mbmi.mb_skip_coeff;
 
     xd->mode_info_context->mbmi.mb_skip_coeff = 1;
-    if (cm->mb_no_coeff_skip) {
-      if (output_enabled)
-        cpi->skip_true_count[mb_skip_context]++;
-      vp9_reset_sb_tokens_context(xd, bsize);
-    } else {
-      vp9_stuff_sb(cpi, xd, t, !output_enabled, bsize);
-      if (output_enabled)
-        cpi->skip_false_count[mb_skip_context]++;
-    }
+    if (output_enabled)
+      cpi->skip_true_count[mb_skip_context]++;
+    vp9_reset_sb_tokens_context(xd, bsize);
   }
 
   // copy skip flag on all mb_mode_info contexts in this SB
@@ -2304,8 +2286,8 @@ static void encode_superblock(VP9_COMP *cpi, TOKENEXTRA **t,
 
   if (output_enabled) {
     if (cm->txfm_mode == TX_MODE_SELECT &&
-        !((cm->mb_no_coeff_skip && mi->mbmi.mb_skip_coeff) ||
-          (vp9_segfeature_active(xd, segment_id, SEG_LVL_SKIP)))) {
+        !(mi->mbmi.mb_skip_coeff ||
+          vp9_segfeature_active(xd, segment_id, SEG_LVL_SKIP))) {
       if (bsize >= BLOCK_SIZE_SB32X32) {
         cpi->txfm_count_32x32p[mi->mbmi.txfm_size]++;
       } else {
index 48a08df..7499cbe 100644 (file)
@@ -2989,43 +2989,41 @@ static void encode_frame_to_data_rate(VP9_COMP *cpi,
     vp9_set_quantizer(cpi, q);
 
     if (loop_count == 0) {
+      int k;
 
       // setup skip prob for costing in mode/mv decision
-      if (cpi->common.mb_no_coeff_skip) {
-        int k;
-        for (k = 0; k < MBSKIP_CONTEXTS; k++)
-          cm->mbskip_pred_probs[k] = cpi->base_skip_false_prob[q][k];
-
-        if (cm->frame_type != KEY_FRAME) {
-          if (cpi->refresh_alt_ref_frame) {
-            for (k = 0; k < MBSKIP_CONTEXTS; k++) {
-              if (cpi->last_skip_false_probs[2][k] != 0)
-                cm->mbskip_pred_probs[k] = cpi->last_skip_false_probs[2][k];
-            }
-          } else if (cpi->refresh_golden_frame) {
-            for (k = 0; k < MBSKIP_CONTEXTS; k++) {
-              if (cpi->last_skip_false_probs[1][k] != 0)
-                cm->mbskip_pred_probs[k] = cpi->last_skip_false_probs[1][k];
-            }
-          } else {
-            int k;
-            for (k = 0; k < MBSKIP_CONTEXTS; k++) {
-              if (cpi->last_skip_false_probs[0][k] != 0)
-                cm->mbskip_pred_probs[k] = cpi->last_skip_false_probs[0][k];
-            }
+      for (k = 0; k < MBSKIP_CONTEXTS; k++)
+        cm->mbskip_pred_probs[k] = cpi->base_skip_false_prob[q][k];
+
+      if (cm->frame_type != KEY_FRAME) {
+        if (cpi->refresh_alt_ref_frame) {
+          for (k = 0; k < MBSKIP_CONTEXTS; k++) {
+            if (cpi->last_skip_false_probs[2][k] != 0)
+              cm->mbskip_pred_probs[k] = cpi->last_skip_false_probs[2][k];
+          }
+        } else if (cpi->refresh_golden_frame) {
+          for (k = 0; k < MBSKIP_CONTEXTS; k++) {
+            if (cpi->last_skip_false_probs[1][k] != 0)
+              cm->mbskip_pred_probs[k] = cpi->last_skip_false_probs[1][k];
+          }
+        } else {
+          int k;
+          for (k = 0; k < MBSKIP_CONTEXTS; k++) {
+            if (cpi->last_skip_false_probs[0][k] != 0)
+              cm->mbskip_pred_probs[k] = cpi->last_skip_false_probs[0][k];
           }
+        }
 
-          // as this is for cost estimate, let's make sure it does not
-          // get extreme either way
-          {
-            int k;
-            for (k = 0; k < MBSKIP_CONTEXTS; ++k) {
-              cm->mbskip_pred_probs[k] = clamp(cm->mbskip_pred_probs[k],
-                                               5, 250);
+        // as this is for cost estimate, let's make sure it does not
+        // get extreme either way
+        {
+          int k;
+          for (k = 0; k < MBSKIP_CONTEXTS; ++k) {
+            cm->mbskip_pred_probs[k] = clamp(cm->mbskip_pred_probs[k],
+                                             5, 250);
 
-              if (cpi->is_src_frame_alt_ref)
-                cm->mbskip_pred_probs[k] = 1;
-            }
+            if (cpi->is_src_frame_alt_ref)
+              cm->mbskip_pred_probs[k] = 1;
           }
         }
       }
index 711461a..4b59fa1 100644 (file)
@@ -566,10 +566,10 @@ static void choose_txfm_size_from_rd(VP9_COMP *cpi, MACROBLOCK *x,
   VP9_COMMON *const cm = &cpi->common;
   MACROBLOCKD *const xd = &x->e_mbd;
   MB_MODE_INFO *const mbmi = &xd->mode_info_context->mbmi;
-  vp9_prob skip_prob = cm->mb_no_coeff_skip ?
-                       vp9_get_pred_prob(cm, xd, PRED_MBSKIP) : 128;
+  vp9_prob skip_prob = vp9_get_pred_prob(cm, xd, PRED_MBSKIP);
   int64_t rd[TX_SIZE_MAX_SB][2];
   int n, m;
+  int s0, s1;
 
   for (n = TX_4X4; n <= max_txfm_size; n++) {
     r[n][1] = r[n][0];
@@ -581,25 +581,16 @@ static void choose_txfm_size_from_rd(VP9_COMP *cpi, MACROBLOCK *x,
     }
   }
 
-  if (cm->mb_no_coeff_skip) {
-    int s0, s1;
+  assert(skip_prob > 0);
+  s0 = vp9_cost_bit(skip_prob, 0);
+  s1 = vp9_cost_bit(skip_prob, 1);
 
-    assert(skip_prob > 0);
-    s0 = vp9_cost_bit(skip_prob, 0);
-    s1 = vp9_cost_bit(skip_prob, 1);
-
-    for (n = TX_4X4; n <= max_txfm_size; n++) {
-      if (s[n]) {
-        rd[n][0] = rd[n][1] = RDCOST(x->rdmult, x->rddiv, s1, d[n]);
-      } else {
-        rd[n][0] = RDCOST(x->rdmult, x->rddiv, r[n][0] + s0, d[n]);
-        rd[n][1] = RDCOST(x->rdmult, x->rddiv, r[n][1] + s0, d[n]);
-      }
-    }
-  } else {
-    for (n = TX_4X4; n <= max_txfm_size; n++) {
-      rd[n][0] = RDCOST(x->rdmult, x->rddiv, r[n][0], d[n]);
-      rd[n][1] = RDCOST(x->rdmult, x->rddiv, r[n][1], d[n]);
+  for (n = TX_4X4; n <= max_txfm_size; n++) {
+    if (s[n]) {
+      rd[n][0] = rd[n][1] = RDCOST(x->rdmult, x->rddiv, s1, d[n]);
+    } else {
+      rd[n][0] = RDCOST(x->rdmult, x->rddiv, r[n][0] + s0, d[n]);
+      rd[n][1] = RDCOST(x->rdmult, x->rddiv, r[n][1] + s0, d[n]);
     }
   }
 
@@ -3862,44 +3853,41 @@ static void rd_pick_inter_mode(VP9_COMP *cpi, MACROBLOCK *x,
       // because there are no non zero coefficients and make any
       // necessary adjustment for rate. Ignore if skip is coded at
       // segment level as the cost wont have been added in.
-      if (cpi->common.mb_no_coeff_skip) {
-        int mb_skip_allowed;
+      int mb_skip_allowed;
 
-        // Is Mb level skip allowed (i.e. not coded at segment level).
-        mb_skip_allowed = !vp9_segfeature_active(xd, segment_id, SEG_LVL_SKIP);
+      // Is Mb level skip allowed (i.e. not coded at segment level).
+      mb_skip_allowed = !vp9_segfeature_active(xd, segment_id, SEG_LVL_SKIP);
 
-        if (skippable) {
-          mbmi->mb_skip_coeff = 1;
+      if (skippable) {
+        mbmi->mb_skip_coeff = 1;
 
-          // Back out the coefficient coding costs
-          rate2 -= (rate_y + rate_uv);
-          // for best_yrd calculation
-          rate_uv = 0;
+        // Back out the coefficient coding costs
+        rate2 -= (rate_y + rate_uv);
+        // for best_yrd calculation
+        rate_uv = 0;
 
-          if (mb_skip_allowed) {
-            int prob_skip_cost;
+        if (mb_skip_allowed) {
+          int prob_skip_cost;
 
-            // Cost the skip mb case
-            vp9_prob skip_prob =
-              vp9_get_pred_prob(cm, &x->e_mbd, PRED_MBSKIP);
+          // Cost the skip mb case
+          vp9_prob skip_prob =
+            vp9_get_pred_prob(cm, &x->e_mbd, PRED_MBSKIP);
 
-            if (skip_prob) {
-              prob_skip_cost = vp9_cost_bit(skip_prob, 1);
-              rate2 += prob_skip_cost;
-              other_cost += prob_skip_cost;
-            }
-          }
-        }
-        // Add in the cost of the no skip flag.
-        else {
-          mbmi->mb_skip_coeff = 0;
-          if (mb_skip_allowed) {
-            int prob_skip_cost = vp9_cost_bit(
-                   vp9_get_pred_prob(cm, &x->e_mbd, PRED_MBSKIP), 0);
+          if (skip_prob) {
+            prob_skip_cost = vp9_cost_bit(skip_prob, 1);
             rate2 += prob_skip_cost;
             other_cost += prob_skip_cost;
           }
         }
+      } else {
+        // Add in the cost of the no skip flag.
+        mbmi->mb_skip_coeff = 0;
+        if (mb_skip_allowed) {
+          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;
+        }
       }
 
       // Calculate the final RD estimate for this mode.
@@ -4089,8 +4077,7 @@ static void rd_pick_inter_mode(VP9_COMP *cpi, MACROBLOCK *x,
     mbmi->ref_frame = ALTREF_FRAME;
     mbmi->mv[0].as_int = 0;
     mbmi->uv_mode = DC_PRED;
-    mbmi->mb_skip_coeff =
-      (cpi->common.mb_no_coeff_skip) ? 1 : 0;
+    mbmi->mb_skip_coeff = 1;
     mbmi->partitioning = 0;
     set_scale_factors(xd, mbmi->ref_frame, mbmi->second_ref_frame,
                       scale_factor);
@@ -4176,16 +4163,15 @@ void vp9_rd_pick_intra_mode_sb(VP9_COMP *cpi, MACROBLOCK *x,
   rd_pick_intra_sbuv_mode(cpi, x, &rate_uv, &rate_uv_tokenonly,
                           &dist_uv, &uv_skip, bsize);
 
-  if (cpi->common.mb_no_coeff_skip && y_skip && uv_skip) {
+  if (y_skip && uv_skip) {
     *returnrate = rate_y + rate_uv - rate_y_tokenonly - rate_uv_tokenonly +
                   vp9_cost_bit(vp9_get_pred_prob(cm, xd, PRED_MBSKIP), 1);
     *returndist = dist_y + (dist_uv >> 2);
     memset(ctx->txfm_rd_diff, 0,
            sizeof(x->sb32_context[xd->sb_index].txfm_rd_diff));
   } else {
-    *returnrate = rate_y + rate_uv;
-    if (cpi->common.mb_no_coeff_skip)
-      *returnrate += vp9_cost_bit(vp9_get_pred_prob(cm, xd, PRED_MBSKIP), 0);
+    *returnrate = rate_y + rate_uv +
+        vp9_cost_bit(vp9_get_pred_prob(cm, xd, PRED_MBSKIP), 0);
     *returndist = dist_y + (dist_uv >> 2);
     for (i = 0; i < NB_TXFM_MODES; i++) {
       ctx->txfm_rd_diff[i] = err - txfm_cache[i];
@@ -4237,7 +4223,7 @@ void vp9_rd_pick_intra_mode(VP9_COMP *cpi, MACROBLOCK *x,
                                       BLOCK_SIZE_MB16X16, txfm_cache[1]);
   mode16x16 = mbmi->mode;
   txfm_size_16x16 = mbmi->txfm_size;
-  if (cpi->common.mb_no_coeff_skip && y_intra16x16_skippable &&
+  if (y_intra16x16_skippable &&
       ((cm->txfm_mode == ONLY_4X4 && uv_intra_skippable[TX_4X4]) ||
        (cm->txfm_mode != ONLY_4X4 && uv_intra_skippable[TX_8X8]))) {
     error16x16 -= RDCOST(x->rdmult, x->rddiv, rate16x16_tokenonly, 0);
@@ -4269,7 +4255,7 @@ void vp9_rd_pick_intra_mode(VP9_COMP *cpi, MACROBLOCK *x,
   }
 
   mbmi->mb_skip_coeff = 0;
-  if (cpi->common.mb_no_coeff_skip && y_intra16x16_skippable &&
+  if (y_intra16x16_skippable &&
       ((cm->txfm_mode == ONLY_4X4 && uv_intra_skippable[TX_4X4]) ||
        (cm->txfm_mode != ONLY_4X4 && uv_intra_skippable[TX_8X8]))) {
     mbmi->mb_skip_coeff = 1;
@@ -4295,8 +4281,7 @@ void vp9_rd_pick_intra_mode(VP9_COMP *cpi, MACROBLOCK *x,
       dist = dist16x16 + (distuv[mbmi->txfm_size != TX_4X4] >> 2);
       mbmi->uv_mode = modeuv[mbmi->txfm_size != TX_4X4];
     }
-    if (cpi->common.mb_no_coeff_skip)
-      rate += vp9_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[TX_4X4] + rate4x4;
@@ -4311,8 +4296,7 @@ void vp9_rd_pick_intra_mode(VP9_COMP *cpi, MACROBLOCK *x,
       rate = rate8x8 + rateuv[TX_4X4];
       dist = dist8x8 + (distuv[TX_4X4] >> 2);
     }
-    if (cpi->common.mb_no_coeff_skip)
-      rate += vp9_cost_bit(vp9_get_pred_prob(cm, xd, PRED_MBSKIP), 0);
+    rate += vp9_cost_bit(vp9_get_pred_prob(cm, xd, PRED_MBSKIP), 0);
   }
 
   for (i = 0; i < NB_TXFM_MODES; i++) {
@@ -4595,39 +4579,36 @@ int64_t vp9_rd_pick_inter_mode_sb(VP9_COMP *cpi, MACROBLOCK *x,
       // because there are no non zero coefficients and make any
       // necessary adjustment for rate. Ignore if skip is coded at
       // segment level as the cost wont have been added in.
-      if (cpi->common.mb_no_coeff_skip) {
-        int mb_skip_allowed;
+      int mb_skip_allowed;
 
-        // Is Mb level skip allowed (i.e. not coded at segment level).
-        mb_skip_allowed = !vp9_segfeature_active(xd, segment_id, SEG_LVL_SKIP);
+      // Is Mb level skip allowed (i.e. not coded at segment level).
+      mb_skip_allowed = !vp9_segfeature_active(xd, segment_id, SEG_LVL_SKIP);
 
-        if (skippable) {
-          // Back out the coefficient coding costs
-          rate2 -= (rate_y + rate_uv);
-          // for best_yrd calculation
-          rate_uv = 0;
+      if (skippable) {
+        // Back out the coefficient coding costs
+        rate2 -= (rate_y + rate_uv);
+        // for best_yrd calculation
+        rate_uv = 0;
 
-          if (mb_skip_allowed) {
-            int prob_skip_cost;
+        if (mb_skip_allowed) {
+          int prob_skip_cost;
 
-            // Cost the skip mb case
-            vp9_prob skip_prob =
-              vp9_get_pred_prob(cm, xd, PRED_MBSKIP);
+          // Cost the skip mb case
+          vp9_prob skip_prob =
+            vp9_get_pred_prob(cm, xd, PRED_MBSKIP);
 
-            if (skip_prob) {
-              prob_skip_cost = vp9_cost_bit(skip_prob, 1);
-              rate2 += prob_skip_cost;
-              other_cost += prob_skip_cost;
-            }
+          if (skip_prob) {
+            prob_skip_cost = vp9_cost_bit(skip_prob, 1);
+            rate2 += prob_skip_cost;
+            other_cost += prob_skip_cost;
           }
         }
+      } else if (mb_skip_allowed) {
         // Add in the cost of the no skip flag.
-        else if (mb_skip_allowed) {
-          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;
-        }
+        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;
       }
 
       // Calculate the final RD estimate for this mode.
@@ -4795,7 +4776,7 @@ int64_t vp9_rd_pick_inter_mode_sb(VP9_COMP *cpi, MACROBLOCK *x,
     mbmi->second_ref_frame = INTRA_FRAME;
     mbmi->mv[0].as_int = 0;
     mbmi->uv_mode = DC_PRED;
-    mbmi->mb_skip_coeff = (cpi->common.mb_no_coeff_skip) ? 1 : 0;
+    mbmi->mb_skip_coeff = 1;
     mbmi->partitioning = 0;
     mbmi->txfm_size = cm->txfm_mode == TX_MODE_SELECT ?
                       TX_32X32 : cm->txfm_mode;
index 3095d64..6c44ebd 100644 (file)
@@ -397,11 +397,7 @@ void vp9_tokenize_sb(VP9_COMP *cpi,
   if (mbmi->mb_skip_coeff) {
     if (!dry_run)
       cpi->skip_true_count[mb_skip_context] += skip_inc;
-    if (!cm->mb_no_coeff_skip) {
-      vp9_stuff_sb(cpi, xd, t, dry_run, bsize);
-    } else {
-      vp9_reset_sb_tokens_context(xd, bsize);
-    }
+    vp9_reset_sb_tokens_context(xd, bsize);
     if (dry_run)
       *t = t_backup;
     return;
@@ -490,11 +486,7 @@ void vp9_tokenize_mb(VP9_COMP *cpi,
   if (xd->mode_info_context->mbmi.mb_skip_coeff) {
     if (!dry_run)
       cpi->skip_true_count[mb_skip_context] += skip_inc;
-    if (!cpi->common.mb_no_coeff_skip) {
-      vp9_stuff_mb(cpi, xd, t, dry_run);
-    } else {
-      vp9_reset_sb_tokens_context(xd, BLOCK_SIZE_MB16X16);
-    }
+    vp9_reset_sb_tokens_context(xd, BLOCK_SIZE_MB16X16);
 
     if (dry_run)
       *t = t_backup;