| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (c) 2012 The WebM project authors. All Rights Reserved. | 2 * Copyright (c) 2012 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 |
| 11 #ifndef VP9_COMMON_VP9_PRED_COMMON_H_ | 11 #ifndef VP9_COMMON_VP9_PRED_COMMON_H_ |
| 12 #define VP9_COMMON_VP9_PRED_COMMON_H_ | 12 #define VP9_COMMON_VP9_PRED_COMMON_H_ |
| 13 | 13 |
| 14 #include "vp9/common/vp9_blockd.h" | 14 #include "vp9/common/vp9_blockd.h" |
| 15 #include "vp9/common/vp9_onyxc_int.h" | 15 #include "vp9/common/vp9_onyxc_int.h" |
| 16 | 16 |
| 17 #ifdef __cplusplus | 17 #ifdef __cplusplus |
| 18 extern "C" { | 18 extern "C" { |
| 19 #endif | 19 #endif |
| 20 | 20 |
| 21 static INLINE const MODE_INFO *get_above_mi(const MACROBLOCKD *const xd) { | |
| 22 return xd->up_available ? xd->mi[-xd->mi_stride].src_mi : NULL; | |
| 23 } | |
| 24 | |
| 25 static INLINE const MODE_INFO *get_left_mi(const MACROBLOCKD *const xd) { | |
| 26 return xd->left_available ? xd->mi[-1].src_mi : NULL; | |
| 27 } | |
| 28 | |
| 29 int vp9_get_segment_id(const VP9_COMMON *cm, const uint8_t *segment_ids, | 21 int vp9_get_segment_id(const VP9_COMMON *cm, const uint8_t *segment_ids, |
| 30 BLOCK_SIZE bsize, int mi_row, int mi_col); | 22 BLOCK_SIZE bsize, int mi_row, int mi_col); |
| 31 | 23 |
| 32 static INLINE int vp9_get_pred_context_seg_id(const MACROBLOCKD *xd) { | 24 static INLINE int vp9_get_pred_context_seg_id(const MACROBLOCKD *xd) { |
| 33 const MODE_INFO *const above_mi = get_above_mi(xd); | 25 const MODE_INFO *const above_mi = xd->above_mi; |
| 34 const MODE_INFO *const left_mi = get_left_mi(xd); | 26 const MODE_INFO *const left_mi = xd->left_mi; |
| 35 const int above_sip = (above_mi != NULL) ? | 27 const int above_sip = (above_mi != NULL) ? |
| 36 above_mi->mbmi.seg_id_predicted : 0; | 28 above_mi->mbmi.seg_id_predicted : 0; |
| 37 const int left_sip = (left_mi != NULL) ? left_mi->mbmi.seg_id_predicted : 0; | 29 const int left_sip = (left_mi != NULL) ? left_mi->mbmi.seg_id_predicted : 0; |
| 38 | 30 |
| 39 return above_sip + left_sip; | 31 return above_sip + left_sip; |
| 40 } | 32 } |
| 41 | 33 |
| 42 static INLINE vp9_prob vp9_get_pred_prob_seg_id(const struct segmentation *seg, | 34 static INLINE vp9_prob vp9_get_pred_prob_seg_id(const struct segmentation *seg, |
| 43 const MACROBLOCKD *xd) { | 35 const MACROBLOCKD *xd) { |
| 44 return seg->pred_probs[vp9_get_pred_context_seg_id(xd)]; | 36 return seg->pred_probs[vp9_get_pred_context_seg_id(xd)]; |
| 45 } | 37 } |
| 46 | 38 |
| 47 static INLINE int vp9_get_skip_context(const MACROBLOCKD *xd) { | 39 static INLINE int vp9_get_skip_context(const MACROBLOCKD *xd) { |
| 48 const MODE_INFO *const above_mi = get_above_mi(xd); | 40 const MODE_INFO *const above_mi = xd->above_mi; |
| 49 const MODE_INFO *const left_mi = get_left_mi(xd); | 41 const MODE_INFO *const left_mi = xd->left_mi; |
| 50 const int above_skip = (above_mi != NULL) ? above_mi->mbmi.skip : 0; | 42 const int above_skip = (above_mi != NULL) ? above_mi->mbmi.skip : 0; |
| 51 const int left_skip = (left_mi != NULL) ? left_mi->mbmi.skip : 0; | 43 const int left_skip = (left_mi != NULL) ? left_mi->mbmi.skip : 0; |
| 52 return above_skip + left_skip; | 44 return above_skip + left_skip; |
| 53 } | 45 } |
| 54 | 46 |
| 55 static INLINE vp9_prob vp9_get_skip_prob(const VP9_COMMON *cm, | 47 static INLINE vp9_prob vp9_get_skip_prob(const VP9_COMMON *cm, |
| 56 const MACROBLOCKD *xd) { | 48 const MACROBLOCKD *xd) { |
| 57 return cm->fc->skip_probs[vp9_get_skip_context(xd)]; | 49 return cm->fc->skip_probs[vp9_get_skip_context(xd)]; |
| 58 } | 50 } |
| 59 | 51 |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 132 assert(0 && "Invalid max_tx_size."); | 124 assert(0 && "Invalid max_tx_size."); |
| 133 return NULL; | 125 return NULL; |
| 134 } | 126 } |
| 135 } | 127 } |
| 136 | 128 |
| 137 #ifdef __cplusplus | 129 #ifdef __cplusplus |
| 138 } // extern "C" | 130 } // extern "C" |
| 139 #endif | 131 #endif |
| 140 | 132 |
| 141 #endif // VP9_COMMON_VP9_PRED_COMMON_H_ | 133 #endif // VP9_COMMON_VP9_PRED_COMMON_H_ |
| OLD | NEW |