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 } partition_context_lookup[BLOCK_SIZES]; | 49 } partition_context_lookup[BLOCK_SIZES]; |
50 | 50 |
51 | 51 |
52 typedef enum { | 52 typedef enum { |
53 SINGLE_REFERENCE = 0, | 53 SINGLE_REFERENCE = 0, |
54 COMPOUND_REFERENCE = 1, | 54 COMPOUND_REFERENCE = 1, |
55 REFERENCE_MODE_SELECT = 2, | 55 REFERENCE_MODE_SELECT = 2, |
56 REFERENCE_MODES = 3, | 56 REFERENCE_MODES = 3, |
57 } REFERENCE_MODE; | 57 } REFERENCE_MODE; |
58 | 58 |
| 59 typedef struct { |
| 60 int_mv mv[2]; |
| 61 MV_REFERENCE_FRAME ref_frame[2]; |
| 62 } MV_REF; |
59 | 63 |
60 typedef struct { | 64 typedef struct { |
61 int ref_count; | 65 int ref_count; |
| 66 MV_REF *mvs; |
| 67 int mi_rows; |
| 68 int mi_cols; |
62 vpx_codec_frame_buffer_t raw_frame_buffer; | 69 vpx_codec_frame_buffer_t raw_frame_buffer; |
63 YV12_BUFFER_CONFIG buf; | 70 YV12_BUFFER_CONFIG buf; |
64 } RefCntBuffer; | 71 } RefCntBuffer; |
65 | 72 |
66 typedef struct VP9Common { | 73 typedef struct VP9Common { |
67 struct vpx_internal_error_info error; | 74 struct vpx_internal_error_info error; |
68 | 75 |
69 DECLARE_ALIGNED(16, int16_t, y_dequant[QINDEX_RANGE][8]); | 76 DECLARE_ALIGNED(16, int16_t, y_dequant[QINDEX_RANGE][8]); |
70 DECLARE_ALIGNED(16, int16_t, uv_dequant[QINDEX_RANGE][8]); | 77 DECLARE_ALIGNED(16, int16_t, uv_dequant[QINDEX_RANGE][8]); |
71 | 78 |
(...skipping 10 matching lines...) Expand all Loading... |
82 // plane. Revisit as part of the future change to YV12_BUFFER_CONFIG to | 89 // plane. Revisit as part of the future change to YV12_BUFFER_CONFIG to |
83 // support additional planes. | 90 // support additional planes. |
84 int subsampling_x; | 91 int subsampling_x; |
85 int subsampling_y; | 92 int subsampling_y; |
86 | 93 |
87 #if CONFIG_VP9_HIGHBITDEPTH | 94 #if CONFIG_VP9_HIGHBITDEPTH |
88 int use_highbitdepth; // Marks if we need to use 16bit frame buffers. | 95 int use_highbitdepth; // Marks if we need to use 16bit frame buffers. |
89 #endif | 96 #endif |
90 | 97 |
91 YV12_BUFFER_CONFIG *frame_to_show; | 98 YV12_BUFFER_CONFIG *frame_to_show; |
| 99 RefCntBuffer frame_bufs[FRAME_BUFFERS]; |
| 100 RefCntBuffer *prev_frame; |
92 | 101 |
93 RefCntBuffer frame_bufs[FRAME_BUFFERS]; | 102 // TODO(hkuang): Combine this with cur_buf in macroblockd. |
| 103 RefCntBuffer *cur_frame; |
94 | 104 |
95 int ref_frame_map[REF_FRAMES]; /* maps fb_idx to reference slot */ | 105 int ref_frame_map[REF_FRAMES]; /* maps fb_idx to reference slot */ |
96 | 106 |
97 // TODO(jkoleszar): could expand active_ref_idx to 4, with 0 as intra, and | 107 // TODO(jkoleszar): could expand active_ref_idx to 4, with 0 as intra, and |
98 // roll new_fb_idx into it. | 108 // roll new_fb_idx into it. |
99 | 109 |
100 // Each frame can reference REFS_PER_FRAME buffers | 110 // Each frame can reference REFS_PER_FRAME buffers |
101 RefBuffer frame_refs[REFS_PER_FRAME]; | 111 RefBuffer frame_refs[REFS_PER_FRAME]; |
102 | 112 |
103 int new_fb_idx; | 113 int new_fb_idx; |
(...skipping 27 matching lines...) Expand all Loading... |
131 /* profile settings */ | 141 /* profile settings */ |
132 TX_MODE tx_mode; | 142 TX_MODE tx_mode; |
133 | 143 |
134 int base_qindex; | 144 int base_qindex; |
135 int y_dc_delta_q; | 145 int y_dc_delta_q; |
136 int uv_dc_delta_q; | 146 int uv_dc_delta_q; |
137 int uv_ac_delta_q; | 147 int uv_ac_delta_q; |
138 | 148 |
139 /* We allocate a MODE_INFO struct for each macroblock, together with | 149 /* We allocate a MODE_INFO struct for each macroblock, together with |
140 an extra row on top and column on the left to simplify prediction. */ | 150 an extra row on top and column on the left to simplify prediction. */ |
141 | |
142 int mi_idx; | |
143 int prev_mi_idx; | |
144 int mi_alloc_size; | 151 int mi_alloc_size; |
145 MODE_INFO *mip_array[2]; | |
146 | |
147 MODE_INFO *mip; /* Base of allocated array */ | 152 MODE_INFO *mip; /* Base of allocated array */ |
148 MODE_INFO *mi; /* Corresponds to upper left visible macroblock */ | 153 MODE_INFO *mi; /* Corresponds to upper left visible macroblock */ |
| 154 |
| 155 // TODO(agrange): Move prev_mi into encoder structure. |
| 156 // prev_mip and prev_mi will only be allocated in VP9 encoder. |
149 MODE_INFO *prev_mip; /* MODE_INFO array 'mip' from last decoded frame */ | 157 MODE_INFO *prev_mip; /* MODE_INFO array 'mip' from last decoded frame */ |
150 MODE_INFO *prev_mi; /* 'mi' from last frame (points into prev_mip) */ | 158 MODE_INFO *prev_mi; /* 'mi' from last frame (points into prev_mip) */ |
151 | 159 |
| 160 // Separate mi functions between encoder and decoder. |
| 161 int (*alloc_mi)(struct VP9Common *cm, int mi_size); |
| 162 void (*free_mi)(struct VP9Common *cm); |
| 163 void (*setup_mi)(struct VP9Common *cm); |
| 164 |
| 165 |
| 166 // Whether to use previous frame's motion vectors for prediction. |
| 167 int use_prev_frame_mvs; |
| 168 |
152 // Persistent mb segment id map used in prediction. | 169 // Persistent mb segment id map used in prediction. |
153 unsigned char *last_frame_seg_map; | 170 unsigned char *last_frame_seg_map; |
154 | 171 |
155 INTERP_FILTER interp_filter; | 172 INTERP_FILTER interp_filter; |
156 | 173 |
157 loop_filter_info_n lf_info; | 174 loop_filter_info_n lf_info; |
158 | 175 |
159 int refresh_frame_context; /* Two state 0 = NO, 1 = YES */ | 176 int refresh_frame_context; /* Two state 0 = NO, 1 = YES */ |
160 | 177 |
161 int ref_frame_sign_bias[MAX_REF_FRAMES]; /* Two state 0, 1 */ | 178 int ref_frame_sign_bias[MAX_REF_FRAMES]; /* Two state 0, 1 */ |
162 | 179 |
163 struct loopfilter lf; | 180 struct loopfilter lf; |
164 struct segmentation seg; | 181 struct segmentation seg; |
165 | 182 |
166 // Context probabilities for reference frame prediction | 183 // Context probabilities for reference frame prediction |
167 int allow_comp_inter_inter; | 184 int allow_comp_inter_inter; |
168 MV_REFERENCE_FRAME comp_fixed_ref; | 185 MV_REFERENCE_FRAME comp_fixed_ref; |
169 MV_REFERENCE_FRAME comp_var_ref[2]; | 186 MV_REFERENCE_FRAME comp_var_ref[2]; |
170 REFERENCE_MODE reference_mode; | 187 REFERENCE_MODE reference_mode; |
171 | 188 |
172 FRAME_CONTEXT fc; /* this frame entropy */ | 189 FRAME_CONTEXT *fc; /* this frame entropy */ |
173 FRAME_CONTEXT frame_contexts[FRAME_CONTEXTS]; | 190 FRAME_CONTEXT *frame_contexts; // FRAME_CONTEXTS |
174 unsigned int frame_context_idx; /* Context to use/update */ | 191 unsigned int frame_context_idx; /* Context to use/update */ |
175 FRAME_COUNTS counts; | 192 FRAME_COUNTS counts; |
176 | 193 |
177 unsigned int current_video_frame; | 194 unsigned int current_video_frame; |
178 BITSTREAM_PROFILE profile; | 195 BITSTREAM_PROFILE profile; |
179 | 196 |
180 // VPX_BITS_8 in profile 0 or 1, VPX_BITS_10 or VPX_BITS_12 in profile 2 or 3. | 197 // VPX_BITS_8 in profile 0 or 1, VPX_BITS_10 or VPX_BITS_12 in profile 2 or 3. |
181 vpx_bit_depth_t bit_depth; | 198 vpx_bit_depth_t bit_depth; |
182 vpx_bit_depth_t dequant_bit_depth; // bit_depth of current dequantizer | 199 vpx_bit_depth_t dequant_bit_depth; // bit_depth of current dequantizer |
183 | 200 |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
254 xd->mi_stride = cm->mi_stride; | 271 xd->mi_stride = cm->mi_stride; |
255 } | 272 } |
256 | 273 |
257 static INLINE int frame_is_intra_only(const VP9_COMMON *const cm) { | 274 static INLINE int frame_is_intra_only(const VP9_COMMON *const cm) { |
258 return cm->frame_type == KEY_FRAME || cm->intra_only; | 275 return cm->frame_type == KEY_FRAME || cm->intra_only; |
259 } | 276 } |
260 | 277 |
261 static INLINE const vp9_prob* get_partition_probs(const VP9_COMMON *cm, | 278 static INLINE const vp9_prob* get_partition_probs(const VP9_COMMON *cm, |
262 int ctx) { | 279 int ctx) { |
263 return frame_is_intra_only(cm) ? vp9_kf_partition_probs[ctx] | 280 return frame_is_intra_only(cm) ? vp9_kf_partition_probs[ctx] |
264 : cm->fc.partition_prob[ctx]; | 281 : cm->fc->partition_prob[ctx]; |
265 } | 282 } |
266 | 283 |
267 static INLINE void set_skip_context(MACROBLOCKD *xd, int mi_row, int mi_col) { | 284 static INLINE void set_skip_context(MACROBLOCKD *xd, int mi_row, int mi_col) { |
268 const int above_idx = mi_col * 2; | 285 const int above_idx = mi_col * 2; |
269 const int left_idx = (mi_row * 2) & 15; | 286 const int left_idx = (mi_row * 2) & 15; |
270 int i; | 287 int i; |
271 for (i = 0; i < MAX_MB_PLANE; ++i) { | 288 for (i = 0; i < MAX_MB_PLANE; ++i) { |
272 struct macroblockd_plane *const pd = &xd->plane[i]; | 289 struct macroblockd_plane *const pd = &xd->plane[i]; |
273 pd->above_context = &xd->above_context[i][above_idx >> pd->subsampling_x]; | 290 pd->above_context = &xd->above_context[i][above_idx >> pd->subsampling_x]; |
274 pd->left_context = &xd->left_context[i][left_idx >> pd->subsampling_y]; | 291 pd->left_context = &xd->left_context[i][left_idx >> pd->subsampling_y]; |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
343 left = (left & bs) > 0; | 360 left = (left & bs) > 0; |
344 | 361 |
345 return (left * 2 + above) + bsl * PARTITION_PLOFFSET; | 362 return (left * 2 + above) + bsl * PARTITION_PLOFFSET; |
346 } | 363 } |
347 | 364 |
348 #ifdef __cplusplus | 365 #ifdef __cplusplus |
349 } // extern "C" | 366 } // extern "C" |
350 #endif | 367 #endif |
351 | 368 |
352 #endif // VP9_COMMON_VP9_ONYXC_INT_H_ | 369 #endif // VP9_COMMON_VP9_ONYXC_INT_H_ |
OLD | NEW |