shithub: libvpx

Download patch

ref: 51b6e73a686bedcd6abe4e004f573cd5acbfeccd
parent: 9068bce4e795215b59d0145d560d27ef5bd79295
author: Jingning Han <jingning@google.com>
date: Mon Jun 3 11:33:31 EDT 2013

Make sb intra rd search consistent with encoding

This commit makes operations of the superblock intra coding rate
distortion optimization consistent with those used in the encoding
process. Given the test prediction mode and transform size, the rd
optimizer encodes and reconstructs each transformed block of the
superblock consecutively, then computes the total rate-distortion
costs accosicated with the current superblock to select the coding
decisions.

It achieves coding performance gains:
derf 0.353%
yt   1.111%

Change-Id: I0da2eb7a71361dfb8c1384927fc536b0c2790d07

--- a/vp9/encoder/vp9_rdopt.c
+++ b/vp9/encoder/vp9_rdopt.c
@@ -549,8 +549,12 @@
                                      BLOCK_SIZE_TYPE bsize, TX_SIZE tx_size) {
   MACROBLOCKD *const xd = &x->e_mbd;
   xd->mode_info_context->mbmi.txfm_size = tx_size;
-  vp9_xform_quant_sby(cm, x, bsize);
 
+  if (xd->mode_info_context->mbmi.ref_frame == INTRA_FRAME)
+    vp9_encode_intra_block_y(cm, x, bsize);
+  else
+    vp9_xform_quant_sby(cm, x, bsize);
+
   *distortion = block_error_sby(x, bsize, tx_size == TX_32X32 ? 0 : 2);
   *rate       = rdcost_plane(cm, x, 0, bsize, tx_size);
   *skippable  = vp9_sby_is_skippable(xd, bsize);
@@ -565,7 +569,8 @@
   MACROBLOCKD *xd = &x->e_mbd;
   MB_MODE_INFO *const mbmi = &xd->mode_info_context->mbmi;
 
-  vp9_subtract_sby(x, bs);
+  if (mbmi->ref_frame > INTRA_FRAME)
+    vp9_subtract_sby(x, bs);
 
   if (cpi->speed > 4) {
     if (bs >= BLOCK_SIZE_SB32X32) {
@@ -829,7 +834,6 @@
       bmode_costs = x->y_mode_costs[A][L];
     }
     x->e_mbd.mode_info_context->mbmi.mode = mode;
-    vp9_build_intra_predictors_sby_s(&x->e_mbd, bsize);
 
     super_block_yrd(cpi, x, &this_rate_tokenonly, &this_distortion, &s,
                     bsize, local_txfm_cache);
@@ -2406,6 +2410,7 @@
 
   ctx->skip = 0;
   xd->mode_info_context->mbmi.mode = DC_PRED;
+  xd->mode_info_context->mbmi.ref_frame = INTRA_FRAME;
   err = rd_pick_intra_sby_mode(cpi, x, &rate_y, &rate_y_tokenonly,
                                &dist_y, &y_skip, bsize, txfm_cache);
   mode = xd->mode_info_context->mbmi.mode;
@@ -2736,7 +2741,6 @@
         txfm_cache[i] = txfm_cache[ONLY_4X4];
     } else if (ref_frame == INTRA_FRAME) {
       TX_SIZE uv_tx;
-      vp9_build_intra_predictors_sby_s(xd, bsize);
       super_block_yrd(cpi, x, &rate_y, &distortion_y, &skippable,
                       bsize, txfm_cache);
 
--