| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (c) 2013 The WebM project authors. All Rights Reserved. | 2 * Copyright (c) 2013 The WebM project authors. All Rights Reserved. |
| 3 * | 3 * |
| 4 * Use of this source code is governed by a BSD-style license | 4 * Use of this source code is governed by a BSD-style license |
| 5 * that can be found in the LICENSE file in the root of the source | 5 * that can be found in the LICENSE file in the root of the source |
| 6 * tree. An additional intellectual property rights grant can be found | 6 * tree. An additional intellectual property rights grant can be found |
| 7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
| 8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
| 9 */ | 9 */ |
| 10 | 10 |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 72 static INLINE vp9_prob merge_probs(vp9_prob pre_prob, | 72 static INLINE vp9_prob merge_probs(vp9_prob pre_prob, |
| 73 const unsigned int ct[2], | 73 const unsigned int ct[2], |
| 74 unsigned int count_sat, | 74 unsigned int count_sat, |
| 75 unsigned int max_update_factor) { | 75 unsigned int max_update_factor) { |
| 76 const vp9_prob prob = get_binary_prob(ct[0], ct[1]); | 76 const vp9_prob prob = get_binary_prob(ct[0], ct[1]); |
| 77 const unsigned int count = MIN(ct[0] + ct[1], count_sat); | 77 const unsigned int count = MIN(ct[0] + ct[1], count_sat); |
| 78 const unsigned int factor = max_update_factor * count / count_sat; | 78 const unsigned int factor = max_update_factor * count / count_sat; |
| 79 return weighted_prob(pre_prob, prob, factor); | 79 return weighted_prob(pre_prob, prob, factor); |
| 80 } | 80 } |
| 81 | 81 |
| 82 static unsigned int tree_merge_probs_impl(unsigned int i, | 82 void vp9_tree_merge_probs(const vp9_tree_index *tree, const vp9_prob *pre_probs, |
| 83 const vp9_tree_index *tree, | 83 const unsigned int *counts, unsigned int count_sat, |
| 84 const vp9_prob *pre_probs, | 84 unsigned int max_update_factor, vp9_prob *probs); |
| 85 const unsigned int *counts, | |
| 86 unsigned int count_sat, | |
| 87 unsigned int max_update_factor, | |
| 88 vp9_prob *probs) { | |
| 89 const int l = tree[i]; | |
| 90 const unsigned int left_count = (l <= 0) | |
| 91 ? counts[-l] | |
| 92 : tree_merge_probs_impl(l, tree, pre_probs, counts, | |
| 93 count_sat, max_update_factor, probs); | |
| 94 const int r = tree[i + 1]; | |
| 95 const unsigned int right_count = (r <= 0) | |
| 96 ? counts[-r] | |
| 97 : tree_merge_probs_impl(r, tree, pre_probs, counts, | |
| 98 count_sat, max_update_factor, probs); | |
| 99 const unsigned int ct[2] = { left_count, right_count }; | |
| 100 probs[i >> 1] = merge_probs(pre_probs[i >> 1], ct, | |
| 101 count_sat, max_update_factor); | |
| 102 return left_count + right_count; | |
| 103 } | |
| 104 | 85 |
| 105 static void tree_merge_probs(const vp9_tree_index *tree, | |
| 106 const vp9_prob *pre_probs, | |
| 107 const unsigned int *counts, | |
| 108 unsigned int count_sat, | |
| 109 unsigned int max_update_factor, vp9_prob *probs) { | |
| 110 tree_merge_probs_impl(0, tree, pre_probs, counts, | |
| 111 count_sat, max_update_factor, probs); | |
| 112 } | |
| 113 | 86 |
| 114 DECLARE_ALIGNED(16, extern const uint8_t, vp9_norm[256]); | 87 DECLARE_ALIGNED(16, extern const uint8_t, vp9_norm[256]); |
| 115 | 88 |
| 116 #ifdef __cplusplus | 89 #ifdef __cplusplus |
| 117 } // extern "C" | 90 } // extern "C" |
| 118 #endif | 91 #endif |
| 119 | 92 |
| 120 #endif // VP9_COMMON_VP9_PROB_H_ | 93 #endif // VP9_COMMON_VP9_PROB_H_ |
| OLD | NEW |