diff options
Diffstat (limited to 'vp9/common/vp9_blockd.h')
-rw-r--r-- | vp9/common/vp9_blockd.h | 74 |
1 files changed, 14 insertions, 60 deletions
diff --git a/vp9/common/vp9_blockd.h b/vp9/common/vp9_blockd.h index a09f33ed9..0f197e330 100644 --- a/vp9/common/vp9_blockd.h +++ b/vp9/common/vp9_blockd.h @@ -338,6 +338,7 @@ typedef struct macroblockd { signed char last_ref_lf_deltas[MAX_REF_LF_DELTAS]; /* 0 = Intra, Last, GF, ARF */ signed char ref_lf_deltas[MAX_REF_LF_DELTAS]; + /* 0 = ZERO_MV, MV */ signed char last_mode_lf_deltas[MAX_MODE_LF_DELTAS]; /* 0 = ZERO_MV, MV */ @@ -404,34 +405,15 @@ static INLINE void update_partition_context(MACROBLOCKD *xd, int bwl = b_width_log2(sb_type); int bhl = b_height_log2(sb_type); int boffset = b_width_log2(BLOCK_SIZE_SB64X64) - bsl; - int i; + char pcvalue[2] = {~(0xe << boffset), ~(0xf <<boffset)}; + + assert(MAX(bwl, bhl) <= bsl); // update the partition context at the end notes. set partition bits // of block sizes larger than the current one to be one, and partition // bits of smaller block sizes to be zero. - if ((bwl == bsl) && (bhl == bsl)) { - for (i = 0; i < bs; i++) - xd->left_seg_context[i] = ~(0xf << boffset); - for (i = 0; i < bs; i++) - xd->above_seg_context[i] = ~(0xf << boffset); - } else if ((bwl == bsl) && (bhl < bsl)) { - for (i = 0; i < bs; i++) - xd->left_seg_context[i] = ~(0xe << boffset); - for (i = 0; i < bs; i++) - xd->above_seg_context[i] = ~(0xf << boffset); - } else if ((bwl < bsl) && (bhl == bsl)) { - for (i = 0; i < bs; i++) - xd->left_seg_context[i] = ~(0xf << boffset); - for (i = 0; i < bs; i++) - xd->above_seg_context[i] = ~(0xe << boffset); - } else if ((bwl < bsl) && (bhl < bsl)) { - for (i = 0; i < bs; i++) - xd->left_seg_context[i] = ~(0xe << boffset); - for (i = 0; i < bs; i++) - xd->above_seg_context[i] = ~(0xe << boffset); - } else { - assert(0); - } + vpx_memset(xd->above_seg_context, pcvalue[bwl == bsl], bs); + vpx_memset(xd->left_seg_context, pcvalue[bhl == bsl], bs); } static INLINE int partition_plane_context(MACROBLOCKD *xd, @@ -504,53 +486,25 @@ static BLOCK_SIZE_TYPE get_subsize(BLOCK_SIZE_TYPE bsize, return subsize; } -// transform mapping -static TX_TYPE txfm_map(MB_PREDICTION_MODE bmode) { - switch (bmode) { - case TM_PRED : - case D135_PRED : - return ADST_ADST; - - case V_PRED : - case D117_PRED : - case D63_PRED: - return ADST_DCT; - - case H_PRED : - case D153_PRED : - case D27_PRED : - return DCT_ADST; +extern const TX_TYPE mode2txfm_map[MB_MODE_COUNT]; - default: - return DCT_DCT; - } -} - -static TX_TYPE get_tx_type_4x4(const MACROBLOCKD *xd, int ib) { +static INLINE TX_TYPE get_tx_type_4x4(const MACROBLOCKD *xd, int ib) { MODE_INFO *const mi = xd->mode_info_context; MB_MODE_INFO *const mbmi = &mi->mbmi; if (xd->lossless || mbmi->ref_frame[0] != INTRA_FRAME) return DCT_DCT; - if (mbmi->sb_type < BLOCK_SIZE_SB8X8) { - return txfm_map(mi->bmi[ib].as_mode.first); - } else { - assert(mbmi->mode <= TM_PRED); - return txfm_map(mbmi->mode); - } + return mode2txfm_map[mbmi->sb_type < BLOCK_SIZE_SB8X8 ? + mi->bmi[ib].as_mode.first : mbmi->mode]; } -static TX_TYPE get_tx_type_8x8(const MACROBLOCKD *xd) { - return xd->mode_info_context->mbmi.mode <= TM_PRED - ? txfm_map(xd->mode_info_context->mbmi.mode) - : DCT_DCT; +static INLINE TX_TYPE get_tx_type_8x8(const MACROBLOCKD *xd) { + return mode2txfm_map[xd->mode_info_context->mbmi.mode]; } -static TX_TYPE get_tx_type_16x16(const MACROBLOCKD *xd) { - return xd->mode_info_context->mbmi.mode <= TM_PRED - ? txfm_map(xd->mode_info_context->mbmi.mode) - : DCT_DCT; +static INLINE TX_TYPE get_tx_type_16x16(const MACROBLOCKD *xd) { + return mode2txfm_map[xd->mode_info_context->mbmi.mode]; } void vp9_setup_block_dptrs(MACROBLOCKD *xd, |