Unified approach for backward probability update.

Replacing update_mode_probs() and adapt_probs() with tree_merge_probs().

Change-Id: I50b2c968d67c9265f5216c700cbeba25fb014654
This commit is contained in:
Dmitry Kovalev
2013-11-04 16:12:29 -08:00
parent dde8069e57
commit c622e1d18f
3 changed files with 88 additions and 80 deletions

View File

@@ -91,5 +91,37 @@ static INLINE vp9_prob merge_probs(vp9_prob pre_prob,
return weighted_prob(pre_prob, prob, factor);
}
static unsigned int tree_merge_probs_impl(unsigned int i,
const vp9_tree_index *tree,
const vp9_prob *pre_probs,
const unsigned int *counts,
unsigned int count_sat,
unsigned int max_update_factor,
vp9_prob *probs) {
const int l = tree[i];
const unsigned int left_count = (l <= 0)
? counts[-l]
: tree_merge_probs_impl(l, tree, pre_probs, counts,
count_sat, max_update_factor, probs);
const int r = tree[i + 1];
const unsigned int right_count = (r <= 0)
? counts[-r]
: tree_merge_probs_impl(r, tree, pre_probs, counts,
count_sat, max_update_factor, probs);
const unsigned int ct[2] = { left_count, right_count };
probs[i >> 1] = merge_probs(pre_probs[i >> 1], ct,
count_sat, max_update_factor);
return left_count + right_count;
}
static void tree_merge_probs(const vp9_tree_index *tree,
const vp9_prob *pre_probs,
const unsigned int *counts, int offset,
unsigned int count_sat,
unsigned int max_update_factor, vp9_prob *probs) {
tree_merge_probs_impl(0, tree, pre_probs, &counts[-offset],
count_sat, max_update_factor, probs);
}
#endif // VP9_COMMON_VP9_TREECODER_H_