shithub: libvpx

Download patch

ref: 2b4cd4cc015b35ae805cc14b5e1665263e3d8098
parent: 737179f275cc4384f587af5f391de5968368c63a
author: Yaowu Xu <yaowu@google.com>
date: Fri Feb 17 10:52:30 EST 2012

Fixed skippable evaluation in mode decision

Yunqing fixed an oddity in UVIntra skippable evaluation for stable
branch, which brought up the fact that the evaluation is broken.
The issue was that for MBs with 2nd order block, the eob for 1st
order blocks is set at 1. The previous evaluation did not take that
into account. This commit intend to fix the problem. The commit also
absorbed Yunqing's fix for UVIntra skippable evalution.

Test on hd showed some good gains in combination with LPF bias fix:
http://www.corp.google.com/~yaowu/no_crawl/LPFBias_FixSkip.html
(avg psnr: .34%, glb psnr: .32%, ssim: .22%)

Change-Id: I36af11c8ef7f643e8ff46da7bf3a167b437039d4

--- a/vp8/encoder/rdopt.c
+++ b/vp8/encoder/rdopt.c
@@ -2270,6 +2270,11 @@
     int best_hybrid_rd = INT_MAX;
     int rate2, distortion2;
     int uv_intra_rate, uv_intra_distortion, uv_intra_rate_tokenonly;
+    int uv_intra_tteob = 0;
+#if CONFIG_T8X8
+    int uv_intra_rate_8x8, uv_intra_distortion_8x8, uv_intra_rate_tokenonly_8x8;
+    int uv_intra_tteob_8x8=0;
+#endif
     int rate_y, UNINITIALIZED_IS_SAFE(rate_uv);
     int distortion_uv;
     int best_yrd = INT_MAX;
@@ -2357,7 +2362,13 @@
     x->e_mbd.mode_info_context->mbmi.ref_frame = INTRA_FRAME;
     rd_pick_intra_mbuv_mode(cpi, x, &uv_intra_rate, &uv_intra_rate_tokenonly, &uv_intra_distortion);
     uv_intra_mode = x->e_mbd.mode_info_context->mbmi.uv_mode;
+    for(i=16; i<24; i++)
+        uv_intra_tteob += x->e_mbd.block[i].eob;
 
+#if CONFIG_T8X8
+        uv_intra_tteob_8x8 = uv_intra_tteob;
+#endif
+
     // Get estimates of reference frame costs for each reference frame
     // that depend on the current prediction etc.
     vp8_estimate_ref_frame_costs( cpi, ref_costs );
@@ -2953,12 +2964,43 @@
             if (cpi->common.mb_no_coeff_skip)
             {
                 int tteob;
-
+                int has_y2_block = ( this_mode!=SPLITMV
+                                    &&this_mode!=B_PRED
+                                    &&this_mode!=I8X8_PRED);
                 tteob = 0;
+                if(has_y2_block)
+                    tteob += x->e_mbd.block[24].eob;
 
-                for (i = 0; i <= 24; i++)
+#if CONFIG_T8X8
+                if(cpi->common.txfm_mode ==ALLOW_8X8 && has_y2_block)
                 {
-                    tteob += x->e_mbd.block[i].eob;
+                    for (i = 0; i < 16; i+=4)
+                        tteob += (x->e_mbd.block[i].eob > 1);
+                    if(x->e_mbd.mode_info_context->mbmi.ref_frame!=INTRA_FRAME)
+                    {
+                        tteob += x->e_mbd.block[16].eob;
+                        tteob += x->e_mbd.block[20].eob;
+                    }
+                    else
+                    {
+                        tteob += uv_intra_tteob_8x8;
+                    }
+                }
+                else
+#endif
+                {
+                    for (i = 0; i < 16; i++)
+                        tteob += (x->e_mbd.block[i].eob > has_y2_block);
+
+                    if(x->e_mbd.mode_info_context->mbmi.ref_frame!=INTRA_FRAME)
+                    {
+                        for (i = 16; i < 24; i++)
+                            tteob += x->e_mbd.block[i].eob;
+                    }
+                    else
+                    {
+                        tteob += uv_intra_tteob;
+                    }
                 }
 
                 if (tteob == 0)