| 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 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 155 #endif | 155 #endif |
| 156 | 156 |
| 157 FRAME_TYPE last_frame_type; /* last frame's frame type for motion search.*/ | 157 FRAME_TYPE last_frame_type; /* last frame's frame type for motion search.*/ |
| 158 FRAME_TYPE frame_type; | 158 FRAME_TYPE frame_type; |
| 159 | 159 |
| 160 int show_frame; | 160 int show_frame; |
| 161 int last_show_frame; | 161 int last_show_frame; |
| 162 int show_existing_frame; | 162 int show_existing_frame; |
| 163 | 163 |
| 164 // Flag signaling that the frame is encoded using only INTRA modes. | 164 // Flag signaling that the frame is encoded using only INTRA modes. |
| 165 int intra_only; | 165 uint8_t intra_only; |
| 166 uint8_t last_intra_only; |
| 166 | 167 |
| 167 int allow_high_precision_mv; | 168 int allow_high_precision_mv; |
| 168 | 169 |
| 169 // Flag signaling that the frame context should be reset to default values. | 170 // Flag signaling that the frame context should be reset to default values. |
| 170 // 0 or 1 implies don't reset, 2 reset just the context specified in the | 171 // 0 or 1 implies don't reset, 2 reset just the context specified in the |
| 171 // frame header, 3 reset all contexts. | 172 // frame header, 3 reset all contexts. |
| 172 int reset_frame_context; | 173 int reset_frame_context; |
| 173 | 174 |
| 174 // MBs, mb_rows/cols is in 16-pixel units; mi_rows/cols is in | 175 // MBs, mb_rows/cols is in 16-pixel units; mi_rows/cols is in |
| 175 // MODE_INFO (8-pixel) units. | 176 // MODE_INFO (8-pixel) units. |
| (...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 328 | 329 |
| 329 *idx = new_idx; | 330 *idx = new_idx; |
| 330 | 331 |
| 331 bufs[new_idx].ref_count++; | 332 bufs[new_idx].ref_count++; |
| 332 } | 333 } |
| 333 | 334 |
| 334 static INLINE int mi_cols_aligned_to_sb(int n_mis) { | 335 static INLINE int mi_cols_aligned_to_sb(int n_mis) { |
| 335 return ALIGN_POWER_OF_TWO(n_mis, MI_BLOCK_SIZE_LOG2); | 336 return ALIGN_POWER_OF_TWO(n_mis, MI_BLOCK_SIZE_LOG2); |
| 336 } | 337 } |
| 337 | 338 |
| 339 static INLINE int frame_is_intra_only(const VP9_COMMON *const cm) { |
| 340 return cm->frame_type == KEY_FRAME || cm->intra_only; |
| 341 } |
| 342 |
| 343 static INLINE void set_partition_probs(const VP9_COMMON *const cm, |
| 344 MACROBLOCKD *const xd) { |
| 345 xd->partition_probs = |
| 346 frame_is_intra_only(cm) ? |
| 347 &vp9_kf_partition_probs[0] : |
| 348 (const vp9_prob (*)[PARTITION_TYPES - 1])cm->fc->partition_prob; |
| 349 } |
| 350 |
| 338 static INLINE void init_macroblockd(VP9_COMMON *cm, MACROBLOCKD *xd) { | 351 static INLINE void init_macroblockd(VP9_COMMON *cm, MACROBLOCKD *xd) { |
| 339 int i; | 352 int i; |
| 340 | 353 |
| 341 for (i = 0; i < MAX_MB_PLANE; ++i) { | 354 for (i = 0; i < MAX_MB_PLANE; ++i) { |
| 342 xd->plane[i].dqcoeff = xd->dqcoeff; | 355 xd->plane[i].dqcoeff = xd->dqcoeff; |
| 343 xd->above_context[i] = cm->above_context + | 356 xd->above_context[i] = cm->above_context + |
| 344 i * sizeof(*cm->above_context) * 2 * mi_cols_aligned_to_sb(cm->mi_cols); | 357 i * sizeof(*cm->above_context) * 2 * mi_cols_aligned_to_sb(cm->mi_cols); |
| 345 | 358 |
| 346 if (xd->plane[i].plane_type == PLANE_TYPE_Y) { | 359 if (xd->plane[i].plane_type == PLANE_TYPE_Y) { |
| 347 memcpy(xd->plane[i].seg_dequant, cm->y_dequant, sizeof(cm->y_dequant)); | 360 memcpy(xd->plane[i].seg_dequant, cm->y_dequant, sizeof(cm->y_dequant)); |
| 348 } else { | 361 } else { |
| 349 memcpy(xd->plane[i].seg_dequant, cm->uv_dequant, sizeof(cm->uv_dequant)); | 362 memcpy(xd->plane[i].seg_dequant, cm->uv_dequant, sizeof(cm->uv_dequant)); |
| 350 } | 363 } |
| 351 xd->fc = cm->fc; | 364 xd->fc = cm->fc; |
| 352 xd->frame_parallel_decoding_mode = cm->frame_parallel_decoding_mode; | 365 xd->frame_parallel_decoding_mode = cm->frame_parallel_decoding_mode; |
| 353 } | 366 } |
| 354 | 367 |
| 355 xd->above_seg_context = cm->above_seg_context; | 368 xd->above_seg_context = cm->above_seg_context; |
| 356 xd->mi_stride = cm->mi_stride; | 369 xd->mi_stride = cm->mi_stride; |
| 357 xd->error_info = &cm->error; | 370 xd->error_info = &cm->error; |
| 371 |
| 372 set_partition_probs(cm, xd); |
| 358 } | 373 } |
| 359 | 374 |
| 360 static INLINE int frame_is_intra_only(const VP9_COMMON *const cm) { | 375 static INLINE const vp9_prob* get_partition_probs(const MACROBLOCKD *xd, |
| 361 return cm->frame_type == KEY_FRAME || cm->intra_only; | |
| 362 } | |
| 363 | |
| 364 static INLINE const vp9_prob* get_partition_probs(const VP9_COMMON *cm, | |
| 365 int ctx) { | 376 int ctx) { |
| 366 return frame_is_intra_only(cm) ? vp9_kf_partition_probs[ctx] | 377 return xd->partition_probs[ctx]; |
| 367 : cm->fc->partition_prob[ctx]; | |
| 368 } | 378 } |
| 369 | 379 |
| 370 static INLINE void set_skip_context(MACROBLOCKD *xd, int mi_row, int mi_col) { | 380 static INLINE void set_skip_context(MACROBLOCKD *xd, int mi_row, int mi_col) { |
| 371 const int above_idx = mi_col * 2; | 381 const int above_idx = mi_col * 2; |
| 372 const int left_idx = (mi_row * 2) & 15; | 382 const int left_idx = (mi_row * 2) & 15; |
| 373 int i; | 383 int i; |
| 374 for (i = 0; i < MAX_MB_PLANE; ++i) { | 384 for (i = 0; i < MAX_MB_PLANE; ++i) { |
| 375 struct macroblockd_plane *const pd = &xd->plane[i]; | 385 struct macroblockd_plane *const pd = &xd->plane[i]; |
| 376 pd->above_context = &xd->above_context[i][above_idx >> pd->subsampling_x]; | 386 pd->above_context = &xd->above_context[i][above_idx >> pd->subsampling_x]; |
| 377 pd->left_context = &xd->left_context[i][left_idx >> pd->subsampling_y]; | 387 pd->left_context = &xd->left_context[i][left_idx >> pd->subsampling_y]; |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 443 assert(bsl >= 0); | 453 assert(bsl >= 0); |
| 444 | 454 |
| 445 return (left * 2 + above) + bsl * PARTITION_PLOFFSET; | 455 return (left * 2 + above) + bsl * PARTITION_PLOFFSET; |
| 446 } | 456 } |
| 447 | 457 |
| 448 #ifdef __cplusplus | 458 #ifdef __cplusplus |
| 449 } // extern "C" | 459 } // extern "C" |
| 450 #endif | 460 #endif |
| 451 | 461 |
| 452 #endif // VP9_COMMON_VP9_ONYXC_INT_H_ | 462 #endif // VP9_COMMON_VP9_ONYXC_INT_H_ |
| OLD | NEW |