ref: aeb603f2afc7a357f364d415abd520ff5e27501e
parent: 6b78f11a03e994fda9ca3dd44848c321eb81d4e2
author: Dmitry Kovalev <[email protected]>
date: Tue Oct 1 11:41:30 EDT 2013
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
--- a/vp9/common/vp9_pred_common.c
+++ b/vp9/common/vp9_pred_common.c
@@ -392,11 +392,6 @@
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;
--- a/vp9/common/vp9_pred_common.h
+++ b/vp9/common/vp9_pred_common.h
@@ -52,9 +52,6 @@
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);
--- a/vp9/decoder/vp9_decodframe.c
+++ b/vp9/decoder/vp9_decodframe.c
@@ -219,6 +219,7 @@
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,15 +233,21 @@
// 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))
set_ref(pbi, 1, mi_row, mi_col);
@@ -247,18 +254,9 @@
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);
}