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 #include "vp9/common/vp9_entropy.h" | 11 #include "vp9/common/vp9_entropy.h" |
12 #include "vp9/common/vp9_blockd.h" | 12 #include "vp9/common/vp9_blockd.h" |
13 #include "vp9/common/vp9_onyxc_int.h" | 13 #include "vp9/common/vp9_onyxc_int.h" |
14 #include "vp9/common/vp9_entropymode.h" | 14 #include "vp9/common/vp9_entropymode.h" |
15 #include "vpx_mem/vpx_mem.h" | 15 #include "vpx_mem/vpx_mem.h" |
16 #include "vpx/vpx_integer.h" | 16 #include "vpx/vpx_integer.h" |
17 | 17 |
18 #define MODEL_NODES (ENTROPY_NODES - UNCONSTRAINED_NODES) | |
19 | 18 |
20 DECLARE_ALIGNED(16, const uint8_t, vp9_norm[256]) = { | 19 DECLARE_ALIGNED(16, const uint8_t, vp9_norm[256]) = { |
21 0, 7, 6, 6, 5, 5, 5, 5, 4, 4, 4, 4, 4, 4, 4, 4, | 20 0, 7, 6, 6, 5, 5, 5, 5, 4, 4, 4, 4, 4, 4, 4, 4, |
22 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, | 21 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, |
23 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, | 22 2, 2, 2,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0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
34 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, | 33 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
35 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, | 34 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
36 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 | 35 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 |
37 }; | 36 }; |
38 | 37 |
39 DECLARE_ALIGNED(16, const uint8_t, | 38 DECLARE_ALIGNED(16, const uint8_t, vp9_coefband_trans_8x8plus[1024]) = { |
40 vp9_coefband_trans_8x8plus[MAXBAND_INDEX + 1]) = { | |
41 0, 1, 1, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, | 39 0, 1, 1, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, |
42 4, 4, 4, 4, 4, 5 | 40 4, 4, 4, 4, 4, 5, |
| 41 // beyond MAXBAND_INDEX+1 all values are filled as 5 |
| 42 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, |
| 43 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, |
| 44 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, |
| 45 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, |
| 46 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, |
| 47 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, |
| 48 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, |
| 49 5, 5, 5, 5, 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+ 1]) = { | |
47 0, 1, 1, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 5, 5, 5, | 108 0, 1, 1, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 5, 5, 5, |
48 5, 5, 5, 5, 5, 5 | |
49 }; | 109 }; |
50 | 110 |
51 DECLARE_ALIGNED(16, const uint8_t, vp9_pt_energy_class[MAX_ENTROPY_TOKENS]) = { | 111 DECLARE_ALIGNED(16, const uint8_t, vp9_pt_energy_class[ENTROPY_TOKENS]) = { |
52 0, 1, 2, 3, 3, 4, 4, 5, 5, 5, 5, 5 | 112 0, 1, 2, 3, 3, 4, 4, 5, 5, 5, 5, 5 |
53 }; | 113 }; |
54 | 114 |
55 | 115 const vp9_tree_index vp9_coefmodel_tree[TREE_SIZE(UNCONSTRAINED_NODES + 1)] = { |
56 | 116 -EOB_MODEL_TOKEN, 2, |
57 /* Array indices are identical to previously-existing CONTEXT_NODE indices */ | 117 -ZERO_TOKEN, 4, |
58 | |
59 const vp9_tree_index vp9_coef_tree[TREE_SIZE(MAX_ENTROPY_TOKENS)] = { | |
60 -DCT_EOB_TOKEN, 2, /* 0 = EOB */ | |
61 -ZERO_TOKEN, 4, /* 1 = ZERO */ | |
62 -ONE_TOKEN, 6, /* 2 = ONE */ | |
63 8, 12, /* 3 = LOW_VAL */ | |
64 -TWO_TOKEN, 10, /* 4 = TWO */ | |
65 -THREE_TOKEN, -FOUR_TOKEN, /* 5 = THREE */ | |
66 14, 16, /* 6 = HIGH_LOW */ | |
67 -DCT_VAL_CATEGORY1, -DCT_VAL_CATEGORY2, /* 7 = CAT_ONE */ | |
68 18, 20, /* 8 = CAT_THREEFOUR */ | |
69 -DCT_VAL_CATEGORY3, -DCT_VAL_CATEGORY4, /* 9 = CAT_THREE */ | |
70 -DCT_VAL_CATEGORY5, -DCT_VAL_CATEGORY6 /* 10 = CAT_FIVE */ | |
71 }; | |
72 | |
73 struct vp9_token vp9_coef_encodings[MAX_ENTROPY_TOKENS]; | |
74 | |
75 /* Trees for extra bits. Probabilities are constant and | |
76 do not depend on previously encoded bits */ | |
77 | |
78 static const vp9_prob Pcat1[] = { 159}; | |
79 static const vp9_prob Pcat2[] = { 165, 145}; | |
80 static const vp9_prob Pcat3[] = { 173, 148, 140}; | |
81 static const vp9_prob Pcat4[] = { 176, 155, 140, 135}; | |
82 static const vp9_prob Pcat5[] = { 180, 157, 141, 134, 130}; | |
83 static const vp9_prob Pcat6[] = { | |
84 254, 254, 254, 252, 249, 243, 230, 196, 177, 153, 140, 133, 130, 129 | |
85 }; | |
86 | |
87 const vp9_tree_index vp9_coefmodel_tree[6] = { | |
88 -DCT_EOB_MODEL_TOKEN, 2, /* 0 = EOB */ | |
89 -ZERO_TOKEN, 4, /* 1 = ZERO */ | |
90 -ONE_TOKEN, -TWO_TOKEN, | 118 -ONE_TOKEN, -TWO_TOKEN, |
91 }; | 119 }; |
92 | 120 |
93 // Model obtained from a 2-sided zero-centerd distribuition derived | 121 // Model obtained from a 2-sided zero-centerd distribuition derived |
94 // from a Pareto distribution. The cdf of the distribution is: | 122 // from a Pareto distribution. The cdf of the distribution is: |
95 // cdf(x) = 0.5 + 0.5 * sgn(x) * [1 - {alpha/(alpha + |x|)} ^ beta] | 123 // cdf(x) = 0.5 + 0.5 * sgn(x) * [1 - {alpha/(alpha + |x|)} ^ beta] |
96 // | 124 // |
97 // For a given beta and a given probablity of the 1-node, the alpha | 125 // For a given beta and a given probablity of the 1-node, the alpha |
98 // is first solved, and then the {alpha, beta} pair is used to generate | 126 // is first solved, and then the {alpha, beta} pair is used to generate |
99 // the probabilities for the rest of the nodes. | 127 // the probabilities for the rest of the nodes. |
100 | 128 |
101 // beta = 8 | 129 // beta = 8 |
102 static const vp9_prob modelcoefprobs_pareto8[COEFPROB_MODELS][MODEL_NODES] = { | 130 |
| 131 // Every odd line in this table can be generated from the even lines |
| 132 // by averaging : |
| 133 // vp9_pareto8_full[l][node] = (vp9_pareto8_full[l-1][node] + |
| 134 // vp9_pareto8_full[l+1][node] ) >> 1; |
| 135 const vp9_prob vp9_pareto8_full[COEFF_PROB_MODELS][MODEL_NODES] = { |
103 { 3, 86, 128, 6, 86, 23, 88, 29}, | 136 { 3, 86, 128, 6, 86, 23, 88, 29}, |
| 137 { 6, 86, 128, 11, 87, 42, 91, 52}, |
104 { 9, 86, 129, 17, 88, 61, 94, 76}, | 138 { 9, 86, 129, 17, 88, 61, 94, 76}, |
| 139 { 12, 86, 129, 22, 88, 77, 97, 93}, |
105 { 15, 87, 129, 28, 89, 93, 100, 110}, | 140 { 15, 87, 129, 28, 89, 93, 100, 110}, |
| 141 { 17, 87, 129, 33, 90, 105, 103, 123}, |
106 { 20, 88, 130, 38, 91, 118, 106, 136}, | 142 { 20, 88, 130, 38, 91, 118, 106, 136}, |
| 143 { 23, 88, 130, 43, 91, 128, 108, 146}, |
107 { 26, 89, 131, 48, 92, 139, 111, 156}, | 144 { 26, 89, 131, 48, 92, 139, 111, 156}, |
| 145 { 28, 89, 131, 53, 93, 147, 114, 163}, |
108 { 31, 90, 131, 58, 94, 156, 117, 171}, | 146 { 31, 90, 131, 58, 94, 156, 117, 171}, |
| 147 { 34, 90, 131, 62, 94, 163, 119, 177}, |
109 { 37, 90, 132, 66, 95, 171, 122, 184}, | 148 { 37, 90, 132, 66, 95, 171, 122, 184}, |
| 149 { 39, 90, 132, 70, 96, 177, 124, 189}, |
110 { 42, 91, 132, 75, 97, 183, 127, 194}, | 150 { 42, 91, 132, 75, 97, 183, 127, 194}, |
| 151 { 44, 91, 132, 79, 97, 188, 129, 198}, |
111 { 47, 92, 133, 83, 98, 193, 132, 202}, | 152 { 47, 92, 133, 83, 98, 193, 132, 202}, |
| 153 { 49, 92, 133, 86, 99, 197, 134, 205}, |
112 { 52, 93, 133, 90, 100, 201, 137, 208}, | 154 { 52, 93, 133, 90, 100, 201, 137, 208}, |
| 155 { 54, 93, 133, 94, 100, 204, 139, 211}, |
113 { 57, 94, 134, 98, 101, 208, 142, 214}, | 156 { 57, 94, 134, 98, 101, 208, 142, 214}, |
| 157 { 59, 94, 134, 101, 102, 211, 144, 216}, |
114 { 62, 94, 135, 105, 103, 214, 146, 218}, | 158 { 62, 94, 135, 105, 103, 214, 146, 218}, |
| 159 { 64, 94, 135, 108, 103, 216, 148, 220}, |
115 { 66, 95, 135, 111, 104, 219, 151, 222}, | 160 { 66, 95, 135, 111, 104, 219, 151, 222}, |
| 161 { 68, 95, 135, 114, 105, 221, 153, 223}, |
116 { 71, 96, 136, 117, 106, 224, 155, 225}, | 162 { 71, 96, 136, 117, 106, 224, 155, 225}, |
| 163 { 73, 96, 136, 120, 106, 225, 157, 226}, |
117 { 76, 97, 136, 123, 107, 227, 159, 228}, | 164 { 76, 97, 136, 123, 107, 227, 159, 228}, |
| 165 { 78, 97, 136, 126, 108, 229, 160, 229}, |
118 { 80, 98, 137, 129, 109, 231, 162, 231}, | 166 { 80, 98, 137, 129, 109, 231, 162, 231}, |
| 167 { 82, 98, 137, 131, 109, 232, 164, 232}, |
119 { 84, 98, 138, 134, 110, 234, 166, 233}, | 168 { 84, 98, 138, 134, 110, 234, 166, 233}, |
| 169 { 86, 98, 138, 137, 111, 235, 168, 234}, |
120 { 89, 99, 138, 140, 112, 236, 170, 235}, | 170 { 89, 99, 138, 140, 112, 236, 170, 235}, |
| 171 { 91, 99, 138, 142, 112, 237, 171, 235}, |
121 { 93, 100, 139, 145, 113, 238, 173, 236}, | 172 { 93, 100, 139, 145, 113, 238, 173, 236}, |
| 173 { 95, 100, 139, 147, 114, 239, 174, 237}, |
122 { 97, 101, 140, 149, 115, 240, 176, 238}, | 174 { 97, 101, 140, 149, 115, 240, 176, 238}, |
| 175 { 99, 101, 140, 151, 115, 241, 177, 238}, |
123 {101, 102, 140, 154, 116, 242, 179, 239}, | 176 {101, 102, 140, 154, 116, 242, 179, 239}, |
| 177 {103, 102, 140, 156, 117, 242, 180, 239}, |
124 {105, 103, 141, 158, 118, 243, 182, 240}, | 178 {105, 103, 141, 158, 118, 243, 182, 240}, |
| 179 {107, 103, 141, 160, 118, 243, 183, 240}, |
125 {109, 104, 141, 162, 119, 244, 185, 241}, | 180 {109, 104, 141, 162, 119, 244, 185, 241}, |
| 181 {111, 104, 141, 164, 119, 244, 186, 241}, |
126 {113, 104, 142, 166, 120, 245, 187, 242}, | 182 {113, 104, 142, 166, 120, 245, 187, 242}, |
| 183 {114, 104, 142, 168, 121, 245, 188, 242}, |
127 {116, 105, 143, 170, 122, 246, 190, 243}, | 184 {116, 105, 143, 170, 122, 246, 190, 243}, |
| 185 {118, 105, 143, 171, 122, 246, 191, 243}, |
128 {120, 106, 143, 173, 123, 247, 192, 244}, | 186 {120, 106, 143, 173, 123, 247, 192, 244}, |
| 187 {121, 106, 143, 175, 124, 247, 193, 244}, |
129 {123, 107, 144, 177, 125, 248, 195, 244}, | 188 {123, 107, 144, 177, 125, 248, 195, 244}, |
| 189 {125, 107, 144, 178, 125, 248, 196, 244}, |
130 {127, 108, 145, 180, 126, 249, 197, 245}, | 190 {127, 108, 145, 180, 126, 249, 197, 245}, |
| 191 {128, 108, 145, 181, 127, 249, 198, 245}, |
131 {130, 109, 145, 183, 128, 249, 199, 245}, | 192 {130, 109, 145, 183, 128, 249, 199, 245}, |
| 193 {132, 109, 145, 184, 128, 249, 200, 245}, |
132 {134, 110, 146, 186, 129, 250, 201, 246}, | 194 {134, 110, 146, 186, 129, 250, 201, 246}, |
| 195 {135, 110, 146, 187, 130, 250, 202, 246}, |
133 {137, 111, 147, 189, 131, 251, 203, 246}, | 196 {137, 111, 147, 189, 131, 251, 203, 246}, |
| 197 {138, 111, 147, 190, 131, 251, 204, 246}, |
134 {140, 112, 147, 192, 132, 251, 205, 247}, | 198 {140, 112, 147, 192, 132, 251, 205, 247}, |
| 199 {141, 112, 147, 193, 132, 251, 206, 247}, |
135 {143, 113, 148, 194, 133, 251, 207, 247}, | 200 {143, 113, 148, 194, 133, 251, 207, 247}, |
| 201 {144, 113, 148, 195, 134, 251, 207, 247}, |
136 {146, 114, 149, 197, 135, 252, 208, 248}, | 202 {146, 114, 149, 197, 135, 252, 208, 248}, |
| 203 {147, 114, 149, 198, 135, 252, 209, 248}, |
137 {149, 115, 149, 199, 136, 252, 210, 248}, | 204 {149, 115, 149, 199, 136, 252, 210, 248}, |
| 205 {150, 115, 149, 200, 137, 252, 210, 248}, |
138 {152, 115, 150, 201, 138, 252, 211, 248}, | 206 {152, 115, 150, 201, 138, 252, 211, 248}, |
| 207 {153, 115, 150, 202, 138, 252, 212, 248}, |
139 {155, 116, 151, 204, 139, 253, 213, 249}, | 208 {155, 116, 151, 204, 139, 253, 213, 249}, |
| 209 {156, 116, 151, 205, 139, 253, 213, 249}, |
140 {158, 117, 151, 206, 140, 253, 214, 249}, | 210 {158, 117, 151, 206, 140, 253, 214, 249}, |
| 211 {159, 117, 151, 207, 141, 253, 215, 249}, |
141 {161, 118, 152, 208, 142, 253, 216, 249}, | 212 {161, 118, 152, 208, 142, 253, 216, 249}, |
| 213 {162, 118, 152, 209, 142, 253, 216, 249}, |
142 {163, 119, 153, 210, 143, 253, 217, 249}, | 214 {163, 119, 153, 210, 143, 253, 217, 249}, |
| 215 {164, 119, 153, 211, 143, 253, 217, 249}, |
143 {166, 120, 153, 212, 144, 254, 218, 250}, | 216 {166, 120, 153, 212, 144, 254, 218, 250}, |
| 217 {167, 120, 153, 212, 145, 254, 219, 250}, |
144 {168, 121, 154, 213, 146, 254, 220, 250}, | 218 {168, 121, 154, 213, 146, 254, 220, 250}, |
| 219 {169, 121, 154, 214, 146, 254, 220, 250}, |
145 {171, 122, 155, 215, 147, 254, 221, 250}, | 220 {171, 122, 155, 215, 147, 254, 221, 250}, |
| 221 {172, 122, 155, 216, 147, 254, 221, 250}, |
146 {173, 123, 155, 217, 148, 254, 222, 250}, | 222 {173, 123, 155, 217, 148, 254, 222, 250}, |
| 223 {174, 123, 155, 217, 149, 254, 222, 250}, |
147 {176, 124, 156, 218, 150, 254, 223, 250}, | 224 {176, 124, 156, 218, 150, 254, 223, 250}, |
| 225 {177, 124, 156, 219, 150, 254, 223, 250}, |
148 {178, 125, 157, 220, 151, 254, 224, 251}, | 226 {178, 125, 157, 220, 151, 254, 224, 251}, |
| 227 {179, 125, 157, 220, 151, 254, 224, 251}, |
149 {180, 126, 157, 221, 152, 254, 225, 251}, | 228 {180, 126, 157, 221, 152, 254, 225, 251}, |
| 229 {181, 126, 157, 221, 152, 254, 225, 251}, |
150 {183, 127, 158, 222, 153, 254, 226, 251}, | 230 {183, 127, 158, 222, 153, 254, 226, 251}, |
| 231 {184, 127, 158, 223, 154, 254, 226, 251}, |
151 {185, 128, 159, 224, 155, 255, 227, 251}, | 232 {185, 128, 159, 224, 155, 255, 227, 251}, |
| 233 {186, 128, 159, 224, 155, 255, 227, 251}, |
152 {187, 129, 160, 225, 156, 255, 228, 251}, | 234 {187, 129, 160, 225, 156, 255, 228, 251}, |
| 235 {188, 130, 160, 225, 156, 255, 228, 251}, |
153 {189, 131, 160, 226, 157, 255, 228, 251}, | 236 {189, 131, 160, 226, 157, 255, 228, 251}, |
| 237 {190, 131, 160, 226, 158, 255, 228, 251}, |
154 {191, 132, 161, 227, 159, 255, 229, 251}, | 238 {191, 132, 161, 227, 159, 255, 229, 251}, |
| 239 {192, 132, 161, 227, 159, 255, 229, 251}, |
155 {193, 133, 162, 228, 160, 255, 230, 252}, | 240 {193, 133, 162, 228, 160, 255, 230, 252}, |
| 241 {194, 133, 162, 229, 160, 255, 230, 252}, |
156 {195, 134, 163, 230, 161, 255, 231, 252}, | 242 {195, 134, 163, 230, 161, 255, 231, 252}, |
| 243 {196, 134, 163, 230, 161, 255, 231, 252}, |
157 {197, 135, 163, 231, 162, 255, 231, 252}, | 244 {197, 135, 163, 231, 162, 255, 231, 252}, |
| 245 {198, 135, 163, 231, 162, 255, 231, 252}, |
158 {199, 136, 164, 232, 163, 255, 232, 252}, | 246 {199, 136, 164, 232, 163, 255, 232, 252}, |
| 247 {200, 136, 164, 232, 164, 255, 232, 252}, |
| 248 {201, 137, 165, 233, 165, 255, 233, 252}, |
159 {201, 137, 165, 233, 165, 255, 233, 252}, | 249 {201, 137, 165, 233, 165, 255, 233, 252}, |
160 {202, 138, 166, 233, 166, 255, 233, 252}, | 250 {202, 138, 166, 233, 166, 255, 233, 252}, |
| 251 {203, 138, 166, 233, 166, 255, 233, 252}, |
161 {204, 139, 166, 234, 167, 255, 234, 252}, | 252 {204, 139, 166, 234, 167, 255, 234, 252}, |
| 253 {205, 139, 166, 234, 167, 255, 234, 252}, |
| 254 {206, 140, 167, 235, 168, 255, 235, 252}, |
162 {206, 140, 167, 235, 168, 255, 235, 252}, | 255 {206, 140, 167, 235, 168, 255, 235, 252}, |
163 {207, 141, 168, 236, 169, 255, 235, 252}, | 256 {207, 141, 168, 236, 169, 255, 235, 252}, |
| 257 {208, 141, 168, 236, 170, 255, 235, 252}, |
164 {209, 142, 169, 237, 171, 255, 236, 252}, | 258 {209, 142, 169, 237, 171, 255, 236, 252}, |
| 259 {209, 143, 169, 237, 171, 255, 236, 252}, |
165 {210, 144, 169, 237, 172, 255, 236, 252}, | 260 {210, 144, 169, 237, 172, 255, 236, 252}, |
| 261 {211, 144, 169, 237, 172, 255, 236, 252}, |
166 {212, 145, 170, 238, 173, 255, 237, 252}, | 262 {212, 145, 170, 238, 173, 255, 237, 252}, |
| 263 {213, 145, 170, 238, 173, 255, 237, 252}, |
| 264 {214, 146, 171, 239, 174, 255, 237, 253}, |
167 {214, 146, 171, 239, 174, 255, 237, 253}, | 265 {214, 146, 171, 239, 174, 255, 237, 253}, |
168 {215, 147, 172, 240, 175, 255, 238, 253}, | 266 {215, 147, 172, 240, 175, 255, 238, 253}, |
| 267 {215, 147, 172, 240, 175, 255, 238, 253}, |
169 {216, 148, 173, 240, 176, 255, 238, 253}, | 268 {216, 148, 173, 240, 176, 255, 238, 253}, |
| 269 {217, 148, 173, 240, 176, 255, 238, 253}, |
170 {218, 149, 173, 241, 177, 255, 239, 253}, | 270 {218, 149, 173, 241, 177, 255, 239, 253}, |
| 271 {218, 149, 173, 241, 178, 255, 239, 253}, |
171 {219, 150, 174, 241, 179, 255, 239, 253}, | 272 {219, 150, 174, 241, 179, 255, 239, 253}, |
| 273 {219, 151, 174, 241, 179, 255, 239, 253}, |
172 {220, 152, 175, 242, 180, 255, 240, 253}, | 274 {220, 152, 175, 242, 180, 255, 240, 253}, |
| 275 {221, 152, 175, 242, 180, 255, 240, 253}, |
| 276 {222, 153, 176, 242, 181, 255, 240, 253}, |
173 {222, 153, 176, 242, 181, 255, 240, 253}, | 277 {222, 153, 176, 242, 181, 255, 240, 253}, |
174 {223, 154, 177, 243, 182, 255, 240, 253}, | 278 {223, 154, 177, 243, 182, 255, 240, 253}, |
| 279 {223, 154, 177, 243, 182, 255, 240, 253}, |
| 280 {224, 155, 178, 244, 183, 255, 241, 253}, |
175 {224, 155, 178, 244, 183, 255, 241, 253}, | 281 {224, 155, 178, 244, 183, 255, 241, 253}, |
176 {225, 156, 178, 244, 184, 255, 241, 253}, | 282 {225, 156, 178, 244, 184, 255, 241, 253}, |
| 283 {225, 157, 178, 244, 184, 255, 241, 253}, |
177 {226, 158, 179, 244, 185, 255, 242, 253}, | 284 {226, 158, 179, 244, 185, 255, 242, 253}, |
| 285 {227, 158, 179, 244, 185, 255, 242, 253}, |
| 286 {228, 159, 180, 245, 186, 255, 242, 253}, |
178 {228, 159, 180, 245, 186, 255, 242, 253}, | 287 {228, 159, 180, 245, 186, 255, 242, 253}, |
179 {229, 160, 181, 245, 187, 255, 242, 253}, | 288 {229, 160, 181, 245, 187, 255, 242, 253}, |
| 289 {229, 160, 181, 245, 187, 255, 242, 253}, |
180 {230, 161, 182, 246, 188, 255, 243, 253}, | 290 {230, 161, 182, 246, 188, 255, 243, 253}, |
| 291 {230, 162, 182, 246, 188, 255, 243, 253}, |
| 292 {231, 163, 183, 246, 189, 255, 243, 253}, |
181 {231, 163, 183, 246, 189, 255, 243, 253}, | 293 {231, 163, 183, 246, 189, 255, 243, 253}, |
182 {232, 164, 184, 247, 190, 255, 243, 253}, | 294 {232, 164, 184, 247, 190, 255, 243, 253}, |
| 295 {232, 164, 184, 247, 190, 255, 243, 253}, |
| 296 {233, 165, 185, 247, 191, 255, 244, 253}, |
183 {233, 165, 185, 247, 191, 255, 244, 253}, | 297 {233, 165, 185, 247, 191, 255, 244, 253}, |
184 {234, 166, 185, 247, 192, 255, 244, 253}, | 298 {234, 166, 185, 247, 192, 255, 244, 253}, |
| 299 {234, 167, 185, 247, 192, 255, 244, 253}, |
| 300 {235, 168, 186, 248, 193, 255, 244, 253}, |
185 {235, 168, 186, 248, 193, 255, 244, 253}, | 301 {235, 168, 186, 248, 193, 255, 244, 253}, |
186 {236, 169, 187, 248, 194, 255, 244, 253}, | 302 {236, 169, 187, 248, 194, 255, 244, 253}, |
| 303 {236, 169, 187, 248, 194, 255, 244, 253}, |
| 304 {236, 170, 188, 248, 195, 255, 245, 253}, |
187 {236, 170, 188, 248, 195, 255, 245, 253}, | 305 {236, 170, 188, 248, 195, 255, 245, 253}, |
188 {237, 171, 189, 249, 196, 255, 245, 254}, | 306 {237, 171, 189, 249, 196, 255, 245, 254}, |
| 307 {237, 172, 189, 249, 196, 255, 245, 254}, |
| 308 {238, 173, 190, 249, 197, 255, 245, 254}, |
189 {238, 173, 190, 249, 197, 255, 245, 254}, | 309 {238, 173, 190, 249, 197, 255, 245, 254}, |
190 {239, 174, 191, 249, 198, 255, 245, 254}, | 310 {239, 174, 191, 249, 198, 255, 245, 254}, |
| 311 {239, 174, 191, 249, 198, 255, 245, 254}, |
191 {240, 175, 192, 249, 199, 255, 246, 254}, | 312 {240, 175, 192, 249, 199, 255, 246, 254}, |
| 313 {240, 176, 192, 249, 199, 255, 246, 254}, |
| 314 {240, 177, 193, 250, 200, 255, 246, 254}, |
192 {240, 177, 193, 250, 200, 255, 246, 254}, | 315 {240, 177, 193, 250, 200, 255, 246, 254}, |
193 {241, 178, 194, 250, 201, 255, 246, 254}, | 316 {241, 178, 194, 250, 201, 255, 246, 254}, |
| 317 {241, 178, 194, 250, 201, 255, 246, 254}, |
194 {242, 179, 195, 250, 202, 255, 246, 254}, | 318 {242, 179, 195, 250, 202, 255, 246, 254}, |
| 319 {242, 180, 195, 250, 202, 255, 246, 254}, |
| 320 {242, 181, 196, 250, 203, 255, 247, 254}, |
195 {242, 181, 196, 250, 203, 255, 247, 254}, | 321 {242, 181, 196, 250, 203, 255, 247, 254}, |
196 {243, 182, 197, 251, 204, 255, 247, 254}, | 322 {243, 182, 197, 251, 204, 255, 247, 254}, |
| 323 {243, 183, 197, 251, 204, 255, 247, 254}, |
| 324 {244, 184, 198, 251, 205, 255, 247, 254}, |
197 {244, 184, 198, 251, 205, 255, 247, 254}, | 325 {244, 184, 198, 251, 205, 255, 247, 254}, |
198 {244, 185, 199, 251, 206, 255, 247, 254}, | 326 {244, 185, 199, 251, 206, 255, 247, 254}, |
| 327 {244, 185, 199, 251, 206, 255, 247, 254}, |
199 {245, 186, 200, 251, 207, 255, 247, 254}, | 328 {245, 186, 200, 251, 207, 255, 247, 254}, |
| 329 {245, 187, 200, 251, 207, 255, 247, 254}, |
| 330 {246, 188, 201, 252, 207, 255, 248, 254}, |
200 {246, 188, 201, 252, 207, 255, 248, 254}, | 331 {246, 188, 201, 252, 207, 255, 248, 254}, |
201 {246, 189, 202, 252, 208, 255, 248, 254}, | 332 {246, 189, 202, 252, 208, 255, 248, 254}, |
| 333 {246, 190, 202, 252, 208, 255, 248, 254}, |
| 334 {247, 191, 203, 252, 209, 255, 248, 254}, |
202 {247, 191, 203, 252, 209, 255, 248, 254}, | 335 {247, 191, 203, 252, 209, 255, 248, 254}, |
203 {247, 192, 204, 252, 210, 255, 248, 254}, | 336 {247, 192, 204, 252, 210, 255, 248, 254}, |
| 337 {247, 193, 204, 252, 210, 255, 248, 254}, |
| 338 {248, 194, 205, 252, 211, 255, 248, 254}, |
204 {248, 194, 205, 252, 211, 255, 248, 254}, | 339 {248, 194, 205, 252, 211, 255, 248, 254}, |
205 {248, 195, 206, 252, 212, 255, 249, 254}, | 340 {248, 195, 206, 252, 212, 255, 249, 254}, |
| 341 {248, 196, 206, 252, 212, 255, 249, 254}, |
| 342 {249, 197, 207, 253, 213, 255, 249, 254}, |
206 {249, 197, 207, 253, 213, 255, 249, 254}, | 343 {249, 197, 207, 253, 213, 255, 249, 254}, |
207 {249, 198, 208, 253, 214, 255, 249, 254}, | 344 {249, 198, 208, 253, 214, 255, 249, 254}, |
| 345 {249, 199, 209, 253, 214, 255, 249, 254}, |
| 346 {250, 200, 210, 253, 215, 255, 249, 254}, |
208 {250, 200, 210, 253, 215, 255, 249, 254}, | 347 {250, 200, 210, 253, 215, 255, 249, 254}, |
209 {250, 201, 211, 253, 215, 255, 249, 254}, | 348 {250, 201, 211, 253, 215, 255, 249, 254}, |
| 349 {250, 202, 211, 253, 215, 255, 249, 254}, |
| 350 {250, 203, 212, 253, 216, 255, 249, 254}, |
210 {250, 203, 212, 253, 216, 255, 249, 254}, | 351 {250, 203, 212, 253, 216, 255, 249, 254}, |
211 {251, 204, 213, 253, 217, 255, 250, 254}, | 352 {251, 204, 213, 253, 217, 255, 250, 254}, |
| 353 {251, 205, 213, 253, 217, 255, 250, 254}, |
212 {251, 206, 214, 254, 218, 255, 250, 254}, | 354 {251, 206, 214, 254, 218, 255, 250, 254}, |
| 355 {251, 206, 215, 254, 218, 255, 250, 254}, |
213 {252, 207, 216, 254, 219, 255, 250, 254}, | 356 {252, 207, 216, 254, 219, 255, 250, 254}, |
| 357 {252, 208, 216, 254, 219, 255, 250, 254}, |
214 {252, 209, 217, 254, 220, 255, 250, 254}, | 358 {252, 209, 217, 254, 220, 255, 250, 254}, |
| 359 {252, 210, 217, 254, 220, 255, 250, 254}, |
215 {252, 211, 218, 254, 221, 255, 250, 254}, | 360 {252, 211, 218, 254, 221, 255, 250, 254}, |
| 361 {252, 212, 218, 254, 221, 255, 250, 254}, |
216 {253, 213, 219, 254, 222, 255, 250, 254}, | 362 {253, 213, 219, 254, 222, 255, 250, 254}, |
| 363 {253, 213, 220, 254, 222, 255, 250, 254}, |
217 {253, 214, 221, 254, 223, 255, 250, 254}, | 364 {253, 214, 221, 254, 223, 255, 250, 254}, |
| 365 {253, 215, 221, 254, 223, 255, 250, 254}, |
218 {253, 216, 222, 254, 224, 255, 251, 254}, | 366 {253, 216, 222, 254, 224, 255, 251, 254}, |
| 367 {253, 217, 223, 254, 224, 255, 251, 254}, |
219 {253, 218, 224, 254, 225, 255, 251, 254}, | 368 {253, 218, 224, 254, 225, 255, 251, 254}, |
| 369 {253, 219, 224, 254, 225, 255, 251, 254}, |
220 {254, 220, 225, 254, 225, 255, 251, 254}, | 370 {254, 220, 225, 254, 225, 255, 251, 254}, |
| 371 {254, 221, 226, 254, 225, 255, 251, 254}, |
221 {254, 222, 227, 255, 226, 255, 251, 254}, | 372 {254, 222, 227, 255, 226, 255, 251, 254}, |
| 373 {254, 223, 227, 255, 226, 255, 251, 254}, |
222 {254, 224, 228, 255, 227, 255, 251, 254}, | 374 {254, 224, 228, 255, 227, 255, 251, 254}, |
| 375 {254, 225, 229, 255, 227, 255, 251, 254}, |
223 {254, 226, 230, 255, 228, 255, 251, 254}, | 376 {254, 226, 230, 255, 228, 255, 251, 254}, |
| 377 {254, 227, 230, 255, 229, 255, 251, 254}, |
224 {255, 228, 231, 255, 230, 255, 251, 254}, | 378 {255, 228, 231, 255, 230, 255, 251, 254}, |
| 379 {255, 229, 232, 255, 230, 255, 251, 254}, |
225 {255, 230, 233, 255, 231, 255, 252, 254}, | 380 {255, 230, 233, 255, 231, 255, 252, 254}, |
| 381 {255, 231, 234, 255, 231, 255, 252, 254}, |
226 {255, 232, 235, 255, 232, 255, 252, 254}, | 382 {255, 232, 235, 255, 232, 255, 252, 254}, |
| 383 {255, 233, 236, 255, 232, 255, 252, 254}, |
227 {255, 235, 237, 255, 233, 255, 252, 254}, | 384 {255, 235, 237, 255, 233, 255, 252, 254}, |
| 385 {255, 236, 238, 255, 234, 255, 252, 254}, |
228 {255, 238, 240, 255, 235, 255, 252, 255}, | 386 {255, 238, 240, 255, 235, 255, 252, 255}, |
| 387 {255, 239, 241, 255, 235, 255, 252, 254}, |
229 {255, 241, 243, 255, 236, 255, 252, 254}, | 388 {255, 241, 243, 255, 236, 255, 252, 254}, |
230 {255, 246, 247, 255, 239, 255, 253, 255} | 389 {255, 243, 245, 255, 237, 255, 252, 254}, |
| 390 {255, 246, 247, 255, 239, 255, 253, 255}, |
| 391 {255, 246, 247, 255, 239, 255, 253, 255}, |
231 }; | 392 }; |
232 | 393 |
233 static void extend_model_to_full_distribution(vp9_prob p, | 394 static const vp9_coeff_probs_model default_coef_probs_4x4[PLANE_TYPES] = { |
234 vp9_prob *tree_probs) { | 395 { // Y plane |
235 const int l = (p - 1) / 2; | 396 { // Intra |
236 const vp9_prob (*model)[MODEL_NODES] = modelcoefprobs_pareto8; | 397 { // Band 0 |
237 if (p & 1) { | 398 { 195, 29, 183 }, { 84, 49, 136 }, { 8, 42, 71 } |
238 vpx_memcpy(tree_probs + UNCONSTRAINED_NODES, | 399 }, { // Band 1 |
239 model[l], MODEL_NODES * sizeof(vp9_prob)); | 400 { 31, 107, 169 }, { 35, 99, 159 }, { 17, 82, 140 }, |
240 } else { | 401 { 8, 66, 114 }, { 2, 44, 76 }, { 1, 19, 32 } |
241 // interpolate | 402 }, { // Band 2 |
242 int i; | 403 { 40, 132, 201 }, { 29, 114, 187 }, { 13, 91, 157 }, |
243 for (i = UNCONSTRAINED_NODES; i < ENTROPY_NODES; ++i) | 404 { 7, 75, 127 }, { 3, 58, 95 }, { 1, 28, 47 } |
244 tree_probs[i] = (model[l][i - UNCONSTRAINED_NODES] + | 405 }, { // Band 3 |
245 model[l + 1][i - UNCONSTRAINED_NODES]) >> 1; | 406 { 69, 142, 221 }, { 42, 122, 201 }, { 15, 91, 159 }, |
| 407 { 6, 67, 121 }, { 1, 42, 77 }, { 1, 17, 31 } |
| 408 }, { // Band 4 |
| 409 { 102, 148, 228 }, { 67, 117, 204 }, { 17, 82, 154 }, |
| 410 { 6, 59, 114 }, { 2, 39, 75 }, { 1, 15, 29 } |
| 411 }, { // Band 5 |
| 412 { 156, 57, 233 }, { 119, 57, 212 }, { 58, 48, 163 }, |
| 413 { 29, 40, 124 }, { 12, 30, 81 }, { 3, 12, 31 } |
| 414 } |
| 415 }, { // Inter |
| 416 { // Band 0 |
| 417 { 191, 107, 226 }, { 124, 117, 204 }, { 25, 99, 155 } |
| 418 }, { // Band 1 |
| 419 { 29, 148, 210 }, { 37, 126, 194 }, { 8, 93, 157 }, |
| 420 { 2, 68, 118 }, { 1, 39, 69 }, { 1, 17, 33 } |
| 421 }, { // Band 2 |
| 422 { 41, 151, 213 }, { 27, 123, 193 }, { 3, 82, 144 }, |
| 423 { 1, 58, 105 }, { 1, 32, 60 }, { 1, 13, 26 } |
| 424 }, { // Band 3 |
| 425 { 59, 159, 220 }, { 23, 126, 198 }, { 4, 88, 151 }, |
| 426 { 1, 66, 114 }, { 1, 38, 71 }, { 1, 18, 34 } |
| 427 }, { // Band 4 |
| 428 { 114, 136, 232 }, { 51, 114, 207 }, { 11, 83, 155 }, |
| 429 { 3, 56, 105 }, { 1, 33, 65 }, { 1, 17, 34 } |
| 430 }, { // Band 5 |
| 431 { 149, 65, 234 }, { 121, 57, 215 }, { 61, 49, 166 }, |
| 432 { 28, 36, 114 }, { 12, 25, 76 }, { 3, 16, 42 } |
| 433 } |
| 434 } |
| 435 }, { // UV plane |
| 436 { // Intra |
| 437 { // Band 0 |
| 438 { 214, 49, 220 }, { 132, 63, 188 }, { 42, 65, 137 } |
| 439 }, { // Band 1 |
| 440 { 85, 137, 221 }, { 104, 131, 216 }, { 49, 111, 192 }, |
| 441 { 21, 87, 155 }, { 2, 49, 87 }, { 1, 16, 28 } |
| 442 }, { // Band 2 |
| 443 { 89, 163, 230 }, { 90, 137, 220 }, { 29, 100, 183 }, |
| 444 { 10, 70, 135 }, { 2, 42, 81 }, { 1, 17, 33 } |
| 445 }, { // Band 3 |
| 446 { 108, 167, 237 }, { 55, 133, 222 }, { 15, 97, 179 }, |
| 447 { 4, 72, 135 }, { 1, 45, 85 }, { 1, 19, 38 } |
| 448 }, { // Band 4 |
| 449 { 124, 146, 240 }, { 66, 124, 224 }, { 17, 88, 175 }, |
| 450 { 4, 58, 122 }, { 1, 36, 75 }, { 1, 18, 37 } |
| 451 }, { // Band 5 |
| 452 { 141, 79, 241 }, { 126, 70, 227 }, { 66, 58, 182 }, |
| 453 { 30, 44, 136 }, { 12, 34, 96 }, { 2, 20, 47 } |
| 454 } |
| 455 }, { // Inter |
| 456 { // Band 0 |
| 457 { 229, 99, 249 }, { 143, 111, 235 }, { 46, 109, 192 } |
| 458 }, { // Band 1 |
| 459 { 82, 158, 236 }, { 94, 146, 224 }, { 25, 117, 191 }, |
| 460 { 9, 87, 149 }, { 3, 56, 99 }, { 1, 33, 57 } |
| 461 }, { // Band 2 |
| 462 { 83, 167, 237 }, { 68, 145, 222 }, { 10, 103, 177 }, |
| 463 { 2, 72, 131 }, { 1, 41, 79 }, { 1, 20, 39 } |
| 464 }, { // Band 3 |
| 465 { 99, 167, 239 }, { 47, 141, 224 }, { 10, 104, 178 }, |
| 466 { 2, 73, 133 }, { 1, 44, 85 }, { 1, 22, 47 } |
| 467 }, { // Band 4 |
| 468 { 127, 145, 243 }, { 71, 129, 228 }, { 17, 93, 177 }, |
| 469 { 3, 61, 124 }, { 1, 41, 84 }, { 1, 21, 52 } |
| 470 }, { // Band 5 |
| 471 { 157, 78, 244 }, { 140, 72, 231 }, { 69, 58, 184 }, |
| 472 { 31, 44, 137 }, { 14, 38, 105 }, { 8, 23, 61 } |
| 473 } |
| 474 } |
246 } | 475 } |
| 476 }; |
| 477 |
| 478 static const vp9_coeff_probs_model default_coef_probs_8x8[PLANE_TYPES] = { |
| 479 { // Y plane |
| 480 { // Intra |
| 481 { // Band 0 |
| 482 { 125, 34, 187 }, { 52, 41, 133 }, { 6, 31, 56 } |
| 483 }, { // Band 1 |
| 484 { 37, 109, 153 }, { 51, 102, 147 }, { 23, 87, 128 }, |
| 485 { 8, 67, 101 }, { 1, 41, 63 }, { 1, 19, 29 } |
| 486 }, { // Band 2 |
| 487 { 31, 154, 185 }, { 17, 127, 175 }, { 6, 96, 145 }, |
| 488 { 2, 73, 114 }, { 1, 51, 82 }, { 1, 28, 45 } |
| 489 }, { // Band 3 |
| 490 { 23, 163, 200 }, { 10, 131, 185 }, { 2, 93, 148 }, |
| 491 { 1, 67, 111 }, { 1, 41, 69 }, { 1, 14, 24 } |
| 492 }, { // Band 4 |
| 493 { 29, 176, 217 }, { 12, 145, 201 }, { 3, 101, 156 }, |
| 494 { 1, 69, 111 }, { 1, 39, 63 }, { 1, 14, 23 } |
| 495 }, { // Band 5 |
| 496 { 57, 192, 233 }, { 25, 154, 215 }, { 6, 109, 167 }, |
| 497 { 3, 78, 118 }, { 1, 48, 69 }, { 1, 21, 29 } |
| 498 } |
| 499 }, { // Inter |
| 500 { // Band 0 |
| 501 { 202, 105, 245 }, { 108, 106, 216 }, { 18, 90, 144 } |
| 502 }, { // Band 1 |
| 503 { 33, 172, 219 }, { 64, 149, 206 }, { 14, 117, 177 }, |
| 504 { 5, 90, 141 }, { 2, 61, 95 }, { 1, 37, 57 } |
| 505 }, { // Band 2 |
| 506 { 33, 179, 220 }, { 11, 140, 198 }, { 1, 89, 148 }, |
| 507 { 1, 60, 104 }, { 1, 33, 57 }, { 1, 12, 21 } |
| 508 }, { // Band 3 |
| 509 { 30, 181, 221 }, { 8, 141, 198 }, { 1, 87, 145 }, |
| 510 { 1, 58, 100 }, { 1, 31, 55 }, { 1, 12, 20 } |
| 511 }, { // Band 4 |
| 512 { 32, 186, 224 }, { 7, 142, 198 }, { 1, 86, 143 }, |
| 513 { 1, 58, 100 }, { 1, 31, 55 }, { 1, 12, 22 } |
| 514 }, { // Band 5 |
| 515 { 57, 192, 227 }, { 20, 143, 204 }, { 3, 96, 154 }, |
| 516 { 1, 68, 112 }, { 1, 42, 69 }, { 1, 19, 32 } |
| 517 } |
| 518 } |
| 519 }, { // UV plane |
| 520 { // Intra |
| 521 { // Band 0 |
| 522 { 212, 35, 215 }, { 113, 47, 169 }, { 29, 48, 105 } |
| 523 }, { // Band 1 |
| 524 { 74, 129, 203 }, { 106, 120, 203 }, { 49, 107, 178 }, |
| 525 { 19, 84, 144 }, { 4, 50, 84 }, { 1, 15, 25 } |
| 526 }, { // Band 2 |
| 527 { 71, 172, 217 }, { 44, 141, 209 }, { 15, 102, 173 }, |
| 528 { 6, 76, 133 }, { 2, 51, 89 }, { 1, 24, 42 } |
| 529 }, { // Band 3 |
| 530 { 64, 185, 231 }, { 31, 148, 216 }, { 8, 103, 175 }, |
| 531 { 3, 74, 131 }, { 1, 46, 81 }, { 1, 18, 30 } |
| 532 }, { // Band 4 |
| 533 { 65, 196, 235 }, { 25, 157, 221 }, { 5, 105, 174 }, |
| 534 { 1, 67, 120 }, { 1, 38, 69 }, { 1, 15, 30 } |
| 535 }, { // Band 5 |
| 536 { 65, 204, 238 }, { 30, 156, 224 }, { 7, 107, 177 }, |
| 537 { 2, 70, 124 }, { 1, 42, 73 }, { 1, 18, 34 } |
| 538 } |
| 539 }, { // Inter |
| 540 { // Band 0 |
| 541 { 225, 86, 251 }, { 144, 104, 235 }, { 42, 99, 181 } |
| 542 }, { // Band 1 |
| 543 { 85, 175, 239 }, { 112, 165, 229 }, { 29, 136, 200 }, |
| 544 { 12, 103, 162 }, { 6, 77, 123 }, { 2, 53, 84 } |
| 545 }, { // Band 2 |
| 546 { 75, 183, 239 }, { 30, 155, 221 }, { 3, 106, 171 }, |
| 547 { 1, 74, 128 }, { 1, 44, 76 }, { 1, 17, 28 } |
| 548 }, { // Band 3 |
| 549 { 73, 185, 240 }, { 27, 159, 222 }, { 2, 107, 172 }, |
| 550 { 1, 75, 127 }, { 1, 42, 73 }, { 1, 17, 29 } |
| 551 }, { // Band 4 |
| 552 { 62, 190, 238 }, { 21, 159, 222 }, { 2, 107, 172 }, |
| 553 { 1, 72, 122 }, { 1, 40, 71 }, { 1, 18, 32 } |
| 554 }, { // Band 5 |
| 555 { 61, 199, 240 }, { 27, 161, 226 }, { 4, 113, 180 }, |
| 556 { 1, 76, 129 }, { 1, 46, 80 }, { 1, 23, 41 } |
| 557 } |
| 558 } |
| 559 } |
| 560 }; |
| 561 |
| 562 static const vp9_coeff_probs_model default_coef_probs_16x16[PLANE_TYPES] = { |
| 563 { // Y plane |
| 564 { // Intra |
| 565 { // Band 0 |
| 566 { 7, 27, 153 }, { 5, 30, 95 }, { 1, 16, 30 } |
| 567 }, { // Band 1 |
| 568 { 50, 75, 127 }, { 57, 75, 124 }, { 27, 67, 108 }, |
| 569 { 10, 54, 86 }, { 1, 33, 52 }, { 1, 12, 18 } |
| 570 }, { // Band 2 |
| 571 { 43, 125, 151 }, { 26, 108, 148 }, { 7, 83, 122 }, |
| 572 { 2, 59, 89 }, { 1, 38, 60 }, { 1, 17, 27 } |
| 573 }, { // Band 3 |
| 574 { 23, 144, 163 }, { 13, 112, 154 }, { 2, 75, 117 }, |
| 575 { 1, 50, 81 }, { 1, 31, 51 }, { 1, 14, 23 } |
| 576 }, { // Band 4 |
| 577 { 18, 162, 185 }, { 6, 123, 171 }, { 1, 78, 125 }, |
| 578 { 1, 51, 86 }, { 1, 31, 54 }, { 1, 14, 23 } |
| 579 }, { // Band 5 |
| 580 { 15, 199, 227 }, { 3, 150, 204 }, { 1, 91, 146 }, |
| 581 { 1, 55, 95 }, { 1, 30, 53 }, { 1, 11, 20 } |
| 582 } |
| 583 }, { // Inter |
| 584 { // Band 0 |
| 585 { 19, 55, 240 }, { 19, 59, 196 }, { 3, 52, 105 } |
| 586 }, { // Band 1 |
| 587 { 41, 166, 207 }, { 104, 153, 199 }, { 31, 123, 181 }, |
| 588 { 14, 101, 152 }, { 5, 72, 106 }, { 1, 36, 52 } |
| 589 }, { // Band 2 |
| 590 { 35, 176, 211 }, { 12, 131, 190 }, { 2, 88, 144 }, |
| 591 { 1, 60, 101 }, { 1, 36, 60 }, { 1, 16, 28 } |
| 592 }, { // Band 3 |
| 593 { 28, 183, 213 }, { 8, 134, 191 }, { 1, 86, 142 }, |
| 594 { 1, 56, 96 }, { 1, 30, 53 }, { 1, 12, 20 } |
| 595 }, { // Band 4 |
| 596 { 20, 190, 215 }, { 4, 135, 192 }, { 1, 84, 139 }, |
| 597 { 1, 53, 91 }, { 1, 28, 49 }, { 1, 11, 20 } |
| 598 }, { // Band 5 |
| 599 { 13, 196, 216 }, { 2, 137, 192 }, { 1, 86, 143 }, |
| 600 { 1, 57, 99 }, { 1, 32, 56 }, { 1, 13, 24 } |
| 601 } |
| 602 } |
| 603 }, { // UV plane |
| 604 { // Intra |
| 605 { // Band 0 |
| 606 { 211, 29, 217 }, { 96, 47, 156 }, { 22, 43, 87 } |
| 607 }, { // Band 1 |
| 608 { 78, 120, 193 }, { 111, 116, 186 }, { 46, 102, 164 }, |
| 609 { 15, 80, 128 }, { 2, 49, 76 }, { 1, 18, 28 } |
| 610 }, { // Band 2 |
| 611 { 71, 161, 203 }, { 42, 132, 192 }, { 10, 98, 150 }, |
| 612 { 3, 69, 109 }, { 1, 44, 70 }, { 1, 18, 29 } |
| 613 }, { // Band 3 |
| 614 { 57, 186, 211 }, { 30, 140, 196 }, { 4, 93, 146 }, |
| 615 { 1, 62, 102 }, { 1, 38, 65 }, { 1, 16, 27 } |
| 616 }, { // Band 4 |
| 617 { 47, 199, 217 }, { 14, 145, 196 }, { 1, 88, 142 }, |
| 618 { 1, 57, 98 }, { 1, 36, 62 }, { 1, 15, 26 } |
| 619 }, { // Band 5 |
| 620 { 26, 219, 229 }, { 5, 155, 207 }, { 1, 94, 151 }, |
| 621 { 1, 60, 104 }, { 1, 36, 62 }, { 1, 16, 28 } |
| 622 } |
| 623 }, { // Inter |
| 624 { // Band 0 |
| 625 { 233, 29, 248 }, { 146, 47, 220 }, { 43, 52, 140 } |
| 626 }, { // Band 1 |
| 627 { 100, 163, 232 }, { 179, 161, 222 }, { 63, 142, 204 }, |
| 628 { 37, 113, 174 }, { 26, 89, 137 }, { 18, 68, 97 } |
| 629 }, { // Band 2 |
| 630 { 85, 181, 230 }, { 32, 146, 209 }, { 7, 100, 164 }, |
| 631 { 3, 71, 121 }, { 1, 45, 77 }, { 1, 18, 30 } |
| 632 }, { // Band 3 |
| 633 { 65, 187, 230 }, { 20, 148, 207 }, { 2, 97, 159 }, |
| 634 { 1, 68, 116 }, { 1, 40, 70 }, { 1, 14, 29 } |
| 635 }, { // Band 4 |
| 636 { 40, 194, 227 }, { 8, 147, 204 }, { 1, 94, 155 }, |
| 637 { 1, 65, 112 }, { 1, 39, 66 }, { 1, 14, 26 } |
| 638 }, { // Band 5 |
| 639 { 16, 208, 228 }, { 3, 151, 207 }, { 1, 98, 160 }, |
| 640 { 1, 67, 117 }, { 1, 41, 74 }, { 1, 17, 31 } |
| 641 } |
| 642 } |
| 643 } |
| 644 }; |
| 645 |
| 646 static const vp9_coeff_probs_model default_coef_probs_32x32[PLANE_TYPES] = { |
| 647 { // Y plane |
| 648 { // Intra |
| 649 { // Band 0 |
| 650 { 17, 38, 140 }, { 7, 34, 80 }, { 1, 17, 29 } |
| 651 }, { // Band 1 |
| 652 { 37, 75, 128 }, { 41, 76, 128 }, { 26, 66, 116 }, |
| 653 { 12, 52, 94 }, { 2, 32, 55 }, { 1, 10, 16 } |
| 654 }, { // Band 2 |
| 655 { 50, 127, 154 }, { 37, 109, 152 }, { 16, 82, 121 }, |
| 656 { 5, 59, 85 }, { 1, 35, 54 }, { 1, 13, 20 } |
| 657 }, { // Band 3 |
| 658 { 40, 142, 167 }, { 17, 110, 157 }, { 2, 71, 112 }, |
| 659 { 1, 44, 72 }, { 1, 27, 45 }, { 1, 11, 17 } |
| 660 }, { // Band 4 |
| 661 { 30, 175, 188 }, { 9, 124, 169 }, { 1, 74, 116 }, |
| 662 { 1, 48, 78 }, { 1, 30, 49 }, { 1, 11, 18 } |
| 663 }, { // Band 5 |
| 664 { 10, 222, 223 }, { 2, 150, 194 }, { 1, 83, 128 }, |
| 665 { 1, 48, 79 }, { 1, 27, 45 }, { 1, 11, 17 } |
| 666 } |
| 667 }, { // Inter |
| 668 { // Band 0 |
| 669 { 36, 41, 235 }, { 29, 36, 193 }, { 10, 27, 111 } |
| 670 }, { // Band 1 |
| 671 { 85, 165, 222 }, { 177, 162, 215 }, { 110, 135, 195 }, |
| 672 { 57, 113, 168 }, { 23, 83, 120 }, { 10, 49, 61 } |
| 673 }, { // Band 2 |
| 674 { 85, 190, 223 }, { 36, 139, 200 }, { 5, 90, 146 }, |
| 675 { 1, 60, 103 }, { 1, 38, 65 }, { 1, 18, 30 } |
| 676 }, { // Band 3 |
| 677 { 72, 202, 223 }, { 23, 141, 199 }, { 2, 86, 140 }, |
| 678 { 1, 56, 97 }, { 1, 36, 61 }, { 1, 16, 27 } |
| 679 }, { // Band 4 |
| 680 { 55, 218, 225 }, { 13, 145, 200 }, { 1, 86, 141 }, |
| 681 { 1, 57, 99 }, { 1, 35, 61 }, { 1, 13, 22 } |
| 682 }, { // Band 5 |
| 683 { 15, 235, 212 }, { 1, 132, 184 }, { 1, 84, 139 }, |
| 684 { 1, 57, 97 }, { 1, 34, 56 }, { 1, 14, 23 } |
| 685 } |
| 686 } |
| 687 }, { // UV plane |
| 688 { // Intra |
| 689 { // Band 0 |
| 690 { 181, 21, 201 }, { 61, 37, 123 }, { 10, 38, 71 } |
| 691 }, { // Band 1 |
| 692 { 47, 106, 172 }, { 95, 104, 173 }, { 42, 93, 159 }, |
| 693 { 18, 77, 131 }, { 4, 50, 81 }, { 1, 17, 23 } |
| 694 }, { // Band 2 |
| 695 { 62, 147, 199 }, { 44, 130, 189 }, { 28, 102, 154 }, |
| 696 { 18, 75, 115 }, { 2, 44, 65 }, { 1, 12, 19 } |
| 697 }, { // Band 3 |
| 698 { 55, 153, 210 }, { 24, 130, 194 }, { 3, 93, 146 }, |
| 699 { 1, 61, 97 }, { 1, 31, 50 }, { 1, 10, 16 } |
| 700 }, { // Band 4 |
| 701 { 49, 186, 223 }, { 17, 148, 204 }, { 1, 96, 142 }, |
| 702 { 1, 53, 83 }, { 1, 26, 44 }, { 1, 11, 17 } |
| 703 }, { // Band 5 |
| 704 { 13, 217, 212 }, { 2, 136, 180 }, { 1, 78, 124 }, |
| 705 { 1, 50, 83 }, { 1, 29, 49 }, { 1, 14, 23 } |
| 706 } |
| 707 }, { // Inter |
| 708 { // Band 0 |
| 709 { 197, 13, 247 }, { 82, 17, 222 }, { 25, 17, 162 } |
| 710 }, { // Band 1 |
| 711 { 126, 186, 247 }, { 234, 191, 243 }, { 176, 177, 234 }, |
| 712 { 104, 158, 220 }, { 66, 128, 186 }, { 55, 90, 137 } |
| 713 }, { // Band 2 |
| 714 { 111, 197, 242 }, { 46, 158, 219 }, { 9, 104, 171 }, |
| 715 { 2, 65, 125 }, { 1, 44, 80 }, { 1, 17, 91 } |
| 716 }, { // Band 3 |
| 717 { 104, 208, 245 }, { 39, 168, 224 }, { 3, 109, 162 }, |
| 718 { 1, 79, 124 }, { 1, 50, 102 }, { 1, 43, 102 } |
| 719 }, { // Band 4 |
| 720 { 84, 220, 246 }, { 31, 177, 231 }, { 2, 115, 180 }, |
| 721 { 1, 79, 134 }, { 1, 55, 77 }, { 1, 60, 79 } |
| 722 }, { // Band 5 |
| 723 { 43, 243, 240 }, { 8, 180, 217 }, { 1, 115, 166 }, |
| 724 { 1, 84, 121 }, { 1, 51, 67 }, { 1, 16, 6 } |
| 725 } |
| 726 } |
| 727 } |
| 728 }; |
| 729 |
| 730 static void extend_to_full_distribution(vp9_prob *probs, vp9_prob p) { |
| 731 vpx_memcpy(probs, vp9_pareto8_full[p = 0 ? 0 : p - 1], |
| 732 MODEL_NODES * sizeof(vp9_prob)); |
247 } | 733 } |
248 | 734 |
249 void vp9_model_to_full_probs(const vp9_prob *model, vp9_prob *full) { | 735 void vp9_model_to_full_probs(const vp9_prob *model, vp9_prob *full) { |
250 if (full != model) | 736 if (full != model) |
251 vpx_memcpy(full, model, sizeof(vp9_prob) * UNCONSTRAINED_NODES); | 737 vpx_memcpy(full, model, sizeof(vp9_prob) * UNCONSTRAINED_NODES); |
252 extend_model_to_full_distribution(model[PIVOT_NODE], full); | 738 extend_to_full_distribution(&full[UNCONSTRAINED_NODES], model[PIVOT_NODE]); |
253 } | 739 } |
254 | 740 |
255 static vp9_tree_index cat1[2], cat2[4], cat3[6], cat4[8], cat5[10], cat6[28]; | |
256 | |
257 static void init_bit_tree(vp9_tree_index *p, int n) { | |
258 int i = 0; | |
259 | |
260 while (++i < n) { | |
261 p[0] = p[1] = i << 1; | |
262 p += 2; | |
263 } | |
264 | |
265 p[0] = p[1] = 0; | |
266 } | |
267 | |
268 static void init_bit_trees() { | |
269 init_bit_tree(cat1, 1); | |
270 init_bit_tree(cat2, 2); | |
271 init_bit_tree(cat3, 3); | |
272 init_bit_tree(cat4, 4); | |
273 init_bit_tree(cat5, 5); | |
274 init_bit_tree(cat6, 14); | |
275 } | |
276 | |
277 const vp9_extra_bit vp9_extra_bits[MAX_ENTROPY_TOKENS] = { | |
278 { 0, 0, 0, 0}, | |
279 { 0, 0, 0, 1}, | |
280 { 0, 0, 0, 2}, | |
281 { 0, 0, 0, 3}, | |
282 { 0, 0, 0, 4}, | |
283 { cat1, Pcat1, 1, 5}, | |
284 { cat2, Pcat2, 2, 7}, | |
285 { cat3, Pcat3, 3, 11}, | |
286 { cat4, Pcat4, 4, 19}, | |
287 { cat5, Pcat5, 5, 35}, | |
288 { cat6, Pcat6, 14, 67}, | |
289 { 0, 0, 0, 0} | |
290 }; | |
291 | |
292 #include "vp9/common/vp9_default_coef_probs.h" | |
293 | |
294 void vp9_default_coef_probs(VP9_COMMON *cm) { | 741 void vp9_default_coef_probs(VP9_COMMON *cm) { |
295 vp9_copy(cm->fc.coef_probs[TX_4X4], default_coef_probs_4x4); | 742 vp9_copy(cm->fc.coef_probs[TX_4X4], default_coef_probs_4x4); |
296 vp9_copy(cm->fc.coef_probs[TX_8X8], default_coef_probs_8x8); | 743 vp9_copy(cm->fc.coef_probs[TX_8X8], default_coef_probs_8x8); |
297 vp9_copy(cm->fc.coef_probs[TX_16X16], default_coef_probs_16x16); | 744 vp9_copy(cm->fc.coef_probs[TX_16X16], default_coef_probs_16x16); |
298 vp9_copy(cm->fc.coef_probs[TX_32X32], default_coef_probs_32x32); | 745 vp9_copy(cm->fc.coef_probs[TX_32X32], default_coef_probs_32x32); |
299 } | 746 } |
300 | 747 |
301 void vp9_coef_tree_initialize() { | |
302 init_bit_trees(); | |
303 vp9_tokens_from_tree(vp9_coef_encodings, vp9_coef_tree); | |
304 } | |
305 | |
306 // #define COEF_COUNT_TESTING | |
307 | |
308 #define COEF_COUNT_SAT 24 | 748 #define COEF_COUNT_SAT 24 |
309 #define COEF_MAX_UPDATE_FACTOR 112 | 749 #define COEF_MAX_UPDATE_FACTOR 112 |
310 #define COEF_COUNT_SAT_KEY 24 | 750 #define COEF_COUNT_SAT_KEY 24 |
311 #define COEF_MAX_UPDATE_FACTOR_KEY 112 | 751 #define COEF_MAX_UPDATE_FACTOR_KEY 112 |
312 #define COEF_COUNT_SAT_AFTER_KEY 24 | 752 #define COEF_COUNT_SAT_AFTER_KEY 24 |
313 #define COEF_MAX_UPDATE_FACTOR_AFTER_KEY 128 | 753 #define COEF_MAX_UPDATE_FACTOR_AFTER_KEY 128 |
314 | 754 |
315 static void adapt_coef_probs(VP9_COMMON *cm, TX_SIZE tx_size, | 755 static void adapt_coef_probs(VP9_COMMON *cm, TX_SIZE tx_size, |
316 unsigned int count_sat, | 756 unsigned int count_sat, |
317 unsigned int update_factor) { | 757 unsigned int update_factor) { |
318 const FRAME_CONTEXT *pre_fc = &cm->frame_contexts[cm->frame_context_idx]; | 758 const FRAME_CONTEXT *pre_fc = &cm->frame_contexts[cm->frame_context_idx]; |
| 759 vp9_coeff_probs_model *const probs = cm->fc.coef_probs[tx_size]; |
| 760 const vp9_coeff_probs_model *const pre_probs = pre_fc->coef_probs[tx_size]; |
| 761 vp9_coeff_count_model *counts = cm->counts.coef[tx_size]; |
| 762 unsigned int (*eob_counts)[REF_TYPES][COEF_BANDS][COEFF_CONTEXTS] = |
| 763 cm->counts.eob_branch[tx_size]; |
| 764 int i, j, k, l, m; |
319 | 765 |
320 vp9_coeff_probs_model *dst_coef_probs = cm->fc.coef_probs[tx_size]; | 766 for (i = 0; i < PLANE_TYPES; ++i) |
321 const vp9_coeff_probs_model *pre_coef_probs = pre_fc->coef_probs[tx_size]; | |
322 vp9_coeff_count_model *coef_counts = cm->counts.coef[tx_size]; | |
323 unsigned int (*eob_branch_count)[REF_TYPES][COEF_BANDS][PREV_COEF_CONTEXTS] = | |
324 cm->counts.eob_branch[tx_size]; | |
325 int t, i, j, k, l; | |
326 unsigned int branch_ct[UNCONSTRAINED_NODES][2]; | |
327 vp9_prob coef_probs[UNCONSTRAINED_NODES]; | |
328 | |
329 for (i = 0; i < BLOCK_TYPES; ++i) | |
330 for (j = 0; j < REF_TYPES; ++j) | 767 for (j = 0; j < REF_TYPES; ++j) |
331 for (k = 0; k < COEF_BANDS; ++k) | 768 for (k = 0; k < COEF_BANDS; ++k) |
332 for (l = 0; l < PREV_COEF_CONTEXTS; ++l) { | 769 for (l = 0; l < BAND_COEFF_CONTEXTS(k); ++l) { |
333 if (l >= 3 && k == 0) | 770 const int n0 = counts[i][j][k][l][ZERO_TOKEN]; |
334 continue; | 771 const int n1 = counts[i][j][k][l][ONE_TOKEN]; |
335 vp9_tree_probs_from_distribution(vp9_coefmodel_tree, coef_probs, | 772 const int n2 = counts[i][j][k][l][TWO_TOKEN]; |
336 branch_ct, coef_counts[i][j][k][l], | 773 const int neob = counts[i][j][k][l][EOB_MODEL_TOKEN]; |
337 0); | 774 const unsigned int branch_ct[UNCONSTRAINED_NODES][2] = { |
338 branch_ct[0][1] = eob_branch_count[i][j][k][l] - branch_ct[0][0]; | 775 { neob, eob_counts[i][j][k][l] - neob }, |
339 coef_probs[0] = get_binary_prob(branch_ct[0][0], branch_ct[0][1]); | 776 { n0, n1 + n2 }, |
340 for (t = 0; t < UNCONSTRAINED_NODES; ++t) | 777 { n1, n2 } |
341 dst_coef_probs[i][j][k][l][t] = merge_probs( | 778 }; |
342 pre_coef_probs[i][j][k][l][t], coef_probs[t], | 779 for (m = 0; m < UNCONSTRAINED_NODES; ++m) |
343 branch_ct[t], count_sat, update_factor); | 780 probs[i][j][k][l][m] = merge_probs(pre_probs[i][j][k][l][m], |
| 781 branch_ct[m], |
| 782 count_sat, update_factor); |
344 } | 783 } |
345 } | 784 } |
346 | 785 |
347 void vp9_adapt_coef_probs(VP9_COMMON *cm) { | 786 void vp9_adapt_coef_probs(VP9_COMMON *cm) { |
348 TX_SIZE t; | 787 TX_SIZE t; |
349 unsigned int count_sat, update_factor; | 788 unsigned int count_sat, update_factor; |
350 | 789 |
351 if (frame_is_intra_only(cm)) { | 790 if (frame_is_intra_only(cm)) { |
352 update_factor = COEF_MAX_UPDATE_FACTOR_KEY; | 791 update_factor = COEF_MAX_UPDATE_FACTOR_KEY; |
353 count_sat = COEF_COUNT_SAT_KEY; | 792 count_sat = COEF_COUNT_SAT_KEY; |
354 } else if (cm->last_frame_type == KEY_FRAME) { | 793 } else if (cm->last_frame_type == KEY_FRAME) { |
355 update_factor = COEF_MAX_UPDATE_FACTOR_AFTER_KEY; /* adapt quickly */ | 794 update_factor = COEF_MAX_UPDATE_FACTOR_AFTER_KEY; /* adapt quickly */ |
356 count_sat = COEF_COUNT_SAT_AFTER_KEY; | 795 count_sat = COEF_COUNT_SAT_AFTER_KEY; |
357 } else { | 796 } else { |
358 update_factor = COEF_MAX_UPDATE_FACTOR; | 797 update_factor = COEF_MAX_UPDATE_FACTOR; |
359 count_sat = COEF_COUNT_SAT; | 798 count_sat = COEF_COUNT_SAT; |
360 } | 799 } |
361 for (t = TX_4X4; t <= TX_32X32; t++) | 800 for (t = TX_4X4; t <= TX_32X32; t++) |
362 adapt_coef_probs(cm, t, count_sat, update_factor); | 801 adapt_coef_probs(cm, t, count_sat, update_factor); |
363 } | 802 } |
OLD | NEW |