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
This commit is contained in:
Yaowu Xu
2011-12-21 12:05:10 -08:00
parent 5920b520a0
commit 4e9b4a1570

View File

@@ -442,17 +442,13 @@ void vp8_update_mode_context(VP8_COMMON *pc)
{
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;
}
}
}
}