// Flags used for prediction status of various bistream signals
unsigned char seg_id_predicted;
-
-#if CONFIG_COMPRED
unsigned char ref_predicted;
-#endif
// Indicates if the mb is part of the image (1) vs border (0)
// This can be useful in determining whether the MB provides
#define MAX_PARTITIONS 9
#if CONFIG_DUALPRED
-#if CONFIG_COMPRED
#define DUAL_PRED_CONTEXTS 2
-#else
-#define DUAL_PRED_CONTEXTS 3
-#endif
#endif /* CONFIG_DUALPRED */
typedef struct frame_contexts
vp8_prob segment_pred_probs[PREDICTION_PROBS];
unsigned char temporal_update;
-#if CONFIG_COMPRED
// Context probabilities for reference frame prediction
unsigned char ref_scores[MAX_REF_FRAMES];
vp8_prob ref_pred_probs[PREDICTION_PROBS];
vp8_prob mod_refprobs[MAX_REF_FRAMES][PREDICTION_PROBS];
-#endif
#if CONFIG_DUALPRED
vp8_prob prob_dualpred[DUAL_PRED_CONTEXTS];
break;
-#if CONFIG_COMPRED
case PRED_REF:
pred_context = (m - 1)->mbmi.ref_predicted +
(m - cm->mode_info_stride)->mbmi.ref_predicted;
pred_context = 1;
break;
-#endif
default:
// TODO *** add error trap code.
pred_probability = cm->segment_pred_probs[pred_context];
break;
-#if CONFIG_COMPRED
case PRED_REF:
pred_probability = cm->ref_pred_probs[pred_context];
break;
// probability of dual pred off.
pred_probability = cm->prob_dualpred[pred_context];
break;
-#endif
default:
// TODO *** add error trap code.
pred_flag = xd->mode_info_context->mbmi.seg_id_predicted;
break;
-#if CONFIG_COMPRED
-
case PRED_REF:
pred_flag = xd->mode_info_context->mbmi.ref_predicted;
break;
-#endif
default:
// TODO *** add error trap code.
xd->mode_info_context->mbmi.seg_id_predicted = pred_flag;
break;
-#if CONFIG_COMPRED
-
case PRED_REF:
xd->mode_info_context->mbmi.ref_predicted = pred_flag;
break;
-#endif
default:
// TODO *** add error trap code.
return cm->last_frame_seg_map[MbIndex];
}
-#if CONFIG_COMPRED
MV_REFERENCE_FRAME get_pred_ref( VP8_COMMON *const cm,
MACROBLOCKD *const xd )
{
cm->ref_scores[GOLDEN_FRAME] = 1 + (gf_count * 16 / 255);
cm->ref_scores[ALTREF_FRAME] = 1 + (arf_count * 16 / 255);
}
-#endif
typedef enum
{
PRED_SEG_ID = 0, // Segment identifier
-
-#if CONFIG_COMPRED
PRED_REF = 1,
PRED_DUAL = 2
-#endif
} PRED_ID;
extern unsigned char get_pred_mb_segid( VP8_COMMON *const cm, int MbIndex );
-#if CONFIG_COMPRED
extern MV_REFERENCE_FRAME get_pred_ref( VP8_COMMON *const cm,
MACROBLOCKD *const xd );
extern void compute_mod_refprobs( VP8_COMMON *const cm );
-#endif
-
#endif /* __INC_PRED_COMMON_H__ */
segment_id,
SEG_LVL_REF_FRAME );
-
-#if CONFIG_COMPRED
-
// If segment coding enabled does the segment allow for more than one
// possible reference frame
if ( seg_ref_active )
// Segment reference frame features not available or allows for
// multiple reference frame options
if ( !seg_ref_active || (seg_ref_count > 1) )
-#else
- if ( !seg_ref_active )
-#endif
{
-#if CONFIG_COMPRED
// Values used in prediction model coding
unsigned char prediction_flag;
vp8_prob pred_prob;
}
}
}
-#else
- ref_frame =
- (MV_REFERENCE_FRAME) vp8_read(bc, cm->prob_intra_coded);
-
- if (ref_frame)
- {
- if (vp8_read(bc, cm->prob_last_coded))
- {
- ref_frame = (MV_REFERENCE_FRAME)((int)ref_frame +
- (int)(1 + vp8_read(bc, cm->prob_gf_coded)));
- }
- }
-#endif
}
//#if CONFIG_SEGFEATURES
// Segment reference frame features are enabled
else
{
-#if CONFIG_COMPRED
// The reference frame for the mb is considered as correclty predicted
// if it is signaled at the segment level for the purposes of the
// common prediction model
set_pred_flag( xd, PRED_REF, 1 );
ref_frame = get_pred_ref( cm, xd );
-#else
- // If there are no inter reference frames enabled we can set INTRA
- if ( !check_segref_inter(xd, segment_id) )
- {
- ref_frame = INTRA_FRAME;
- }
- else
- {
- // 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, cm->prob_intra_coded);
- else
- ref_frame = LAST_FRAME;
-
- if ( ref_frame == LAST_FRAME )
- {
- // Now consider last vs (golden or alt) flag....
- // If Last is not enabled
- if ( !check_segref( xd, segment_id, LAST_FRAME ) )
- {
- // If not golden then it must be altref
- if (!check_segref( xd, segment_id, GOLDEN_FRAME ))
- {
- ref_frame = ALTREF_FRAME;
- }
- // Not Altref therefore must be Golden
- else if (!check_segref( xd, segment_id,
- ALTREF_FRAME ))
- {
- ref_frame = GOLDEN_FRAME;
- }
- // Else we must read bit to decide.
- else
- {
- 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
- else if ( check_segref( xd, segment_id, GOLDEN_FRAME ) ||
- check_segref( xd, segment_id, ALTREF_FRAME ) )
- {
- // Read flag to indicate (golden or altref) vs 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 ))
- {
- ref_frame = ALTREF_FRAME;
- }
- // Not Altref therefore must be Golden
- else if (!check_segref( xd, segment_id,
- ALTREF_FRAME ))
- {
- ref_frame = GOLDEN_FRAME;
- }
- else
- {
- ref_frame =
- (MV_REFERENCE_FRAME)((int)ref_frame +
- (int)(1 + vp8_read(bc, cm->prob_gf_coded)));
- }
- }
- // ELSE LAST
- }
- }
- }
-#endif
}
return (MV_REFERENCE_FRAME)ref_frame;
cm->prob_last_coded = (vp8_prob)vp8_read_literal(bc, 8);
cm->prob_gf_coded = (vp8_prob)vp8_read_literal(bc, 8);
-#if CONFIG_COMPRED
// Computes a modified set of probabilities for use when reference
// frame prediction fails.
compute_mod_refprobs( cm );
-#endif
#if CONFIG_DUALPRED
pbi->common.dual_pred_mode = vp8_read(bc, 128);
#if CONFIG_DUALPRED
if ( cm->dual_pred_mode == DUAL_PREDICTION_ONLY ||
(cm->dual_pred_mode == HYBRID_PREDICTION &&
-#if CONFIG_COMPRED
vp8_read(bc, get_pred_prob( cm, xd, PRED_DUAL ))) )
-#else
- vp8_read(bc, cm->prob_dualpred[(mi[-1].mbmi.second_ref_frame != INTRA_FRAME) +
- (mi[-mis].mbmi.second_ref_frame != INTRA_FRAME)])))
-#endif
{
mbmi->second_ref_frame = mbmi->ref_frame + 1;
if (mbmi->second_ref_frame == 4)
}
}
-#if CONFIG_COMPRED
// Read common prediction model status flag probability updates for the
// reference frame
if ( pc->frame_type == KEY_FRAME )
pc->ref_pred_probs[i] = (vp8_prob)vp8_read_literal(bc, 8);
}
}
-#endif
/* Read the loop filter level and type */
pc->filter_type = (LOOPFILTERTYPE) vp8_read_bit(bc);
segment_id,
SEG_LVL_REF_FRAME );
-#if CONFIG_COMPRED
if ( seg_ref_active )
{
seg_ref_count = check_segref( xd, segment_id, INTRA_FRAME ) +
// If segment level coding of this signal is disabled...
// or the segment allows multiple reference frame options
if ( !seg_ref_active || (seg_ref_count > 1) )
-#else
- if ( !seg_ref_active )
-#endif
{
-#if CONFIG_COMPRED
// Values used in prediction model coding
unsigned char prediction_flag;
vp8_prob pred_prob;
}
}
}
-#else
- if (rf == INTRA_FRAME)
- {
- vp8_write(w, 0, cm->prob_intra_coded);
- }
- else /* inter coded */
- {
- vp8_write(w, 1, cm->prob_intra_coded);
-
- if (rf == LAST_FRAME)
- {
- vp8_write(w, 0, cm->prob_last_coded);
- }
- else
- {
- vp8_write(w, 1, cm->prob_last_coded);
-
- vp8_write(w, (rf == GOLDEN_FRAME) ? 0 : 1, cm->prob_gf_coded);
- }
- }
-#endif
}
// if using the prediction mdoel we have nothing further to do because
// the reference frame is fully coded by the segment
-
-//#if CONFIG_SEGFEATURES
-#if !CONFIG_COMPRED
- // Else use the segment
- else
- {
- if (rf == INTRA_FRAME)
- {
- // This MB intra coded. If inter also allowed we must code
- // an explicit inter/intra flag.
- if ( check_segref_inter( xd, segment_id ) )
- vp8_write(w, 0, cm->prob_intra_coded);
- }
- else /* inter coded */
- {
- // If intra also allowed we must code an explicit intra/inter flag.
- if ( check_segref( xd, segment_id, INTRA_FRAME ) )
- vp8_write(w, 1, cm->prob_intra_coded);
-
- if (rf == LAST_FRAME)
- {
- // If GOLDEN or ALTREF allowed we must code explicit flag.
- if ( check_segref( xd, segment_id, GOLDEN_FRAME ) ||
- check_segref( xd, segment_id, ALTREF_FRAME ) )
- {
- vp8_write(w, 0, cm->prob_last_coded);
- }
- }
- else
- {
- // if LAST is allowed we must code explicit flag
- if ( check_segref( xd, segment_id, LAST_FRAME ) )
- {
- vp8_write(w, 1, cm->prob_last_coded);
- }
-
- // if GOLDEN and ALTREF allowed we must code an explicit flag
- if ( check_segref( xd, segment_id, GOLDEN_FRAME ) &&
- check_segref( xd, segment_id, ALTREF_FRAME ) )
- {
- vp8_write(w, (rf == GOLDEN_FRAME) ? 0 : 1, cm->prob_gf_coded);
- }
- }
- }
- }
-#endif
}
// Update the probabilities used to encode reference frame data
if (!cm->prob_gf_coded)
cm->prob_gf_coded = 1;
-#if CONFIG_COMPRED
// Compute a modified set of probabilities to use when prediction of the
// reference frame fails
compute_mod_refprobs( cm );
-#endif
}
#if CONFIG_SUPERBLOCKS
int prob_skip_false = 0;
-#if CONFIG_DUALPRED
-#if !CONFIG_COMPRED
- int prob_dual_pred[DUAL_PRED_CONTEXTS];
-#endif
-#endif /* CONFIG_DUALPRED */
-
// Values used in prediction model coding
vp8_prob pred_prob;
unsigned char prediction_flag;
{
if (cpi->single_pred_count[i] + cpi->dual_pred_count[i])
{
-#if CONFIG_COMPRED
pc->prob_dualpred[i] = cpi->single_pred_count[i] * 255 /
(cpi->single_pred_count[i] + cpi->dual_pred_count[i]);
if (pc->prob_dualpred[i] < 1)
pc->prob_dualpred[i] = 128;
}
vp8_write_literal(w, pc->prob_dualpred[i], 8);
-#else
- prob_dual_pred[i] = cpi->single_pred_count[i] * 256 /
- (cpi->single_pred_count[i] + cpi->dual_pred_count[i]);
- if (prob_dual_pred[i] < 1)
- prob_dual_pred[i] = 1;
- else if (prob_dual_pred[i] > 255)
- prob_dual_pred[i] = 255;
- }
- else
- {
- prob_dual_pred[i] = 128;
- }
- vp8_write_literal(w, prob_dual_pred[i], 8);
-#endif
}
}
else if (cpi->common.dual_pred_mode == SINGLE_PREDICTION_ONLY)
#if CONFIG_DUALPRED
if (cpi->common.dual_pred_mode == HYBRID_PREDICTION)
{
-#if CONFIG_COMPRED
vp8_write(w,
mi->second_ref_frame != INTRA_FRAME,
get_pred_prob( pc, xd, PRED_DUAL ) );
-#else
-
- int t = m[-mis].mbmi.second_ref_frame != INTRA_FRAME;
- int l = m[-1 ].mbmi.second_ref_frame != INTRA_FRAME;
- vp8_write(w, mi->second_ref_frame != INTRA_FRAME,
- prob_dual_pred[t + l]);
-#endif
}
if (mi->second_ref_frame)
{
#if CONFIG_DUALPRED
if (cpi->common.dual_pred_mode == HYBRID_PREDICTION)
{
-#if CONFIG_COMPRED
-
vp8_write(w,
mi->second_ref_frame != INTRA_FRAME,
get_pred_prob( pc, xd, PRED_DUAL ) );
-#else
- int t = m[-mis].mbmi.second_ref_frame != INTRA_FRAME;
- int l = m[-1 ].mbmi.second_ref_frame != INTRA_FRAME;
- vp8_write(w, mi->second_ref_frame != INTRA_FRAME,
- prob_dual_pred[t + l]);
-#endif
}
#endif /* CONFIG_DUALPRED */
break;
m += mis + (1- (pc->mb_cols & 0x1));
cpi->mb.partition_info += mis + (1- (pc->mb_cols & 0x1));
}
-
-#if !CONFIG_COMPRED
-#if CONFIG_DUALPRED
- if (cpi->common.dual_pred_mode == HYBRID_PREDICTION)
- {
- pc->prob_dualpred[0] = (prob_dual_pred[0] + pc->prob_dualpred[0] + 1) >> 1;
- pc->prob_dualpred[1] = (prob_dual_pred[1] + pc->prob_dualpred[1] + 1) >> 1;
- pc->prob_dualpred[2] = (prob_dual_pred[2] + pc->prob_dualpred[2] + 1) >> 1;
- }
-#endif /* CONFIG_DUALPRED */
-#endif
}
#else
static void pack_inter_mode_mvs(VP8_COMP *const cpi)
int prob_skip_false = 0;
-#if CONFIG_DUALPRED
-#if !CONFIG_COMPRED
- int prob_dual_pred[DUAL_PRED_CONTEXTS];
-#endif
-#endif /* CONFIG_DUALPRED */
-
// Values used in prediction model coding
vp8_prob pred_prob;
unsigned char prediction_flag;
{
if (cpi->single_pred_count[i] + cpi->dual_pred_count[i])
{
-#if CONFIG_COMPRED
pc->prob_dualpred[i] = cpi->single_pred_count[i] * 255 /
(cpi->single_pred_count[i] + cpi->dual_pred_count[i]);
if (pc->prob_dualpred[i] < 1)
pc->prob_dualpred[i] = 128;
}
vp8_write_literal(w, pc->prob_dualpred[i], 8);
-#else
- prob_dual_pred[i] = cpi->single_pred_count[i] * 256 /
- (cpi->single_pred_count[i] + cpi->dual_pred_count[i]);
- if (prob_dual_pred[i] < 1)
- prob_dual_pred[i] = 1;
- else if (prob_dual_pred[i] > 255)
- prob_dual_pred[i] = 255;
- }
- else
- {
- prob_dual_pred[i] = 128;
- }
- vp8_write_literal(w, prob_dual_pred[i], 8);
-#endif
}
}
else if (cpi->common.dual_pred_mode == SINGLE_PREDICTION_ONLY)
#if CONFIG_DUALPRED
if (cpi->common.dual_pred_mode == HYBRID_PREDICTION)
{
-#if CONFIG_COMPRED
-
vp8_write(w, mi->second_ref_frame != INTRA_FRAME,
get_pred_prob( pc, xd, PRED_DUAL ) );
-#else
- int t = m[-mis].mbmi.second_ref_frame != INTRA_FRAME;
- int l = m[-1 ].mbmi.second_ref_frame != INTRA_FRAME;
- vp8_write(w, mi->second_ref_frame != INTRA_FRAME,
- prob_dual_pred[t + l]);
-#endif
}
if (mi->second_ref_frame)
{
#if CONFIG_DUALPRED
if (cpi->common.dual_pred_mode == HYBRID_PREDICTION)
{
-#if CONFIG_COMPRED
-
vp8_write(w, mi->second_ref_frame != INTRA_FRAME,
get_pred_prob( pc, xd, PRED_DUAL ) );
-#else
- int t = m[-mis].mbmi.second_ref_frame != INTRA_FRAME;
- int l = m[-1 ].mbmi.second_ref_frame != INTRA_FRAME;
- vp8_write(w, mi->second_ref_frame != INTRA_FRAME,
- prob_dual_pred[t + l]);
-#endif
}
#endif /* CONFIG_DUALPRED */
break;
++prev_m;
cpi->mb.partition_info++;
}
-
-#if !CONFIG_COMPRED
-#if CONFIG_DUALPRED
- if (cpi->common.dual_pred_mode == HYBRID_PREDICTION)
- {
- pc->prob_dualpred[0] = (prob_dual_pred[0] + pc->prob_dualpred[0] + 1) >> 1;
- pc->prob_dualpred[1] = (prob_dual_pred[1] + pc->prob_dualpred[1] + 1) >> 1;
- pc->prob_dualpred[2] = (prob_dual_pred[2] + pc->prob_dualpred[2] + 1) >> 1;
- }
-#endif /* CONFIG_DUALPRED */
-#endif
}
#endif // CONFIG_SUPERBLOCKS
return savings;
}
-#if CONFIG_COMPRED
-// TODO... this will all need changing for new reference frame coding model
-#endif
int vp8_estimate_entropy_savings(VP8_COMP *cpi)
{
int savings = 0;
}
}
-#if CONFIG_COMPRED
// Encode the common prediction model status flag probability updates for
// the reference frame
if ( pc->frame_type != KEY_FRAME )
vp8_write_bit(bc, 0);
}
}
-#endif
// Encode the loop filter level and type
vp8_write_bit(bc, pc->filter_type);
TOKENEXTRA *tp = cpi->tok;
int totalrate;
-#if CONFIG_COMPRED
// Compute a modified set of reference frame probabilities to use when
// prediction fails. These are based on the current genreal estimates for
// this frame which may be updated with each itteration of the recode loop.
compute_mod_refprobs( cm );
-#endif
//#if CONFIG_SEGFEATURES
// debug output
int distortion;
unsigned char *segment_id = &xd->mode_info_context->mbmi.segment_id;
int seg_ref_active;
-#if CONFIG_COMPRED
unsigned char ref_pred_flag;
-#endif
x->skip = 0;
{
unsigned char pred_context;
-#if CONFIG_COMPRED
pred_context = get_pred_context( cm, xd, PRED_DUAL );
-#else
- MB_MODE_INFO *t = &x->e_mbd.mode_info_context
- [-cpi->common.mode_info_stride].mbmi;
- MB_MODE_INFO *l = &x->e_mbd.mode_info_context[-1].mbmi;
- pred_context = (t->second_ref_frame != INTRA_FRAME) +
- (l->second_ref_frame != INTRA_FRAME);
-#endif
+
if (xd->mode_info_context->mbmi.second_ref_frame == INTRA_FRAME)
cpi->single_pred_count[pred_context]++;
else
//#if CONFIG_SEGFEATURES
seg_ref_active = segfeature_active( xd, *segment_id, SEG_LVL_REF_FRAME );
-#if CONFIG_COMPRED
// SET VARIOUS PREDICTION FLAGS
// Did the chosen reference frame match its predicted value.
get_pred_ref( cm, xd )) );
set_pred_flag( xd, PRED_REF, ref_pred_flag );
-#endif
-
// If we have just a single reference frame coded for a segment then
// exclude from the reference frame counts used to work out
// probabilities. NOTE: At the moment we dont support custom trees
}
}
-#if !CONFIG_COMPRED
-//#if 1
-// This function updates the reference frame probability estimates that
-// will be used during mode selection
-static void update_rd_ref_frame_probs(VP8_COMP *cpi)
-{
- VP8_COMMON *cm = &cpi->common;
-
-#if 0
- const int *const rfct = cpi->recent_ref_frame_usage;
- const int rf_intra = rfct[INTRA_FRAME];
- const int rf_inter = rfct[LAST_FRAME] + rfct[GOLDEN_FRAME] + rfct[ALTREF_FRAME];
-
- if (cm->frame_type == KEY_FRAME)
- {
- cm->prob_intra_coded = 255;
- cm->prob_last_coded = 128;
- cm->prob_gf_coded = 128;
- }
- else if (!(rf_intra + rf_inter))
- {
- // This is a trap in case this function is called with cpi->recent_ref_frame_usage[] blank.
- cm->prob_intra_coded = 63;
- cm->prob_last_coded = 128;
- cm->prob_gf_coded = 128;
- }
- else
- {
- cm->prob_intra_coded = (rf_intra * 255) / (rf_intra + rf_inter);
-
- if (cm->prob_intra_coded < 1)
- cm->prob_intra_coded = 1;
-
- if ((cm->frames_since_golden > 0) || cpi->source_alt_ref_active)
- {
- cm->prob_last_coded = rf_inter ? (rfct[LAST_FRAME] * 255) / rf_inter : 128;
-
- if (cm->prob_last_coded < 1)
- cm->prob_last_coded = 1;
-
- cm->prob_gf_coded = (rfct[GOLDEN_FRAME] + rfct[ALTREF_FRAME])
- ? (rfct[GOLDEN_FRAME] * 255) / (rfct[GOLDEN_FRAME] + rfct[ALTREF_FRAME]) : 128;
-
- if (cm->prob_gf_coded < 1)
- cm->prob_gf_coded = 1;
- }
- }
-
-#else
- const int *const rfct = cpi->count_mb_ref_frame_usage;
- const int rf_intra = rfct[INTRA_FRAME];
- const int rf_inter = rfct[LAST_FRAME] + rfct[GOLDEN_FRAME] + rfct[ALTREF_FRAME];
-
- if (cm->frame_type == KEY_FRAME)
- {
- cm->prob_intra_coded = 255;
- cm->prob_last_coded = 128;
- cm->prob_gf_coded = 128;
- }
- else if (!(rf_intra + rf_inter))
- {
- // This is a trap in case this function is called with
- // cpi->recent_ref_frame_usage[] blank.
- cm->prob_intra_coded = 63;
- cm->prob_last_coded = 128;
- cm->prob_gf_coded = 128;
- }
- else
- {
- cm->prob_intra_coded = (rf_intra * 255) / (rf_intra + rf_inter);
-
- if (cm->prob_intra_coded < 1)
- cm->prob_intra_coded = 1;
-
- cm->prob_last_coded =
- rf_inter ? (rfct[LAST_FRAME] * 255) / rf_inter : 128;
-
- if (cm->prob_last_coded < 1)
- cm->prob_last_coded = 1;
-
- cm->prob_gf_coded =
- (rfct[GOLDEN_FRAME] + rfct[ALTREF_FRAME])
- ? (rfct[GOLDEN_FRAME] * 255) /
- (rfct[GOLDEN_FRAME] + rfct[ALTREF_FRAME]) : 128;
-
- if (cm->prob_gf_coded < 1)
- cm->prob_gf_coded = 1;
- }
-
- // update reference frame costs since we can do better than what we got
- // last frame.
-
- if (cpi->common.refresh_alt_ref_frame)
- {
- cm->prob_intra_coded += 40;
- cm->prob_last_coded = 200;
- cm->prob_gf_coded = 1;
- }
- else if (cpi->common.frames_since_golden == 0)
- {
- cm->prob_last_coded = 214;
- cm->prob_gf_coded = 1;
- }
- else if (cpi->common.frames_since_golden == 1)
- {
- cm->prob_last_coded = 192;
- cm->prob_gf_coded = 220;
- }
- else if (cpi->source_alt_ref_active)
- {
- cm->prob_gf_coded =
- ( cm->prob_gf_coded > 30 ) ? cm->prob_gf_coded - 20 : 10;
- }
-
-#endif
-}
-#endif
-
// 1 = key, 0 = inter
static int decide_key_frame(VP8_COMP *cpi)
{
}
-#if CONFIG_COMPRED
// This function updates the reference frame prediction stats
static void update_refpred_stats( VP8_COMP *cpi )
{
xd->mode_info_context++;
}
- // TEMP / Print out prediction quality numbers
- if (0)
- {
- FILE *f = fopen("predquality.stt", "a");
- int pred0, pred1, pred2;
-
-
- pred0 = ref_pred_count[0][0] + ref_pred_count[0][1];
- if ( pred0 )
- pred0 = (ref_pred_count[0][1] * 255) / pred0;
-
- pred1 = ref_pred_count[1][0] + ref_pred_count[1][1];
- if ( pred1 )
- pred1 = (ref_pred_count[1][1] * 255) / pred1;
-
- pred2 = ref_pred_count[2][0] + ref_pred_count[2][1];
- if ( pred2 )
- pred2 = (ref_pred_count[2][1] * 255) / pred2;
-
- fprintf(f, "%8d: %8d %8d: %8d %8d: %8d %8d\n",
- cm->current_video_frame,
- pred0, ref_pred_count[0][1],
- pred1, ref_pred_count[1][1],
- pred2, ref_pred_count[2][1] );
- fclose(f);
- }
-
// From the prediction counts set the probabilities for each context
for ( i = 0; i < PREDICTION_PROBS; i++ )
{
}
}
}
-#endif
static void encode_frame_to_data_rate
(
}
#endif
-#if !CONFIG_COMPRED
-//#if 1
- update_rd_ref_frame_probs(cpi);
-#endif
+//#if !CONFIG_COMPRED
+ // This function has been deprecated for now but we may want to do
+ // something here at a late date
+ //update_rd_ref_frame_probs(cpi);
+//#endif
// Test code for new segment features
init_seg_features( cpi );
cpi->segmentation_map, cm->MBs );
}
-#if CONFIG_COMPRED
// Update the common prediction model probabilities to reflect
// the what was seen in the current frame.
update_refpred_stats( cpi );
-#endif
// build the bitstream
vp8_pack_bitstream(cpi, dest, size);
// #if CONFIG_COMPRED
-// TODO... this will all need changing for new reference frame coding model
+// TODO... this will need changing for new reference frame coding model
// #endif
// Work out the cost assosciated with selecting the reference frame
frame_cost =
}
}
-#if CONFIG_COMPRED
void vp8_estimate_ref_frame_costs(VP8_COMP *cpi, unsigned int * ref_costs )
{
VP8_COMMON *cm = &cpi->common;
ref_costs[i] = cost;
}
}
-#endif
void vp8_rd_pick_inter_mode(VP8_COMP *cpi, MACROBLOCK *x, int recon_yoffset, int recon_uvoffset,
int *returnrate, int *returndistortion, int *returnintra,
unsigned char *u_buffer[4];
unsigned char *v_buffer[4];
-#if CONFIG_COMPRED
unsigned int ref_costs[MAX_REF_FRAMES];
-#endif
vpx_memset(&best_mbmode, 0, sizeof(best_mbmode));
vpx_memset(&best_bmodes, 0, sizeof(best_bmodes));
rd_pick_intra_mbuv_mode(cpi, x, &uv_intra_rate, &uv_intra_rate_tokenonly, &uv_intra_distortion);
uv_intra_mode = x->e_mbd.mode_info_context->mbmi.uv_mode;
-#if CONFIG_COMPRED
// Get estimates of reference frame costs for each reference frame
// that depend on the current prediction etc.
vp8_estimate_ref_frame_costs( cpi, ref_costs );
-#endif
for (mode_index = 0; mode_index < MAX_MODES; mode_index++)
{
vp8_build_inter16x16_predictors_mby(&x->e_mbd);
#if CONFIG_DUALPRED
-#if CONFIG_COMPRED
dualmode_cost =
vp8_cost_bit( get_pred_prob( cm, xd, PRED_DUAL ), 0 );
-#else
- {
- MB_MODE_INFO *t = &x->e_mbd.mode_info_context[-cpi->common.mode_info_stride].mbmi;
- MB_MODE_INFO *l = &x->e_mbd.mode_info_context[-1].mbmi;
- int cnt = (t->second_ref_frame != INTRA_FRAME) + (l->second_ref_frame != INTRA_FRAME);
- dualmode_cost = vp8_cost_bit(cm->prob_dualpred[cnt], 0);
- }
-#endif
#endif /* CONFIG_DUALPRED */
if (cpi->active_map_enabled && x->active_ptr[0] == 0) {
/* We don't include the cost of the second reference here, because there are only
* three options: Last/Golden, ARF/Last or Golden/ARF, or in other words if you
* present them in that order, the second one is always known if the first is known */
-#if CONFIG_COMPRED
dualmode_cost =
vp8_cost_bit( get_pred_prob( cm, xd, PRED_DUAL ), 1 );
-#else
- {
- MB_MODE_INFO *t = &x->e_mbd.mode_info_context[-cpi->common.mode_info_stride].mbmi;
- MB_MODE_INFO *l = &x->e_mbd.mode_info_context[-1].mbmi;
- int cnt = (t->second_ref_frame != INTRA_FRAME) + (l->second_ref_frame != INTRA_FRAME);
- dualmode_cost = vp8_cost_bit(cm->prob_dualpred[cnt], 1);
- }
-#endif
}
#endif /* CONFIG_DUALPRED */
// Estimate the reference frame signaling cost and add it
// to the rolling cost variable.
-#if CONFIG_COMPRED
rate2 += ref_costs[x->e_mbd.mode_info_context->mbmi.ref_frame];
-#else
- rate2 +=
- x->e_mbd.ref_frame_cost[x->e_mbd.mode_info_context->mbmi.ref_frame];
-#endif
if (!disable_skip)
{
x->e_mbd.mode_info_context->mbmi.mv.as_int = 0;
}
-#if CONFIG_COMPRED
other_cost += ref_costs[x->e_mbd.mode_info_context->mbmi.ref_frame];
-#else
- other_cost +=
- x->e_mbd.ref_frame_cost[x->e_mbd.mode_info_context->mbmi.ref_frame];
-#endif
/* Calculate the final y RD estimate for this mode */
best_yrd = RDCOST(x->rdmult, x->rddiv, (rate2-rate_uv-other_cost),