shithub: libvpx

Download patch

ref: 56d01ee0a6cb3c73943db5d07e16554f6ac40fc9
parent: 44dc18064e13cc2362dd37b9672c0f34f28ccd00
parent: 13e41ba44064d7c5c6c46fead819996cc3c8d955
author: Ronald S. Bultje <rbultje@google.com>
date: Thu Apr 11 11:19:08 EDT 2013

Merge "Remove unused macroblock versions of reconstruction functions." into experimental

--- a/vp9/common/vp9_invtrans.c
+++ b/vp9/common/vp9_invtrans.c
@@ -20,95 +20,14 @@
     xd->inv_txm4x4(dqcoeff, diff, pitch);
 }
 
-void vp9_inverse_transform_mby_4x4(MACROBLOCKD *xd) {
-  int i;
-
-  for (i = 0; i < 16; i++) {
-    TX_TYPE tx_type = get_tx_type_4x4(xd, i);
-    const int x = i & 3, y = i >> 2;
-    if (tx_type != DCT_DCT) {
-      vp9_short_iht4x4(BLOCK_OFFSET(xd->plane[0].dqcoeff, i, 16),
-                       xd->diff + 64 * y + 4 * x, 16, tx_type);
-    } else {
-      vp9_inverse_transform_b_4x4(xd,
-                                  xd->plane[0].eobs[i],
-                                  BLOCK_OFFSET(xd->plane[0].dqcoeff, i, 16),
-                                  xd->diff + 64 * y + 4 * x, 32);
-    }
-  }
-}
-
-void vp9_inverse_transform_mbuv_4x4(MACROBLOCKD *xd) {
-  int i;
-
-  for (i = 0; i < 4; i++) {
-    const int y = i >> 1, x = i & 1;
-    vp9_inverse_transform_b_4x4(xd, xd->plane[1].eobs[i],
-                                BLOCK_OFFSET(xd->plane[1].dqcoeff, i, 16),
-                                xd->diff + 256 + y * 32 + x * 4, 16);
-    vp9_inverse_transform_b_4x4(xd, xd->plane[2].eobs[i],
-                                BLOCK_OFFSET(xd->plane[2].dqcoeff, i, 16),
-                                xd->diff + 320 + y * 32 + x * 4, 16);
-  }
-}
-
-void vp9_inverse_transform_mb_4x4(MACROBLOCKD *xd) {
-  vp9_inverse_transform_mby_4x4(xd);
-  vp9_inverse_transform_mbuv_4x4(xd);
-}
-
 void vp9_inverse_transform_b_8x8(int16_t *input_dqcoeff, int16_t *output_coeff,
                                  int pitch) {
   vp9_short_idct8x8(input_dqcoeff, output_coeff, pitch);
 }
 
-void vp9_inverse_transform_mby_8x8(MACROBLOCKD *xd) {
-  int i;
-
-  for (i = 0; i < 4; i++) {
-    const int y = i >> 1, x = i & 1;
-    TX_TYPE tx_type = get_tx_type_8x8(xd, x * 2 + y * 8);
-    if (tx_type != DCT_DCT) {
-      vp9_short_iht8x8(BLOCK_OFFSET(xd->plane[0].dqcoeff, i * 4, 16),
-                       xd->diff + y * 128 + x * 8, 16, tx_type);
-    } else {
-      vp9_inverse_transform_b_8x8(BLOCK_OFFSET(xd->plane[0].dqcoeff, i * 4, 16),
-                                  xd->diff + y * 128 + x * 8, 32);
-    }
-  }
-}
-
-void vp9_inverse_transform_mbuv_8x8(MACROBLOCKD *xd) {
-  vp9_inverse_transform_b_8x8(BLOCK_OFFSET(xd->plane[1].dqcoeff, 0, 16),
-                              xd->diff + 256, 16);
-  vp9_inverse_transform_b_8x8(BLOCK_OFFSET(xd->plane[2].dqcoeff, 0, 16),
-                              xd->diff + 320, 16);
-}
-
-void vp9_inverse_transform_mb_8x8(MACROBLOCKD *xd) {
-  vp9_inverse_transform_mby_8x8(xd);
-  vp9_inverse_transform_mbuv_8x8(xd);
-}
-
 void vp9_inverse_transform_b_16x16(int16_t *input_dqcoeff,
                                    int16_t *output_coeff, int pitch) {
   vp9_short_idct16x16(input_dqcoeff, output_coeff, pitch);
-}
-
-void vp9_inverse_transform_mby_16x16(MACROBLOCKD *xd) {
-  TX_TYPE tx_type = get_tx_type_16x16(xd, 0);
-  if (tx_type != DCT_DCT) {
-    vp9_short_iht16x16(BLOCK_OFFSET(xd->plane[0].dqcoeff, 0, 16),
-                       xd->diff, 16, tx_type);
-  } else {
-    vp9_inverse_transform_b_16x16(BLOCK_OFFSET(xd->plane[0].dqcoeff, 0, 16),
-                                  xd->diff, 32);
-  }
-}
-
-void vp9_inverse_transform_mb_16x16(MACROBLOCKD *xd) {
-  vp9_inverse_transform_mby_16x16(xd);
-  vp9_inverse_transform_mbuv_8x8(xd);
 }
 
 void vp9_inverse_transform_sby_32x32(MACROBLOCKD *xd, BLOCK_SIZE_TYPE bsize) {
--- a/vp9/common/vp9_invtrans.h
+++ b/vp9/common/vp9_invtrans.h
@@ -19,27 +19,11 @@
                                  int16_t *dqcoeff, int16_t *diff,
                                  int pitch);
 
-void vp9_inverse_transform_mb_4x4(MACROBLOCKD *xd);
-
-void vp9_inverse_transform_mby_4x4(MACROBLOCKD *xd);
-
-void vp9_inverse_transform_mbuv_4x4(MACROBLOCKD *xd);
-
 void vp9_inverse_transform_b_8x8(int16_t *input_dqcoeff,
-                                        int16_t *output_coeff, int pitch);
+                                 int16_t *output_coeff, int pitch);
 
-void vp9_inverse_transform_mb_8x8(MACROBLOCKD *xd);
-
-void vp9_inverse_transform_mby_8x8(MACROBLOCKD *xd);
-
-void vp9_inverse_transform_mbuv_8x8(MACROBLOCKD *xd);
-
 void vp9_inverse_transform_b_16x16(int16_t *input_dqcoeff,
-                                          int16_t *output_coeff, int pitch);
-
-void vp9_inverse_transform_mb_16x16(MACROBLOCKD *xd);
-
-void vp9_inverse_transform_mby_16x16(MACROBLOCKD *xd);
+                                   int16_t *output_coeff, int pitch);
 
 void vp9_inverse_transform_sby_32x32(MACROBLOCKD *xd, BLOCK_SIZE_TYPE bsize);
 void vp9_inverse_transform_sby_16x16(MACROBLOCKD *xd, BLOCK_SIZE_TYPE bsize);
--- a/vp9/encoder/vp9_encodeintra.c
+++ b/vp9/encoder/vp9_encodeintra.c
@@ -90,25 +90,25 @@
 
   switch (tx_size) {
     case TX_16X16:
-      vp9_transform_mby_16x16(x);
-      vp9_quantize_mby_16x16(x);
+      vp9_transform_sby_16x16(x, BLOCK_SIZE_MB16X16);
+      vp9_quantize_sby_16x16(x, BLOCK_SIZE_MB16X16);
       if (x->optimize)
-        vp9_optimize_mby_16x16(cm, x);
-      vp9_inverse_transform_mby_16x16(xd);
+        vp9_optimize_sby_16x16(cm, x, BLOCK_SIZE_MB16X16);
+      vp9_inverse_transform_sby_16x16(xd, BLOCK_SIZE_MB16X16);
       break;
     case TX_8X8:
-      vp9_transform_mby_8x8(x);
-      vp9_quantize_mby_8x8(x);
+      vp9_transform_sby_8x8(x, BLOCK_SIZE_MB16X16);
+      vp9_quantize_sby_8x8(x, BLOCK_SIZE_MB16X16);
       if (x->optimize)
-        vp9_optimize_mby_8x8(cm, x);
-      vp9_inverse_transform_mby_8x8(xd);
+        vp9_optimize_sby_8x8(cm, x, BLOCK_SIZE_MB16X16);
+      vp9_inverse_transform_sby_8x8(xd, BLOCK_SIZE_MB16X16);
       break;
     default:
-      vp9_transform_mby_4x4(x);
-      vp9_quantize_mby_4x4(x);
+      vp9_transform_sby_4x4(x, BLOCK_SIZE_MB16X16);
+      vp9_quantize_sby_4x4(x, BLOCK_SIZE_MB16X16);
       if (x->optimize)
-        vp9_optimize_mby_4x4(cm, x);
-      vp9_inverse_transform_mby_4x4(xd);
+        vp9_optimize_sby_4x4(cm, x, BLOCK_SIZE_MB16X16);
+      vp9_inverse_transform_sby_4x4(xd, BLOCK_SIZE_MB16X16);
       break;
   }
 
@@ -126,18 +126,18 @@
 
   switch (tx_size) {
     case TX_4X4:
-      vp9_transform_mbuv_4x4(x);
-      vp9_quantize_mbuv_4x4(x);
+      vp9_transform_sbuv_4x4(x, BLOCK_SIZE_MB16X16);
+      vp9_quantize_sbuv_4x4(x, BLOCK_SIZE_MB16X16);
       if (x->optimize)
-        vp9_optimize_mbuv_4x4(cm, x);
-      vp9_inverse_transform_mbuv_4x4(xd);
+        vp9_optimize_sbuv_4x4(cm, x, BLOCK_SIZE_MB16X16);
+      vp9_inverse_transform_sbuv_4x4(xd, BLOCK_SIZE_MB16X16);
       break;
     default:  // 16x16 or 8x8
-      vp9_transform_mbuv_8x8(x);
-      vp9_quantize_mbuv_8x8(x);
+      vp9_transform_sbuv_8x8(x, BLOCK_SIZE_MB16X16);
+      vp9_quantize_sbuv_8x8(x, BLOCK_SIZE_MB16X16);
       if (x->optimize)
-        vp9_optimize_mbuv_8x8(cm, x);
-      vp9_inverse_transform_mbuv_8x8(xd);
+        vp9_optimize_sbuv_8x8(cm, x, BLOCK_SIZE_MB16X16);
+      vp9_inverse_transform_sbuv_8x8(xd, BLOCK_SIZE_MB16X16);
       break;
     }
 
--- a/vp9/encoder/vp9_encodemb.c
+++ b/vp9/encoder/vp9_encodemb.c
@@ -166,90 +166,6 @@
                     x->e_mbd.predictor, x->src.uv_stride);
 }
 
-void vp9_transform_mby_4x4(MACROBLOCK *x) {
-  int i;
-  MACROBLOCKD *xd = &x->e_mbd;
-
-  for (i = 0; i < 16; i++) {
-    BLOCK *b = &x->block[i];
-    TX_TYPE tx_type = get_tx_type_4x4(xd, i);
-    if (tx_type != DCT_DCT) {
-      vp9_short_fht4x4(b->src_diff, b->coeff, 16, tx_type);
-    } else if (!(i & 1) && get_tx_type_4x4(xd, i + 1) == DCT_DCT) {
-      x->fwd_txm8x4(x->block[i].src_diff, x->block[i].coeff, 32);
-      i++;
-    } else {
-      x->fwd_txm4x4(x->block[i].src_diff, x->block[i].coeff, 32);
-    }
-  }
-}
-
-void vp9_transform_mbuv_4x4(MACROBLOCK *x) {
-  int i;
-
-  for (i = 16; i < 24; i += 2)
-    x->fwd_txm8x4(x->block[i].src_diff, x->block[i].coeff, 16);
-}
-
-static void transform_mb_4x4(MACROBLOCK *x) {
-  vp9_transform_mby_4x4(x);
-  vp9_transform_mbuv_4x4(x);
-}
-
-void vp9_transform_mby_8x8(MACROBLOCK *x) {
-  int i;
-  MACROBLOCKD *xd = &x->e_mbd;
-  TX_TYPE tx_type;
-
-  for (i = 0; i < 9; i += 8) {
-    BLOCK *b = &x->block[i];
-    tx_type = get_tx_type_8x8(xd, i);
-    if (tx_type != DCT_DCT) {
-      vp9_short_fht8x8(b->src_diff, b->coeff, 16, tx_type);
-    } else {
-      x->fwd_txm8x8(x->block[i].src_diff, x->block[i].coeff, 32);
-    }
-  }
-  for (i = 2; i < 11; i += 8) {
-    BLOCK *b = &x->block[i];
-    tx_type = get_tx_type_8x8(xd, i);
-    if (tx_type != DCT_DCT) {
-      vp9_short_fht8x8(b->src_diff, (b + 2)->coeff, 16, tx_type);
-    } else {
-      x->fwd_txm8x8(x->block[i].src_diff, x->block[i + 2].coeff, 32);
-    }
-  }
-}
-
-void vp9_transform_mbuv_8x8(MACROBLOCK *x) {
-  int i;
-
-  for (i = 16; i < 24; i += 4)
-    x->fwd_txm8x8(x->block[i].src_diff, x->block[i].coeff, 16);
-}
-
-void vp9_transform_mb_8x8(MACROBLOCK *x) {
-  vp9_transform_mby_8x8(x);
-  vp9_transform_mbuv_8x8(x);
-}
-
-void vp9_transform_mby_16x16(MACROBLOCK *x) {
-  MACROBLOCKD *xd = &x->e_mbd;
-  BLOCK *b = &x->block[0];
-  TX_TYPE tx_type = get_tx_type_16x16(xd, 0);
-  vp9_clear_system_state();
-  if (tx_type != DCT_DCT) {
-    vp9_short_fht16x16(b->src_diff, b->coeff, 16, tx_type);
-  } else {
-    x->fwd_txm16x16(x->block[0].src_diff, x->block[0].coeff, 32);
-  }
-}
-
-void vp9_transform_mb_16x16(MACROBLOCK *x) {
-  vp9_transform_mby_16x16(x);
-  vp9_transform_mbuv_8x8(x);
-}
-
 void vp9_transform_sby_32x32(MACROBLOCK *x, BLOCK_SIZE_TYPE bsize) {
   const int bwl = mb_width_log2(bsize) - 1, bw = 1 << bwl;
   const int bh = 1 << (mb_height_log2(bsize) - 1);
@@ -749,123 +665,6 @@
 #endif
 }
 
-void vp9_optimize_mby_4x4(VP9_COMMON *const cm, MACROBLOCK *x) {
-  int b;
-  ENTROPY_CONTEXT_PLANES t_above, t_left;
-  ENTROPY_CONTEXT *ta;
-  ENTROPY_CONTEXT *tl;
-
-  if (!x->e_mbd.above_context || !x->e_mbd.left_context)
-    return;
-
-  vpx_memcpy(&t_above, x->e_mbd.above_context, sizeof(ENTROPY_CONTEXT_PLANES));
-  vpx_memcpy(&t_left, x->e_mbd.left_context, sizeof(ENTROPY_CONTEXT_PLANES));
-
-  ta = (ENTROPY_CONTEXT *)&t_above;
-  tl = (ENTROPY_CONTEXT *)&t_left;
-
-  for (b = 0; b < 16; b++) {
-    optimize_b(cm, x, b, PLANE_TYPE_Y_WITH_DC, x->e_mbd.block[b].dequant,
-               ta + vp9_block2above[TX_4X4][b],
-               tl + vp9_block2left[TX_4X4][b], TX_4X4, 16);
-  }
-}
-
-void vp9_optimize_mbuv_4x4(VP9_COMMON *const cm, MACROBLOCK *x) {
-  int b;
-  ENTROPY_CONTEXT_PLANES t_above, t_left;
-  ENTROPY_CONTEXT *ta;
-  ENTROPY_CONTEXT *tl;
-
-  if (!x->e_mbd.above_context || !x->e_mbd.left_context)
-    return;
-
-  vpx_memcpy(&t_above, x->e_mbd.above_context, sizeof(ENTROPY_CONTEXT_PLANES));
-  vpx_memcpy(&t_left, x->e_mbd.left_context, sizeof(ENTROPY_CONTEXT_PLANES));
-
-  ta = (ENTROPY_CONTEXT *)&t_above;
-  tl = (ENTROPY_CONTEXT *)&t_left;
-
-  for (b = 16; b < 24; b++) {
-    optimize_b(cm, x, b, PLANE_TYPE_UV, x->e_mbd.block[b].dequant,
-               ta + vp9_block2above[TX_4X4][b],
-               tl + vp9_block2left[TX_4X4][b], TX_4X4, 16);
-  }
-}
-
-static void optimize_mb_4x4(VP9_COMMON *const cm, MACROBLOCK *x) {
-  vp9_optimize_mby_4x4(cm, x);
-  vp9_optimize_mbuv_4x4(cm, x);
-}
-
-void vp9_optimize_mby_8x8(VP9_COMMON *const cm, MACROBLOCK *x) {
-  int b;
-  ENTROPY_CONTEXT_PLANES t_above, t_left;
-  ENTROPY_CONTEXT *ta;
-  ENTROPY_CONTEXT *tl;
-
-  if (!x->e_mbd.above_context || !x->e_mbd.left_context)
-    return;
-
-  vpx_memcpy(&t_above, x->e_mbd.above_context, sizeof(ENTROPY_CONTEXT_PLANES));
-  vpx_memcpy(&t_left, x->e_mbd.left_context, sizeof(ENTROPY_CONTEXT_PLANES));
-
-  ta = (ENTROPY_CONTEXT *)&t_above;
-  tl = (ENTROPY_CONTEXT *)&t_left;
-  for (b = 0; b < 16; b += 4) {
-    ENTROPY_CONTEXT *const a = ta + vp9_block2above[TX_8X8][b];
-    ENTROPY_CONTEXT *const l = tl + vp9_block2left[TX_8X8][b];
-    ENTROPY_CONTEXT above_ec = (a[0] + a[1]) != 0;
-    ENTROPY_CONTEXT left_ec = (l[0] + l[1]) != 0;
-    optimize_b(cm, x, b, PLANE_TYPE_Y_WITH_DC, x->e_mbd.block[b].dequant,
-               &above_ec, &left_ec, TX_8X8, 16);
-    a[1] = a[0] = above_ec;
-    l[1] = l[0] = left_ec;
-  }
-}
-
-void vp9_optimize_mbuv_8x8(VP9_COMMON *const cm, MACROBLOCK *x) {
-  int b;
-  ENTROPY_CONTEXT *const ta = (ENTROPY_CONTEXT *)x->e_mbd.above_context;
-  ENTROPY_CONTEXT *const tl = (ENTROPY_CONTEXT *)x->e_mbd.left_context;
-
-  if (!ta || !tl)
-    return;
-
-  for (b = 16; b < 24; b += 4) {
-    ENTROPY_CONTEXT *const a = ta + vp9_block2above[TX_8X8][b];
-    ENTROPY_CONTEXT *const l = tl + vp9_block2left[TX_8X8][b];
-    ENTROPY_CONTEXT above_ec = (a[0] + a[1]) != 0;
-    ENTROPY_CONTEXT left_ec = (l[0] + l[1]) != 0;
-    optimize_b(cm, x, b, PLANE_TYPE_UV, x->e_mbd.block[b].dequant,
-               &above_ec, &left_ec, TX_8X8, 16);
-  }
-}
-
-static void optimize_mb_8x8(VP9_COMMON *const cm, MACROBLOCK *x) {
-  vp9_optimize_mby_8x8(cm, x);
-  vp9_optimize_mbuv_8x8(cm, x);
-}
-
-void vp9_optimize_mby_16x16(VP9_COMMON *const cm, MACROBLOCK *x) {
-  ENTROPY_CONTEXT_PLANES *const t_above = x->e_mbd.above_context;
-  ENTROPY_CONTEXT_PLANES *const t_left = x->e_mbd.left_context;
-  ENTROPY_CONTEXT ta, tl;
-
-  if (!t_above || !t_left)
-    return;
-
-  ta = (t_above->y1[0] + t_above->y1[1] + t_above->y1[2] + t_above->y1[3]) != 0;
-  tl = (t_left->y1[0] + t_left->y1[1] + t_left->y1[2] + t_left->y1[3]) != 0;
-  optimize_b(cm, x, 0, PLANE_TYPE_Y_WITH_DC, x->e_mbd.block[0].dequant,
-             &ta, &tl, TX_16X16, 16);
-}
-
-static void optimize_mb_16x16(VP9_COMMON *const cm, MACROBLOCK *x) {
-  vp9_optimize_mby_16x16(cm, x);
-  vp9_optimize_mbuv_8x8(cm, x);
-}
-
 void vp9_optimize_sby_32x32(VP9_COMMON *const cm, MACROBLOCK *x,
                             BLOCK_SIZE_TYPE bsize) {
   const int bwl = mb_width_log2(bsize) - 1, bw = 1 << bwl;
@@ -1104,40 +903,50 @@
 
 void vp9_fidct_mb(VP9_COMMON *const cm, MACROBLOCK *x) {
   MACROBLOCKD *const xd = &x->e_mbd;
-  TX_SIZE tx_size = xd->mode_info_context->mbmi.txfm_size;
+  const TX_SIZE tx_size = xd->mode_info_context->mbmi.txfm_size;
 
   if (tx_size == TX_16X16) {
-    vp9_transform_mb_16x16(x);
-    vp9_quantize_mb_16x16(x);
-    if (x->optimize)
-      optimize_mb_16x16(cm, x);
-    vp9_inverse_transform_mb_16x16(xd);
+    vp9_transform_sby_16x16(x, BLOCK_SIZE_MB16X16);
+    vp9_transform_sbuv_8x8(x, BLOCK_SIZE_MB16X16);
+    vp9_quantize_sby_16x16(x, BLOCK_SIZE_MB16X16);
+    vp9_quantize_sbuv_8x8(x, BLOCK_SIZE_MB16X16);
+    if (x->optimize) {
+      vp9_optimize_sby_16x16(cm, x, BLOCK_SIZE_MB16X16);
+      vp9_optimize_sbuv_8x8(cm, x, BLOCK_SIZE_MB16X16);
+    }
+    vp9_inverse_transform_sby_16x16(xd, BLOCK_SIZE_MB16X16);
+    vp9_inverse_transform_sbuv_8x8(xd, BLOCK_SIZE_MB16X16);
   } else if (tx_size == TX_8X8) {
+    vp9_transform_sby_8x8(x, BLOCK_SIZE_MB16X16);
+    vp9_quantize_sby_8x8(x, BLOCK_SIZE_MB16X16);
+    if (x->optimize)
+      vp9_optimize_sby_8x8(cm, x, BLOCK_SIZE_MB16X16);
+    vp9_inverse_transform_sby_8x8(xd, BLOCK_SIZE_MB16X16);
     if (xd->mode_info_context->mbmi.mode == SPLITMV) {
       assert(xd->mode_info_context->mbmi.partitioning != PARTITIONING_4X4);
-      vp9_transform_mby_8x8(x);
-      vp9_transform_mbuv_4x4(x);
-      vp9_quantize_mby_8x8(x);
-      vp9_quantize_mbuv_4x4(x);
-      if (x->optimize) {
-        vp9_optimize_mby_8x8(cm, x);
-        vp9_optimize_mbuv_4x4(cm, x);
-      }
-      vp9_inverse_transform_mby_8x8(xd);
-      vp9_inverse_transform_mbuv_4x4(xd);
+      vp9_transform_sbuv_4x4(x, BLOCK_SIZE_MB16X16);
+      vp9_quantize_sbuv_4x4(x, BLOCK_SIZE_MB16X16);
+      if (x->optimize)
+        vp9_optimize_sbuv_4x4(cm, x, BLOCK_SIZE_MB16X16);
+      vp9_inverse_transform_sbuv_4x4(xd, BLOCK_SIZE_MB16X16);
     } else {
-      vp9_transform_mb_8x8(x);
-      vp9_quantize_mb_8x8(x);
+      vp9_transform_sbuv_8x8(x, BLOCK_SIZE_MB16X16);
+      vp9_quantize_sbuv_8x8(x, BLOCK_SIZE_MB16X16);
       if (x->optimize)
-        optimize_mb_8x8(cm, x);
-      vp9_inverse_transform_mb_8x8(xd);
+        vp9_optimize_sbuv_8x8(cm, x, BLOCK_SIZE_MB16X16);
+      vp9_inverse_transform_sbuv_8x8(xd, BLOCK_SIZE_MB16X16);
     }
   } else {
-    transform_mb_4x4(x);
-    vp9_quantize_mb_4x4(x);
-    if (x->optimize)
-      optimize_mb_4x4(cm, x);
-    vp9_inverse_transform_mb_4x4(xd);
+    vp9_transform_sby_4x4(x, BLOCK_SIZE_MB16X16);
+    vp9_transform_sbuv_4x4(x, BLOCK_SIZE_MB16X16);
+    vp9_quantize_sby_4x4(x, BLOCK_SIZE_MB16X16);
+    vp9_quantize_sbuv_4x4(x, BLOCK_SIZE_MB16X16);
+    if (x->optimize) {
+      vp9_optimize_sby_4x4(cm, x, BLOCK_SIZE_MB16X16);
+      vp9_optimize_sbuv_4x4(cm, x, BLOCK_SIZE_MB16X16);
+    }
+    vp9_inverse_transform_sby_4x4(xd, BLOCK_SIZE_MB16X16);
+    vp9_inverse_transform_sbuv_4x4(xd, BLOCK_SIZE_MB16X16);
   }
 }
 
@@ -1160,9 +969,9 @@
 
   vp9_subtract_mby(x->src_diff, *(b->base_src), xd->predictor, b->src_stride);
 
-  vp9_transform_mby_4x4(x);
-  vp9_quantize_mby_4x4(x);
-  vp9_inverse_transform_mby_4x4(xd);
+  vp9_transform_sby_4x4(x, BLOCK_SIZE_MB16X16);
+  vp9_quantize_sby_4x4(x, BLOCK_SIZE_MB16X16);
+  vp9_inverse_transform_sby_4x4(xd, BLOCK_SIZE_MB16X16);
 
   vp9_recon_mby(xd);
 }
--- a/vp9/encoder/vp9_encodemb.h
+++ b/vp9/encoder/vp9_encodemb.h
@@ -27,22 +27,7 @@
 void vp9_encode_inter16x16(VP9_COMMON *const cm, MACROBLOCK *x,
                            int mb_row, int mb_col);
 
-void vp9_transform_mbuv_4x4(MACROBLOCK *x);
-void vp9_transform_mby_4x4(MACROBLOCK *x);
-
-void vp9_optimize_mby_4x4(VP9_COMMON *const cm, MACROBLOCK *x);
-void vp9_optimize_mbuv_4x4(VP9_COMMON *const cm, MACROBLOCK *x);
 void vp9_encode_inter16x16y(MACROBLOCK *x, int mb_row, int mb_col);
-
-void vp9_transform_mb_8x8(MACROBLOCK *mb);
-void vp9_transform_mby_8x8(MACROBLOCK *x);
-void vp9_transform_mbuv_8x8(MACROBLOCK *x);
-void vp9_optimize_mby_8x8(VP9_COMMON *const cm, MACROBLOCK *x);
-void vp9_optimize_mbuv_8x8(VP9_COMMON *const cm, MACROBLOCK *x);
-
-void vp9_transform_mb_16x16(MACROBLOCK *mb);
-void vp9_transform_mby_16x16(MACROBLOCK *x);
-void vp9_optimize_mby_16x16(VP9_COMMON *const cm, MACROBLOCK *x);
 
 void vp9_transform_sby_32x32(MACROBLOCK *x, BLOCK_SIZE_TYPE bsize);
 void vp9_optimize_sby_32x32(VP9_COMMON *const cm, MACROBLOCK *x,
--- a/vp9/encoder/vp9_quantize.c
+++ b/vp9/encoder/vp9_quantize.c
@@ -172,35 +172,6 @@
 #endif
 }
 
-void vp9_quantize_mby_4x4(MACROBLOCK *x) {
-  int i;
-
-  for (i = 0; i < 16; i++) {
-    TX_TYPE tx_type = get_tx_type_4x4(&x->e_mbd, i);
-    if (tx_type != DCT_DCT) {
-      vp9_ht_quantize_b_4x4(x, i, tx_type);
-    } else {
-      x->quantize_b_4x4(x, i, 16);
-    }
-  }
-}
-
-void vp9_quantize_mbuv_4x4(MACROBLOCK *x) {
-  int i;
-  const MACROBLOCKD * const xd = &x->e_mbd;
-  const BLOCK_SIZE_TYPE real_sb_type = xd->mode_info_context->mbmi.sb_type;
-  xd->mode_info_context->mbmi.sb_type = BLOCK_SIZE_MB16X16;
-
-  for (i = 16; i < 24; i++)
-    x->quantize_b_4x4(x, i, 16);
-  xd->mode_info_context->mbmi.sb_type = real_sb_type;
-}
-
-void vp9_quantize_mb_4x4(MACROBLOCK *x) {
-  vp9_quantize_mby_4x4(x);
-  vp9_quantize_mbuv_4x4(x);
-}
-
 void vp9_regular_quantize_b_8x8(MACROBLOCK *mb, int b_idx, TX_TYPE tx_type,
                                 int y_blocks) {
   MACROBLOCKD *const xd = &mb->e_mbd;
@@ -317,57 +288,6 @@
     xd->nzcs[b_idx] = 0;
 #endif
   }
-}
-
-void vp9_quantize_mby_8x8(MACROBLOCK *x) {
-  int i;
-
-#if CONFIG_CODE_NONZEROCOUNT
-  for (i = 0; i < 16; i ++) {
-    x->e_mbd.nzcs[i] = 0;
-  }
-#endif
-  for (i = 0; i < 16; i += 4) {
-    TX_TYPE tx_type = get_tx_type_8x8(&x->e_mbd, (i & 8) + ((i & 4) >> 1));
-    x->quantize_b_8x8(x, i, tx_type, 16);
-  }
-}
-
-void vp9_quantize_mbuv_8x8(MACROBLOCK *x) {
-  int i;
-  const MACROBLOCKD * const xd = &x->e_mbd;
-  const BLOCK_SIZE_TYPE real_sb_type = xd->mode_info_context->mbmi.sb_type;
-  xd->mode_info_context->mbmi.sb_type = BLOCK_SIZE_MB16X16;
-
-#if CONFIG_CODE_NONZEROCOUNT
-  for (i = 16; i < 24; i ++) {
-    x->e_mbd.nzcs[i] = 0;
-  }
-#endif
-  for (i = 16; i < 24; i += 4)
-    x->quantize_b_8x8(x, i, DCT_DCT, 16);
-  xd->mode_info_context->mbmi.sb_type = real_sb_type;
-}
-
-void vp9_quantize_mb_8x8(MACROBLOCK *x) {
-  vp9_quantize_mby_8x8(x);
-  vp9_quantize_mbuv_8x8(x);
-}
-
-void vp9_quantize_mby_16x16(MACROBLOCK *x) {
-  TX_TYPE tx_type = get_tx_type_16x16(&x->e_mbd, 0);
-#if CONFIG_CODE_NONZEROCOUNT
-  int i;
-  for (i = 0; i < 16; i++) {
-    x->e_mbd.nzcs[i] = 0;
-  }
-#endif
-  x->quantize_b_16x16(x, 0, tx_type, 16);
-}
-
-void vp9_quantize_mb_16x16(MACROBLOCK *x) {
-  vp9_quantize_mby_16x16(x);
-  vp9_quantize_mbuv_8x8(x);
 }
 
 static void quantize(int16_t *zbin_boost_orig_ptr,
--- a/vp9/encoder/vp9_quantize.h
+++ b/vp9/encoder/vp9_quantize.h
@@ -37,18 +37,6 @@
 void vp9_regular_quantize_b_32x32(MACROBLOCK *mb, int b_idx,
                                   int y_blocks);
 
-void vp9_quantize_mb_4x4(MACROBLOCK *x);
-void vp9_quantize_mb_8x8(MACROBLOCK *x);
-
-void vp9_quantize_mbuv_4x4(MACROBLOCK *x);
-void vp9_quantize_mby_4x4(MACROBLOCK *x);
-
-void vp9_quantize_mby_8x8(MACROBLOCK *x);
-void vp9_quantize_mbuv_8x8(MACROBLOCK *x);
-
-void vp9_quantize_mb_16x16(MACROBLOCK *x);
-void vp9_quantize_mby_16x16(MACROBLOCK *x);
-
 void vp9_quantize_sby_32x32(MACROBLOCK *x, BLOCK_SIZE_TYPE bsize);
 void vp9_quantize_sby_16x16(MACROBLOCK *x, BLOCK_SIZE_TYPE bsize);
 void vp9_quantize_sby_8x8(MACROBLOCK *x, BLOCK_SIZE_TYPE bsize);