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

Side by Side Diff: source/libvpx/vp9/common/vp9_entropy.h

Issue 23600008: libvpx: Pull from upstream (Closed) Base URL: svn://chrome-svn/chrome/trunk/deps/third_party/libvpx/
Patch Set: Created 7 years, 3 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/common/vp9_debugmodes.c ('k') | source/libvpx/vp9/common/vp9_entropy.c » ('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
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
43 43
44 extern struct vp9_token vp9_coef_encodings[MAX_ENTROPY_TOKENS]; 44 extern struct vp9_token vp9_coef_encodings[MAX_ENTROPY_TOKENS];
45 45
46 typedef struct { 46 typedef struct {
47 vp9_tree_p tree; 47 vp9_tree_p tree;
48 const vp9_prob *prob; 48 const vp9_prob *prob;
49 int len; 49 int len;
50 int base_val; 50 int base_val;
51 } vp9_extra_bit; 51 } vp9_extra_bit;
52 52
53 extern vp9_extra_bit vp9_extra_bits[12]; /* indexed by token value */ 53 extern const vp9_extra_bit vp9_extra_bits[12]; /* indexed by token value */
54 54
55 #define MAX_PROB 255 55 #define MAX_PROB 255
56 #define DCT_MAX_VALUE 16384 56 #define DCT_MAX_VALUE 16384
57 57
58 /* Coefficients are predicted via a 3-dimensional probability table. */ 58 /* Coefficients are predicted via a 3-dimensional probability table. */
59 59
60 /* Outside dimension. 0 = Y with DC, 1 = UV */ 60 /* Outside dimension. 0 = Y with DC, 1 = UV */
61 #define BLOCK_TYPES 2 61 #define BLOCK_TYPES 2
62 #define REF_TYPES 2 // intra=0, inter=1 62 #define REF_TYPES 2 // intra=0, inter=1
63 63
64 /* Middle dimension reflects the coefficient position within the transform. */ 64 /* Middle dimension reflects the coefficient position within the transform. */
65 #define COEF_BANDS 6 65 #define COEF_BANDS 6
66 66
67 /* Inside dimension is measure of nearby complexity, that reflects the energy 67 /* Inside dimension is measure of nearby complexity, that reflects the energy
68 of nearby coefficients are nonzero. For the first coefficient (DC, unless 68 of nearby coefficients are nonzero. For the first coefficient (DC, unless
69 block type is 0), we look at the (already encoded) blocks above and to the 69 block type is 0), we look at the (already encoded) blocks above and to the
70 left of the current block. The context index is then the number (0,1,or 2) 70 left of the current block. The context index is then the number (0,1,or 2)
71 of these blocks having nonzero coefficients. 71 of these blocks having nonzero coefficients.
72 After decoding a coefficient, the measure is determined by the size of the 72 After decoding a coefficient, the measure is determined by the size of the
73 most recently decoded coefficient. 73 most recently decoded coefficient.
74 Note that the intuitive meaning of this measure changes as coefficients 74 Note that the intuitive meaning of this measure changes as coefficients
75 are decoded, e.g., prior to the first token, a zero means that my neighbors 75 are decoded, e.g., prior to the first token, a zero means that my neighbors
76 are empty while, after the first token, because of the use of end-of-block, 76 are empty while, after the first token, because of the use of end-of-block,
77 a zero means we just decoded a zero and hence guarantees that a non-zero 77 a zero means we just decoded a zero and hence guarantees that a non-zero
78 coefficient will appear later in this block. However, this shift 78 coefficient will appear later in this block. However, this shift
79 in meaning is perfectly OK because our context depends also on the 79 in meaning is perfectly OK because our context depends also on the
80 coefficient band (and since zigzag positions 0, 1, and 2 are in 80 coefficient band (and since zigzag positions 0, 1, and 2 are in
81 distinct bands). */ 81 distinct bands). */
82 82
83 /*# define DC_TOKEN_CONTEXTS 3*/ /* 00, 0!0, !0!0 */
84 #define PREV_COEF_CONTEXTS 6 83 #define PREV_COEF_CONTEXTS 6
85 84
86 // #define ENTROPY_STATS 85 // #define ENTROPY_STATS
87 86
88 typedef unsigned int vp9_coeff_count[REF_TYPES][COEF_BANDS][PREV_COEF_CONTEXTS] 87 typedef unsigned int vp9_coeff_count[REF_TYPES][COEF_BANDS][PREV_COEF_CONTEXTS]
89 [MAX_ENTROPY_TOKENS]; 88 [MAX_ENTROPY_TOKENS];
90 typedef unsigned int vp9_coeff_stats[REF_TYPES][COEF_BANDS][PREV_COEF_CONTEXTS] 89 typedef unsigned int vp9_coeff_stats[REF_TYPES][COEF_BANDS][PREV_COEF_CONTEXTS]
91 [ENTROPY_NODES][2]; 90 [ENTROPY_NODES][2];
92 typedef vp9_prob vp9_coeff_probs[REF_TYPES][COEF_BANDS][PREV_COEF_CONTEXTS] 91 typedef vp9_prob vp9_coeff_probs[REF_TYPES][COEF_BANDS][PREV_COEF_CONTEXTS]
93 [ENTROPY_NODES]; 92 [ENTROPY_NODES];
94 93
95 #define SUBEXP_PARAM 4 /* Subexponential code parameter */ 94 #define SUBEXP_PARAM 4 /* Subexponential code parameter */
96 #define MODULUS_PARAM 13 /* Modulus parameter */ 95 #define MODULUS_PARAM 13 /* Modulus parameter */
97 96
98 struct VP9Common; 97 struct VP9Common;
99 void vp9_default_coef_probs(struct VP9Common *); 98 void vp9_default_coef_probs(struct VP9Common *);
100 extern DECLARE_ALIGNED(16, const int16_t, vp9_default_scan_4x4[16]); 99 extern DECLARE_ALIGNED(16, const int16_t, vp9_default_scan_4x4[16]);
101 100
102 extern DECLARE_ALIGNED(16, const int16_t, vp9_col_scan_4x4[16]); 101 extern DECLARE_ALIGNED(16, const int16_t, vp9_col_scan_4x4[16]);
103 extern DECLARE_ALIGNED(16, const int16_t, vp9_row_scan_4x4[16]); 102 extern DECLARE_ALIGNED(16, const int16_t, vp9_row_scan_4x4[16]);
104 103
105 extern DECLARE_ALIGNED(64, const int16_t, vp9_default_scan_8x8[64]); 104 extern DECLARE_ALIGNED(16, const int16_t, vp9_default_scan_8x8[64]);
106 105
107 extern DECLARE_ALIGNED(16, const int16_t, vp9_col_scan_8x8[64]); 106 extern DECLARE_ALIGNED(16, const int16_t, vp9_col_scan_8x8[64]);
108 extern DECLARE_ALIGNED(16, const int16_t, vp9_row_scan_8x8[64]); 107 extern DECLARE_ALIGNED(16, const int16_t, vp9_row_scan_8x8[64]);
109 108
110 extern DECLARE_ALIGNED(16, const int16_t, vp9_default_scan_16x16[256]); 109 extern DECLARE_ALIGNED(16, const int16_t, vp9_default_scan_16x16[256]);
111 110
112 extern DECLARE_ALIGNED(16, const int16_t, vp9_col_scan_16x16[256]); 111 extern DECLARE_ALIGNED(16, const int16_t, vp9_col_scan_16x16[256]);
113 extern DECLARE_ALIGNED(16, const int16_t, vp9_row_scan_16x16[256]); 112 extern DECLARE_ALIGNED(16, const int16_t, vp9_row_scan_16x16[256]);
114 113
115 extern DECLARE_ALIGNED(16, const int16_t, vp9_default_scan_32x32[1024]); 114 extern DECLARE_ALIGNED(16, const int16_t, vp9_default_scan_32x32[1024]);
116 115
117 extern DECLARE_ALIGNED(16, int16_t, vp9_default_iscan_4x4[16]); 116 extern DECLARE_ALIGNED(16, int16_t, vp9_default_iscan_4x4[16]);
118 117
119 extern DECLARE_ALIGNED(16, int16_t, vp9_col_iscan_4x4[16]); 118 extern DECLARE_ALIGNED(16, int16_t, vp9_col_iscan_4x4[16]);
120 extern DECLARE_ALIGNED(16, int16_t, vp9_row_iscan_4x4[16]); 119 extern DECLARE_ALIGNED(16, int16_t, vp9_row_iscan_4x4[16]);
121 120
122 extern DECLARE_ALIGNED(64, int16_t, vp9_default_iscan_8x8[64]); 121 extern DECLARE_ALIGNED(16, int16_t, vp9_default_iscan_8x8[64]);
123 122
124 extern DECLARE_ALIGNED(16, int16_t, vp9_col_iscan_8x8[64]); 123 extern DECLARE_ALIGNED(16, int16_t, vp9_col_iscan_8x8[64]);
125 extern DECLARE_ALIGNED(16, int16_t, vp9_row_iscan_8x8[64]); 124 extern DECLARE_ALIGNED(16, int16_t, vp9_row_iscan_8x8[64]);
126 125
127 extern DECLARE_ALIGNED(16, int16_t, vp9_default_iscan_16x16[256]); 126 extern DECLARE_ALIGNED(16, int16_t, vp9_default_iscan_16x16[256]);
128 127
129 extern DECLARE_ALIGNED(16, int16_t, vp9_col_iscan_16x16[256]); 128 extern DECLARE_ALIGNED(16, int16_t, vp9_col_iscan_16x16[256]);
130 extern DECLARE_ALIGNED(16, int16_t, vp9_row_iscan_16x16[256]); 129 extern DECLARE_ALIGNED(16, int16_t, vp9_row_iscan_16x16[256]);
131 130
132 extern DECLARE_ALIGNED(16, int16_t, vp9_default_iscan_32x32[1024]); 131 extern DECLARE_ALIGNED(16, int16_t, vp9_default_iscan_32x32[1024]);
(...skipping 17 matching lines...) Expand all
150 extern DECLARE_ALIGNED(16, int16_t, 149 extern DECLARE_ALIGNED(16, int16_t,
151 vp9_row_scan_16x16_neighbors[257 * MAX_NEIGHBORS]); 150 vp9_row_scan_16x16_neighbors[257 * MAX_NEIGHBORS]);
152 extern DECLARE_ALIGNED(16, int16_t, 151 extern DECLARE_ALIGNED(16, int16_t,
153 vp9_default_scan_16x16_neighbors[257 * MAX_NEIGHBORS]); 152 vp9_default_scan_16x16_neighbors[257 * MAX_NEIGHBORS]);
154 extern DECLARE_ALIGNED(16, int16_t, 153 extern DECLARE_ALIGNED(16, int16_t,
155 vp9_default_scan_32x32_neighbors[1025 * MAX_NEIGHBORS]); 154 vp9_default_scan_32x32_neighbors[1025 * MAX_NEIGHBORS]);
156 155
157 void vp9_coef_tree_initialize(void); 156 void vp9_coef_tree_initialize(void);
158 void vp9_adapt_coef_probs(struct VP9Common *); 157 void vp9_adapt_coef_probs(struct VP9Common *);
159 158
160 static INLINE void vp9_reset_sb_tokens_context(MACROBLOCKD* const xd, 159 static INLINE void reset_skip_context(MACROBLOCKD *xd, BLOCK_SIZE bsize) {
161 BLOCK_SIZE_TYPE bsize) {
162 /* Clear entropy contexts */
163 const int bw = 1 << b_width_log2(bsize);
164 const int bh = 1 << b_height_log2(bsize);
165 int i; 160 int i;
166 for (i = 0; i < MAX_MB_PLANE; i++) { 161 for (i = 0; i < MAX_MB_PLANE; i++) {
167 vpx_memset(xd->plane[i].above_context, 0, 162 struct macroblockd_plane *const pd = &xd->plane[i];
168 sizeof(ENTROPY_CONTEXT) * bw >> xd->plane[i].subsampling_x); 163 const BLOCK_SIZE plane_bsize = get_plane_block_size(bsize, pd);
169 vpx_memset(xd->plane[i].left_context, 0, 164 vpx_memset(pd->above_context, 0, sizeof(ENTROPY_CONTEXT) *
170 sizeof(ENTROPY_CONTEXT) * bh >> xd->plane[i].subsampling_y); 165 num_4x4_blocks_wide_lookup[plane_bsize]);
166 vpx_memset(pd->left_context, 0, sizeof(ENTROPY_CONTEXT) *
167 num_4x4_blocks_high_lookup[plane_bsize]);
171 } 168 }
172 } 169 }
173 170
174 // This is the index in the scan order beyond which all coefficients for 171 // This is the index in the scan order beyond which all coefficients for
175 // 8x8 transform and above are in the top band. 172 // 8x8 transform and above are in the top band.
176 // For 4x4 blocks the index is less but to keep things common the lookup 173 // For 4x4 blocks the index is less but to keep things common the lookup
177 // table for 4x4 is padded out to this index. 174 // table for 4x4 is padded out to this index.
178 #define MAXBAND_INDEX 21 175 #define MAXBAND_INDEX 21
179 176
180 extern const uint8_t vp9_coefband_trans_8x8plus[MAXBAND_INDEX + 1]; 177 extern const uint8_t vp9_coefband_trans_8x8plus[MAXBAND_INDEX + 1];
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after
335 case DCT_ADST: 332 case DCT_ADST:
336 return vp9_col_iscan_16x16; 333 return vp9_col_iscan_16x16;
337 default: 334 default:
338 return vp9_default_iscan_16x16; 335 return vp9_default_iscan_16x16;
339 } 336 }
340 } 337 }
341 338
342 enum { VP9_COEF_UPDATE_PROB = 252 }; 339 enum { VP9_COEF_UPDATE_PROB = 252 };
343 340
344 #endif // VP9_COMMON_VP9_ENTROPY_H_ 341 #endif // VP9_COMMON_VP9_ENTROPY_H_
OLDNEW
« no previous file with comments | « source/libvpx/vp9/common/vp9_debugmodes.c ('k') | source/libvpx/vp9/common/vp9_entropy.c » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698