| 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 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 105 GOLDEN_FRAME = 2, | 105 GOLDEN_FRAME = 2, |
| 106 ALTREF_FRAME = 3, | 106 ALTREF_FRAME = 3, |
| 107 MAX_REF_FRAMES = 4 | 107 MAX_REF_FRAMES = 4 |
| 108 } MV_REFERENCE_FRAME; | 108 } MV_REFERENCE_FRAME; |
| 109 | 109 |
| 110 // This structure now relates to 8x8 block regions. | 110 // This structure now relates to 8x8 block regions. |
| 111 typedef struct { | 111 typedef struct { |
| 112 // Common for both INTER and INTRA blocks | 112 // Common for both INTER and INTRA blocks |
| 113 BLOCK_SIZE sb_type; | 113 BLOCK_SIZE sb_type; |
| 114 PREDICTION_MODE mode; | 114 PREDICTION_MODE mode; |
| 115 #if CONFIG_FILTERINTRA |
| 116 int filterbit, uv_filterbit; |
| 117 #endif |
| 115 TX_SIZE tx_size; | 118 TX_SIZE tx_size; |
| 116 int8_t skip; | 119 int8_t skip; |
| 117 int8_t segment_id; | 120 int8_t segment_id; |
| 118 int8_t seg_id_predicted; // valid only when temporal_update is enabled | 121 int8_t seg_id_predicted; // valid only when temporal_update is enabled |
| 119 | 122 |
| 120 // Only for INTRA blocks | 123 // Only for INTRA blocks |
| 121 PREDICTION_MODE uv_mode; | 124 PREDICTION_MODE uv_mode; |
| 122 | 125 |
| 123 // Only for INTER blocks | 126 // Only for INTER blocks |
| 124 MV_REFERENCE_FRAME ref_frame[2]; | 127 MV_REFERENCE_FRAME ref_frame[2]; |
| 125 int_mv mv[2]; | 128 int_mv mv[2]; |
| 126 int_mv ref_mvs[MAX_REF_FRAMES][MAX_MV_REF_CANDIDATES]; | 129 int_mv ref_mvs[MAX_REF_FRAMES][MAX_MV_REF_CANDIDATES]; |
| 127 uint8_t mode_context[MAX_REF_FRAMES]; | 130 uint8_t mode_context[MAX_REF_FRAMES]; |
| 128 INTERP_FILTER interp_filter; | 131 INTERP_FILTER interp_filter; |
| 132 |
| 133 #if CONFIG_EXT_TX |
| 134 EXT_TX_TYPE ext_txfrm; |
| 135 #endif |
| 129 } MB_MODE_INFO; | 136 } MB_MODE_INFO; |
| 130 | 137 |
| 131 typedef struct MODE_INFO { | 138 typedef struct MODE_INFO { |
| 132 struct MODE_INFO *src_mi; | 139 struct MODE_INFO *src_mi; |
| 133 MB_MODE_INFO mbmi; | 140 MB_MODE_INFO mbmi; |
| 141 #if CONFIG_FILTERINTRA |
| 142 int b_filter_info[4]; |
| 143 #endif |
| 134 b_mode_info bmi[4]; | 144 b_mode_info bmi[4]; |
| 135 } MODE_INFO; | 145 } MODE_INFO; |
| 136 | 146 |
| 137 static INLINE PREDICTION_MODE get_y_mode(const MODE_INFO *mi, int block) { | 147 static INLINE PREDICTION_MODE get_y_mode(const MODE_INFO *mi, int block) { |
| 138 return mi->mbmi.sb_type < BLOCK_8X8 ? mi->bmi[block].as_mode | 148 return mi->mbmi.sb_type < BLOCK_8X8 ? mi->bmi[block].as_mode |
| 139 : mi->mbmi.mode; | 149 : mi->mbmi.mode; |
| 140 } | 150 } |
| 141 | 151 |
| 152 #if CONFIG_FILTERINTRA |
| 153 static INLINE int is_filter_allowed(PREDICTION_MODE mode) { |
| 154 (void)mode; |
| 155 return 1; |
| 156 } |
| 157 |
| 158 static INLINE int is_filter_enabled(TX_SIZE txsize) { |
| 159 return (txsize < TX_SIZES); |
| 160 } |
| 161 #endif |
| 162 |
| 142 static INLINE int is_inter_block(const MB_MODE_INFO *mbmi) { | 163 static INLINE int is_inter_block(const MB_MODE_INFO *mbmi) { |
| 143 return mbmi->ref_frame[0] > INTRA_FRAME; | 164 return mbmi->ref_frame[0] > INTRA_FRAME; |
| 144 } | 165 } |
| 145 | 166 |
| 146 static INLINE int has_second_ref(const MB_MODE_INFO *mbmi) { | 167 static INLINE int has_second_ref(const MB_MODE_INFO *mbmi) { |
| 147 return mbmi->ref_frame[1] > INTRA_FRAME; | 168 return mbmi->ref_frame[1] > INTRA_FRAME; |
| 148 } | 169 } |
| 149 | 170 |
| 150 PREDICTION_MODE vp9_left_block_mode(const MODE_INFO *cur_mi, | 171 PREDICTION_MODE vp9_left_block_mode(const MODE_INFO *cur_mi, |
| 151 const MODE_INFO *left_mi, int b); | 172 const MODE_INFO *left_mi, int b); |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 229 PARTITION_CONTEXT left_seg_context[8]; | 250 PARTITION_CONTEXT left_seg_context[8]; |
| 230 } MACROBLOCKD; | 251 } MACROBLOCKD; |
| 231 | 252 |
| 232 static INLINE BLOCK_SIZE get_subsize(BLOCK_SIZE bsize, | 253 static INLINE BLOCK_SIZE get_subsize(BLOCK_SIZE bsize, |
| 233 PARTITION_TYPE partition) { | 254 PARTITION_TYPE partition) { |
| 234 return subsize_lookup[partition][bsize]; | 255 return subsize_lookup[partition][bsize]; |
| 235 } | 256 } |
| 236 | 257 |
| 237 extern const TX_TYPE intra_mode_to_tx_type_lookup[INTRA_MODES]; | 258 extern const TX_TYPE intra_mode_to_tx_type_lookup[INTRA_MODES]; |
| 238 | 259 |
| 260 #if CONFIG_EXT_TX |
| 261 static TX_TYPE ext_tx_to_txtype(EXT_TX_TYPE ext_tx) { |
| 262 switch (ext_tx) { |
| 263 case NORM: |
| 264 default: |
| 265 return DCT_DCT; |
| 266 case ALT: |
| 267 return ADST_ADST; |
| 268 } |
| 269 } |
| 270 #endif |
| 271 |
| 239 static INLINE TX_TYPE get_tx_type(PLANE_TYPE plane_type, | 272 static INLINE TX_TYPE get_tx_type(PLANE_TYPE plane_type, |
| 240 const MACROBLOCKD *xd) { | 273 const MACROBLOCKD *xd) { |
| 241 const MB_MODE_INFO *const mbmi = &xd->mi[0].src_mi->mbmi; | 274 const MB_MODE_INFO *const mbmi = &xd->mi[0].src_mi->mbmi; |
| 242 | 275 |
| 243 if (plane_type != PLANE_TYPE_Y || is_inter_block(mbmi)) | 276 #if CONFIG_EXT_TX |
| 277 if (plane_type != PLANE_TYPE_Y || xd->lossless) |
| 278 return DCT_DCT; |
| 279 |
| 280 if (is_inter_block(mbmi)) { |
| 281 return ext_tx_to_txtype(mbmi->ext_txfrm); |
| 282 } |
| 283 #else |
| 284 if (plane_type != PLANE_TYPE_Y || xd->lossless || is_inter_block(mbmi)) |
| 244 return DCT_DCT; | 285 return DCT_DCT; |
| 286 #endif |
| 245 return intra_mode_to_tx_type_lookup[mbmi->mode]; | 287 return intra_mode_to_tx_type_lookup[mbmi->mode]; |
| 246 } | 288 } |
| 247 | 289 |
| 248 static INLINE TX_TYPE get_tx_type_4x4(PLANE_TYPE plane_type, | 290 static INLINE TX_TYPE get_tx_type_4x4(PLANE_TYPE plane_type, |
| 249 const MACROBLOCKD *xd, int ib) { | 291 const MACROBLOCKD *xd, int ib) { |
| 250 const MODE_INFO *const mi = xd->mi[0].src_mi; | 292 const MODE_INFO *const mi = xd->mi[0].src_mi; |
| 251 | 293 |
| 294 #if CONFIG_EXT_TX |
| 295 if (plane_type != PLANE_TYPE_Y || xd->lossless) |
| 296 return DCT_DCT; |
| 297 |
| 298 if (is_inter_block(&mi->mbmi)) { |
| 299 return ext_tx_to_txtype(mi->mbmi.ext_txfrm); |
| 300 } |
| 301 #else |
| 252 if (plane_type != PLANE_TYPE_Y || xd->lossless || is_inter_block(&mi->mbmi)) | 302 if (plane_type != PLANE_TYPE_Y || xd->lossless || is_inter_block(&mi->mbmi)) |
| 253 return DCT_DCT; | 303 return DCT_DCT; |
| 304 #endif |
| 254 | 305 |
| 255 return intra_mode_to_tx_type_lookup[get_y_mode(mi, ib)]; | 306 return intra_mode_to_tx_type_lookup[get_y_mode(mi, ib)]; |
| 256 } | 307 } |
| 257 | 308 |
| 258 void vp9_setup_block_planes(MACROBLOCKD *xd, int ss_x, int ss_y); | 309 void vp9_setup_block_planes(MACROBLOCKD *xd, int ss_x, int ss_y); |
| 259 | 310 |
| 260 static INLINE TX_SIZE get_uv_tx_size_impl(TX_SIZE y_tx_size, BLOCK_SIZE bsize, | 311 static INLINE TX_SIZE get_uv_tx_size_impl(TX_SIZE y_tx_size, BLOCK_SIZE bsize, |
| 261 int xss, int yss) { | 312 int xss, int yss) { |
| 262 if (bsize < BLOCK_8X8) { | 313 if (bsize < BLOCK_8X8) { |
| 263 return TX_4X4; | 314 return TX_4X4; |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 305 | 356 |
| 306 void vp9_set_contexts(const MACROBLOCKD *xd, struct macroblockd_plane *pd, | 357 void vp9_set_contexts(const MACROBLOCKD *xd, struct macroblockd_plane *pd, |
| 307 BLOCK_SIZE plane_bsize, TX_SIZE tx_size, int has_eob, | 358 BLOCK_SIZE plane_bsize, TX_SIZE tx_size, int has_eob, |
| 308 int aoff, int loff); | 359 int aoff, int loff); |
| 309 | 360 |
| 310 #ifdef __cplusplus | 361 #ifdef __cplusplus |
| 311 } // extern "C" | 362 } // extern "C" |
| 312 #endif | 363 #endif |
| 313 | 364 |
| 314 #endif // VP9_COMMON_VP9_BLOCKD_H_ | 365 #endif // VP9_COMMON_VP9_BLOCKD_H_ |
| OLD | NEW |