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 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
130 int base_qindex; | 130 int base_qindex; |
131 int y_dc_delta_q; | 131 int y_dc_delta_q; |
132 int uv_dc_delta_q; | 132 int uv_dc_delta_q; |
133 int uv_ac_delta_q; | 133 int uv_ac_delta_q; |
134 | 134 |
135 /* We allocate a MODE_INFO struct for each macroblock, together with | 135 /* We allocate a MODE_INFO struct for each macroblock, together with |
136 an extra row on top and column on the left to simplify prediction. */ | 136 an extra row on top and column on the left to simplify prediction. */ |
137 | 137 |
138 int mi_idx; | 138 int mi_idx; |
139 int prev_mi_idx; | 139 int prev_mi_idx; |
| 140 int mi_alloc_size; |
140 MODE_INFO *mip_array[2]; | 141 MODE_INFO *mip_array[2]; |
141 MODE_INFO **mi_grid_base_array[2]; | 142 MODE_INFO **mi_grid_base_array[2]; |
142 | 143 |
143 MODE_INFO *mip; /* Base of allocated array */ | 144 MODE_INFO *mip; /* Base of allocated array */ |
144 MODE_INFO *mi; /* Corresponds to upper left visible macroblock */ | 145 MODE_INFO *mi; /* Corresponds to upper left visible macroblock */ |
145 MODE_INFO *prev_mip; /* MODE_INFO array 'mip' from last decoded frame */ | 146 MODE_INFO *prev_mip; /* MODE_INFO array 'mip' from last decoded frame */ |
146 MODE_INFO *prev_mi; /* 'mi' from last frame (points into prev_mip) */ | 147 MODE_INFO *prev_mi; /* 'mi' from last frame (points into prev_mip) */ |
147 | 148 |
148 MODE_INFO **mi_grid_base; | 149 MODE_INFO **mi_grid_base; |
149 MODE_INFO **mi_grid_visible; | 150 MODE_INFO **mi_grid_visible; |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
181 // BITS_8 in versions 0 and 1, BITS_10 or BITS_12 in version 2 | 182 // BITS_8 in versions 0 and 1, BITS_10 or BITS_12 in version 2 |
182 BIT_DEPTH bit_depth; | 183 BIT_DEPTH bit_depth; |
183 | 184 |
184 #if CONFIG_VP9_POSTPROC | 185 #if CONFIG_VP9_POSTPROC |
185 struct postproc_state postproc_state; | 186 struct postproc_state postproc_state; |
186 #endif | 187 #endif |
187 | 188 |
188 int error_resilient_mode; | 189 int error_resilient_mode; |
189 int frame_parallel_decoding_mode; | 190 int frame_parallel_decoding_mode; |
190 | 191 |
191 // Flag indicates if prev_mi can be used in coding: | |
192 // 0: encoder assumes decoder does not have prev_mi | |
193 // 1: encoder assumes decoder has and uses prev_mi | |
194 unsigned int coding_use_prev_mi; | |
195 | |
196 int log2_tile_cols, log2_tile_rows; | 192 int log2_tile_cols, log2_tile_rows; |
197 | 193 |
198 // Private data associated with the frame buffer callbacks. | 194 // Private data associated with the frame buffer callbacks. |
199 void *cb_priv; | 195 void *cb_priv; |
200 vpx_get_frame_buffer_cb_fn_t get_fb_cb; | 196 vpx_get_frame_buffer_cb_fn_t get_fb_cb; |
201 vpx_release_frame_buffer_cb_fn_t release_fb_cb; | 197 vpx_release_frame_buffer_cb_fn_t release_fb_cb; |
202 | 198 |
203 // Handles memory for the codec. | 199 // Handles memory for the codec. |
204 InternalFrameBufferList int_frame_buffers; | 200 InternalFrameBufferList int_frame_buffers; |
205 | 201 |
206 PARTITION_CONTEXT *above_seg_context; | 202 PARTITION_CONTEXT *above_seg_context; |
207 ENTROPY_CONTEXT *above_context; | 203 ENTROPY_CONTEXT *above_context; |
208 } VP9_COMMON; | 204 } VP9_COMMON; |
209 | 205 |
| 206 static INLINE YV12_BUFFER_CONFIG *get_ref_frame(VP9_COMMON *cm, int index) { |
| 207 if (index < 0 || index >= REF_FRAMES) |
| 208 return NULL; |
| 209 if (cm->ref_frame_map[index] < 0) |
| 210 return NULL; |
| 211 assert(cm->ref_frame_map[index] < FRAME_BUFFERS); |
| 212 return &cm->frame_bufs[cm->ref_frame_map[index]].buf; |
| 213 } |
| 214 |
210 static INLINE YV12_BUFFER_CONFIG *get_frame_new_buffer(VP9_COMMON *cm) { | 215 static INLINE YV12_BUFFER_CONFIG *get_frame_new_buffer(VP9_COMMON *cm) { |
211 return &cm->frame_bufs[cm->new_fb_idx].buf; | 216 return &cm->frame_bufs[cm->new_fb_idx].buf; |
212 } | 217 } |
213 | 218 |
214 static INLINE int get_free_fb(VP9_COMMON *cm) { | 219 static INLINE int get_free_fb(VP9_COMMON *cm) { |
215 int i; | 220 int i; |
216 for (i = 0; i < FRAME_BUFFERS; i++) | 221 for (i = 0; i < FRAME_BUFFERS; i++) |
217 if (cm->frame_bufs[i].ref_count == 0) | 222 if (cm->frame_bufs[i].ref_count == 0) |
218 break; | 223 break; |
219 | 224 |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
264 const int above_idx = mi_col * 2; | 269 const int above_idx = mi_col * 2; |
265 const int left_idx = (mi_row * 2) & 15; | 270 const int left_idx = (mi_row * 2) & 15; |
266 int i; | 271 int i; |
267 for (i = 0; i < MAX_MB_PLANE; ++i) { | 272 for (i = 0; i < MAX_MB_PLANE; ++i) { |
268 struct macroblockd_plane *const pd = &xd->plane[i]; | 273 struct macroblockd_plane *const pd = &xd->plane[i]; |
269 pd->above_context = &xd->above_context[i][above_idx >> pd->subsampling_x]; | 274 pd->above_context = &xd->above_context[i][above_idx >> pd->subsampling_x]; |
270 pd->left_context = &xd->left_context[i][left_idx >> pd->subsampling_y]; | 275 pd->left_context = &xd->left_context[i][left_idx >> pd->subsampling_y]; |
271 } | 276 } |
272 } | 277 } |
273 | 278 |
| 279 static INLINE int calc_mi_size(int len) { |
| 280 // len is in mi units. |
| 281 return len + MI_BLOCK_SIZE; |
| 282 } |
| 283 |
274 static INLINE void set_mi_row_col(MACROBLOCKD *xd, const TileInfo *const tile, | 284 static INLINE void set_mi_row_col(MACROBLOCKD *xd, const TileInfo *const tile, |
275 int mi_row, int bh, | 285 int mi_row, int bh, |
276 int mi_col, int bw, | 286 int mi_col, int bw, |
277 int mi_rows, int mi_cols) { | 287 int mi_rows, int mi_cols) { |
278 xd->mb_to_top_edge = -((mi_row * MI_SIZE) * 8); | 288 xd->mb_to_top_edge = -((mi_row * MI_SIZE) * 8); |
279 xd->mb_to_bottom_edge = ((mi_rows - bh - mi_row) * MI_SIZE) * 8; | 289 xd->mb_to_bottom_edge = ((mi_rows - bh - mi_row) * MI_SIZE) * 8; |
280 xd->mb_to_left_edge = -((mi_col * MI_SIZE) * 8); | 290 xd->mb_to_left_edge = -((mi_col * MI_SIZE) * 8); |
281 xd->mb_to_right_edge = ((mi_cols - bw - mi_col) * MI_SIZE) * 8; | 291 xd->mb_to_right_edge = ((mi_cols - bw - mi_col) * MI_SIZE) * 8; |
282 | 292 |
283 // Are edges available for intra prediction? | 293 // Are edges available for intra prediction? |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
334 left = (left & bs) > 0; | 344 left = (left & bs) > 0; |
335 | 345 |
336 return (left * 2 + above) + bsl * PARTITION_PLOFFSET; | 346 return (left * 2 + above) + bsl * PARTITION_PLOFFSET; |
337 } | 347 } |
338 | 348 |
339 #ifdef __cplusplus | 349 #ifdef __cplusplus |
340 } // extern "C" | 350 } // extern "C" |
341 #endif | 351 #endif |
342 | 352 |
343 #endif // VP9_COMMON_VP9_ONYXC_INT_H_ | 353 #endif // VP9_COMMON_VP9_ONYXC_INT_H_ |
OLD | NEW |