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_ENTROPY_H_ | 11 #ifndef VP9_COMMON_VP9_ENTROPY_H_ |
12 #define VP9_COMMON_VP9_ENTROPY_H_ | 12 #define VP9_COMMON_VP9_ENTROPY_H_ |
13 | 13 |
14 #include "vpx/vpx_integer.h" | 14 #include "vpx/vpx_integer.h" |
15 #include "vp9/common/vp9_treecoder.h" | 15 |
16 #include "vp9/common/vp9_blockd.h" | 16 #include "vp9/common/vp9_blockd.h" |
17 #include "vp9/common/vp9_common.h" | 17 #include "vp9/common/vp9_common.h" |
| 18 #include "vp9/common/vp9_scan.h" |
| 19 #include "vp9/common/vp9_treecoder.h" |
| 20 |
| 21 #define DIFF_UPDATE_PROB 252 |
18 | 22 |
19 /* Coefficient token alphabet */ | 23 /* Coefficient token alphabet */ |
20 | 24 |
21 #define ZERO_TOKEN 0 /* 0 Extra Bits 0+0 */ | 25 #define ZERO_TOKEN 0 /* 0 Extra Bits 0+0 */ |
22 #define ONE_TOKEN 1 /* 1 Extra Bits 0+1 */ | 26 #define ONE_TOKEN 1 /* 1 Extra Bits 0+1 */ |
23 #define TWO_TOKEN 2 /* 2 Extra Bits 0+1 */ | 27 #define TWO_TOKEN 2 /* 2 Extra Bits 0+1 */ |
24 #define THREE_TOKEN 3 /* 3 Extra Bits 0+1 */ | 28 #define THREE_TOKEN 3 /* 3 Extra Bits 0+1 */ |
25 #define FOUR_TOKEN 4 /* 4 Extra Bits 0+1 */ | 29 #define FOUR_TOKEN 4 /* 4 Extra Bits 0+1 */ |
26 #define DCT_VAL_CATEGORY1 5 /* 5-6 Extra Bits 1+1 */ | 30 #define DCT_VAL_CATEGORY1 5 /* 5-6 Extra Bits 1+1 */ |
27 #define DCT_VAL_CATEGORY2 6 /* 7-10 Extra Bits 2+1 */ | 31 #define DCT_VAL_CATEGORY2 6 /* 7-10 Extra Bits 2+1 */ |
28 #define DCT_VAL_CATEGORY3 7 /* 11-18 Extra Bits 3+1 */ | 32 #define DCT_VAL_CATEGORY3 7 /* 11-18 Extra Bits 3+1 */ |
29 #define DCT_VAL_CATEGORY4 8 /* 19-34 Extra Bits 4+1 */ | 33 #define DCT_VAL_CATEGORY4 8 /* 19-34 Extra Bits 4+1 */ |
30 #define DCT_VAL_CATEGORY5 9 /* 35-66 Extra Bits 5+1 */ | 34 #define DCT_VAL_CATEGORY5 9 /* 35-66 Extra Bits 5+1 */ |
31 #define DCT_VAL_CATEGORY6 10 /* 67+ Extra Bits 14+1 */ | 35 #define DCT_VAL_CATEGORY6 10 /* 67+ Extra Bits 14+1 */ |
32 #define DCT_EOB_TOKEN 11 /* EOB Extra Bits 0+0 */ | 36 #define DCT_EOB_TOKEN 11 /* EOB Extra Bits 0+0 */ |
33 #define MAX_ENTROPY_TOKENS 12 | 37 #define MAX_ENTROPY_TOKENS 12 |
34 #define ENTROPY_NODES 11 | 38 #define ENTROPY_NODES 11 |
35 #define EOSB_TOKEN 127 /* Not signalled, encoder only */ | 39 #define EOSB_TOKEN 127 /* Not signalled, encoder only */ |
36 | 40 |
37 #define INTER_MODE_CONTEXTS 7 | 41 #define INTER_MODE_CONTEXTS 7 |
38 | 42 |
39 extern const vp9_tree_index vp9_coef_tree[]; | 43 extern DECLARE_ALIGNED(16, const uint8_t, |
| 44 vp9_pt_energy_class[MAX_ENTROPY_TOKENS]); |
| 45 |
| 46 extern const vp9_tree_index vp9_coef_tree[TREE_SIZE(MAX_ENTROPY_TOKENS)]; |
40 | 47 |
41 #define DCT_EOB_MODEL_TOKEN 3 /* EOB Extra Bits 0+0 */ | 48 #define DCT_EOB_MODEL_TOKEN 3 /* EOB Extra Bits 0+0 */ |
42 extern const vp9_tree_index vp9_coefmodel_tree[]; | 49 extern const vp9_tree_index vp9_coefmodel_tree[]; |
43 | 50 |
44 extern struct vp9_token vp9_coef_encodings[MAX_ENTROPY_TOKENS]; | 51 extern struct vp9_token vp9_coef_encodings[MAX_ENTROPY_TOKENS]; |
45 | 52 |
46 typedef struct { | 53 typedef struct { |
47 vp9_tree_p tree; | 54 vp9_tree_index *tree; |
48 const vp9_prob *prob; | 55 const vp9_prob *prob; |
49 int len; | 56 int len; |
50 int base_val; | 57 int base_val; |
51 } vp9_extra_bit; | 58 } vp9_extra_bit; |
52 | 59 |
53 extern const vp9_extra_bit vp9_extra_bits[12]; /* indexed by token value */ | 60 // indexed by token value |
| 61 extern const vp9_extra_bit vp9_extra_bits[MAX_ENTROPY_TOKENS]; |
54 | 62 |
55 #define MAX_PROB 255 | 63 #define MAX_PROB 255 |
56 #define DCT_MAX_VALUE 16384 | 64 #define DCT_MAX_VALUE 16384 |
57 | 65 |
58 /* Coefficients are predicted via a 3-dimensional probability table. */ | 66 /* Coefficients are predicted via a 3-dimensional probability table. */ |
59 | 67 |
60 /* Outside dimension. 0 = Y with DC, 1 = UV */ | 68 /* Outside dimension. 0 = Y with DC, 1 = UV */ |
61 #define BLOCK_TYPES 2 | 69 #define BLOCK_TYPES 2 |
62 #define REF_TYPES 2 // intra=0, inter=1 | 70 #define REF_TYPES 2 // intra=0, inter=1 |
63 | 71 |
(...skipping 17 matching lines...) Expand all Loading... |
81 distinct bands). */ | 89 distinct bands). */ |
82 | 90 |
83 #define PREV_COEF_CONTEXTS 6 | 91 #define PREV_COEF_CONTEXTS 6 |
84 | 92 |
85 // #define ENTROPY_STATS | 93 // #define ENTROPY_STATS |
86 | 94 |
87 typedef unsigned int vp9_coeff_count[REF_TYPES][COEF_BANDS][PREV_COEF_CONTEXTS] | 95 typedef unsigned int vp9_coeff_count[REF_TYPES][COEF_BANDS][PREV_COEF_CONTEXTS] |
88 [MAX_ENTROPY_TOKENS]; | 96 [MAX_ENTROPY_TOKENS]; |
89 typedef unsigned int vp9_coeff_stats[REF_TYPES][COEF_BANDS][PREV_COEF_CONTEXTS] | 97 typedef unsigned int vp9_coeff_stats[REF_TYPES][COEF_BANDS][PREV_COEF_CONTEXTS] |
90 [ENTROPY_NODES][2]; | 98 [ENTROPY_NODES][2]; |
91 typedef vp9_prob vp9_coeff_probs[REF_TYPES][COEF_BANDS][PREV_COEF_CONTEXTS] | |
92 [ENTROPY_NODES]; | |
93 | 99 |
94 #define SUBEXP_PARAM 4 /* Subexponential code parameter */ | 100 #define SUBEXP_PARAM 4 /* Subexponential code parameter */ |
95 #define MODULUS_PARAM 13 /* Modulus parameter */ | 101 #define MODULUS_PARAM 13 /* Modulus parameter */ |
96 | 102 |
97 struct VP9Common; | 103 struct VP9Common; |
98 void vp9_default_coef_probs(struct VP9Common *cm); | 104 void vp9_default_coef_probs(struct VP9Common *cm); |
99 extern DECLARE_ALIGNED(16, const int16_t, vp9_default_scan_4x4[16]); | |
100 | 105 |
101 extern DECLARE_ALIGNED(16, const int16_t, vp9_col_scan_4x4[16]); | 106 void vp9_coef_tree_initialize(); |
102 extern DECLARE_ALIGNED(16, const int16_t, vp9_row_scan_4x4[16]); | |
103 | |
104 extern DECLARE_ALIGNED(16, const int16_t, vp9_default_scan_8x8[64]); | |
105 | |
106 extern DECLARE_ALIGNED(16, const int16_t, vp9_col_scan_8x8[64]); | |
107 extern DECLARE_ALIGNED(16, const int16_t, vp9_row_scan_8x8[64]); | |
108 | |
109 extern DECLARE_ALIGNED(16, const int16_t, vp9_default_scan_16x16[256]); | |
110 | |
111 extern DECLARE_ALIGNED(16, const int16_t, vp9_col_scan_16x16[256]); | |
112 extern DECLARE_ALIGNED(16, const int16_t, vp9_row_scan_16x16[256]); | |
113 | |
114 extern DECLARE_ALIGNED(16, const int16_t, vp9_default_scan_32x32[1024]); | |
115 | |
116 extern DECLARE_ALIGNED(16, int16_t, vp9_default_iscan_4x4[16]); | |
117 | |
118 extern DECLARE_ALIGNED(16, int16_t, vp9_col_iscan_4x4[16]); | |
119 extern DECLARE_ALIGNED(16, int16_t, vp9_row_iscan_4x4[16]); | |
120 | |
121 extern DECLARE_ALIGNED(16, int16_t, vp9_default_iscan_8x8[64]); | |
122 | |
123 extern DECLARE_ALIGNED(16, int16_t, vp9_col_iscan_8x8[64]); | |
124 extern DECLARE_ALIGNED(16, int16_t, vp9_row_iscan_8x8[64]); | |
125 | |
126 extern DECLARE_ALIGNED(16, int16_t, vp9_default_iscan_16x16[256]); | |
127 | |
128 extern DECLARE_ALIGNED(16, int16_t, vp9_col_iscan_16x16[256]); | |
129 extern DECLARE_ALIGNED(16, int16_t, vp9_row_iscan_16x16[256]); | |
130 | |
131 extern DECLARE_ALIGNED(16, int16_t, vp9_default_iscan_32x32[1024]); | |
132 | |
133 #define MAX_NEIGHBORS 2 | |
134 | |
135 extern DECLARE_ALIGNED(16, int16_t, | |
136 vp9_default_scan_4x4_neighbors[17 * MAX_NEIGHBORS]); | |
137 extern DECLARE_ALIGNED(16, int16_t, | |
138 vp9_col_scan_4x4_neighbors[17 * MAX_NEIGHBORS]); | |
139 extern DECLARE_ALIGNED(16, int16_t, | |
140 vp9_row_scan_4x4_neighbors[17 * MAX_NEIGHBORS]); | |
141 extern DECLARE_ALIGNED(16, int16_t, | |
142 vp9_col_scan_8x8_neighbors[65 * MAX_NEIGHBORS]); | |
143 extern DECLARE_ALIGNED(16, int16_t, | |
144 vp9_row_scan_8x8_neighbors[65 * MAX_NEIGHBORS]); | |
145 extern DECLARE_ALIGNED(16, int16_t, | |
146 vp9_default_scan_8x8_neighbors[65 * MAX_NEIGHBORS]); | |
147 extern DECLARE_ALIGNED(16, int16_t, | |
148 vp9_col_scan_16x16_neighbors[257 * MAX_NEIGHBORS]); | |
149 extern DECLARE_ALIGNED(16, int16_t, | |
150 vp9_row_scan_16x16_neighbors[257 * MAX_NEIGHBORS]); | |
151 extern DECLARE_ALIGNED(16, int16_t, | |
152 vp9_default_scan_16x16_neighbors[257 * MAX_NEIGHBORS]); | |
153 extern DECLARE_ALIGNED(16, int16_t, | |
154 vp9_default_scan_32x32_neighbors[1025 * MAX_NEIGHBORS]); | |
155 | |
156 void vp9_coef_tree_initialize(void); | |
157 void vp9_adapt_coef_probs(struct VP9Common *cm); | 107 void vp9_adapt_coef_probs(struct VP9Common *cm); |
158 | 108 |
159 static INLINE void reset_skip_context(MACROBLOCKD *xd, BLOCK_SIZE bsize) { | 109 static INLINE void reset_skip_context(MACROBLOCKD *xd, BLOCK_SIZE bsize) { |
160 int i; | 110 int i; |
161 for (i = 0; i < MAX_MB_PLANE; i++) { | 111 for (i = 0; i < MAX_MB_PLANE; i++) { |
162 struct macroblockd_plane *const pd = &xd->plane[i]; | 112 struct macroblockd_plane *const pd = &xd->plane[i]; |
163 const BLOCK_SIZE plane_bsize = get_plane_block_size(bsize, pd); | 113 const BLOCK_SIZE plane_bsize = get_plane_block_size(bsize, pd); |
164 vpx_memset(pd->above_context, 0, sizeof(ENTROPY_CONTEXT) * | 114 vpx_memset(pd->above_context, 0, sizeof(ENTROPY_CONTEXT) * |
165 num_4x4_blocks_wide_lookup[plane_bsize]); | 115 num_4x4_blocks_wide_lookup[plane_bsize]); |
166 vpx_memset(pd->left_context, 0, sizeof(ENTROPY_CONTEXT) * | 116 vpx_memset(pd->left_context, 0, sizeof(ENTROPY_CONTEXT) * |
167 num_4x4_blocks_high_lookup[plane_bsize]); | 117 num_4x4_blocks_high_lookup[plane_bsize]); |
168 } | 118 } |
169 } | 119 } |
170 | 120 |
171 // This is the index in the scan order beyond which all coefficients for | 121 // This is the index in the scan order beyond which all coefficients for |
172 // 8x8 transform and above are in the top band. | 122 // 8x8 transform and above are in the top band. |
173 // For 4x4 blocks the index is less but to keep things common the lookup | 123 // For 4x4 blocks the index is less but to keep things common the lookup |
174 // table for 4x4 is padded out to this index. | 124 // table for 4x4 is padded out to this index. |
175 #define MAXBAND_INDEX 21 | 125 #define MAXBAND_INDEX 21 |
176 | 126 |
177 extern const uint8_t vp9_coefband_trans_8x8plus[MAXBAND_INDEX + 1]; | 127 extern const uint8_t vp9_coefband_trans_8x8plus[MAXBAND_INDEX + 1]; |
178 extern const uint8_t vp9_coefband_trans_4x4[MAXBAND_INDEX + 1]; | 128 extern const uint8_t vp9_coefband_trans_4x4[MAXBAND_INDEX + 1]; |
179 | 129 |
180 | 130 |
181 static int get_coef_band(const uint8_t * band_translate, int coef_index) { | 131 static int get_coef_band(const uint8_t * band_translate, int coef_index) { |
182 return (coef_index > MAXBAND_INDEX) | 132 return (coef_index > MAXBAND_INDEX) |
183 ? (COEF_BANDS-1) : band_translate[coef_index]; | 133 ? (COEF_BANDS-1) : band_translate[coef_index]; |
184 } | 134 } |
185 | 135 |
186 static INLINE int get_coef_context(const int16_t *neighbors, | |
187 uint8_t *token_cache, | |
188 int c) { | |
189 return (1 + token_cache[neighbors[MAX_NEIGHBORS * c + 0]] + | |
190 token_cache[neighbors[MAX_NEIGHBORS * c + 1]]) >> 1; | |
191 } | |
192 | |
193 const int16_t *vp9_get_coef_neighbors_handle(const int16_t *scan); | |
194 | |
195 | |
196 // 128 lists of probabilities are stored for the following ONE node probs: | 136 // 128 lists of probabilities are stored for the following ONE node probs: |
197 // 1, 3, 5, 7, ..., 253, 255 | 137 // 1, 3, 5, 7, ..., 253, 255 |
198 // In between probabilities are interpolated linearly | 138 // In between probabilities are interpolated linearly |
199 | 139 |
200 #define COEFPROB_MODELS 128 | 140 #define COEFPROB_MODELS 128 |
201 | 141 |
202 #define UNCONSTRAINED_NODES 3 | 142 #define UNCONSTRAINED_NODES 3 |
203 | 143 |
204 #define PIVOT_NODE 2 // which node is pivot | 144 #define PIVOT_NODE 2 // which node is pivot |
205 | 145 |
206 typedef vp9_prob vp9_coeff_probs_model[REF_TYPES][COEF_BANDS] | 146 typedef vp9_prob vp9_coeff_probs_model[REF_TYPES][COEF_BANDS] |
207 [PREV_COEF_CONTEXTS] | 147 [PREV_COEF_CONTEXTS] |
208 [UNCONSTRAINED_NODES]; | 148 [UNCONSTRAINED_NODES]; |
209 | 149 |
210 typedef unsigned int vp9_coeff_count_model[REF_TYPES][COEF_BANDS] | 150 typedef unsigned int vp9_coeff_count_model[REF_TYPES][COEF_BANDS] |
211 [PREV_COEF_CONTEXTS] | 151 [PREV_COEF_CONTEXTS] |
212 [UNCONSTRAINED_NODES + 1]; | 152 [UNCONSTRAINED_NODES + 1]; |
213 typedef unsigned int vp9_coeff_stats_model[REF_TYPES][COEF_BANDS] | |
214 [PREV_COEF_CONTEXTS] | |
215 [UNCONSTRAINED_NODES][2]; | |
216 | 153 |
217 void vp9_model_to_full_probs(const vp9_prob *model, vp9_prob *full); | 154 void vp9_model_to_full_probs(const vp9_prob *model, vp9_prob *full); |
218 | 155 |
219 static INLINE const int16_t* get_scan_4x4(TX_TYPE tx_type) { | 156 static int get_entropy_context(TX_SIZE tx_size, |
220 switch (tx_type) { | 157 ENTROPY_CONTEXT *a, ENTROPY_CONTEXT *l) { |
221 case ADST_DCT: | |
222 return vp9_row_scan_4x4; | |
223 case DCT_ADST: | |
224 return vp9_col_scan_4x4; | |
225 default: | |
226 return vp9_default_scan_4x4; | |
227 } | |
228 } | |
229 | |
230 static INLINE void get_scan_nb_4x4(TX_TYPE tx_type, | |
231 const int16_t **scan, const int16_t **nb) { | |
232 switch (tx_type) { | |
233 case ADST_DCT: | |
234 *scan = vp9_row_scan_4x4; | |
235 *nb = vp9_row_scan_4x4_neighbors; | |
236 break; | |
237 case DCT_ADST: | |
238 *scan = vp9_col_scan_4x4; | |
239 *nb = vp9_col_scan_4x4_neighbors; | |
240 break; | |
241 default: | |
242 *scan = vp9_default_scan_4x4; | |
243 *nb = vp9_default_scan_4x4_neighbors; | |
244 break; | |
245 } | |
246 } | |
247 | |
248 static INLINE const int16_t* get_iscan_4x4(TX_TYPE tx_type) { | |
249 switch (tx_type) { | |
250 case ADST_DCT: | |
251 return vp9_row_iscan_4x4; | |
252 case DCT_ADST: | |
253 return vp9_col_iscan_4x4; | |
254 default: | |
255 return vp9_default_iscan_4x4; | |
256 } | |
257 } | |
258 | |
259 static INLINE const int16_t* get_scan_8x8(TX_TYPE tx_type) { | |
260 switch (tx_type) { | |
261 case ADST_DCT: | |
262 return vp9_row_scan_8x8; | |
263 case DCT_ADST: | |
264 return vp9_col_scan_8x8; | |
265 default: | |
266 return vp9_default_scan_8x8; | |
267 } | |
268 } | |
269 | |
270 static INLINE void get_scan_nb_8x8(TX_TYPE tx_type, | |
271 const int16_t **scan, const int16_t **nb) { | |
272 switch (tx_type) { | |
273 case ADST_DCT: | |
274 *scan = vp9_row_scan_8x8; | |
275 *nb = vp9_row_scan_8x8_neighbors; | |
276 break; | |
277 case DCT_ADST: | |
278 *scan = vp9_col_scan_8x8; | |
279 *nb = vp9_col_scan_8x8_neighbors; | |
280 break; | |
281 default: | |
282 *scan = vp9_default_scan_8x8; | |
283 *nb = vp9_default_scan_8x8_neighbors; | |
284 break; | |
285 } | |
286 } | |
287 | |
288 static INLINE const int16_t* get_iscan_8x8(TX_TYPE tx_type) { | |
289 switch (tx_type) { | |
290 case ADST_DCT: | |
291 return vp9_row_iscan_8x8; | |
292 case DCT_ADST: | |
293 return vp9_col_iscan_8x8; | |
294 default: | |
295 return vp9_default_iscan_8x8; | |
296 } | |
297 } | |
298 | |
299 static INLINE const int16_t* get_scan_16x16(TX_TYPE tx_type) { | |
300 switch (tx_type) { | |
301 case ADST_DCT: | |
302 return vp9_row_scan_16x16; | |
303 case DCT_ADST: | |
304 return vp9_col_scan_16x16; | |
305 default: | |
306 return vp9_default_scan_16x16; | |
307 } | |
308 } | |
309 | |
310 static INLINE void get_scan_nb_16x16(TX_TYPE tx_type, | |
311 const int16_t **scan, const int16_t **nb) { | |
312 switch (tx_type) { | |
313 case ADST_DCT: | |
314 *scan = vp9_row_scan_16x16; | |
315 *nb = vp9_row_scan_16x16_neighbors; | |
316 break; | |
317 case DCT_ADST: | |
318 *scan = vp9_col_scan_16x16; | |
319 *nb = vp9_col_scan_16x16_neighbors; | |
320 break; | |
321 default: | |
322 *scan = vp9_default_scan_16x16; | |
323 *nb = vp9_default_scan_16x16_neighbors; | |
324 break; | |
325 } | |
326 } | |
327 | |
328 static INLINE const int16_t* get_iscan_16x16(TX_TYPE tx_type) { | |
329 switch (tx_type) { | |
330 case ADST_DCT: | |
331 return vp9_row_iscan_16x16; | |
332 case DCT_ADST: | |
333 return vp9_col_iscan_16x16; | |
334 default: | |
335 return vp9_default_iscan_16x16; | |
336 } | |
337 } | |
338 | |
339 static int get_entropy_context(const MACROBLOCKD *xd, TX_SIZE tx_size, | |
340 PLANE_TYPE type, int block_idx, | |
341 ENTROPY_CONTEXT *A, ENTROPY_CONTEXT *L, | |
342 const int16_t **scan, | |
343 const uint8_t **band_translate) { | |
344 ENTROPY_CONTEXT above_ec = 0, left_ec = 0; | 158 ENTROPY_CONTEXT above_ec = 0, left_ec = 0; |
345 | 159 |
346 switch (tx_size) { | 160 switch (tx_size) { |
347 case TX_4X4: | 161 case TX_4X4: |
348 *scan = get_scan_4x4(get_tx_type_4x4(type, xd, block_idx)); | 162 above_ec = a[0] != 0; |
349 *band_translate = vp9_coefband_trans_4x4; | 163 left_ec = l[0] != 0; |
350 above_ec = A[0] != 0; | |
351 left_ec = L[0] != 0; | |
352 break; | 164 break; |
353 case TX_8X8: | 165 case TX_8X8: |
354 *scan = get_scan_8x8(get_tx_type_8x8(type, xd)); | 166 above_ec = !!*(uint16_t *)a; |
355 *band_translate = vp9_coefband_trans_8x8plus; | 167 left_ec = !!*(uint16_t *)l; |
356 above_ec = !!*(uint16_t *)A; | |
357 left_ec = !!*(uint16_t *)L; | |
358 break; | 168 break; |
359 case TX_16X16: | 169 case TX_16X16: |
360 *scan = get_scan_16x16(get_tx_type_16x16(type, xd)); | 170 above_ec = !!*(uint32_t *)a; |
361 *band_translate = vp9_coefband_trans_8x8plus; | 171 left_ec = !!*(uint32_t *)l; |
362 above_ec = !!*(uint32_t *)A; | |
363 left_ec = !!*(uint32_t *)L; | |
364 break; | 172 break; |
365 case TX_32X32: | 173 case TX_32X32: |
366 *scan = vp9_default_scan_32x32; | 174 above_ec = !!*(uint64_t *)a; |
367 *band_translate = vp9_coefband_trans_8x8plus; | 175 left_ec = !!*(uint64_t *)l; |
368 above_ec = !!*(uint64_t *)A; | |
369 left_ec = !!*(uint64_t *)L; | |
370 break; | 176 break; |
371 default: | 177 default: |
372 assert(!"Invalid transform size."); | 178 assert(!"Invalid transform size."); |
373 } | 179 } |
374 | 180 |
375 return combine_entropy_contexts(above_ec, left_ec); | 181 return combine_entropy_contexts(above_ec, left_ec); |
376 } | 182 } |
377 | 183 |
378 enum { VP9_COEF_UPDATE_PROB = 252 }; | 184 static const uint8_t *get_band_translate(TX_SIZE tx_size) { |
| 185 return tx_size == TX_4X4 ? vp9_coefband_trans_4x4 |
| 186 : vp9_coefband_trans_8x8plus; |
| 187 } |
| 188 |
| 189 static void get_scan(const MACROBLOCKD *xd, TX_SIZE tx_size, |
| 190 PLANE_TYPE type, int block_idx, |
| 191 const int16_t **scan, const int16_t **scan_nb) { |
| 192 switch (tx_size) { |
| 193 case TX_4X4: |
| 194 get_scan_nb_4x4(get_tx_type_4x4(type, xd, block_idx), scan, scan_nb); |
| 195 break; |
| 196 case TX_8X8: |
| 197 get_scan_nb_8x8(get_tx_type_8x8(type, xd), scan, scan_nb); |
| 198 break; |
| 199 case TX_16X16: |
| 200 get_scan_nb_16x16(get_tx_type_16x16(type, xd), scan, scan_nb); |
| 201 break; |
| 202 case TX_32X32: |
| 203 *scan = vp9_default_scan_32x32; |
| 204 *scan_nb = vp9_default_scan_32x32_neighbors; |
| 205 break; |
| 206 default: |
| 207 assert(!"Invalid transform size."); |
| 208 } |
| 209 } |
379 | 210 |
380 #endif // VP9_COMMON_VP9_ENTROPY_H_ | 211 #endif // VP9_COMMON_VP9_ENTROPY_H_ |
OLD | NEW |