diff --git a/vp8/common/blockd.h b/vp8/common/blockd.h index 6b0ea61cbeacc2557771c44fe4aeb899c38a9972..9c1453e2ad1cc4ea096320a4424a583f3a05c220 100644 --- a/vp8/common/blockd.h +++ b/vp8/common/blockd.h @@ -191,8 +191,7 @@ typedef struct unsigned char need_to_clamp_mvs; unsigned char segment_id; /* Which set of segmentation parameters should be used for this MB */ - // Flag used when temporal prediction of segment map is enabled. - // 1 means it is predicted 0 that it must be coded explicitly + // Flags used for prediction status of various bistream signals unsigned char seg_id_predicted; } MB_MODE_INFO; @@ -300,9 +299,9 @@ typedef struct MacroBlockD int mb_to_top_edge; int mb_to_bottom_edge; + // TODO this is not used in the decoder so should not be in this structure int ref_frame_cost[MAX_REF_FRAMES]; - unsigned int frames_since_golden; unsigned int frames_till_alt_ref_frame; vp8_subpix_fn_t subpixel_predict; diff --git a/vp8/common/onyxc_int.h b/vp8/common/onyxc_int.h index e5c7b912ab598b62a7971801864b88e8850303ea..75c1c001df00983ea1809c373e753ad9d5c34b6b 100644 --- a/vp8/common/onyxc_int.h +++ b/vp8/common/onyxc_int.h @@ -208,7 +208,6 @@ typedef struct VP8Common ENTROPY_CONTEXT_PLANES *above_context; /* row of context for each plane */ ENTROPY_CONTEXT_PLANES left_context; /* (up to) 4 contexts "" */ - /* keyframe block modes are predicted by their above, left neighbors */ vp8_prob kf_bmode_prob [VP8_BINTRAMODES] [VP8_BINTRAMODES] [VP8_BINTRAMODES-1]; @@ -226,6 +225,11 @@ typedef struct VP8Common #endif vp8_prob i8x8_mode_prob [VP8_UV_MODES-1]; + + vp8_prob prob_intra_coded; + vp8_prob prob_last_coded; + vp8_prob prob_gf_coded; + // Context probabilities when using predictive coding of segment id vp8_prob segment_pred_probs[PREDICTION_PROBS]; unsigned char temporal_update; diff --git a/vp8/decoder/decodemv.c b/vp8/decoder/decodemv.c index 5e7d5c09930d3529e63b8a0834fcc3651f65e74d..3e3b8616bbbcd16262af44079fc792b2f62f1488 100644 --- a/vp8/decoder/decodemv.c +++ b/vp8/decoder/decodemv.c @@ -121,6 +121,7 @@ static void vp8_kfread_modes(VP8D_COMP *pbi, y_mode = (MB_PREDICTION_MODE) vp8_kfread_ymode( bc, pbi->common.kf_ymode_prob); #endif + m->mbmi.ref_frame = INTRA_FRAME; if ((m->mbmi.mode = y_mode) == B_PRED) @@ -236,6 +237,7 @@ static MV_REFERENCE_FRAME read_ref_frame( VP8D_COMP *pbi, int seg_ref_active; //#if CONFIG_SEGFEATURES + VP8_COMMON *const cm = & pbi->common; MACROBLOCKD *const xd = &pbi->mb; seg_ref_active = segfeature_active( xd, @@ -246,14 +248,14 @@ static MV_REFERENCE_FRAME read_ref_frame( VP8D_COMP *pbi, if ( !seg_ref_active ) { ref_frame = - (MV_REFERENCE_FRAME) vp8_read(bc, pbi->prob_intra); + (MV_REFERENCE_FRAME) vp8_read(bc, cm->prob_intra_coded); if (ref_frame) { - if (vp8_read(bc, pbi->prob_last)) + if (vp8_read(bc, cm->prob_last_coded)) { ref_frame = (MV_REFERENCE_FRAME)((int)ref_frame + - (int)(1 + vp8_read(bc, pbi->prob_gf))); + (int)(1 + vp8_read(bc, cm->prob_gf_coded))); } } } @@ -272,7 +274,8 @@ static MV_REFERENCE_FRAME read_ref_frame( VP8D_COMP *pbi, // Else if there are both intra and inter options we need to read // the inter / intra flag, else mark as inter. if ( check_segref( xd, segment_id, INTRA_FRAME ) ) - ref_frame = (MV_REFERENCE_FRAME) vp8_read(bc, pbi->prob_intra); + ref_frame = + (MV_REFERENCE_FRAME) vp8_read(bc, cm->prob_intra_coded); else ref_frame = LAST_FRAME; @@ -296,8 +299,9 @@ static MV_REFERENCE_FRAME read_ref_frame( VP8D_COMP *pbi, // Else we must read bit to decide. else { - ref_frame = (MV_REFERENCE_FRAME)((int)ref_frame + - (int)(1 + vp8_read(bc, pbi->prob_gf))); + ref_frame = + (MV_REFERENCE_FRAME)((int)ref_frame + + (int)(1 + vp8_read(bc, cm->prob_gf_coded))); } } // Both last and at least one of alt or golden are enabled @@ -305,7 +309,7 @@ static MV_REFERENCE_FRAME read_ref_frame( VP8D_COMP *pbi, check_segref( xd, segment_id, ALTREF_FRAME ) ) { // Read flag to indicate (golden or altref) vs last - if (vp8_read(bc, pbi->prob_last)) + if (vp8_read(bc, cm->prob_last_coded)) { // If not golden then it must be altref if (!check_segref( xd, segment_id, GOLDEN_FRAME )) @@ -320,8 +324,9 @@ static MV_REFERENCE_FRAME read_ref_frame( VP8D_COMP *pbi, } else { - ref_frame = (MV_REFERENCE_FRAME)((int)ref_frame + - (int)(1 + vp8_read(bc, pbi->prob_gf))); + ref_frame = + (MV_REFERENCE_FRAME)((int)ref_frame + + (int)(1 + vp8_read(bc, cm->prob_gf_coded))); } } // ELSE LAST @@ -370,6 +375,7 @@ static const unsigned char mbsplit_fill_offset[4][16] = { static void mb_mode_mv_init(VP8D_COMP *pbi) { + VP8_COMMON *const cm = & pbi->common; vp8_reader *const bc = & pbi->bc; MV_CONTEXT *const mvc = pbi->common.fc.mvc; @@ -385,14 +391,17 @@ static void mb_mode_mv_init(VP8D_COMP *pbi) if(pbi->common.frame_type != KEY_FRAME) { - pbi->prob_intra = (vp8_prob)vp8_read_literal(bc, 8); - pbi->prob_last = (vp8_prob)vp8_read_literal(bc, 8); - pbi->prob_gf = (vp8_prob)vp8_read_literal(bc, 8); + // Decode the baseline probabilities for decoding reference frame + cm->prob_intra_coded = (vp8_prob)vp8_read_literal(bc, 8); + cm->prob_last_coded = (vp8_prob)vp8_read_literal(bc, 8); + cm->prob_gf_coded = (vp8_prob)vp8_read_literal(bc, 8); + + #if CONFIG_DUALPRED pbi->common.dual_pred_mode = vp8_read(bc, 128); - if (pbi->common.dual_pred_mode) - pbi->common.dual_pred_mode += vp8_read(bc, 128); - if (pbi->common.dual_pred_mode == HYBRID_PREDICTION) + if (cm->dual_pred_mode) + cm->dual_pred_mode += vp8_read(bc, 128); + if (cm->dual_pred_mode == HYBRID_PREDICTION) { pbi->prob_dualpred[0] = (vp8_prob)vp8_read_literal(bc, 8); pbi->prob_dualpred[1] = (vp8_prob)vp8_read_literal(bc, 8); @@ -406,7 +415,7 @@ static void mb_mode_mv_init(VP8D_COMP *pbi) do { - pbi->common.fc.ymode_prob[i] = (vp8_prob) vp8_read_literal(bc, 8); + cm->fc.ymode_prob[i] = (vp8_prob) vp8_read_literal(bc, 8); } while (++i < 4); } @@ -419,7 +428,7 @@ static void mb_mode_mv_init(VP8D_COMP *pbi) do { - pbi->common.fc.uv_mode_prob[i] = (vp8_prob) vp8_read_literal(bc, 8); + cm->fc.uv_mode_prob[i] = (vp8_prob) vp8_read_literal(bc, 8); } while (++i < 3); } diff --git a/vp8/decoder/decodframe.c b/vp8/decoder/decodframe.c index 64a5557c0175f416dc25ab7b92ff660f1db2a1dd..7725dbc53a7194f963ce11865dd84f07a6136449 100644 --- a/vp8/decoder/decodframe.c +++ b/vp8/decoder/decodframe.c @@ -1351,7 +1351,7 @@ int vp8_decode_frame(VP8D_COMP *pbi) vpx_memcpy(&xd->pre, &pc->yv12_fb[pc->lst_fb_idx], sizeof(YV12_BUFFER_CONFIG)); vpx_memcpy(&xd->dst, &pc->yv12_fb[pc->new_fb_idx], sizeof(YV12_BUFFER_CONFIG)); - // Create the encoder segmentation map and set all entries to 0 + // Create the segmentation map structure and set to 0 if (!pc->last_frame_seg_map) CHECK_MEM_ERROR(pc->last_frame_seg_map, vpx_calloc((pc->mb_rows * pc->mb_cols), 1)); diff --git a/vp8/decoder/onyxd_int.h b/vp8/decoder/onyxd_int.h index 21d223e5dae8447fada08927a77ab64e83364e38..4e22bd04109c4c38ee3c65c0d66fe01b9ade06f4 100644 --- a/vp8/decoder/onyxd_int.h +++ b/vp8/decoder/onyxd_int.h @@ -129,10 +129,6 @@ typedef struct VP8Decompressor vp8_dequant_rtcd_vtable_t dequant; #endif - - vp8_prob prob_intra; - vp8_prob prob_last; - vp8_prob prob_gf; vp8_prob prob_skip_false; #if CONFIG_DUALPRED vp8_prob prob_dualpred[3];