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 239 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
250 for (i = 0; i < MAX_MB_PLANE; ++i) { | 250 for (i = 0; i < MAX_MB_PLANE; ++i) { |
251 xd->plane[i].dqcoeff = xd->dqcoeff[i]; | 251 xd->plane[i].dqcoeff = xd->dqcoeff[i]; |
252 xd->above_context[i] = cm->above_context + | 252 xd->above_context[i] = cm->above_context + |
253 i * sizeof(*cm->above_context) * 2 * mi_cols_aligned_to_sb(cm->mi_cols); | 253 i * sizeof(*cm->above_context) * 2 * mi_cols_aligned_to_sb(cm->mi_cols); |
254 } | 254 } |
255 | 255 |
256 xd->above_seg_context = cm->above_seg_context; | 256 xd->above_seg_context = cm->above_seg_context; |
257 xd->mi_stride = cm->mi_stride; | 257 xd->mi_stride = cm->mi_stride; |
258 } | 258 } |
259 | 259 |
| 260 static INLINE int frame_is_intra_only(const VP9_COMMON *const cm) { |
| 261 return cm->frame_type == KEY_FRAME || cm->intra_only; |
| 262 } |
| 263 |
260 static INLINE const vp9_prob* get_partition_probs(const VP9_COMMON *cm, | 264 static INLINE const vp9_prob* get_partition_probs(const VP9_COMMON *cm, |
261 int ctx) { | 265 int ctx) { |
262 return cm->frame_type == KEY_FRAME ? vp9_kf_partition_probs[ctx] | 266 return frame_is_intra_only(cm) ? vp9_kf_partition_probs[ctx] |
263 : cm->fc.partition_prob[ctx]; | 267 : cm->fc.partition_prob[ctx]; |
264 } | 268 } |
265 | 269 |
266 static INLINE void set_skip_context(MACROBLOCKD *xd, int mi_row, int mi_col) { | 270 static INLINE void set_skip_context(MACROBLOCKD *xd, int mi_row, int mi_col) { |
267 const int above_idx = mi_col * 2; | 271 const int above_idx = mi_col * 2; |
268 const int left_idx = (mi_row * 2) & 15; | 272 const int left_idx = (mi_row * 2) & 15; |
269 int i; | 273 int i; |
270 for (i = 0; i < MAX_MB_PLANE; ++i) { | 274 for (i = 0; i < MAX_MB_PLANE; ++i) { |
271 struct macroblockd_plane *const pd = &xd->plane[i]; | 275 struct macroblockd_plane *const pd = &xd->plane[i]; |
272 pd->above_context = &xd->above_context[i][above_idx >> pd->subsampling_x]; | 276 pd->above_context = &xd->above_context[i][above_idx >> pd->subsampling_x]; |
273 pd->left_context = &xd->left_context[i][left_idx >> pd->subsampling_y]; | 277 pd->left_context = &xd->left_context[i][left_idx >> pd->subsampling_y]; |
(...skipping 18 matching lines...) Expand all Loading... |
292 const int use_prev_in_find_mv_refs = cm->width == cm->last_width && | 296 const int use_prev_in_find_mv_refs = cm->width == cm->last_width && |
293 cm->height == cm->last_height && | 297 cm->height == cm->last_height && |
294 !cm->intra_only && | 298 !cm->intra_only && |
295 cm->last_show_frame; | 299 cm->last_show_frame; |
296 // Special case: set prev_mi to NULL when the previous mode info | 300 // Special case: set prev_mi to NULL when the previous mode info |
297 // context cannot be used. | 301 // context cannot be used. |
298 cm->prev_mi = use_prev_in_find_mv_refs ? | 302 cm->prev_mi = use_prev_in_find_mv_refs ? |
299 cm->prev_mip + cm->mi_stride + 1 : NULL; | 303 cm->prev_mip + cm->mi_stride + 1 : NULL; |
300 } | 304 } |
301 | 305 |
302 static INLINE int frame_is_intra_only(const VP9_COMMON *const cm) { | |
303 return cm->frame_type == KEY_FRAME || cm->intra_only; | |
304 } | |
305 | |
306 static INLINE void update_partition_context(MACROBLOCKD *xd, | 306 static INLINE void update_partition_context(MACROBLOCKD *xd, |
307 int mi_row, int mi_col, | 307 int mi_row, int mi_col, |
308 BLOCK_SIZE subsize, | 308 BLOCK_SIZE subsize, |
309 BLOCK_SIZE bsize) { | 309 BLOCK_SIZE bsize) { |
310 PARTITION_CONTEXT *const above_ctx = xd->above_seg_context + mi_col; | 310 PARTITION_CONTEXT *const above_ctx = xd->above_seg_context + mi_col; |
311 PARTITION_CONTEXT *const left_ctx = xd->left_seg_context + (mi_row & MI_MASK); | 311 PARTITION_CONTEXT *const left_ctx = xd->left_seg_context + (mi_row & MI_MASK); |
312 | 312 |
313 // num_4x4_blocks_wide_lookup[bsize] / 2 | 313 // num_4x4_blocks_wide_lookup[bsize] / 2 |
314 const int bs = num_8x8_blocks_wide_lookup[bsize]; | 314 const int bs = num_8x8_blocks_wide_lookup[bsize]; |
315 | 315 |
(...skipping 25 matching lines...) Expand all Loading... |
341 left = (left & bs) > 0; | 341 left = (left & bs) > 0; |
342 | 342 |
343 return (left * 2 + above) + bsl * PARTITION_PLOFFSET; | 343 return (left * 2 + above) + bsl * PARTITION_PLOFFSET; |
344 } | 344 } |
345 | 345 |
346 #ifdef __cplusplus | 346 #ifdef __cplusplus |
347 } // extern "C" | 347 } // extern "C" |
348 #endif | 348 #endif |
349 | 349 |
350 #endif // VP9_COMMON_VP9_ONYXC_INT_H_ | 350 #endif // VP9_COMMON_VP9_ONYXC_INT_H_ |
OLD | NEW |