]> granicus.if.org Git - libvpx/commitdiff
Reduce bmi buffer length from 16 to 4
authorJingning Han <jingning@google.com>
Mon, 27 May 2013 14:55:25 +0000 (07:55 -0700)
committerJingning Han <jingning@google.com>
Mon, 27 May 2013 15:59:15 +0000 (08:59 -0700)
This commit removes the use of bmi_ in the first-pass encoding by
forcing encode_intra4x4block_ to use DC_PRED, followed by DCT_DCT
only, as John suggested. This makes the need for bmi buffer only
up to 4 entries, instead of 16.

Change-Id: I3410007dfae789ee46a09ae20c39d3ce3c7954aa

vp9/common/vp9_blockd.h
vp9/encoder/vp9_encodeintra.c

index e53e107ade3825903c3cd6d9f60b1551a70975e9..cc8b23983180d6f70f17eaaae3c70ebcba2a6ffa 100644 (file)
@@ -254,7 +254,7 @@ typedef struct {
 
 typedef struct {
   MB_MODE_INFO mbmi;
-  union b_mode_info bmi[16];
+  union b_mode_info bmi[4];
 } MODE_INFO;
 
 struct scale_factors {
index 91866b28ffbca1803a3faf3da1d78ac957cd3691..cd67cc4e1feebd2941b221b6aa7c4de5f0c94292 100644 (file)
@@ -31,19 +31,17 @@ int vp9_encode_intra(VP9_COMP *cpi, MACROBLOCK *x, int use_16x16_pred) {
   } else {
     int i;
 
-    for (i = 0; i < 16; i++) {
-      x->e_mbd.mode_info_context->bmi[i].as_mode.first = B_DC_PRED;
+    for (i = 0; i < 16; i++)
       encode_intra4x4block(x, i, BLOCK_SIZE_MB16X16);
-    }
   }
 
   return vp9_get_mb_ss(x->plane[0].src_diff);
 }
 
+// This function is used only by the firstpass encoding.
 static void encode_intra4x4block(MACROBLOCK *x, int ib,
                                  BLOCK_SIZE_TYPE bsize) {
   MACROBLOCKD * const xd = &x->e_mbd;
-  TX_TYPE tx_type;
   uint8_t* const src =
       raster_block_offset_uint8(xd, bsize, 0, ib,
                                 x->plane[0].src.buf, x->plane[0].src.stride);
@@ -58,26 +56,17 @@ static void encode_intra4x4block(MACROBLOCK *x, int ib,
 
   assert(ib < (1 << (bwl + bhl)));
 
-  vp9_intra4x4_predict(&x->e_mbd, ib, bsize,
-                       xd->mode_info_context->bmi[ib].as_mode.first,
+  vp9_intra4x4_predict(&x->e_mbd, ib, bsize, DC_PRED,
                        dst, xd->plane[0].dst.stride);
   vp9_subtract_block(4, 4, src_diff, 4 << bwl,
                      src, x->plane[0].src.stride,
                      dst, xd->plane[0].dst.stride);
 
-  tx_type = get_tx_type_4x4(&x->e_mbd, ib);
-  if (tx_type != DCT_DCT) {
-    vp9_short_fht4x4(src_diff, coeff, 4 << bwl, tx_type);
-    x->quantize_b_4x4(x, ib, tx_type, 16);
-    vp9_short_iht4x4_add(BLOCK_OFFSET(xd->plane[0].dqcoeff, ib, 16), dst,
-                         xd->plane[0].dst.stride, tx_type);
-  } else {
-    x->fwd_txm4x4(src_diff, coeff, 8 << bwl);
-    x->quantize_b_4x4(x, ib, tx_type, 16);
-    vp9_inverse_transform_b_4x4_add(&x->e_mbd, xd->plane[0].eobs[ib],
-                                BLOCK_OFFSET(xd->plane[0].dqcoeff, ib, 16),
-                                dst, xd->plane[0].dst.stride);
-  }
+  x->fwd_txm4x4(src_diff, coeff, 8 << bwl);
+  x->quantize_b_4x4(x, ib, DCT_DCT, 16);
+  vp9_inverse_transform_b_4x4_add(&x->e_mbd, xd->plane[0].eobs[ib],
+                              BLOCK_OFFSET(xd->plane[0].dqcoeff, ib, 16),
+                              dst, xd->plane[0].dst.stride);
 }
 
 void vp9_encode_intra16x16mby(VP9_COMMON *const cm, MACROBLOCK *x) {