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 |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
48 2, 6, // 0 = LOW_VAL | 48 2, 6, // 0 = LOW_VAL |
49 -TWO_TOKEN, 4, // 1 = TWO | 49 -TWO_TOKEN, 4, // 1 = TWO |
50 -THREE_TOKEN, -FOUR_TOKEN, // 2 = THREE | 50 -THREE_TOKEN, -FOUR_TOKEN, // 2 = THREE |
51 8, 10, // 3 = HIGH_LOW | 51 8, 10, // 3 = HIGH_LOW |
52 -CATEGORY1_TOKEN, -CATEGORY2_TOKEN, // 4 = CAT_ONE | 52 -CATEGORY1_TOKEN, -CATEGORY2_TOKEN, // 4 = CAT_ONE |
53 12, 14, // 5 = CAT_THREEFOUR | 53 12, 14, // 5 = CAT_THREEFOUR |
54 -CATEGORY3_TOKEN, -CATEGORY4_TOKEN, // 6 = CAT_THREE | 54 -CATEGORY3_TOKEN, -CATEGORY4_TOKEN, // 6 = CAT_THREE |
55 -CATEGORY5_TOKEN, -CATEGORY6_TOKEN // 7 = CAT_FIVE | 55 -CATEGORY5_TOKEN, -CATEGORY6_TOKEN // 7 = CAT_FIVE |
56 }; | 56 }; |
57 | 57 |
58 static const vp9_prob Pcat1[] = { 159}; | |
59 static const vp9_prob Pcat2[] = { 165, 145}; | |
60 static const vp9_prob Pcat3[] = { 173, 148, 140}; | |
61 static const vp9_prob Pcat4[] = { 176, 155, 140, 135}; | |
62 static const vp9_prob Pcat5[] = { 180, 157, 141, 134, 130}; | |
63 static const vp9_prob Pcat6[] = { | |
64 254, 254, 254, 252, 249, 243, 230, 196, 177, 153, 140, 133, 130, 129 | |
65 }; | |
66 | |
67 static vp9_tree_index cat1[2], cat2[4], cat3[6], cat4[8], cat5[10], cat6[28]; | 58 static vp9_tree_index cat1[2], cat2[4], cat3[6], cat4[8], cat5[10], cat6[28]; |
68 | 59 |
69 static void init_bit_tree(vp9_tree_index *p, int n) { | 60 static void init_bit_tree(vp9_tree_index *p, int n) { |
70 int i = 0; | 61 int i = 0; |
71 | 62 |
72 while (++i < n) { | 63 while (++i < n) { |
73 p[0] = p[1] = i << 1; | 64 p[0] = p[1] = i << 1; |
74 p += 2; | 65 p += 2; |
75 } | 66 } |
76 | 67 |
77 p[0] = p[1] = 0; | 68 p[0] = p[1] = 0; |
78 } | 69 } |
79 | 70 |
80 static void init_bit_trees() { | 71 static void init_bit_trees() { |
81 init_bit_tree(cat1, 1); | 72 init_bit_tree(cat1, 1); |
82 init_bit_tree(cat2, 2); | 73 init_bit_tree(cat2, 2); |
83 init_bit_tree(cat3, 3); | 74 init_bit_tree(cat3, 3); |
84 init_bit_tree(cat4, 4); | 75 init_bit_tree(cat4, 4); |
85 init_bit_tree(cat5, 5); | 76 init_bit_tree(cat5, 5); |
86 init_bit_tree(cat6, 14); | 77 init_bit_tree(cat6, 14); |
87 } | 78 } |
88 | 79 |
89 const vp9_extra_bit vp9_extra_bits[ENTROPY_TOKENS] = { | 80 const vp9_extra_bit vp9_extra_bits[ENTROPY_TOKENS] = { |
90 {0, 0, 0, 0}, // ZERO_TOKEN | 81 {0, 0, 0, 0}, // ZERO_TOKEN |
91 {0, 0, 0, 1}, // ONE_TOKEN | 82 {0, 0, 0, 1}, // ONE_TOKEN |
92 {0, 0, 0, 2}, // TWO_TOKEN | 83 {0, 0, 0, 2}, // TWO_TOKEN |
93 {0, 0, 0, 3}, // THREE_TOKEN | 84 {0, 0, 0, 3}, // THREE_TOKEN |
94 {0, 0, 0, 4}, // FOUR_TOKEN | 85 {0, 0, 0, 4}, // FOUR_TOKEN |
95 {cat1, Pcat1, 1, 5}, // CATEGORY1_TOKEN | 86 {cat1, vp9_cat1_prob, 1, CAT1_MIN_VAL}, // CATEGORY1_TOKEN |
96 {cat2, Pcat2, 2, 7}, // CATEGORY2_TOKEN | 87 {cat2, vp9_cat2_prob, 2, CAT2_MIN_VAL}, // CATEGORY2_TOKEN |
97 {cat3, Pcat3, 3, 11}, // CATEGORY3_TOKEN | 88 {cat3, vp9_cat3_prob, 3, CAT3_MIN_VAL}, // CATEGORY3_TOKEN |
98 {cat4, Pcat4, 4, 19}, // CATEGORY4_TOKEN | 89 {cat4, vp9_cat4_prob, 4, CAT4_MIN_VAL}, // CATEGORY4_TOKEN |
99 {cat5, Pcat5, 5, 35}, // CATEGORY5_TOKEN | 90 {cat5, vp9_cat5_prob, 5, CAT5_MIN_VAL}, // CATEGORY5_TOKEN |
100 {cat6, Pcat6, 14, 67}, // CATEGORY6_TOKEN | 91 {cat6, vp9_cat6_prob, 14, CAT6_MIN_VAL}, // CATEGORY6_TOKEN |
101 {0, 0, 0, 0} // EOB_TOKEN | 92 {0, 0, 0, 0} // EOB_TOKEN |
102 }; | 93 }; |
103 | 94 |
104 struct vp9_token vp9_coef_encodings[ENTROPY_TOKENS]; | 95 struct vp9_token vp9_coef_encodings[ENTROPY_TOKENS]; |
105 | 96 |
106 void vp9_coef_tree_initialize() { | 97 void vp9_coef_tree_initialize() { |
107 init_bit_trees(); | 98 init_bit_trees(); |
108 vp9_tokens_from_tree(vp9_coef_encodings, vp9_coef_tree); | 99 vp9_tokens_from_tree(vp9_coef_encodings, vp9_coef_tree); |
109 } | 100 } |
110 | 101 |
111 void vp9_tokenize_initialize() { | 102 void vp9_tokenize_initialize() { |
(...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
327 } | 318 } |
328 | 319 |
329 if (!dry_run) { | 320 if (!dry_run) { |
330 cm->counts.skip[ctx][0] += skip_inc; | 321 cm->counts.skip[ctx][0] += skip_inc; |
331 vp9_foreach_transformed_block(xd, bsize, tokenize_b, &arg); | 322 vp9_foreach_transformed_block(xd, bsize, tokenize_b, &arg); |
332 } else { | 323 } else { |
333 vp9_foreach_transformed_block(xd, bsize, set_entropy_context_b, &arg); | 324 vp9_foreach_transformed_block(xd, bsize, set_entropy_context_b, &arg); |
334 *t = t_backup; | 325 *t = t_backup; |
335 } | 326 } |
336 } | 327 } |
OLD | NEW |