Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(78)

Side by Side Diff: source/libvpx/vp9/decoder/vp9_detokenize.c

Issue 812033011: libvpx: Pull from upstream (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/deps/third_party/libvpx/
Patch Set: Created 5 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « source/libvpx/vp9/decoder/vp9_decoder.c ('k') | source/libvpx/vp9/decoder/vp9_dthread.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "vpx_mem/vpx_mem.h" 11 #include "vpx_mem/vpx_mem.h"
12 #include "vpx_ports/mem.h" 12 #include "vpx_ports/mem.h"
13 13
14 #include "vp9/common/vp9_blockd.h" 14 #include "vp9/common/vp9_blockd.h"
15 #include "vp9/common/vp9_common.h" 15 #include "vp9/common/vp9_common.h"
16 #include "vp9/common/vp9_entropy.h" 16 #include "vp9/common/vp9_entropy.h"
17 #if CONFIG_COEFFICIENT_RANGE_CHECKING
18 #include "vp9/common/vp9_idct.h"
19 #endif
17 20
18 #include "vp9/decoder/vp9_detokenize.h" 21 #include "vp9/decoder/vp9_detokenize.h"
19 22
20 #define EOB_CONTEXT_NODE 0 23 #define EOB_CONTEXT_NODE 0
21 #define ZERO_CONTEXT_NODE 1 24 #define ZERO_CONTEXT_NODE 1
22 #define ONE_CONTEXT_NODE 2 25 #define ONE_CONTEXT_NODE 2
23 #define LOW_VAL_CONTEXT_NODE 0 26 #define LOW_VAL_CONTEXT_NODE 0
24 #define TWO_CONTEXT_NODE 1 27 #define TWO_CONTEXT_NODE 1
25 #define THREE_CONTEXT_NODE 2 28 #define THREE_CONTEXT_NODE 2
26 #define HIGH_LOW_CONTEXT_NODE 3 29 #define HIGH_LOW_CONTEXT_NODE 3
27 #define CAT_ONE_CONTEXT_NODE 4 30 #define CAT_ONE_CONTEXT_NODE 4
28 #define CAT_THREEFOUR_CONTEXT_NODE 5 31 #define CAT_THREEFOUR_CONTEXT_NODE 5
29 #define CAT_THREE_CONTEXT_NODE 6 32 #define CAT_THREE_CONTEXT_NODE 6
30 #define CAT_FIVE_CONTEXT_NODE 7 33 #define CAT_FIVE_CONTEXT_NODE 7
31 34
32 #define INCREMENT_COUNT(token) \ 35 #define INCREMENT_COUNT(token) \
33 do { \ 36 do { \
34 if (!cm->frame_parallel_decoding_mode) \ 37 if (!cm->frame_parallel_decoding_mode) \
35 ++coef_counts[band][ctx][token]; \ 38 ++coef_counts[band][ctx][token]; \
36 } while (0) 39 } while (0)
37 40
38 static INLINE int read_coeff(const vp9_prob *probs, int n, vp9_reader *r) { 41 static INLINE int read_coeff(const vp9_prob *probs, int n, vp9_reader *r) {
39 int i, val = 0; 42 int i, val = 0;
40 for (i = 0; i < n; ++i) 43 for (i = 0; i < n; ++i)
41 val = (val << 1) | vp9_read(r, probs[i]); 44 val = (val << 1) | vp9_read(r, probs[i]);
42 return val; 45 return val;
43 } 46 }
44 47
45 static const vp9_tree_index coeff_subtree_high[TREE_SIZE(ENTROPY_TOKENS)] = { 48 static const vp9_tree_index coeff_subtree_high[TREE_SIZE(ENTROPY_TOKENS)] = {
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after
184 return -1; 187 return -1;
185 } 188 }
186 #else 189 #else
187 val = CAT6_MIN_VAL + read_coeff(cat6_prob, 14, r); 190 val = CAT6_MIN_VAL + read_coeff(cat6_prob, 14, r);
188 #endif 191 #endif
189 break; 192 break;
190 } 193 }
191 } 194 }
192 v = (val * dqv) >> dq_shift; 195 v = (val * dqv) >> dq_shift;
193 #if CONFIG_COEFFICIENT_RANGE_CHECKING 196 #if CONFIG_COEFFICIENT_RANGE_CHECKING
197 #if CONFIG_VP9_HIGHBITDEPTH
198 dqcoeff[scan[c]] = highbd_check_range((vp9_read_bit(r) ? -v : v),
199 cm->bit_depth);
200 #else
194 dqcoeff[scan[c]] = check_range(vp9_read_bit(r) ? -v : v); 201 dqcoeff[scan[c]] = check_range(vp9_read_bit(r) ? -v : v);
202 #endif // CONFIG_VP9_HIGHBITDEPTH
195 #else 203 #else
196 dqcoeff[scan[c]] = vp9_read_bit(r) ? -v : v; 204 dqcoeff[scan[c]] = vp9_read_bit(r) ? -v : v;
197 #endif 205 #endif // CONFIG_COEFFICIENT_RANGE_CHECKING
198 token_cache[scan[c]] = vp9_pt_energy_class[token]; 206 token_cache[scan[c]] = vp9_pt_energy_class[token];
199 ++c; 207 ++c;
200 ctx = get_coef_context(nb, token_cache, c); 208 ctx = get_coef_context(nb, token_cache, c);
201 dqv = dq[1]; 209 dqv = dq[1];
202 } 210 }
203 211
204 return c; 212 return c;
205 } 213 }
206 214
207 int vp9_decode_block_tokens(VP9_COMMON *cm, MACROBLOCKD *xd, 215 int vp9_decode_block_tokens(VP9_COMMON *cm, MACROBLOCKD *xd,
208 int plane, int block, BLOCK_SIZE plane_bsize, 216 int plane, int block, BLOCK_SIZE plane_bsize,
209 int x, int y, TX_SIZE tx_size, vp9_reader *r) { 217 int x, int y, TX_SIZE tx_size, vp9_reader *r) {
210 struct macroblockd_plane *const pd = &xd->plane[plane]; 218 struct macroblockd_plane *const pd = &xd->plane[plane];
211 const int ctx = get_entropy_context(tx_size, pd->above_context + x, 219 const int ctx = get_entropy_context(tx_size, pd->above_context + x,
212 pd->left_context + y); 220 pd->left_context + y);
213 const scan_order *so = get_scan(xd, tx_size, pd->plane_type, block); 221 const scan_order *so = get_scan(xd, tx_size, pd->plane_type, block);
214 const int eob = decode_coefs(cm, xd, pd->plane_type, 222 const int eob = decode_coefs(cm, xd, pd->plane_type,
215 BLOCK_OFFSET(pd->dqcoeff, block), tx_size, 223 BLOCK_OFFSET(pd->dqcoeff, block), tx_size,
216 pd->dequant, ctx, so->scan, so->neighbors, r); 224 pd->dequant, ctx, so->scan, so->neighbors, r);
217 vp9_set_contexts(xd, pd, plane_bsize, tx_size, eob > 0, x, y); 225 vp9_set_contexts(xd, pd, plane_bsize, tx_size, eob > 0, x, y);
218 return eob; 226 return eob;
219 } 227 }
220 228
221 229
OLDNEW
« no previous file with comments | « source/libvpx/vp9/decoder/vp9_decoder.c ('k') | source/libvpx/vp9/decoder/vp9_dthread.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698