Commit 5f0f260f authored by Paul Wilkins's avatar Paul Wilkins
Browse files

Moved some reference frame data structures into common.

In this commit only the decoder side was updated.

Change-Id: Ia9bd58da07d1a943f028e330f0489344e62b0d02
parent fe96afa7
...@@ -191,8 +191,7 @@ typedef struct ...@@ -191,8 +191,7 @@ typedef struct
unsigned char need_to_clamp_mvs; unsigned char need_to_clamp_mvs;
unsigned char segment_id; /* Which set of segmentation parameters should be used for this MB */ 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. // Flags used for prediction status of various bistream signals
// 1 means it is predicted 0 that it must be coded explicitly
unsigned char seg_id_predicted; unsigned char seg_id_predicted;
} MB_MODE_INFO; } MB_MODE_INFO;
...@@ -300,9 +299,9 @@ typedef struct MacroBlockD ...@@ -300,9 +299,9 @@ typedef struct MacroBlockD
int mb_to_top_edge; int mb_to_top_edge;
int mb_to_bottom_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]; int ref_frame_cost[MAX_REF_FRAMES];
unsigned int frames_since_golden; unsigned int frames_since_golden;
unsigned int frames_till_alt_ref_frame; unsigned int frames_till_alt_ref_frame;
vp8_subpix_fn_t subpixel_predict; vp8_subpix_fn_t subpixel_predict;
......
...@@ -208,7 +208,6 @@ typedef struct VP8Common ...@@ -208,7 +208,6 @@ typedef struct VP8Common
ENTROPY_CONTEXT_PLANES *above_context; /* row of context for each plane */ ENTROPY_CONTEXT_PLANES *above_context; /* row of context for each plane */
ENTROPY_CONTEXT_PLANES left_context; /* (up to) 4 contexts "" */ ENTROPY_CONTEXT_PLANES left_context; /* (up to) 4 contexts "" */
/* keyframe block modes are predicted by their above, left neighbors */ /* keyframe block modes are predicted by their above, left neighbors */
vp8_prob kf_bmode_prob [VP8_BINTRAMODES] [VP8_BINTRAMODES] [VP8_BINTRAMODES-1]; vp8_prob kf_bmode_prob [VP8_BINTRAMODES] [VP8_BINTRAMODES] [VP8_BINTRAMODES-1];
...@@ -226,6 +225,11 @@ typedef struct VP8Common ...@@ -226,6 +225,11 @@ typedef struct VP8Common
#endif #endif
vp8_prob i8x8_mode_prob [VP8_UV_MODES-1]; 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 // Context probabilities when using predictive coding of segment id
vp8_prob segment_pred_probs[PREDICTION_PROBS]; vp8_prob segment_pred_probs[PREDICTION_PROBS];
unsigned char temporal_update; unsigned char temporal_update;
......
...@@ -121,6 +121,7 @@ static void vp8_kfread_modes(VP8D_COMP *pbi, ...@@ -121,6 +121,7 @@ static void vp8_kfread_modes(VP8D_COMP *pbi,
y_mode = (MB_PREDICTION_MODE) vp8_kfread_ymode( y_mode = (MB_PREDICTION_MODE) vp8_kfread_ymode(
bc, pbi->common.kf_ymode_prob); bc, pbi->common.kf_ymode_prob);
#endif #endif
m->mbmi.ref_frame = INTRA_FRAME; m->mbmi.ref_frame = INTRA_FRAME;
if ((m->mbmi.mode = y_mode) == B_PRED) if ((m->mbmi.mode = y_mode) == B_PRED)
...@@ -236,6 +237,7 @@ static MV_REFERENCE_FRAME read_ref_frame( VP8D_COMP *pbi, ...@@ -236,6 +237,7 @@ static MV_REFERENCE_FRAME read_ref_frame( VP8D_COMP *pbi,
int seg_ref_active; int seg_ref_active;
//#if CONFIG_SEGFEATURES //#if CONFIG_SEGFEATURES
VP8_COMMON *const cm = & pbi->common;
MACROBLOCKD *const xd = &pbi->mb; MACROBLOCKD *const xd = &pbi->mb;
seg_ref_active = segfeature_active( xd, seg_ref_active = segfeature_active( xd,
...@@ -246,14 +248,14 @@ static MV_REFERENCE_FRAME read_ref_frame( VP8D_COMP *pbi, ...@@ -246,14 +248,14 @@ static MV_REFERENCE_FRAME read_ref_frame( VP8D_COMP *pbi,
if ( !seg_ref_active ) if ( !seg_ref_active )
{ {
ref_frame = 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 (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 + 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, ...@@ -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 // Else if there are both intra and inter options we need to read
// the inter / intra flag, else mark as inter. // the inter / intra flag, else mark as inter.
if ( check_segref( xd, segment_id, INTRA_FRAME ) ) 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 else
ref_frame = LAST_FRAME; ref_frame = LAST_FRAME;
...@@ -296,8 +299,9 @@ static MV_REFERENCE_FRAME read_ref_frame( VP8D_COMP *pbi, ...@@ -296,8 +299,9 @@ static MV_REFERENCE_FRAME read_ref_frame( VP8D_COMP *pbi,
// Else we must read bit to decide. // Else we must read bit to decide.
else else
{ {
ref_frame = (MV_REFERENCE_FRAME)((int)ref_frame + ref_frame =
(int)(1 + vp8_read(bc, pbi->prob_gf))); (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 // 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, ...@@ -305,7 +309,7 @@ static MV_REFERENCE_FRAME read_ref_frame( VP8D_COMP *pbi,
check_segref( xd, segment_id, ALTREF_FRAME ) ) check_segref( xd, segment_id, ALTREF_FRAME ) )
{ {
// Read flag to indicate (golden or altref) vs last // 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 not golden then it must be altref
if (!check_segref( xd, segment_id, GOLDEN_FRAME )) if (!check_segref( xd, segment_id, GOLDEN_FRAME ))
...@@ -320,8 +324,9 @@ static MV_REFERENCE_FRAME read_ref_frame( VP8D_COMP *pbi, ...@@ -320,8 +324,9 @@ static MV_REFERENCE_FRAME read_ref_frame( VP8D_COMP *pbi,
} }
else else
{ {
ref_frame = (MV_REFERENCE_FRAME)((int)ref_frame + ref_frame =
(int)(1 + vp8_read(bc, pbi->prob_gf))); (MV_REFERENCE_FRAME)((int)ref_frame +
(int)(1 + vp8_read(bc, cm->prob_gf_coded)));
} }
} }
// ELSE LAST // ELSE LAST
...@@ -370,6 +375,7 @@ static const unsigned char mbsplit_fill_offset[4][16] = { ...@@ -370,6 +375,7 @@ static const unsigned char mbsplit_fill_offset[4][16] = {
static void mb_mode_mv_init(VP8D_COMP *pbi) static void mb_mode_mv_init(VP8D_COMP *pbi)
{ {
VP8_COMMON *const cm = & pbi->common;
vp8_reader *const bc = & pbi->bc; vp8_reader *const bc = & pbi->bc;
MV_CONTEXT *const mvc = pbi->common.fc.mvc; MV_CONTEXT *const mvc = pbi->common.fc.mvc;
...@@ -385,14 +391,17 @@ static void mb_mode_mv_init(VP8D_COMP *pbi) ...@@ -385,14 +391,17 @@ static void mb_mode_mv_init(VP8D_COMP *pbi)
if(pbi->common.frame_type != KEY_FRAME) if(pbi->common.frame_type != KEY_FRAME)
{ {
pbi->prob_intra = (vp8_prob)vp8_read_literal(bc, 8); // Decode the baseline probabilities for decoding reference frame
pbi->prob_last = (vp8_prob)vp8_read_literal(bc, 8); cm->prob_intra_coded = (vp8_prob)vp8_read_literal(bc, 8);
pbi->prob_gf = (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 #if CONFIG_DUALPRED
pbi->common.dual_pred_mode = vp8_read(bc, 128); pbi->common.dual_pred_mode = vp8_read(bc, 128);
if (pbi->common.dual_pred_mode) if (cm->dual_pred_mode)
pbi->common.dual_pred_mode += vp8_read(bc, 128); cm->dual_pred_mode += vp8_read(bc, 128);
if (pbi->common.dual_pred_mode == HYBRID_PREDICTION) if (cm->dual_pred_mode == HYBRID_PREDICTION)
{ {
pbi->prob_dualpred[0] = (vp8_prob)vp8_read_literal(bc, 8); pbi->prob_dualpred[0] = (vp8_prob)vp8_read_literal(bc, 8);
pbi->prob_dualpred[1] = (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) ...@@ -406,7 +415,7 @@ static void mb_mode_mv_init(VP8D_COMP *pbi)
do 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); while (++i < 4);
} }
...@@ -419,7 +428,7 @@ static void mb_mode_mv_init(VP8D_COMP *pbi) ...@@ -419,7 +428,7 @@ static void mb_mode_mv_init(VP8D_COMP *pbi)
do 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); while (++i < 3);
} }
......
...@@ -1351,7 +1351,7 @@ int vp8_decode_frame(VP8D_COMP *pbi) ...@@ -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->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)); 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) if (!pc->last_frame_seg_map)
CHECK_MEM_ERROR(pc->last_frame_seg_map, CHECK_MEM_ERROR(pc->last_frame_seg_map,
vpx_calloc((pc->mb_rows * pc->mb_cols), 1)); vpx_calloc((pc->mb_rows * pc->mb_cols), 1));
......
...@@ -129,10 +129,6 @@ typedef struct VP8Decompressor ...@@ -129,10 +129,6 @@ typedef struct VP8Decompressor
vp8_dequant_rtcd_vtable_t dequant; vp8_dequant_rtcd_vtable_t dequant;
#endif #endif
vp8_prob prob_intra;
vp8_prob prob_last;
vp8_prob prob_gf;
vp8_prob prob_skip_false; vp8_prob prob_skip_false;
#if CONFIG_DUALPRED #if CONFIG_DUALPRED
vp8_prob prob_dualpred[3]; vp8_prob prob_dualpred[3];
......
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