From: Jingning Han Date: Sat, 15 Mar 2014 00:05:35 +0000 (-0700) Subject: Fix the use of uninitialized skip flag X-Git-Tag: v1.4.0~2033^2 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=98fd11c56728ee1a3471d383a1b7260684f88630;p=libvpx Fix the use of uninitialized skip flag The use of uninitialized skip flag will trigger inconsistency in coding statistics, when alternate RD and non-RD coding modes are enabled. This commit fixes this issue and removes unnecessary if statements from update_state_rt. Change-Id: I7d549dcb0e3ef48b999e5bbc78174ba84502cfcf --- diff --git a/vp9/encoder/vp9_encodeframe.c b/vp9/encoder/vp9_encodeframe.c index 87ebc3de0..a38592240 100644 --- a/vp9/encoder/vp9_encodeframe.c +++ b/vp9/encoder/vp9_encodeframe.c @@ -1469,7 +1469,10 @@ static void update_state_rt(VP9_COMP *cpi, const PICK_MODE_CONTEXT *ctx, MB_MODE_INFO *const mbmi = &xd->mi_8x8[0]->mbmi; const struct segmentation *const seg = &cm->seg; - x->skip = ctx->skip; + // TODO(jingning) We might need PICK_MODE_CONTEXT to buffer coding modes + // associated with variable block sizes. Otherwise, remove this ctx + // from argument list. + (void)ctx; // Check for reseting segment_id and update cyclic map. if (cpi->oxcf.aq_mode == CYCLIC_REFRESH_AQ && seg->enabled) { @@ -1477,39 +1480,18 @@ static void update_state_rt(VP9_COMP *cpi, const PICK_MODE_CONTEXT *ctx, vp9_init_plane_quantizers(cpi, x); } -#if CONFIG_INTERNAL_STATS - if (frame_is_intra_only(cm)) { - static const int kf_mode_index[] = { - THR_DC /*DC_PRED*/, - THR_V_PRED /*V_PRED*/, - THR_H_PRED /*H_PRED*/, - THR_D45_PRED /*D45_PRED*/, - THR_D135_PRED /*D135_PRED*/, - THR_D117_PRED /*D117_PRED*/, - THR_D153_PRED /*D153_PRED*/, - THR_D207_PRED /*D207_PRED*/, - THR_D63_PRED /*D63_PRED*/, - THR_TM /*TM_PRED*/, - }; - ++cpi->mode_chosen_counts[kf_mode_index[mbmi->mode]]; - } else { - // Note how often each mode chosen as best - ++cpi->mode_chosen_counts[ctx->best_mode_index]; - } -#endif - if (!frame_is_intra_only(cm)) { - if (is_inter_block(mbmi)) { - if (mbmi->sb_type < BLOCK_8X8 || mbmi->mode == NEWMV) { - MV best_mv[2]; - for (i = 0; i < 1 + has_second_ref(mbmi); ++i) - best_mv[i] = mbmi->ref_mvs[mbmi->ref_frame[i]][0].as_mv; - vp9_update_mv_count(cm, xd, best_mv); - } - if (cm->interp_filter == SWITCHABLE) { - const int pred_ctx = vp9_get_pred_context_switchable_interp(xd); - ++cm->counts.switchable_interp[pred_ctx][mbmi->interp_filter]; - } + if (is_inter_block(mbmi)) { + if (mbmi->sb_type < BLOCK_8X8 || mbmi->mode == NEWMV) { + MV best_mv[2]; + for (i = 0; i < 1 + has_second_ref(mbmi); ++i) + best_mv[i] = mbmi->ref_mvs[mbmi->ref_frame[i]][0].as_mv; + vp9_update_mv_count(cm, xd, best_mv); + } + + if (cm->interp_filter == SWITCHABLE) { + const int pred_ctx = vp9_get_pred_context_switchable_interp(xd); + ++cm->counts.switchable_interp[pred_ctx][mbmi->interp_filter]; } } } diff --git a/vp9/encoder/vp9_encodemb.c b/vp9/encoder/vp9_encodemb.c index 8dbd1a460..fae03bf55 100644 --- a/vp9/encoder/vp9_encodemb.c +++ b/vp9/encoder/vp9_encodemb.c @@ -424,6 +424,7 @@ static void encode_block(int plane, int block, BLOCK_SIZE plane_bsize, assert(0 && "Invalid transform size"); } } + static void encode_block_pass1(int plane, int block, BLOCK_SIZE plane_bsize, TX_SIZE tx_size, void *arg) { MACROBLOCK *const x = (MACROBLOCK *)arg;