Adding is_inter_block function.

Using it instead of long unclear verbose check
"mbmi->ref_frame[0] != INTRA_FRAME".

Change-Id: I9c7b4b3797942fa962bf3ba7460fff3084beabe9
This commit is contained in:
Dmitry Kovalev 2013-08-02 16:25:33 -07:00
parent d4e020c4b1
commit 680ec32d18
9 changed files with 20 additions and 15 deletions

View File

@ -161,6 +161,11 @@ typedef struct {
union b_mode_info bmi[4];
} MODE_INFO;
static int is_inter_block(const MB_MODE_INFO *mbmi) {
return mbmi->ref_frame[0] > INTRA_FRAME;
}
enum mv_precision {
MV_PRECISION_Q3,
MV_PRECISION_Q4
@ -363,7 +368,7 @@ static INLINE TX_TYPE get_tx_type_4x4(PLANE_TYPE plane_type,
if (plane_type != PLANE_TYPE_Y_WITH_DC ||
xd->lossless ||
mbmi->ref_frame[0] != INTRA_FRAME)
is_inter_block(mbmi))
return DCT_DCT;
return mode2txfm_map[mbmi->sb_type < BLOCK_SIZE_SB8X8 ?

View File

@ -50,7 +50,7 @@ static MB_PREDICTION_MODE left_block_mode(const MODE_INFO *cur_mb, int b) {
/* On L edge, get from MB to left of us */
--cur_mb;
if (cur_mb->mbmi.ref_frame[0] != INTRA_FRAME) {
if (is_inter_block(&cur_mb->mbmi)) {
return DC_PRED;
} else if (cur_mb->mbmi.sb_type < BLOCK_SIZE_SB8X8) {
return ((cur_mb->bmi + 1 + b)->as_mode);
@ -68,7 +68,7 @@ static MB_PREDICTION_MODE above_block_mode(const MODE_INFO *cur_mb,
/* On top edge, get from MB above us */
cur_mb -= mi_stride;
if (cur_mb->mbmi.ref_frame[0] != INTRA_FRAME) {
if (is_inter_block(&cur_mb->mbmi)) {
return DC_PRED;
} else if (cur_mb->mbmi.sb_type < BLOCK_SIZE_SB8X8) {
return ((cur_mb->bmi + 2 + b)->as_mode);

View File

@ -263,7 +263,7 @@ static void filter_block_plane(VP9_COMMON *const cm,
// Determine the vertical edges that need filtering
for (c = 0; c < MI_BLOCK_SIZE && mi_col + c < cm->mi_cols; c += col_step) {
const int skip_this = mi[c].mbmi.mb_skip_coeff
&& mi[c].mbmi.ref_frame[0] != INTRA_FRAME;
&& is_inter_block(&mi[c].mbmi);
// left edge of current unit is block/partition edge -> no skip
const int block_edge_left = b_width_log2(mi[c].mbmi.sb_type) ?
!(c & ((1 << (b_width_log2(mi[c].mbmi.sb_type)-1)) - 1)) : 1;

View File

@ -60,8 +60,8 @@ unsigned char vp9_get_pred_context_intra_inter(const MACROBLOCKD *xd) {
const MB_MODE_INFO *const left_mbmi = &mi[-1].mbmi;
const int left_in_image = xd->left_available && left_mbmi->mb_in_image;
const int above_in_image = xd->up_available && above_mbmi->mb_in_image;
const int left_intra = left_mbmi->ref_frame[0] == INTRA_FRAME;
const int above_intra = above_mbmi->ref_frame[0] == INTRA_FRAME;
const int left_intra = !is_inter_block(left_mbmi);
const int above_intra = !is_inter_block(above_mbmi);
// The mode info data structure has a one element border above and to the
// left of the entries corresponding to real macroblocks.

View File

@ -241,7 +241,7 @@ static void decode_modes_b(VP9D_COMP *pbi, int mi_row, int mi_col,
// Has to be called after set_offsets
mbmi = &xd->mode_info_context->mbmi;
if (mbmi->ref_frame[0] == INTRA_FRAME) {
if (!is_inter_block(mbmi)) {
// Intra reconstruction
decode_tokens(pbi, bsize, r);
foreach_transformed_block(xd, bsize, decode_block_intra, xd);

View File

@ -95,7 +95,7 @@ static int decode_coefs(VP9_COMMON *cm, const MACROBLOCKD *xd,
FRAME_CONTEXT *const fc = &cm->fc;
FRAME_COUNTS *const counts = &cm->counts;
ENTROPY_CONTEXT above_ec, left_ec;
const int ref = xd->mode_info_context->mbmi.ref_frame[0] != INTRA_FRAME;
const int ref = is_inter_block(&xd->mode_info_context->mbmi);
int band, pt, c = 0;
vp9_prob (*coef_probs)[PREV_COEF_CONTEXTS][UNCONSTRAINED_NODES] =
fc->coef_probs[tx_size][type][ref];

View File

@ -368,7 +368,7 @@ static void update_state(VP9_COMP *cpi, PICK_MODE_CONTEXT *ctx,
ctx->txfm_rd_diff[ALLOW_32X32] = ctx->txfm_rd_diff[ALLOW_16X16];
}
if (mbmi->ref_frame[0] != INTRA_FRAME && mbmi->sb_type < BLOCK_SIZE_SB8X8) {
if (is_inter_block(mbmi) && mbmi->sb_type < BLOCK_SIZE_SB8X8) {
*x->partition_info = ctx->partition_info;
mbmi->mv[0].as_int = mi->bmi[3].as_mv[0].as_int;
mbmi->mv[1].as_int = mi->bmi[3].as_mv[1].as_int;
@ -411,7 +411,7 @@ static void update_state(VP9_COMP *cpi, PICK_MODE_CONTEXT *ctx,
} else {
// Note how often each mode chosen as best
cpi->mode_chosen_counts[mb_mode_index]++;
if (mbmi->ref_frame[0] != INTRA_FRAME
if (is_inter_block(mbmi)
&& (mbmi->sb_type < BLOCK_SIZE_SB8X8 || mbmi->mode == NEWMV)) {
int_mv best_mv, best_second_mv;
const MV_REFERENCE_FRAME rf1 = mbmi->ref_frame[0];
@ -2573,7 +2573,7 @@ static void encode_superblock(VP9_COMP *cpi, TOKENEXTRA **t, int output_enabled,
// Increase zbin size to suppress noise
cpi->zbin_mode_boost = 0;
if (cpi->zbin_mode_boost_enabled) {
if (mbmi->ref_frame[0] != INTRA_FRAME) {
if (is_inter_block(mbmi)) {
if (mbmi->mode == ZEROMV) {
if (mbmi->ref_frame[0] != LAST_FRAME)
cpi->zbin_mode_boost = GF_ZEROMV_ZBIN_BOOST;
@ -2646,7 +2646,7 @@ static void encode_superblock(VP9_COMP *cpi, TOKENEXTRA **t, int output_enabled,
if (output_enabled) {
if (cm->tx_mode == TX_MODE_SELECT &&
mbmi->sb_type >= BLOCK_SIZE_SB8X8 &&
!(mbmi->ref_frame[0] != INTRA_FRAME &&
!(is_inter_block(mbmi) &&
(mbmi->mb_skip_coeff ||
vp9_segfeature_active(&xd->seg, segment_id, SEG_LVL_SKIP)))) {
const uint8_t context = vp9_get_pred_context_tx_size(xd);
@ -2655,7 +2655,7 @@ static void encode_superblock(VP9_COMP *cpi, TOKENEXTRA **t, int output_enabled,
int x, y;
TX_SIZE sz = (cm->tx_mode == TX_MODE_SELECT) ? TX_32X32 : cm->tx_mode;
// The new intra coding scheme requires no change of transform size
if (mi->mbmi.ref_frame[0] != INTRA_FRAME) {
if (is_inter_block(&mi->mbmi)) {
if (sz == TX_32X32 && bsize < BLOCK_SIZE_SB32X32)
sz = TX_16X16;
if (sz == TX_16X16 && bsize < BLOCK_SIZE_MB16X16)

View File

@ -145,8 +145,8 @@ static void optimize_b(MACROBLOCK *mb,
int plane, int block, BLOCK_SIZE_TYPE bsize,
ENTROPY_CONTEXT *a, ENTROPY_CONTEXT *l,
TX_SIZE tx_size) {
const int ref = mb->e_mbd.mode_info_context->mbmi.ref_frame[0] != INTRA_FRAME;
MACROBLOCKD *const xd = &mb->e_mbd;
const int ref = is_inter_block(&xd->mode_info_context->mbmi);
vp9_token_state tokens[1025][2];
unsigned best_index[1025][2];
const int16_t *coeff_ptr = BLOCK_OFFSET(mb->plane[plane].coeff,

View File

@ -148,7 +148,7 @@ static void tokenize_b(int plane, int block, BLOCK_SIZE_TYPE bsize,
const int16_t *scan, *nb;
vp9_coeff_count *counts;
vp9_coeff_probs_model *coef_probs;
const int ref = mbmi->ref_frame[0] != INTRA_FRAME;
const int ref = is_inter_block(mbmi);
ENTROPY_CONTEXT above_ec, left_ec;
uint8_t token_cache[1024];
const uint8_t *band_translate;