From: Dmitry Kovalev Date: Thu, 3 Oct 2013 17:55:36 +0000 (-0700) Subject: Reading diff update flag inside vp9_diff_update_prob. X-Git-Tag: v1.3.0~313^2 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=6f1bb2246c8fa7f333c286def48a0bee16f6d7fa;p=libvpx Reading diff update flag inside vp9_diff_update_prob. Change-Id: I5ae659c1bfb132428a7272d094b5287d144ec7c8 --- diff --git a/vp9/decoder/vp9_decodemv.c b/vp9/decoder/vp9_decodemv.c index 18e6ea0ef..3499cc881 100644 --- a/vp9/decoder/vp9_decodemv.c +++ b/vp9/decoder/vp9_decodemv.c @@ -339,16 +339,15 @@ static void read_switchable_interp_probs(FRAME_CONTEXT *fc, vp9_reader *r) { int i, j; for (j = 0; j < SWITCHABLE_FILTERS + 1; ++j) for (i = 0; i < SWITCHABLE_FILTERS - 1; ++i) - if (vp9_read(r, MODE_UPDATE_PROB)) - vp9_diff_update_prob(r, &fc->switchable_interp_prob[j][i]); + vp9_diff_update_prob(r, MODE_UPDATE_PROB, + &fc->switchable_interp_prob[j][i]); } static void read_inter_mode_probs(FRAME_CONTEXT *fc, vp9_reader *r) { int i, j; for (i = 0; i < INTER_MODE_CONTEXTS; ++i) for (j = 0; j < INTER_MODES - 1; ++j) - if (vp9_read(r, MODE_UPDATE_PROB)) - vp9_diff_update_prob(r, &fc->inter_mode_probs[i][j]); + vp9_diff_update_prob(r, MODE_UPDATE_PROB, &fc->inter_mode_probs[i][j]); } static INLINE COMPPREDMODE_TYPE read_comp_pred_mode(vp9_reader *r) { @@ -607,21 +606,17 @@ static void read_comp_pred(VP9_COMMON *cm, vp9_reader *r) { if (cm->comp_pred_mode == HYBRID_PREDICTION) for (i = 0; i < COMP_INTER_CONTEXTS; i++) - if (vp9_read(r, MODE_UPDATE_PROB)) - vp9_diff_update_prob(r, &cm->fc.comp_inter_prob[i]); + vp9_diff_update_prob(r, MODE_UPDATE_PROB, &cm->fc.comp_inter_prob[i]); if (cm->comp_pred_mode != COMP_PREDICTION_ONLY) for (i = 0; i < REF_CONTEXTS; i++) { - if (vp9_read(r, MODE_UPDATE_PROB)) - vp9_diff_update_prob(r, &cm->fc.single_ref_prob[i][0]); - if (vp9_read(r, MODE_UPDATE_PROB)) - vp9_diff_update_prob(r, &cm->fc.single_ref_prob[i][1]); + vp9_diff_update_prob(r, MODE_UPDATE_PROB, &cm->fc.single_ref_prob[i][0]); + vp9_diff_update_prob(r, MODE_UPDATE_PROB, &cm->fc.single_ref_prob[i][1]); } if (cm->comp_pred_mode != SINGLE_PREDICTION_ONLY) for (i = 0; i < REF_CONTEXTS; i++) - if (vp9_read(r, MODE_UPDATE_PROB)) - vp9_diff_update_prob(r, &cm->fc.comp_ref_prob[i]); + vp9_diff_update_prob(r, MODE_UPDATE_PROB, &cm->fc.comp_ref_prob[i]); } void vp9_prepare_read_mode_info(VP9D_COMP* pbi, vp9_reader *r) { @@ -631,8 +626,7 @@ void vp9_prepare_read_mode_info(VP9D_COMP* pbi, vp9_reader *r) { // TODO(jkoleszar): does this clear more than MBSKIP_CONTEXTS? Maybe remove. // vpx_memset(cm->fc.mbskip_probs, 0, sizeof(cm->fc.mbskip_probs)); for (k = 0; k < MBSKIP_CONTEXTS; ++k) - if (vp9_read(r, MODE_UPDATE_PROB)) - vp9_diff_update_prob(r, &cm->fc.mbskip_probs[k]); + vp9_diff_update_prob(r, MODE_UPDATE_PROB, &cm->fc.mbskip_probs[k]); if (cm->frame_type != KEY_FRAME && !cm->intra_only) { nmv_context *const nmvc = &pbi->common.fc.nmvc; @@ -645,20 +639,18 @@ void vp9_prepare_read_mode_info(VP9D_COMP* pbi, vp9_reader *r) { read_switchable_interp_probs(&cm->fc, r); for (i = 0; i < INTRA_INTER_CONTEXTS; i++) - if (vp9_read(r, MODE_UPDATE_PROB)) - vp9_diff_update_prob(r, &cm->fc.intra_inter_prob[i]); + vp9_diff_update_prob(r, MODE_UPDATE_PROB, &cm->fc.intra_inter_prob[i]); read_comp_pred(cm, r); for (j = 0; j < BLOCK_SIZE_GROUPS; j++) for (i = 0; i < INTRA_MODES - 1; ++i) - if (vp9_read(r, MODE_UPDATE_PROB)) - vp9_diff_update_prob(r, &cm->fc.y_mode_prob[j][i]); + vp9_diff_update_prob(r, MODE_UPDATE_PROB, &cm->fc.y_mode_prob[j][i]); for (j = 0; j < NUM_PARTITION_CONTEXTS; ++j) for (i = 0; i < PARTITION_TYPES - 1; ++i) - if (vp9_read(r, MODE_UPDATE_PROB)) - vp9_diff_update_prob(r, &cm->fc.partition_prob[INTER_FRAME][j][i]); + vp9_diff_update_prob(r, MODE_UPDATE_PROB, + &cm->fc.partition_prob[INTER_FRAME][j][i]); read_mv_probs(r, nmvc, xd->allow_high_precision_mv); } diff --git a/vp9/decoder/vp9_decodframe.c b/vp9/decoder/vp9_decodframe.c index 809366302..882b34978 100644 --- a/vp9/decoder/vp9_decodframe.c +++ b/vp9/decoder/vp9_decodframe.c @@ -63,18 +63,15 @@ static void read_tx_probs(struct tx_probs *tx_probs, vp9_reader *r) { for (i = 0; i < TX_SIZE_CONTEXTS; ++i) for (j = 0; j < TX_SIZES - 3; ++j) - if (vp9_read(r, MODE_UPDATE_PROB)) - vp9_diff_update_prob(r, &tx_probs->p8x8[i][j]); + vp9_diff_update_prob(r, MODE_UPDATE_PROB, &tx_probs->p8x8[i][j]); for (i = 0; i < TX_SIZE_CONTEXTS; ++i) for (j = 0; j < TX_SIZES - 2; ++j) - if (vp9_read(r, MODE_UPDATE_PROB)) - vp9_diff_update_prob(r, &tx_probs->p16x16[i][j]); + vp9_diff_update_prob(r, MODE_UPDATE_PROB, &tx_probs->p16x16[i][j]); for (i = 0; i < TX_SIZE_CONTEXTS; ++i) for (j = 0; j < TX_SIZES - 1; ++j) - if (vp9_read(r, MODE_UPDATE_PROB)) - vp9_diff_update_prob(r, &tx_probs->p32x32[i][j]); + vp9_diff_update_prob(r, MODE_UPDATE_PROB, &tx_probs->p32x32[i][j]); } static void setup_plane_dequants(VP9_COMMON *cm, MACROBLOCKD *xd, int q_index) { @@ -376,8 +373,8 @@ static void read_coef_probs_common(vp9_coeff_probs_model *coef_probs, for (l = 0; l < PREV_COEF_CONTEXTS; l++) if (k > 0 || l < 3) for (m = 0; m < UNCONSTRAINED_NODES; m++) - if (vp9_read(r, VP9_COEF_UPDATE_PROB)) - vp9_diff_update_prob(r, &coef_probs[i][j][k][l][m]); + vp9_diff_update_prob(r, VP9_COEF_UPDATE_PROB, + &coef_probs[i][j][k][l][m]); } static void read_coef_probs(FRAME_CONTEXT *fc, TX_MODE tx_mode, diff --git a/vp9/decoder/vp9_dsubexp.c b/vp9/decoder/vp9_dsubexp.c index 9a970d42b..6f01cead6 100644 --- a/vp9/decoder/vp9_dsubexp.c +++ b/vp9/decoder/vp9_dsubexp.c @@ -99,7 +99,9 @@ static int decode_term_subexp(vp9_reader *r, int k, int num_syms) { return word; } -void vp9_diff_update_prob(vp9_reader *r, vp9_prob* p) { - int delp = decode_term_subexp(r, SUBEXP_PARAM, 255); - *p = (vp9_prob)inv_remap_prob(delp, *p); +void vp9_diff_update_prob(vp9_reader *r, int update_prob, vp9_prob* p) { + if (vp9_read(r, update_prob)) { + const int delp = decode_term_subexp(r, SUBEXP_PARAM, 255); + *p = (vp9_prob)inv_remap_prob(delp, *p); + } } diff --git a/vp9/decoder/vp9_dsubexp.h b/vp9/decoder/vp9_dsubexp.h index aeb9399d0..21ac31393 100644 --- a/vp9/decoder/vp9_dsubexp.h +++ b/vp9/decoder/vp9_dsubexp.h @@ -14,6 +14,6 @@ #include "vp9/decoder/vp9_dboolhuff.h" -void vp9_diff_update_prob(vp9_reader *r, vp9_prob* p); +void vp9_diff_update_prob(vp9_reader *r, int update_prob, vp9_prob* p); #endif // VP9_DECODER_VP9_DSUBEXP_H_