diff options
author | Deb Mukherjee <debargha@google.com> | 2013-06-04 15:25:16 -0700 |
---|---|---|
committer | Deb Mukherjee <debargha@google.com> | 2013-06-05 10:11:52 -0700 |
commit | 83885235a7398045302a62f9afccd0c4b27324ab (patch) | |
tree | af3aa7d0fef3a3f7a5c5481a11d6009930a4323d /vp9/common/vp9_entropymode.c | |
parent | 513d326d75d4616c44a8a188ddfa2495d485b344 (diff) | |
download | libvpx-83885235a7398045302a62f9afccd0c4b27324ab.tar libvpx-83885235a7398045302a62f9afccd0c4b27324ab.tar.gz libvpx-83885235a7398045302a62f9afccd0c4b27324ab.tar.bz2 libvpx-83885235a7398045302a62f9afccd0c4b27324ab.zip |
Clean-ups on switchable interpolation and mv_ref
Adds backward adaptation and differential forward updates of switchable
interpolation filter probabilities. Also adds some cosmetic cleanups
and minor fixes on mv_ref probabilities.
derfraw300: +0.353% (with most coming from switchable interp changes)
Change-Id: Ie2718be73528c945fd0d80cfd63ca2d9cb3032de
Diffstat (limited to 'vp9/common/vp9_entropymode.c')
-rw-r--r-- | vp9/common/vp9_entropymode.c | 50 |
1 files changed, 31 insertions, 19 deletions
diff --git a/vp9/common/vp9_entropymode.c b/vp9/common/vp9_entropymode.c index 0274b4d05..516e82a68 100644 --- a/vp9/common/vp9_entropymode.c +++ b/vp9/common/vp9_entropymode.c @@ -169,29 +169,30 @@ void vp9_entropy_mode_init() { } void vp9_init_mode_contexts(VP9_COMMON *pc) { - vpx_memset(pc->fc.mv_ref_ct, 0, sizeof(pc->fc.mv_ref_ct)); - vpx_memcpy(pc->fc.vp9_mode_contexts, - vp9_default_mode_contexts, - sizeof(vp9_default_mode_contexts)); + vpx_memset(pc->fc.inter_mode_counts, 0, sizeof(pc->fc.inter_mode_counts)); + vpx_memcpy(pc->fc.inter_mode_probs, + vp9_default_inter_mode_probs, + sizeof(vp9_default_inter_mode_probs)); } void vp9_accum_mv_refs(VP9_COMMON *pc, MB_PREDICTION_MODE m, const int context) { - unsigned int (*mv_ref_ct)[VP9_MVREFS - 1][2] = pc->fc.mv_ref_ct; + unsigned int (*inter_mode_counts)[VP9_MVREFS - 1][2] = + pc->fc.inter_mode_counts; if (m == ZEROMV) { - ++mv_ref_ct[context][0][0]; + ++inter_mode_counts[context][0][0]; } else { - ++mv_ref_ct[context][0][1]; + ++inter_mode_counts[context][0][1]; if (m == NEARESTMV) { - ++mv_ref_ct[context][1][0]; + ++inter_mode_counts[context][1][0]; } else { - ++mv_ref_ct[context][1][1]; + ++inter_mode_counts[context][1][1]; if (m == NEARMV) { - ++mv_ref_ct[context][2][0]; + ++inter_mode_counts[context][2][0]; } else { - ++mv_ref_ct[context][2][1]; + ++inter_mode_counts[context][2][1]; } } } @@ -201,19 +202,21 @@ void vp9_accum_mv_refs(VP9_COMMON *pc, #define MVREF_MAX_UPDATE_FACTOR 128 void vp9_adapt_mode_context(VP9_COMMON *pc) { int i, j; - unsigned int (*mv_ref_ct)[VP9_MVREFS - 1][2] = pc->fc.mv_ref_ct; - int (*mode_context)[VP9_MVREFS - 1] = pc->fc.vp9_mode_contexts; + unsigned int (*inter_mode_counts)[VP9_MVREFS - 1][2] = + pc->fc.inter_mode_counts; + vp9_prob (*mode_context)[VP9_MVREFS - 1] = pc->fc.inter_mode_probs; for (j = 0; j < INTER_MODE_CONTEXTS; j++) { for (i = 0; i < VP9_MVREFS - 1; i++) { - int count = mv_ref_ct[j][i][0] + mv_ref_ct[j][i][1], factor; - + int count = inter_mode_counts[j][i][0] + inter_mode_counts[j][i][1]; + int factor; count = count > MVREF_COUNT_SAT ? MVREF_COUNT_SAT : count; factor = (MVREF_MAX_UPDATE_FACTOR * count / MVREF_COUNT_SAT); - mode_context[j][i] = weighted_prob(pc->fc.vp9_mode_contexts[j][i], - get_binary_prob(mv_ref_ct[j][i][0], - mv_ref_ct[j][i][1]), - factor); + mode_context[j][i] = weighted_prob( + pc->fc.pre_inter_mode_probs[j][i], + get_binary_prob(inter_mode_counts[j][i][0], + inter_mode_counts[j][i][1]), + factor); } } } @@ -290,6 +293,15 @@ void vp9_adapt_mode_probs(VP9_COMMON *cm) { update_mode_probs(PARTITION_TYPES, vp9_partition_tree, fc->partition_counts[i], fc->pre_partition_prob[i], fc->partition_prob[i], 0); + + if (cm->mcomp_filter_type == SWITCHABLE) { + for (i = 0; i <= VP9_SWITCHABLE_FILTERS; i++) { + update_mode_probs(VP9_SWITCHABLE_FILTERS, vp9_switchable_interp_tree, + fc->switchable_interp_count[i], + fc->pre_switchable_interp_prob[i], + fc->switchable_interp_prob[i], 0); + } + } } static void set_default_lf_deltas(MACROBLOCKD *xd) { |