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 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
49 2, 6, /* 0 = LOW_VAL */ | 49 2, 6, /* 0 = LOW_VAL */ |
50 -TWO_TOKEN, 4, /* 1 = TWO */ | 50 -TWO_TOKEN, 4, /* 1 = TWO */ |
51 -THREE_TOKEN, -FOUR_TOKEN, /* 2 = THREE */ | 51 -THREE_TOKEN, -FOUR_TOKEN, /* 2 = THREE */ |
52 8, 10, /* 3 = HIGH_LOW */ | 52 8, 10, /* 3 = HIGH_LOW */ |
53 -CATEGORY1_TOKEN, -CATEGORY2_TOKEN, /* 4 = CAT_ONE */ | 53 -CATEGORY1_TOKEN, -CATEGORY2_TOKEN, /* 4 = CAT_ONE */ |
54 12, 14, /* 5 = CAT_THREEFOUR */ | 54 12, 14, /* 5 = CAT_THREEFOUR */ |
55 -CATEGORY3_TOKEN, -CATEGORY4_TOKEN, /* 6 = CAT_THREE */ | 55 -CATEGORY3_TOKEN, -CATEGORY4_TOKEN, /* 6 = CAT_THREE */ |
56 -CATEGORY5_TOKEN, -CATEGORY6_TOKEN /* 7 = CAT_FIVE */ | 56 -CATEGORY5_TOKEN, -CATEGORY6_TOKEN /* 7 = CAT_FIVE */ |
57 }; | 57 }; |
58 | 58 |
59 static int decode_coefs(VP9_COMMON *cm, const MACROBLOCKD *xd, PLANE_TYPE type, | 59 static int decode_coefs(VP9_COMMON *cm, const MACROBLOCKD *xd, |
| 60 FRAME_COUNTS *counts, PLANE_TYPE type, |
60 tran_low_t *dqcoeff, TX_SIZE tx_size, const int16_t *dq, | 61 tran_low_t *dqcoeff, TX_SIZE tx_size, const int16_t *dq, |
61 int ctx, const int16_t *scan, const int16_t *nb, | 62 int ctx, const int16_t *scan, const int16_t *nb, |
62 vp9_reader *r) { | 63 vp9_reader *r) { |
63 const int max_eob = 16 << (tx_size << 1); | 64 const int max_eob = 16 << (tx_size << 1); |
64 const FRAME_CONTEXT *const fc = cm->fc; | 65 const FRAME_CONTEXT *const fc = cm->fc; |
65 FRAME_COUNTS *const counts = &cm->counts; | |
66 const int ref = is_inter_block(&xd->mi[0].src_mi->mbmi); | 66 const int ref = is_inter_block(&xd->mi[0].src_mi->mbmi); |
67 int band, c = 0; | 67 int band, c = 0; |
68 const vp9_prob (*coef_probs)[COEFF_CONTEXTS][UNCONSTRAINED_NODES] = | 68 const vp9_prob (*coef_probs)[COEFF_CONTEXTS][UNCONSTRAINED_NODES] = |
69 fc->coef_probs[tx_size][type][ref]; | 69 fc->coef_probs[tx_size][type][ref]; |
70 const vp9_prob *prob; | 70 const vp9_prob *prob; |
71 unsigned int (*coef_counts)[COEFF_CONTEXTS][UNCONSTRAINED_NODES + 1] = | 71 unsigned int (*coef_counts)[COEFF_CONTEXTS][UNCONSTRAINED_NODES + 1] = |
72 counts->coef[tx_size][type][ref]; | 72 counts->coef[tx_size][type][ref]; |
73 unsigned int (*eob_branch_count)[COEFF_CONTEXTS] = | 73 unsigned int (*eob_branch_count)[COEFF_CONTEXTS] = |
74 counts->eob_branch[tx_size][type][ref]; | 74 counts->eob_branch[tx_size][type][ref]; |
75 uint8_t token_cache[32 * 32]; | 75 uint8_t token_cache[32 * 32]; |
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
206 token_cache[scan[c]] = vp9_pt_energy_class[token]; | 206 token_cache[scan[c]] = vp9_pt_energy_class[token]; |
207 ++c; | 207 ++c; |
208 ctx = get_coef_context(nb, token_cache, c); | 208 ctx = get_coef_context(nb, token_cache, c); |
209 dqv = dq[1]; | 209 dqv = dq[1]; |
210 } | 210 } |
211 | 211 |
212 return c; | 212 return c; |
213 } | 213 } |
214 | 214 |
215 int vp9_decode_block_tokens(VP9_COMMON *cm, MACROBLOCKD *xd, | 215 int vp9_decode_block_tokens(VP9_COMMON *cm, MACROBLOCKD *xd, |
216 int plane, int block, BLOCK_SIZE plane_bsize, | 216 FRAME_COUNTS *counts, int plane, int block, |
217 int x, int y, TX_SIZE tx_size, vp9_reader *r) { | 217 BLOCK_SIZE plane_bsize, int x, int y, |
| 218 TX_SIZE tx_size, vp9_reader *r, |
| 219 const int16_t *const dequant) { |
218 struct macroblockd_plane *const pd = &xd->plane[plane]; | 220 struct macroblockd_plane *const pd = &xd->plane[plane]; |
219 const int ctx = get_entropy_context(tx_size, pd->above_context + x, | 221 const int ctx = get_entropy_context(tx_size, pd->above_context + x, |
220 pd->left_context + y); | 222 pd->left_context + y); |
221 const scan_order *so = get_scan(xd, tx_size, pd->plane_type, block); | 223 const scan_order *so = get_scan(xd, tx_size, pd->plane_type, block); |
222 const int eob = decode_coefs(cm, xd, pd->plane_type, | 224 const int eob = decode_coefs(cm, xd, counts, pd->plane_type, |
223 BLOCK_OFFSET(pd->dqcoeff, block), tx_size, | 225 BLOCK_OFFSET(pd->dqcoeff, block), tx_size, |
224 pd->dequant, ctx, so->scan, so->neighbors, r); | 226 dequant, ctx, so->scan, so->neighbors, r); |
225 vp9_set_contexts(xd, pd, plane_bsize, tx_size, eob > 0, x, y); | 227 vp9_set_contexts(xd, pd, plane_bsize, tx_size, eob > 0, x, y); |
226 return eob; | 228 return eob; |
227 } | 229 } |
228 | 230 |
229 | 231 |
OLD | NEW |