Commit aeb603f2 authored by Dmitry Kovalev's avatar Dmitry Kovalev

Making decode_modes_b function more straightforward.

Moving out decode_tokens function calls and adding decode_blocks boolean
variable. We only have to decode if eobtotal > 0, i.e. we have at least one
non-zero coefficient. Also inlining and remove vp9_set_pred_flag_mbskip
function.

Change-Id: I7be38b12ee8206faf0beea2bbf4d52be42575b03
parent 6b78f11a
......@@ -392,11 +392,6 @@ void vp9_set_pred_flag_seg_id(MACROBLOCKD *xd, uint8_t pred_flag) {
xd->this_mi->mbmi.seg_id_predicted = pred_flag;
}
void vp9_set_pred_flag_mbskip(MACROBLOCKD *xd, BLOCK_SIZE bsize,
uint8_t pred_flag) {
xd->this_mi->mbmi.skip_coeff = pred_flag;
}
int vp9_get_segment_id(VP9_COMMON *cm, const uint8_t *segment_ids,
BLOCK_SIZE bsize, int mi_row, int mi_col) {
const int mi_offset = mi_row * cm->mi_cols + mi_col;
......
......@@ -52,9 +52,6 @@ static INLINE unsigned char vp9_get_pred_flag_mbskip(const MACROBLOCKD *xd) {
return xd->this_mi->mbmi.skip_coeff;
}
void vp9_set_pred_flag_mbskip(MACROBLOCKD *xd, BLOCK_SIZE bsize,
uint8_t pred_flag);
unsigned char vp9_get_pred_context_switchable_interp(const MACROBLOCKD *xd);
unsigned char vp9_get_pred_context_intra_inter(const MACROBLOCKD *xd);
......
......@@ -219,6 +219,7 @@ static void decode_modes_b(VP9D_COMP *pbi, int mi_row, int mi_col,
MACROBLOCKD *const xd = &pbi->mb;
const int less8x8 = bsize < BLOCK_8X8;
MB_MODE_INFO *mbmi;
int eobtotal;
if (less8x8)
if (xd->ab_index > 0)
......@@ -232,14 +233,20 @@ static void decode_modes_b(VP9D_COMP *pbi, int mi_row, int mi_col,
// Has to be called after set_offsets
mbmi = &xd->this_mi->mbmi;
eobtotal = decode_tokens(pbi, bsize, r);
if (!is_inter_block(mbmi)) {
// Intra reconstruction
decode_tokens(pbi, bsize, r);
foreach_transformed_block(xd, bsize, decode_block_intra, xd);
} else {
// Inter reconstruction
int eobtotal;
const int decode_blocks = (eobtotal > 0);
if (!less8x8) {
assert(mbmi->sb_type == bsize);
if (eobtotal == 0)
mbmi->skip_coeff = 1; // skip loopfilter
}
set_ref(pbi, 0, mi_row, mi_col);
if (has_second_ref(mbmi))
......@@ -247,18 +254,9 @@ static void decode_modes_b(VP9D_COMP *pbi, int mi_row, int mi_col,
vp9_setup_interp_filters(xd, mbmi->interp_filter, cm);
vp9_build_inter_predictors_sb(xd, mi_row, mi_col, bsize);
eobtotal = decode_tokens(pbi, bsize, r);
if (less8x8) {
if (eobtotal >= 0)
foreach_transformed_block(xd, bsize, decode_block, xd);
} else {
assert(mbmi->sb_type == bsize);
if (eobtotal == 0)
// skip loopfilter
vp9_set_pred_flag_mbskip(xd, bsize, 1);
else if (eobtotal > 0)
foreach_transformed_block(xd, bsize, decode_block, xd);
}
if (decode_blocks)
foreach_transformed_block(xd, bsize, decode_block, xd);
}
xd->corrupted |= vp9_reader_has_error(r);
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment