shithub: libvpx

Download patch

ref: 4e9b4a1570177148d49de3411a6d6733394fa757
parent: 5920b520a01574525dc279cad37087e604c1f212
author: Yaowu Xu <yaowu@google.com>
date: Wed Dec 21 07:05:10 EST 2011

changed mode_context update strategy

Previously, the mode context is always udpated based on stats of current
frame, when there is no count, 50% is used for both left and right branch.
However, it is observed that with such strategy, a small count or no count
at all can skew the probability distribution significantly. This commmit
changed the mode_context update strategy to prevent small counts from
skewing the probability distributions.

Tests on derf set showed a small gain:  .06% in psnr and .09% in ssim

Change-Id: Ic812e64ae5f70251c170b0717f7b7fa587055488

--- a/vp8/common/entropymode.c
+++ b/vp8/common/entropymode.c
@@ -442,17 +442,13 @@
         {
             int this_prob;
             int count = mv_ref_ct[j][i][0] + mv_ref_ct[j][i][1];
-
-            if (count)
+            /* preventing rare occurances from skewing the probs */
+            if (count>=4)
+            {
                 this_prob = 256 * mv_ref_ct[j][i][0] / count;
-            else
-                this_prob = 128;
-            this_prob = this_prob? (this_prob<255?this_prob:255):1;
-            if (this_prob == 0)
-                this_prob = 1;
-            if (this_prob == 256)
-                this_prob = 255;
-            mode_context[j][i] = this_prob;
+                this_prob = this_prob? (this_prob<255?this_prob:255):1;
+                mode_context[j][i] = this_prob;
+            }
         }
     }
 }
--