OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2010 The WebM project authors. All Rights Reserved. | 2 * Copyright (c) 2010 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 |
11 #ifndef VP9_COMMON_VP9_TREECODER_H_ | 11 #ifndef VP9_COMMON_VP9_TREECODER_H_ |
12 #define VP9_COMMON_VP9_TREECODER_H_ | 12 #define VP9_COMMON_VP9_TREECODER_H_ |
13 | 13 |
14 #include "./vpx_config.h" | 14 #include "./vpx_config.h" |
15 #include "vpx/vpx_integer.h" | 15 #include "vpx/vpx_integer.h" |
16 #include "vp9/common/vp9_common.h" | 16 #include "vp9/common/vp9_common.h" |
17 | 17 |
18 typedef uint8_t vp9_prob; | 18 typedef uint8_t vp9_prob; |
19 | 19 |
20 #define vp9_prob_half ((vp9_prob) 128) | 20 #define vp9_prob_half ((vp9_prob) 128) |
21 | 21 |
22 typedef int8_t vp9_tree_index; | 22 typedef int8_t vp9_tree_index; |
23 | 23 |
| 24 #define TREE_SIZE(leaf_count) (2 * (leaf_count) - 2) |
| 25 |
24 #define vp9_complement(x) (255 - x) | 26 #define vp9_complement(x) (255 - x) |
25 | 27 |
26 /* We build coding trees compactly in arrays. | 28 /* We build coding trees compactly in arrays. |
27 Each node of the tree is a pair of vp9_tree_indices. | 29 Each node of the tree is a pair of vp9_tree_indices. |
28 Array index often references a corresponding probability table. | 30 Array index often references a corresponding probability table. |
29 Index <= 0 means done encoding/decoding and value = -Index, | 31 Index <= 0 means done encoding/decoding and value = -Index, |
30 Index > 0 means need another bit, specification at index. | 32 Index > 0 means need another bit, specification at index. |
31 Nonnegative indices are always even; processing begins at node 0. */ | 33 Nonnegative indices are always even; processing begins at node 0. */ |
32 | 34 |
33 typedef const vp9_tree_index vp9_tree[], *vp9_tree_p; | 35 typedef const vp9_tree_index vp9_tree[]; |
34 | 36 |
35 struct vp9_token { | 37 struct vp9_token { |
36 int value; | 38 int value; |
37 int len; | 39 int len; |
38 }; | 40 }; |
39 | 41 |
40 /* Construct encoding array from tree. */ | 42 /* Construct encoding array from tree. */ |
41 | 43 |
42 void vp9_tokens_from_tree(struct vp9_token*, vp9_tree); | 44 void vp9_tokens_from_tree(struct vp9_token*, vp9_tree); |
43 void vp9_tokens_from_tree_offset(struct vp9_token*, vp9_tree, int offset); | 45 void vp9_tokens_from_tree_offset(struct vp9_token*, vp9_tree, int offset); |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
91 static INLINE vp9_prob merge_probs2(vp9_prob pre_prob, | 93 static INLINE vp9_prob merge_probs2(vp9_prob pre_prob, |
92 const unsigned int ct[2], | 94 const unsigned int ct[2], |
93 unsigned int count_sat, | 95 unsigned int count_sat, |
94 unsigned int max_update_factor) { | 96 unsigned int max_update_factor) { |
95 return merge_probs(pre_prob, get_binary_prob(ct[0], ct[1]), ct, count_sat, | 97 return merge_probs(pre_prob, get_binary_prob(ct[0], ct[1]), ct, count_sat, |
96 max_update_factor); | 98 max_update_factor); |
97 } | 99 } |
98 | 100 |
99 | 101 |
100 #endif // VP9_COMMON_VP9_TREECODER_H_ | 102 #endif // VP9_COMMON_VP9_TREECODER_H_ |
OLD | NEW |