| 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 int vp9_get_segment_id(VP9_COMMON *cm, const uint8_t *segment_ids, | 17 int vp9_get_segment_id(VP9_COMMON *cm, const uint8_t *segment_ids, |
| 18 BLOCK_SIZE_TYPE bsize, int mi_row, int mi_col); | 18 BLOCK_SIZE bsize, int mi_row, int mi_col); |
| 19 | 19 |
| 20 | 20 |
| 21 static INLINE int vp9_get_pred_context_seg_id(const MACROBLOCKD *xd) { | 21 static INLINE int vp9_get_pred_context_seg_id(const MACROBLOCKD *xd) { |
| 22 const MODE_INFO *const mi = xd->mode_info_context; | 22 const MODE_INFO *const mi = xd->mode_info_context; |
| 23 const MB_MODE_INFO *const above_mbmi = &mi[-xd->mode_info_stride].mbmi; | 23 const MB_MODE_INFO *const above_mbmi = &mi[-xd->mode_info_stride].mbmi; |
| 24 const MB_MODE_INFO *const left_mbmi = &mi[-1].mbmi; | 24 const MB_MODE_INFO *const left_mbmi = &mi[-1].mbmi; |
| 25 | 25 |
| 26 return above_mbmi->seg_id_predicted + | 26 return above_mbmi->seg_id_predicted + |
| 27 (xd->left_available ? left_mbmi->seg_id_predicted : 0); | 27 (xd->left_available ? left_mbmi->seg_id_predicted : 0); |
| 28 } | 28 } |
| 29 | 29 |
| 30 static INLINE vp9_prob vp9_get_pred_prob_seg_id(const MACROBLOCKD *xd) { | 30 static INLINE vp9_prob vp9_get_pred_prob_seg_id(struct segmentation *seg, |
| 31 return xd->seg.pred_probs[vp9_get_pred_context_seg_id(xd)]; | 31 const MACROBLOCKD *xd) { |
| 32 return seg->pred_probs[vp9_get_pred_context_seg_id(xd)]; |
| 32 } | 33 } |
| 33 | 34 |
| 34 void vp9_set_pred_flag_seg_id(VP9_COMMON *cm, BLOCK_SIZE_TYPE bsize, | 35 void vp9_set_pred_flag_seg_id(VP9_COMMON *cm, BLOCK_SIZE bsize, |
| 35 int mi_row, int mi_col, uint8_t pred_flag); | 36 int mi_row, int mi_col, uint8_t pred_flag); |
| 36 | 37 |
| 37 static INLINE int vp9_get_pred_context_mbskip(const MACROBLOCKD *xd) { | 38 static INLINE int vp9_get_pred_context_mbskip(const MACROBLOCKD *xd) { |
| 38 const MODE_INFO *const mi = xd->mode_info_context; | 39 const MODE_INFO *const mi = xd->mode_info_context; |
| 39 const MB_MODE_INFO *const above_mbmi = &mi[-xd->mode_info_stride].mbmi; | 40 const MB_MODE_INFO *const above_mbmi = &mi[-xd->mode_info_stride].mbmi; |
| 40 const MB_MODE_INFO *const left_mbmi = &mi[-1].mbmi; | 41 const MB_MODE_INFO *const left_mbmi = &mi[-1].mbmi; |
| 41 | 42 |
| 42 return above_mbmi->mb_skip_coeff + | 43 return above_mbmi->skip_coeff + |
| 43 (xd->left_available ? left_mbmi->mb_skip_coeff : 0); | 44 (xd->left_available ? left_mbmi->skip_coeff : 0); |
| 44 } | 45 } |
| 45 | 46 |
| 46 static INLINE vp9_prob vp9_get_pred_prob_mbskip(const VP9_COMMON *cm, | 47 static INLINE vp9_prob vp9_get_pred_prob_mbskip(const VP9_COMMON *cm, |
| 47 const MACROBLOCKD *xd) { | 48 const MACROBLOCKD *xd) { |
| 48 return cm->fc.mbskip_probs[vp9_get_pred_context_mbskip(xd)]; | 49 return cm->fc.mbskip_probs[vp9_get_pred_context_mbskip(xd)]; |
| 49 } | 50 } |
| 50 | 51 |
| 51 static INLINE unsigned char vp9_get_pred_flag_mbskip(const MACROBLOCKD *xd) { | 52 static INLINE unsigned char vp9_get_pred_flag_mbskip(const MACROBLOCKD *xd) { |
| 52 return xd->mode_info_context->mbmi.mb_skip_coeff; | 53 return xd->mode_info_context->mbmi.skip_coeff; |
| 53 } | 54 } |
| 54 | 55 |
| 55 void vp9_set_pred_flag_mbskip(VP9_COMMON *cm, BLOCK_SIZE_TYPE bsize, | 56 void vp9_set_pred_flag_mbskip(VP9_COMMON *cm, BLOCK_SIZE bsize, |
| 56 int mi_row, int mi_col, uint8_t pred_flag); | 57 int mi_row, int mi_col, uint8_t pred_flag); |
| 57 | 58 |
| 58 unsigned char vp9_get_pred_context_switchable_interp(const MACROBLOCKD *xd); | 59 unsigned char vp9_get_pred_context_switchable_interp(const MACROBLOCKD *xd); |
| 59 | 60 |
| 60 static INLINE const vp9_prob *vp9_get_pred_probs_switchable_interp( | |
| 61 const VP9_COMMON *cm, const MACROBLOCKD *xd) { | |
| 62 const int pred_context = vp9_get_pred_context_switchable_interp(xd); | |
| 63 return &cm->fc.switchable_interp_prob[pred_context][0]; | |
| 64 } | |
| 65 | |
| 66 unsigned char vp9_get_pred_context_intra_inter(const MACROBLOCKD *xd); | 61 unsigned char vp9_get_pred_context_intra_inter(const MACROBLOCKD *xd); |
| 67 | 62 |
| 68 static INLINE vp9_prob vp9_get_pred_prob_intra_inter(const VP9_COMMON *cm, | 63 static INLINE vp9_prob vp9_get_pred_prob_intra_inter(const VP9_COMMON *cm, |
| 69 const MACROBLOCKD *xd) { | 64 const MACROBLOCKD *xd) { |
| 70 const int pred_context = vp9_get_pred_context_intra_inter(xd); | 65 const int pred_context = vp9_get_pred_context_intra_inter(xd); |
| 71 return cm->fc.intra_inter_prob[pred_context]; | 66 return cm->fc.intra_inter_prob[pred_context]; |
| 72 } | 67 } |
| 73 | 68 |
| 74 unsigned char vp9_get_pred_context_comp_inter_inter(const VP9_COMMON *cm, | 69 unsigned char vp9_get_pred_context_comp_inter_inter(const VP9_COMMON *cm, |
| 75 const MACROBLOCKD *xd); | 70 const MACROBLOCKD *xd); |
| (...skipping 25 matching lines...) Expand all Loading... |
| 101 unsigned char vp9_get_pred_context_single_ref_p2(const MACROBLOCKD *xd); | 96 unsigned char vp9_get_pred_context_single_ref_p2(const MACROBLOCKD *xd); |
| 102 | 97 |
| 103 static INLINE vp9_prob vp9_get_pred_prob_single_ref_p2(const VP9_COMMON *cm, | 98 static INLINE vp9_prob vp9_get_pred_prob_single_ref_p2(const VP9_COMMON *cm, |
| 104 const MACROBLOCKD *xd) { | 99 const MACROBLOCKD *xd) { |
| 105 const int pred_context = vp9_get_pred_context_single_ref_p2(xd); | 100 const int pred_context = vp9_get_pred_context_single_ref_p2(xd); |
| 106 return cm->fc.single_ref_prob[pred_context][1]; | 101 return cm->fc.single_ref_prob[pred_context][1]; |
| 107 } | 102 } |
| 108 | 103 |
| 109 unsigned char vp9_get_pred_context_tx_size(const MACROBLOCKD *xd); | 104 unsigned char vp9_get_pred_context_tx_size(const MACROBLOCKD *xd); |
| 110 | 105 |
| 111 static const vp9_prob *get_tx_probs(BLOCK_SIZE_TYPE bsize, uint8_t context, | 106 static const vp9_prob *get_tx_probs(BLOCK_SIZE bsize, uint8_t context, |
| 112 const struct tx_probs *tx_probs) { | 107 const struct tx_probs *tx_probs) { |
| 113 if (bsize < BLOCK_SIZE_MB16X16) | 108 if (bsize < BLOCK_16X16) |
| 114 return tx_probs->p8x8[context]; | 109 return tx_probs->p8x8[context]; |
| 115 else if (bsize < BLOCK_SIZE_SB32X32) | 110 else if (bsize < BLOCK_32X32) |
| 116 return tx_probs->p16x16[context]; | 111 return tx_probs->p16x16[context]; |
| 117 else | 112 else |
| 118 return tx_probs->p32x32[context]; | 113 return tx_probs->p32x32[context]; |
| 119 } | 114 } |
| 120 | 115 |
| 121 static const vp9_prob *get_tx_probs2(const MACROBLOCKD *xd, | 116 static const vp9_prob *get_tx_probs2(const MACROBLOCKD *xd, |
| 122 const struct tx_probs *tx_probs) { | 117 const struct tx_probs *tx_probs) { |
| 123 const BLOCK_SIZE_TYPE bsize = xd->mode_info_context->mbmi.sb_type; | 118 const BLOCK_SIZE bsize = xd->mode_info_context->mbmi.sb_type; |
| 124 const int context = vp9_get_pred_context_tx_size(xd); | 119 const int context = vp9_get_pred_context_tx_size(xd); |
| 125 return get_tx_probs(bsize, context, tx_probs); | 120 return get_tx_probs(bsize, context, tx_probs); |
| 126 } | 121 } |
| 127 | 122 |
| 128 static void update_tx_counts(BLOCK_SIZE_TYPE bsize, uint8_t context, | 123 static void update_tx_counts(BLOCK_SIZE bsize, uint8_t context, |
| 129 TX_SIZE tx_size, struct tx_counts *tx_counts) { | 124 TX_SIZE tx_size, struct tx_counts *tx_counts) { |
| 130 if (bsize >= BLOCK_SIZE_SB32X32) | 125 if (bsize >= BLOCK_32X32) |
| 131 tx_counts->p32x32[context][tx_size]++; | 126 tx_counts->p32x32[context][tx_size]++; |
| 132 else if (bsize >= BLOCK_SIZE_MB16X16) | 127 else if (bsize >= BLOCK_16X16) |
| 133 tx_counts->p16x16[context][tx_size]++; | 128 tx_counts->p16x16[context][tx_size]++; |
| 134 else | 129 else |
| 135 tx_counts->p8x8[context][tx_size]++; | 130 tx_counts->p8x8[context][tx_size]++; |
| 136 } | 131 } |
| 137 | 132 |
| 138 #endif // VP9_COMMON_VP9_PRED_COMMON_H_ | 133 #endif // VP9_COMMON_VP9_PRED_COMMON_H_ |
| OLD | NEW |