| 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 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 137 INTERP_FILTER interp_filter; | 137 INTERP_FILTER interp_filter; |
| 138 | 138 |
| 139 BLOCK_SIZE sb_type; | 139 BLOCK_SIZE sb_type; |
| 140 } MB_MODE_INFO; | 140 } MB_MODE_INFO; |
| 141 | 141 |
| 142 typedef struct { | 142 typedef struct { |
| 143 MB_MODE_INFO mbmi; | 143 MB_MODE_INFO mbmi; |
| 144 b_mode_info bmi[4]; | 144 b_mode_info bmi[4]; |
| 145 } MODE_INFO; | 145 } MODE_INFO; |
| 146 | 146 |
| 147 static INLINE MB_PREDICTION_MODE get_y_mode(const MODE_INFO *mi, int block) { |
| 148 return mi->mbmi.sb_type < BLOCK_8X8 ? mi->bmi[block].as_mode |
| 149 : mi->mbmi.mode; |
| 150 } |
| 151 |
| 147 static INLINE int is_inter_block(const MB_MODE_INFO *mbmi) { | 152 static INLINE int is_inter_block(const MB_MODE_INFO *mbmi) { |
| 148 return mbmi->ref_frame[0] > INTRA_FRAME; | 153 return mbmi->ref_frame[0] > INTRA_FRAME; |
| 149 } | 154 } |
| 150 | 155 |
| 151 static INLINE int has_second_ref(const MB_MODE_INFO *mbmi) { | 156 static INLINE int has_second_ref(const MB_MODE_INFO *mbmi) { |
| 152 return mbmi->ref_frame[1] > INTRA_FRAME; | 157 return mbmi->ref_frame[1] > INTRA_FRAME; |
| 153 } | 158 } |
| 154 | 159 |
| 155 MB_PREDICTION_MODE vp9_left_block_mode(const MODE_INFO *cur_mi, | 160 MB_PREDICTION_MODE vp9_left_block_mode(const MODE_INFO *cur_mi, |
| 156 const MODE_INFO *left_mi, int b); | 161 const MODE_INFO *left_mi, int b); |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 248 const BLOCK_SIZE subsize = subsize_lookup[partition][bsize]; | 253 const BLOCK_SIZE subsize = subsize_lookup[partition][bsize]; |
| 249 assert(subsize < BLOCK_SIZES); | 254 assert(subsize < BLOCK_SIZES); |
| 250 return subsize; | 255 return subsize; |
| 251 } | 256 } |
| 252 | 257 |
| 253 extern const TX_TYPE mode2txfm_map[MB_MODE_COUNT]; | 258 extern const TX_TYPE mode2txfm_map[MB_MODE_COUNT]; |
| 254 | 259 |
| 255 static INLINE TX_TYPE get_tx_type_4x4(PLANE_TYPE plane_type, | 260 static INLINE TX_TYPE get_tx_type_4x4(PLANE_TYPE plane_type, |
| 256 const MACROBLOCKD *xd, int ib) { | 261 const MACROBLOCKD *xd, int ib) { |
| 257 const MODE_INFO *const mi = xd->mi_8x8[0]; | 262 const MODE_INFO *const mi = xd->mi_8x8[0]; |
| 258 const MB_MODE_INFO *const mbmi = &mi->mbmi; | |
| 259 | 263 |
| 260 if (plane_type != PLANE_TYPE_Y || xd->lossless || is_inter_block(mbmi)) | 264 if (plane_type != PLANE_TYPE_Y || xd->lossless || is_inter_block(&mi->mbmi)) |
| 261 return DCT_DCT; | 265 return DCT_DCT; |
| 262 | 266 |
| 263 return mode2txfm_map[mbmi->sb_type < BLOCK_8X8 ? mi->bmi[ib].as_mode | 267 return mode2txfm_map[get_y_mode(mi, ib)]; |
| 264 : mbmi->mode]; | |
| 265 } | 268 } |
| 266 | 269 |
| 267 static INLINE TX_TYPE get_tx_type_8x8(PLANE_TYPE plane_type, | 270 static INLINE TX_TYPE get_tx_type_8x8(PLANE_TYPE plane_type, |
| 268 const MACROBLOCKD *xd) { | 271 const MACROBLOCKD *xd) { |
| 269 return plane_type == PLANE_TYPE_Y ? mode2txfm_map[xd->mi_8x8[0]->mbmi.mode] | 272 return plane_type == PLANE_TYPE_Y ? mode2txfm_map[xd->mi_8x8[0]->mbmi.mode] |
| 270 : DCT_DCT; | 273 : DCT_DCT; |
| 271 } | 274 } |
| 272 | 275 |
| 273 static INLINE TX_TYPE get_tx_type_16x16(PLANE_TYPE plane_type, | 276 static INLINE TX_TYPE get_tx_type_16x16(PLANE_TYPE plane_type, |
| 274 const MACROBLOCKD *xd) { | 277 const MACROBLOCKD *xd) { |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 321 const int tx_cols = 1 << tx_cols_log2; | 324 const int tx_cols = 1 << tx_cols_log2; |
| 322 const int raster_mb = block >> (tx_size << 1); | 325 const int raster_mb = block >> (tx_size << 1); |
| 323 *x = (raster_mb & (tx_cols - 1)) << tx_size; | 326 *x = (raster_mb & (tx_cols - 1)) << tx_size; |
| 324 *y = (raster_mb >> tx_cols_log2) << tx_size; | 327 *y = (raster_mb >> tx_cols_log2) << tx_size; |
| 325 } | 328 } |
| 326 | 329 |
| 327 void vp9_set_contexts(const MACROBLOCKD *xd, struct macroblockd_plane *pd, | 330 void vp9_set_contexts(const MACROBLOCKD *xd, struct macroblockd_plane *pd, |
| 328 BLOCK_SIZE plane_bsize, TX_SIZE tx_size, int has_eob, | 331 BLOCK_SIZE plane_bsize, TX_SIZE tx_size, int has_eob, |
| 329 int aoff, int loff); | 332 int aoff, int loff); |
| 330 | 333 |
| 331 | |
| 332 static INLINE int get_tx_eob(const struct segmentation *seg, int segment_id, | |
| 333 TX_SIZE tx_size) { | |
| 334 const int eob_max = 16 << (tx_size << 1); | |
| 335 return vp9_segfeature_active(seg, segment_id, SEG_LVL_SKIP) ? 0 : eob_max; | |
| 336 } | |
| 337 | |
| 338 #ifdef __cplusplus | 334 #ifdef __cplusplus |
| 339 } // extern "C" | 335 } // extern "C" |
| 340 #endif | 336 #endif |
| 341 | 337 |
| 342 #endif // VP9_COMMON_VP9_BLOCKD_H_ | 338 #endif // VP9_COMMON_VP9_BLOCKD_H_ |
| OLD | NEW |