shithub: libvpx

Download patch

ref: c1814d267a8a713fd781e6f938d37b717786cf7a
parent: ad06c9f051ce1fdd3b289dade25df3c611113345
author: Yaowu Xu <yaowu@google.com>
date: Wed Apr 25 04:33:30 EDT 2012

Merge UVINTRA experiment

The commit merges the UVINTRA experiment and removed the related
macros. The overall effect of the experiment is a small gain (.1%
on derf)

Change-Id: Ia34b3312fb9b5b34c9ba111bf0fa78c6f78ac80b

--- a/vp8/common/entropymode.c
+++ b/vp8/common/entropymode.c
@@ -35,7 +35,6 @@
 static const unsigned int y_mode_cts  [VP8_YMODES] = {
     106,  25, 21, 13, 16, 74};
 
-#if CONFIG_UVINTRA
 static const unsigned int uv_mode_cts [VP8_YMODES] [VP8_UV_MODES] ={
     { 210, 20, 20,  6},
     { 180, 60, 10,  6},
@@ -44,13 +43,9 @@
     { 142, 51, 45, 18}, /* never used */
     { 160, 40, 46, 10},
 };
-#else
-static const unsigned int uv_mode_cts  [VP8_UV_MODES] = { 59483, 13605, 16492, 4230};
-#endif
 
 static const unsigned int i8x8_mode_cts  [VP8_UV_MODES] = {93, 69, 81, 13};
 
-#if CONFIG_UVINTRA
 static const unsigned int kf_uv_mode_cts [VP8_YMODES] [VP8_UV_MODES] ={
     { 180, 34, 34,  8},
     { 132, 74, 40, 10},
@@ -59,9 +54,6 @@
     { 142, 51, 45, 18}, /* never used */
     { 142, 51, 45, 18},
 };
-#else
-static const unsigned int kf_uv_mode_cts[VP8_UV_MODES] = { 5319, 1904, 1703, 674};
-#endif
 
 static const unsigned int bmode_cts[VP8_BINTRAMODES] =
 {
@@ -287,7 +279,6 @@
         256, 1
     );
 #endif
-#if CONFIG_UVINTRA
     {
         int i;
         for (i=0;i<VP8_YMODES;i++)
@@ -302,17 +293,7 @@
                 256, 1);
         }
     }
-#else
-    vp8_tree_probs_from_distribution(
-        VP8_UV_MODES, vp8_uv_mode_encodings, vp8_uv_mode_tree,
-        x->fc.uv_mode_prob, bct, uv_mode_cts,
-        256, 1);
 
-    vp8_tree_probs_from_distribution(
-        VP8_UV_MODES, vp8_uv_mode_encodings, vp8_uv_mode_tree,
-        x->kf_uv_mode_prob, bct, kf_uv_mode_cts,
-        256, 1);
-#endif
     vp8_tree_probs_from_distribution(
         VP8_UV_MODES, vp8_i8x8_mode_encodings, vp8_i8x8_mode_tree,
         x->i8x8_mode_prob, bct, i8x8_mode_cts,
--- a/vp8/common/onyxc_int.h
+++ b/vp8/common/onyxc_int.h
@@ -46,11 +46,7 @@
 {
     vp8_prob bmode_prob [VP8_BINTRAMODES-1];
     vp8_prob ymode_prob [VP8_YMODES-1];   /* interframe intra mode probs */
-#if CONFIG_UVINTRA
     vp8_prob uv_mode_prob [VP8_YMODES][VP8_UV_MODES-1];
-#else
-    vp8_prob uv_mode_prob [VP8_UV_MODES-1];
-#endif
     vp8_prob sub_mv_ref_prob [VP8_SUBMVREFS-1];
     vp8_prob coef_probs [BLOCK_TYPES] [COEF_BANDS] [PREV_COEF_CONTEXTS] [ENTROPY_NODES];
     vp8_prob coef_probs_8x8 [BLOCK_TYPES] [COEF_BANDS] [PREV_COEF_CONTEXTS] [ENTROPY_NODES];
@@ -212,12 +208,7 @@
 #else
     vp8_prob kf_ymode_prob [VP8_YMODES-1];  /* keyframe "" */
 #endif
-#if CONFIG_UVINTRA
     vp8_prob kf_uv_mode_prob[VP8_YMODES] [VP8_UV_MODES-1];
-#else
-    vp8_prob kf_uv_mode_prob [VP8_UV_MODES-1];
-#endif
-
     vp8_prob i8x8_mode_prob [VP8_UV_MODES-1];
 
     vp8_prob prob_intra_coded;
--- a/vp8/decoder/decodemv.c
+++ b/vp8/decoder/decodemv.c
@@ -190,13 +190,8 @@
          }
    }
     else
-#if CONFIG_UVINTRA
         m->mbmi.uv_mode = (MB_PREDICTION_MODE)vp8_read_uv_mode(bc,
             pbi->common.kf_uv_mode_prob[m->mbmi.mode]);
-#else
-        m->mbmi.uv_mode = (MB_PREDICTION_MODE)vp8_read_uv_mode(bc,
-            pbi->common.kf_uv_mode_prob);
-#endif
 #if CONFIG_COMP_INTRA_PRED
     m->mbmi.second_uv_mode = (MB_PREDICTION_MODE) (DC_PRED - 1);
 #endif
@@ -568,20 +563,6 @@
             }
             while (++i < VP8_YMODES-1);
         }
-#if CONFIG_UVINTRA
-        //vp8_read_bit(bc);
-#else
-        if (vp8_read_bit(bc))
-        {
-            int i = 0;
-
-            do
-            {
-                cm->fc.uv_mode_prob[i] = (vp8_prob) vp8_read_literal(bc, 8);
-            }
-            while (++i < VP8_UV_MODES-1);
-        }
-#endif /* CONFIG_UVINTRA */
 #if CONFIG_HIGH_PRECISION_MV
         if (xd->allow_high_precision_mv)
             read_mvcontexts_hp(bc, mvc_hp);
@@ -1041,13 +1022,9 @@
             }
         }
         else
-#if CONFIG_UVINTRA
             mbmi->uv_mode = (MB_PREDICTION_MODE)vp8_read_uv_mode(bc,
                                     pbi->common.fc.uv_mode_prob[mbmi->mode]);
-#else
-            mbmi->uv_mode = (MB_PREDICTION_MODE)vp8_read_uv_mode(bc,
-                                    pbi->common.fc.uv_mode_prob);
-#endif /*CONFIG_UVINTRA*/
+
 #if CONFIG_COMP_INTRA_PRED
         mbmi->second_uv_mode = (MB_PREDICTION_MODE) (DC_PRED - 1);
 #endif
--- a/vp8/encoder/bitstream.c
+++ b/vp8/encoder/bitstream.c
@@ -134,18 +134,6 @@
             Pnew, x->fc.ymode_prob, bct, (unsigned int *)cpi->ymode_count
         );
     }
-    {
-#if CONFIG_UVINTRA
-        //vp8_write_bit(w, 0);
-#else
-        vp8_prob Pnew   [VP8_UV_MODES-1];
-        unsigned int bct [VP8_UV_MODES-1] [2];
-        update_mode(
-            w, VP8_UV_MODES, vp8_uv_mode_encodings, vp8_uv_mode_tree,
-            Pnew, x->fc.uv_mode_prob, bct, (unsigned int *)cpi->uv_mode_count
-        );
-#endif
-    }
 }
 
 void update_skip_probs(VP8_COMP *cpi)
@@ -1009,7 +997,6 @@
                     }
                     else
                     {
-#if CONFIG_UVINTRA
                         write_uv_mode(w, mi->uv_mode,
                                       pc->fc.uv_mode_prob[mode]);
 #ifdef MODE_STATS
@@ -1016,11 +1003,6 @@
                         if(mode!=B_PRED)
                             ++cpi->y_uv_mode_count[mode][mi->uv_mode];
 #endif
-
-#else
-                        write_uv_mode(w, mi->uv_mode, pc->fc.uv_mode_prob);
-#endif /*CONFIG_UVINTRA*/
-
                     }
                 }
                 else
@@ -1362,11 +1344,7 @@
                                     c->i8x8_mode_prob);
                 }
                 else
-#if CONFIG_UVINTRA
                     write_uv_mode(bc, m->mbmi.uv_mode, c->kf_uv_mode_prob[ym]);
-#else
-                    write_uv_mode(bc, m->mbmi.uv_mode, c->kf_uv_mode_prob);
-#endif
 
                 // Next MB
                 mb_row += dy;
--- a/vp8/encoder/modecosts.c
+++ b/vp8/encoder/modecosts.c
@@ -49,17 +49,10 @@
     vp8_cost_tokens(c->mb.mbmode_cost[0],
                     x->kf_ymode_prob, vp8_kf_ymode_tree);
 #endif
-#if CONFIG_UVINTRA
     vp8_cost_tokens(c->mb.intra_uv_mode_cost[1],
                     x->fc.uv_mode_prob[VP8_YMODES-1], vp8_uv_mode_tree);
     vp8_cost_tokens(c->mb.intra_uv_mode_cost[0],
                     x->kf_uv_mode_prob[VP8_YMODES-1], vp8_uv_mode_tree);
-#else
-    vp8_cost_tokens(c->mb.intra_uv_mode_cost[1],
-                    x->fc.uv_mode_prob, vp8_uv_mode_tree);
-    vp8_cost_tokens(c->mb.intra_uv_mode_cost[0],
-                    x->kf_uv_mode_prob, vp8_uv_mode_tree);
-#endif
     vp8_cost_tokens(c->mb.i8x8_mode_costs,
                     x->i8x8_mode_prob,vp8_i8x8_mode_tree);
 
--- a/vp8/encoder/onyx_if.c
+++ b/vp8/encoder/onyx_if.c
@@ -1914,12 +1914,9 @@
 
     cpi->common.error.setjmp = 0;
 
-#if CONFIG_UVINTRA
     vp8_zero(cpi->y_uv_mode_count)
-#endif
 
     return (VP8_PTR) cpi;
-
 }
 
 void vp8_remove_compressor(VP8_PTR *ptr)
@@ -2013,7 +2010,6 @@
                         uv_modes_y[i][1], uv_modes_y[i][2], uv_modes_y[i][3]);
                 }
             }
-#if CONFIG_UVINTRA
             fprintf(f, "Inter Y-UV:\n");
             {
                 int i;
@@ -2023,7 +2019,6 @@
                         cpi->y_uv_mode_count[i][1], cpi->y_uv_mode_count[i][2], cpi->y_uv_mode_count[i][3]);
                 }
             }
-#endif
             fprintf(f, "B: ");
             {
                 int i;
--- a/vp8/encoder/onyx_int.h
+++ b/vp8/encoder/onyx_int.h
@@ -91,11 +91,7 @@
                            [COEF_BANDS][PREV_COEF_CONTEXTS][ENTROPY_NODES];
 
     vp8_prob ymode_prob [VP8_YMODES-1];   /* interframe intra mode probs */
-#if CONFIG_UVINTRA
     vp8_prob uv_mode_prob [VP8_YMODES][VP8_UV_MODES-1];
-#else
-    vp8_prob uv_mode_prob [VP8_UV_MODES-1];
-#endif
 
     int mv_ref_ct[6][4][2];
     int mode_context[6][4];
@@ -522,10 +518,7 @@
     int t4x4_count;
     int t8x8_count;
 
-#if CONFIG_UVINTRA
     int y_uv_mode_count[VP8_YMODES][VP8_UV_MODES];
-#endif
-
     unsigned char *segmentation_map;
 
     // segment threashold for encode breakout