| 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 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 58 /* This function assumes prob1 and prob2 are already within [1,255] range. */ | 58 /* This function assumes prob1 and prob2 are already within [1,255] range. */ |
| 59 static INLINE vpx_prob weighted_prob(int prob1, int prob2, int factor) { | 59 static INLINE vpx_prob weighted_prob(int prob1, int prob2, int factor) { |
| 60 return ROUND_POWER_OF_TWO(prob1 * (256 - factor) + prob2 * factor, 8); | 60 return ROUND_POWER_OF_TWO(prob1 * (256 - factor) + prob2 * factor, 8); |
| 61 } | 61 } |
| 62 | 62 |
| 63 static INLINE vpx_prob merge_probs(vpx_prob pre_prob, | 63 static INLINE vpx_prob merge_probs(vpx_prob pre_prob, |
| 64 const unsigned int ct[2], | 64 const unsigned int ct[2], |
| 65 unsigned int count_sat, | 65 unsigned int count_sat, |
| 66 unsigned int max_update_factor) { | 66 unsigned int max_update_factor) { |
| 67 const vpx_prob prob = get_binary_prob(ct[0], ct[1]); | 67 const vpx_prob prob = get_binary_prob(ct[0], ct[1]); |
| 68 const unsigned int count = MIN(ct[0] + ct[1], count_sat); | 68 const unsigned int count = VPXMIN(ct[0] + ct[1], count_sat); |
| 69 const unsigned int factor = max_update_factor * count / count_sat; | 69 const unsigned int factor = max_update_factor * count / count_sat; |
| 70 return weighted_prob(pre_prob, prob, factor); | 70 return weighted_prob(pre_prob, prob, factor); |
| 71 } | 71 } |
| 72 | 72 |
| 73 // MODE_MV_MAX_UPDATE_FACTOR (128) * count / MODE_MV_COUNT_SAT; | 73 // MODE_MV_MAX_UPDATE_FACTOR (128) * count / MODE_MV_COUNT_SAT; |
| 74 static const int count_to_update_factor[MODE_MV_COUNT_SAT + 1] = { | 74 static const int count_to_update_factor[MODE_MV_COUNT_SAT + 1] = { |
| 75 0, 6, 12, 19, 25, 32, 38, 44, 51, 57, 64, | 75 0, 6, 12, 19, 25, 32, 38, 44, 51, 57, 64, |
| 76 70, 76, 83, 89, 96, 102, 108, 115, 121, 128 | 76 70, 76, 83, 89, 96, 102, 108, 115, 121, 128 |
| 77 }; | 77 }; |
| 78 | 78 |
| 79 static INLINE vpx_prob mode_mv_merge_probs(vpx_prob pre_prob, | 79 static INLINE vpx_prob mode_mv_merge_probs(vpx_prob pre_prob, |
| 80 const unsigned int ct[2]) { | 80 const unsigned int ct[2]) { |
| 81 const unsigned int den = ct[0] + ct[1]; | 81 const unsigned int den = ct[0] + ct[1]; |
| 82 if (den == 0) { | 82 if (den == 0) { |
| 83 return pre_prob; | 83 return pre_prob; |
| 84 } else { | 84 } else { |
| 85 const unsigned int count = MIN(den, MODE_MV_COUNT_SAT); | 85 const unsigned int count = VPXMIN(den, MODE_MV_COUNT_SAT); |
| 86 const unsigned int factor = count_to_update_factor[count]; | 86 const unsigned int factor = count_to_update_factor[count]; |
| 87 const vpx_prob prob = | 87 const vpx_prob prob = |
| 88 clip_prob(((int64_t)(ct[0]) * 256 + (den >> 1)) / den); | 88 clip_prob(((int64_t)(ct[0]) * 256 + (den >> 1)) / den); |
| 89 return weighted_prob(pre_prob, prob, factor); | 89 return weighted_prob(pre_prob, prob, factor); |
| 90 } | 90 } |
| 91 } | 91 } |
| 92 | 92 |
| 93 void vpx_tree_merge_probs(const vpx_tree_index *tree, const vpx_prob *pre_probs, | 93 void vpx_tree_merge_probs(const vpx_tree_index *tree, const vpx_prob *pre_probs, |
| 94 const unsigned int *counts, vpx_prob *probs); | 94 const unsigned int *counts, vpx_prob *probs); |
| 95 | 95 |
| 96 | 96 |
| 97 DECLARE_ALIGNED(16, extern const uint8_t, vpx_norm[256]); | 97 DECLARE_ALIGNED(16, extern const uint8_t, vpx_norm[256]); |
| 98 | 98 |
| 99 #ifdef __cplusplus | 99 #ifdef __cplusplus |
| 100 } // extern "C" | 100 } // extern "C" |
| 101 #endif | 101 #endif |
| 102 | 102 |
| 103 #endif // VPX_DSP_PROB_H_ | 103 #endif // VPX_DSP_PROB_H_ |
| OLD | NEW |