Commit bbc926dc authored by Adrian Grange's avatar Adrian Grange

Added Prediction Filter to Mode Selection

Added the ability to optionally filter the prediction data
when inter modes are selected (excludes SPLITMV, for now).

The mode selection loop considers both the filtered and
non-filtered prediction data when choosing mode. The filter
can be turned on/off at the frame-level, or signaled for
each MB.

Change-Id: I1b783c71d95a361ab36c761b07e8a6b06bc36822
parent f3dff402
...@@ -231,6 +231,7 @@ EXPERIMENT_LIST=" ...@@ -231,6 +231,7 @@ EXPERIMENT_LIST="
int_8x8fdct int_8x8fdct
newintramodes newintramodes
adaptive_entropy adaptive_entropy
pred_filter
" "
CONFIG_LIST=" CONFIG_LIST="
external_build external_build
......
...@@ -214,6 +214,11 @@ typedef struct ...@@ -214,6 +214,11 @@ typedef struct
// a valid predictor // a valid predictor
unsigned char mb_in_image; unsigned char mb_in_image;
#if CONFIG_PRED_FILTER
// Flag to turn prediction signal filter on(1)/off(0 ) at the MB level
unsigned int pred_filter_enabled;
#endif
} MB_MODE_INFO; } MB_MODE_INFO;
typedef struct typedef struct
......
...@@ -287,6 +287,15 @@ typedef struct VP8Common ...@@ -287,6 +287,15 @@ typedef struct VP8Common
#if CONFIG_POSTPROC #if CONFIG_POSTPROC
struct postproc_state postproc_state; struct postproc_state postproc_state;
#endif #endif
#if CONFIG_PRED_FILTER
/* Prediction filter variables */
int pred_filter_mode; // 0=disabled at the frame level (no MB filtered)
// 1=enabled at the frame level (all MB filtered)
// 2=specified per MB (1=filtered, 0=non-filtered)
vp8_prob prob_pred_filter_off;
#endif
} VP8_COMMON; } VP8_COMMON;
#endif #endif
This diff is collapsed.
...@@ -527,8 +527,14 @@ static void mb_mode_mv_init(VP8D_COMP *pbi) ...@@ -527,8 +527,14 @@ static void mb_mode_mv_init(VP8D_COMP *pbi)
#endif #endif
} }
if(pbi->common.frame_type != KEY_FRAME) if(cm->frame_type != KEY_FRAME)
{ {
#if CONFIG_PRED_FILTER
cm->pred_filter_mode = (vp8_prob)vp8_read_literal(bc, 2);
if (cm->pred_filter_mode == 2)
cm->prob_pred_filter_off = (vp8_prob)vp8_read_literal(bc, 8);
#endif
// Decode the baseline probabilities for decoding reference frame // Decode the baseline probabilities for decoding reference frame
cm->prob_intra_coded = (vp8_prob)vp8_read_literal(bc, 8); cm->prob_intra_coded = (vp8_prob)vp8_read_literal(bc, 8);
cm->prob_last_coded = (vp8_prob)vp8_read_literal(bc, 8); cm->prob_last_coded = (vp8_prob)vp8_read_literal(bc, 8);
...@@ -728,6 +734,18 @@ static void read_mb_modes_mv(VP8D_COMP *pbi, MODE_INFO *mi, MB_MODE_INFO *mbmi, ...@@ -728,6 +734,18 @@ static void read_mb_modes_mv(VP8D_COMP *pbi, MODE_INFO *mi, MB_MODE_INFO *mbmi,
vp8_accum_mv_refs(&pbi->common, mbmi->mode, rct); vp8_accum_mv_refs(&pbi->common, mbmi->mode, rct);
} }
#if CONFIG_PRED_FILTER
if (mbmi->mode >= NEARESTMV && mbmi->mode < SPLITMV)
{
// Is the prediction filter enabled
if (cm->pred_filter_mode == 2)
mbmi->pred_filter_enabled =
vp8_read(bc, cm->prob_pred_filter_off);
else
mbmi->pred_filter_enabled = cm->pred_filter_mode;
}
#endif
if ( cm->comp_pred_mode == COMP_PREDICTION_ONLY || if ( cm->comp_pred_mode == COMP_PREDICTION_ONLY ||
(cm->comp_pred_mode == HYBRID_PREDICTION && (cm->comp_pred_mode == HYBRID_PREDICTION &&
vp8_read(bc, get_pred_prob( cm, xd, PRED_COMP ))) ) vp8_read(bc, get_pred_prob( cm, xd, PRED_COMP ))) )
......
...@@ -815,6 +815,18 @@ static void pack_inter_mode_mvs(VP8_COMP *const cpi) ...@@ -815,6 +815,18 @@ static void pack_inter_mode_mvs(VP8_COMP *const cpi)
#endif #endif
} }
#if CONFIG_PRED_FILTER
// Write the prediction filter mode used for this frame
vp8_write_literal(w, pc->pred_filter_mode, 2);
// Write prediction filter on/off probability if signaling at MB level
if (pc->pred_filter_mode == 2)
vp8_write_literal(w, pc->prob_pred_filter_off, 8);
//printf("pred_filter_mode:%d prob_pred_filter_off:%d\n",
// pc->pred_filter_mode, pc->prob_pred_filter_off);
#endif
vp8_write_literal(w, pc->prob_intra_coded, 8); vp8_write_literal(w, pc->prob_intra_coded, 8);
vp8_write_literal(w, pc->prob_last_coded, 8); vp8_write_literal(w, pc->prob_last_coded, 8);
vp8_write_literal(w, pc->prob_gf_coded, 8); vp8_write_literal(w, pc->prob_gf_coded, 8);
...@@ -1032,6 +1044,18 @@ static void pack_inter_mode_mvs(VP8_COMP *const cpi) ...@@ -1032,6 +1044,18 @@ static void pack_inter_mode_mvs(VP8_COMP *const cpi)
vp8_accum_mv_refs(&cpi->common, mode, ct); vp8_accum_mv_refs(&cpi->common, mode, ct);
} }
#if CONFIG_PRED_FILTER
// Is the prediction filter enabled
if (mode >= NEARESTMV && mode < SPLITMV)
{
if (cpi->common.pred_filter_mode == 2 )
vp8_write(w, mi->pred_filter_enabled,
pc->prob_pred_filter_off);
else
assert (mi->pred_filter_enabled ==
cpi->common.pred_filter_mode);
}
#endif
if (mi->second_ref_frame && if (mi->second_ref_frame &&
(mode == NEWMV || mode == SPLITMV)) (mode == NEWMV || mode == SPLITMV))
{ {
......
...@@ -1201,6 +1201,19 @@ static void encode_frame_internal(VP8_COMP *cpi) ...@@ -1201,6 +1201,19 @@ static void encode_frame_internal(VP8_COMP *cpi)
cpi->skip_false_count = 0; cpi->skip_false_count = 0;
#endif #endif
#if CONFIG_PRED_FILTER
if (cm->current_video_frame == 0)
{
// Initially assume that we'll signal the prediction filter
// state at the frame level and that it is off.
cpi->common.pred_filter_mode = 0;
cpi->common.prob_pred_filter_off = 128;
}
cpi->pred_filter_on_count = 0;
cpi->pred_filter_off_count = 0;
#endif
#if 0 #if 0
// Experimental code // Experimental code
cpi->frame_distortion = 0; cpi->frame_distortion = 0;
......
...@@ -1223,6 +1223,11 @@ void vp8_encode_inter16x16y(const VP8_ENCODER_RTCD *rtcd, MACROBLOCK *x) ...@@ -1223,6 +1223,11 @@ void vp8_encode_inter16x16y(const VP8_ENCODER_RTCD *rtcd, MACROBLOCK *x)
BLOCK *b = &x->block[0]; BLOCK *b = &x->block[0];
#if CONFIG_PRED_FILTER
// Disable the prediction filter for firstpass
x->e_mbd.mode_info_context->mbmi.pred_filter_enabled = 0;
#endif
vp8_build_inter16x16_predictors_mby(&x->e_mbd); vp8_build_inter16x16_predictors_mby(&x->e_mbd);
ENCODEMB_INVOKE(&rtcd->encodemb, submby)(x->src_diff, *(b->base_src), x->e_mbd.predictor, b->src_stride); ENCODEMB_INVOKE(&rtcd->encodemb, submby)(x->src_diff, *(b->base_src), x->e_mbd.predictor, b->src_stride);
......
...@@ -83,6 +83,17 @@ typedef struct ...@@ -83,6 +83,17 @@ typedef struct
prototype_submbuv(*submbuv); prototype_submbuv(*submbuv);
} vp8_encodemb_rtcd_vtable_t; } vp8_encodemb_rtcd_vtable_t;
typedef struct
{
MB_PREDICTION_MODE mode;
MV_REFERENCE_FRAME ref_frame;
MV_REFERENCE_FRAME second_ref_frame;
#if CONFIG_PRED_FILTER
int pred_filter_flag;
#endif
} MODE_DEFINITION;
#if CONFIG_RUNTIME_CPU_DETECT #if CONFIG_RUNTIME_CPU_DETECT
#define ENCODEMB_INVOKE(ctx,fn) (ctx)->fn #define ENCODEMB_INVOKE(ctx,fn) (ctx)->fn
#else #else
......
...@@ -104,6 +104,11 @@ static unsigned int do_16x16_motion_iteration ...@@ -104,6 +104,11 @@ static unsigned int do_16x16_motion_iteration
&distortion, &sse); &distortion, &sse);
} }
#if CONFIG_PRED_FILTER
// Disable the prediction filter
xd->mode_info_context->mbmi.pred_filter_enabled = 0;
#endif
vp8_set_mbmode_and_mvs(x, NEWMV, dst_mv); vp8_set_mbmode_and_mvs(x, NEWMV, dst_mv);
vp8_build_inter16x16_predictors_mby(xd); vp8_build_inter16x16_predictors_mby(xd);
//VARIANCE_INVOKE(&cpi->rtcd.variance, satd16x16) //VARIANCE_INVOKE(&cpi->rtcd.variance, satd16x16)
......
...@@ -741,6 +741,41 @@ void vp8_set_speed_features(VP8_COMP *cpi) ...@@ -741,6 +741,41 @@ void vp8_set_speed_features(VP8_COMP *cpi)
switch (Mode) switch (Mode)
{ {
case 0: // best quality mode case 0: // best quality mode
#if CONFIG_PRED_FILTER
sf->thresh_mult[THR_ZEROMV ] = 0;
sf->thresh_mult[THR_ZEROMV_FILT ] = 0;
sf->thresh_mult[THR_ZEROG ] = 0;
sf->thresh_mult[THR_ZEROG_FILT ] = 0;
sf->thresh_mult[THR_ZEROA ] = 0;
sf->thresh_mult[THR_ZEROA_FILT ] = 0;
sf->thresh_mult[THR_NEARESTMV ] = 0;
sf->thresh_mult[THR_NEARESTMV_FILT] = 0;
sf->thresh_mult[THR_NEARESTG ] = 0;
sf->thresh_mult[THR_NEARESTG_FILT ] = 0;
sf->thresh_mult[THR_NEARESTA ] = 0;
sf->thresh_mult[THR_NEARESTA_FILT ] = 0;
sf->thresh_mult[THR_NEARMV ] = 0;
sf->thresh_mult[THR_NEARMV_FILT ] = 0;
sf->thresh_mult[THR_NEARG ] = 0;
sf->thresh_mult[THR_NEARG_FILT ] = 0;
sf->thresh_mult[THR_NEARA ] = 0;
sf->thresh_mult[THR_NEARA_FILT ] = 0;
sf->thresh_mult[THR_DC ] = 0;
sf->thresh_mult[THR_V_PRED ] = 1000;
sf->thresh_mult[THR_H_PRED ] = 1000;
sf->thresh_mult[THR_B_PRED ] = 2000;
sf->thresh_mult[THR_I8X8_PRED] = 2000;
sf->thresh_mult[THR_TM ] = 1000;
sf->thresh_mult[THR_NEWMV ] = 1000;
sf->thresh_mult[THR_NEWG ] = 1000;
sf->thresh_mult[THR_NEWA ] = 1000;
sf->thresh_mult[THR_NEWMV_FILT ] = 1000;
sf->thresh_mult[THR_NEWG_FILT ] = 1000;
sf->thresh_mult[THR_NEWA_FILT ] = 1000;
#else
sf->thresh_mult[THR_ZEROMV ] = 0; sf->thresh_mult[THR_ZEROMV ] = 0;
sf->thresh_mult[THR_ZEROG ] = 0; sf->thresh_mult[THR_ZEROG ] = 0;
sf->thresh_mult[THR_ZEROA ] = 0; sf->thresh_mult[THR_ZEROA ] = 0;
...@@ -770,7 +805,7 @@ void vp8_set_speed_features(VP8_COMP *cpi) ...@@ -770,7 +805,7 @@ void vp8_set_speed_features(VP8_COMP *cpi)
sf->thresh_mult[THR_NEWMV ] = 1000; sf->thresh_mult[THR_NEWMV ] = 1000;
sf->thresh_mult[THR_NEWG ] = 1000; sf->thresh_mult[THR_NEWG ] = 1000;
sf->thresh_mult[THR_NEWA ] = 1000; sf->thresh_mult[THR_NEWA ] = 1000;
#endif
sf->thresh_mult[THR_SPLITMV ] = 2500; sf->thresh_mult[THR_SPLITMV ] = 2500;
sf->thresh_mult[THR_SPLITG ] = 5000; sf->thresh_mult[THR_SPLITG ] = 5000;
sf->thresh_mult[THR_SPLITA ] = 5000; sf->thresh_mult[THR_SPLITA ] = 5000;
...@@ -800,10 +835,14 @@ void vp8_set_speed_features(VP8_COMP *cpi) ...@@ -800,10 +835,14 @@ void vp8_set_speed_features(VP8_COMP *cpi)
#endif #endif
break; break;
case 1: case 1:
#if CONFIG_PRED_FILTER
sf->thresh_mult[THR_NEARESTMV] = 0; sf->thresh_mult[THR_NEARESTMV] = 0;
sf->thresh_mult[THR_NEARESTMV_FILT] = 0;
sf->thresh_mult[THR_ZEROMV ] = 0; sf->thresh_mult[THR_ZEROMV ] = 0;
sf->thresh_mult[THR_ZEROMV_FILT ] = 0;
sf->thresh_mult[THR_DC ] = 0; sf->thresh_mult[THR_DC ] = 0;
sf->thresh_mult[THR_NEARMV ] = 0; sf->thresh_mult[THR_NEARMV ] = 0;
sf->thresh_mult[THR_NEARMV_FILT ] = 0;
sf->thresh_mult[THR_V_PRED ] = 1000; sf->thresh_mult[THR_V_PRED ] = 1000;
sf->thresh_mult[THR_H_PRED ] = 1000; sf->thresh_mult[THR_H_PRED ] = 1000;
#if CONFIG_NEWINTRAMODES #if CONFIG_NEWINTRAMODES
...@@ -819,12 +858,18 @@ void vp8_set_speed_features(VP8_COMP *cpi) ...@@ -819,12 +858,18 @@ void vp8_set_speed_features(VP8_COMP *cpi)
sf->thresh_mult[THR_TM ] = 1000; sf->thresh_mult[THR_TM ] = 1000;
sf->thresh_mult[THR_NEARESTG ] = 1000; sf->thresh_mult[THR_NEARESTG ] = 1000;
sf->thresh_mult[THR_NEARESTG_FILT ] = 1000;
sf->thresh_mult[THR_NEARESTA ] = 1000; sf->thresh_mult[THR_NEARESTA ] = 1000;
sf->thresh_mult[THR_NEARESTA_FILT ] = 1000;
sf->thresh_mult[THR_ZEROG ] = 1000; sf->thresh_mult[THR_ZEROG ] = 1000;
sf->thresh_mult[THR_ZEROA ] = 1000; sf->thresh_mult[THR_ZEROA ] = 1000;
sf->thresh_mult[THR_NEARG ] = 1000; sf->thresh_mult[THR_NEARG ] = 1000;
sf->thresh_mult[THR_NEARA ] = 1000; sf->thresh_mult[THR_NEARA ] = 1000;
sf->thresh_mult[THR_ZEROG_FILT ] = 1000;
sf->thresh_mult[THR_ZEROA_FILT ] = 1000;
sf->thresh_mult[THR_NEARG_FILT ] = 1000;
sf->thresh_mult[THR_NEARA_FILT ] = 1000;
sf->thresh_mult[THR_ZEROMV ] = 0; sf->thresh_mult[THR_ZEROMV ] = 0;
sf->thresh_mult[THR_ZEROG ] = 0; sf->thresh_mult[THR_ZEROG ] = 0;
...@@ -835,11 +880,63 @@ void vp8_set_speed_features(VP8_COMP *cpi) ...@@ -835,11 +880,63 @@ void vp8_set_speed_features(VP8_COMP *cpi)
sf->thresh_mult[THR_NEARMV ] = 0; sf->thresh_mult[THR_NEARMV ] = 0;
sf->thresh_mult[THR_NEARG ] = 0; sf->thresh_mult[THR_NEARG ] = 0;
sf->thresh_mult[THR_NEARA ] = 0; sf->thresh_mult[THR_NEARA ] = 0;
sf->thresh_mult[THR_ZEROMV_FILT ] = 0;
sf->thresh_mult[THR_ZEROG_FILT ] = 0;
sf->thresh_mult[THR_ZEROA_FILT ] = 0;
sf->thresh_mult[THR_NEARESTMV_FILT] = 0;
sf->thresh_mult[THR_NEARESTG_FILT ] = 0;
sf->thresh_mult[THR_NEARESTA_FILT ] = 0;
sf->thresh_mult[THR_NEARMV_FILT ] = 0;
sf->thresh_mult[THR_NEARG_FILT ] = 0;
sf->thresh_mult[THR_NEARA_FILT ] = 0;
sf->thresh_mult[THR_NEWMV ] = 1000; sf->thresh_mult[THR_NEWMV ] = 1000;
sf->thresh_mult[THR_NEWG ] = 1000; sf->thresh_mult[THR_NEWG ] = 1000;
sf->thresh_mult[THR_NEWA ] = 1000; sf->thresh_mult[THR_NEWA ] = 1000;
sf->thresh_mult[THR_NEWMV_FILT ] = 1000;
sf->thresh_mult[THR_NEWG_FILT ] = 1000;
sf->thresh_mult[THR_NEWA_FILT ] = 1000;
#else
sf->thresh_mult[THR_NEARESTMV] = 0;
sf->thresh_mult[THR_ZEROMV ] = 0;
sf->thresh_mult[THR_DC ] = 0;
sf->thresh_mult[THR_NEARMV ] = 0;
sf->thresh_mult[THR_V_PRED ] = 1000;
sf->thresh_mult[THR_H_PRED ] = 1000;
#if CONFIG_NEWINTRAMODES
sf->thresh_mult[THR_D45_PRED ] = 1000;
sf->thresh_mult[THR_D135_PRED] = 1000;
sf->thresh_mult[THR_D117_PRED] = 1000;
sf->thresh_mult[THR_D153_PRED] = 1000;
sf->thresh_mult[THR_D27_PRED ] = 1000;
sf->thresh_mult[THR_D63_PRED ] = 1000;
#endif
sf->thresh_mult[THR_B_PRED ] = 2500;
sf->thresh_mult[THR_I8X8_PRED] = 2500;
sf->thresh_mult[THR_TM ] = 1000;
sf->thresh_mult[THR_NEARESTG ] = 1000;
sf->thresh_mult[THR_NEARESTA ] = 1000;
sf->thresh_mult[THR_ZEROG ] = 1000;
sf->thresh_mult[THR_ZEROA ] = 1000;
sf->thresh_mult[THR_NEARG ] = 1000;
sf->thresh_mult[THR_NEARA ] = 1000;
sf->thresh_mult[THR_ZEROMV ] = 0;
sf->thresh_mult[THR_ZEROG ] = 0;
sf->thresh_mult[THR_ZEROA ] = 0;
sf->thresh_mult[THR_NEARESTMV] = 0;
sf->thresh_mult[THR_NEARESTG ] = 0;
sf->thresh_mult[THR_NEARESTA ] = 0;
sf->thresh_mult[THR_NEARMV ] = 0;
sf->thresh_mult[THR_NEARG ] = 0;
sf->thresh_mult[THR_NEARA ] = 0;
sf->thresh_mult[THR_NEWMV ] = 1000;
sf->thresh_mult[THR_NEWG ] = 1000;
sf->thresh_mult[THR_NEWA ] = 1000;
#endif
sf->thresh_mult[THR_SPLITMV ] = 1700; sf->thresh_mult[THR_SPLITMV ] = 1700;
sf->thresh_mult[THR_SPLITG ] = 4500; sf->thresh_mult[THR_SPLITG ] = 4500;
sf->thresh_mult[THR_SPLITA ] = 4500; sf->thresh_mult[THR_SPLITA ] = 4500;
...@@ -906,6 +1003,9 @@ void vp8_set_speed_features(VP8_COMP *cpi) ...@@ -906,6 +1003,9 @@ void vp8_set_speed_features(VP8_COMP *cpi)
if (cpi->ref_frame_flags & VP8_LAST_FLAG) if (cpi->ref_frame_flags & VP8_LAST_FLAG)
{ {
sf->thresh_mult[THR_NEWMV ] = 2000; sf->thresh_mult[THR_NEWMV ] = 2000;
#if CONFIG_PRED_FILTER
sf->thresh_mult[THR_NEWMV_FILT ] = 2000;
#endif
sf->thresh_mult[THR_SPLITMV ] = 10000; sf->thresh_mult[THR_SPLITMV ] = 10000;
sf->thresh_mult[THR_COMP_SPLITLG ] = 20000; sf->thresh_mult[THR_COMP_SPLITLG ] = 20000;
} }
...@@ -916,6 +1016,12 @@ void vp8_set_speed_features(VP8_COMP *cpi) ...@@ -916,6 +1016,12 @@ void vp8_set_speed_features(VP8_COMP *cpi)
sf->thresh_mult[THR_ZEROG ] = 1500; sf->thresh_mult[THR_ZEROG ] = 1500;
sf->thresh_mult[THR_NEARG ] = 1500; sf->thresh_mult[THR_NEARG ] = 1500;
sf->thresh_mult[THR_NEWG ] = 2000; sf->thresh_mult[THR_NEWG ] = 2000;
#if CONFIG_PRED_FILTER
sf->thresh_mult[THR_NEARESTG_FILT ] = 1500;
sf->thresh_mult[THR_ZEROG_FILT ] = 1500;
sf->thresh_mult[THR_NEARG_FILT ] = 1500;
sf->thresh_mult[THR_NEWG_FILT ] = 2000;
#endif
sf->thresh_mult[THR_SPLITG ] = 20000; sf->thresh_mult[THR_SPLITG ] = 20000;
sf->thresh_mult[THR_COMP_SPLITGA ] = 20000; sf->thresh_mult[THR_COMP_SPLITGA ] = 20000;
} }
...@@ -926,6 +1032,12 @@ void vp8_set_speed_features(VP8_COMP *cpi) ...@@ -926,6 +1032,12 @@ void vp8_set_speed_features(VP8_COMP *cpi)
sf->thresh_mult[THR_ZEROA ] = 1500; sf->thresh_mult[THR_ZEROA ] = 1500;
sf->thresh_mult[THR_NEARA ] = 1500; sf->thresh_mult[THR_NEARA ] = 1500;
sf->thresh_mult[THR_NEWA ] = 2000; sf->thresh_mult[THR_NEWA ] = 2000;
#if CONFIG_PRED_FILTER
sf->thresh_mult[THR_NEARESTA_FILT ] = 1500;
sf->thresh_mult[THR_ZEROA_FILT ] = 1500;
sf->thresh_mult[THR_NEARA_FILT ] = 1500;
sf->thresh_mult[THR_NEWA_FILT ] = 2000;
#endif
sf->thresh_mult[THR_SPLITA ] = 20000; sf->thresh_mult[THR_SPLITA ] = 20000;
sf->thresh_mult[THR_COMP_SPLITLA ] = 10000; sf->thresh_mult[THR_COMP_SPLITLA ] = 10000;
} }
...@@ -972,6 +1084,9 @@ void vp8_set_speed_features(VP8_COMP *cpi) ...@@ -972,6 +1084,9 @@ void vp8_set_speed_features(VP8_COMP *cpi)
if (cpi->ref_frame_flags & VP8_LAST_FLAG) if (cpi->ref_frame_flags & VP8_LAST_FLAG)
{ {
sf->thresh_mult[THR_NEWMV ] = 2000; sf->thresh_mult[THR_NEWMV ] = 2000;
#if CONFIG_PRED_FILTER
sf->thresh_mult[THR_NEWMV_FILT ] = 2000;
#endif
sf->thresh_mult[THR_SPLITMV ] = 25000; sf->thresh_mult[THR_SPLITMV ] = 25000;
sf->thresh_mult[THR_COMP_SPLITLG ] = 50000; sf->thresh_mult[THR_COMP_SPLITLG ] = 50000;
} }
...@@ -982,6 +1097,12 @@ void vp8_set_speed_features(VP8_COMP *cpi) ...@@ -982,6 +1097,12 @@ void vp8_set_speed_features(VP8_COMP *cpi)
sf->thresh_mult[THR_ZEROG ] = 2000; sf->thresh_mult[THR_ZEROG ] = 2000;
sf->thresh_mult[THR_NEARG ] = 2000; sf->thresh_mult[THR_NEARG ] = 2000;
sf->thresh_mult[THR_NEWG ] = 2500; sf->thresh_mult[THR_NEWG ] = 2500;
#if CONFIG_PRED_FILTER
sf->thresh_mult[THR_NEARESTG_FILT ] = 2000;
sf->thresh_mult[THR_ZEROG_FILT ] = 2000;
sf->thresh_mult[THR_NEARG_FILT ] = 2000;
sf->thresh_mult[THR_NEWG_FILT ] = 2500;
#endif
sf->thresh_mult[THR_SPLITG ] = 50000; sf->thresh_mult[THR_SPLITG ] = 50000;
sf->thresh_mult[THR_COMP_SPLITGA ] = 50000; sf->thresh_mult[THR_COMP_SPLITGA ] = 50000;
} }
...@@ -992,6 +1113,12 @@ void vp8_set_speed_features(VP8_COMP *cpi) ...@@ -992,6 +1113,12 @@ void vp8_set_speed_features(VP8_COMP *cpi)
sf->thresh_mult[THR_ZEROA ] = 2000; sf->thresh_mult[THR_ZEROA ] = 2000;
sf->thresh_mult[THR_NEARA ] = 2000; sf->thresh_mult[THR_NEARA ] = 2000;
sf->thresh_mult[THR_NEWA ] = 2500; sf->thresh_mult[THR_NEWA ] = 2500;
#if CONFIG_PRED_FILTER
sf->thresh_mult[THR_NEARESTA_FILT ] = 2000;
sf->thresh_mult[THR_ZEROA_FILT ] = 2000;
sf->thresh_mult[THR_NEARA_FILT ] = 2000;
sf->thresh_mult[THR_NEWA_FILT ] = 2500;
#endif
sf->thresh_mult[THR_SPLITA ] = 50000; sf->thresh_mult[THR_SPLITA ] = 50000;
sf->thresh_mult[THR_COMP_SPLITLA ] = 25000; sf->thresh_mult[THR_COMP_SPLITLA ] = 25000;
} }
...@@ -1029,6 +1156,12 @@ void vp8_set_speed_features(VP8_COMP *cpi) ...@@ -1029,6 +1156,12 @@ void vp8_set_speed_features(VP8_COMP *cpi)
sf->thresh_mult[THR_NEARESTMV] = INT_MAX; sf->thresh_mult[THR_NEARESTMV] = INT_MAX;
sf->thresh_mult[THR_ZEROMV ] = INT_MAX; sf->thresh_mult[THR_ZEROMV ] = INT_MAX;
sf->thresh_mult[THR_NEARMV ] = INT_MAX; sf->thresh_mult[THR_NEARMV ] = INT_MAX;
#if CONFIG_PRED_FILTER
sf->thresh_mult[THR_NEWMV_FILT ] = INT_MAX;
sf->thresh_mult[THR_NEARESTMV_FILT] = INT_MAX;
sf->thresh_mult[THR_ZEROMV_FILT ] = INT_MAX;
sf->thresh_mult[THR_NEARMV_FILT ] = INT_MAX;
#endif
sf->thresh_mult[THR_SPLITMV ] = INT_MAX; sf->thresh_mult[THR_SPLITMV ] = INT_MAX;
} }
...@@ -1038,6 +1171,12 @@ void vp8_set_speed_features(VP8_COMP *cpi) ...@@ -1038,6 +1171,12 @@ void vp8_set_speed_features(VP8_COMP *cpi)
sf->thresh_mult[THR_ZEROG ] = INT_MAX; sf->thresh_mult[THR_ZEROG ] = INT_MAX;
sf->thresh_mult[THR_NEARG ] = INT_MAX; sf->thresh_mult[THR_NEARG ] = INT_MAX;
sf->thresh_mult[THR_NEWG ] = INT_MAX; sf->thresh_mult[THR_NEWG ] = INT_MAX;
#if CONFIG_PRED_FILTER
sf->thresh_mult[THR_NEARESTG_FILT ] = INT_MAX;
sf->thresh_mult[THR_ZEROG_FILT ] = INT_MAX;
sf->thresh_mult[THR_NEARG_FILT ] = INT_MAX;
sf->thresh_mult[THR_NEWG_FILT ] = INT_MAX;
#endif
sf->thresh_mult[THR_SPLITG ] = INT_MAX; sf->thresh_mult[THR_SPLITG ] = INT_MAX;
} }
...@@ -1047,6 +1186,12 @@ void vp8_set_speed_features(VP8_COMP *cpi) ...@@ -1047,6 +1186,12 @@ void vp8_set_speed_features(VP8_COMP *cpi)
sf->thresh_mult[THR_ZEROA ] = INT_MAX; sf->thresh_mult[THR_ZEROA ] = INT_MAX;
sf->thresh_mult[THR_NEARA ] = INT_MAX; sf->thresh_mult[THR_NEARA ] = INT_MAX;
sf->thresh_mult[THR_NEWA ] = INT_MAX; sf->thresh_mult[THR_NEWA ] = INT_MAX;
#if CONFIG_PRED_FILTER
sf->thresh_mult[THR_NEARESTA_FILT ] = INT_MAX;
sf->thresh_mult[THR_ZEROA_FILT ] = INT_MAX;
sf->thresh_mult[THR_NEARA_FILT ] = INT_MAX;
sf->thresh_mult[THR_NEWA_FILT ] = INT_MAX;
#endif
sf->thresh_mult[THR_SPLITA ] = INT_MAX; sf->thresh_mult[THR_SPLITA ] = INT_MAX;
} }
...@@ -2866,6 +3011,55 @@ void loopfilter_frame(VP8_COMP *cpi, VP8_COMMON *cm) ...@@ -2866,6 +3011,55 @@ void loopfilter_frame(VP8_COMP *cpi, VP8_COMMON *cm)
} }
#if CONFIG_PRED_FILTER
void select_pred_filter_mode(VP8_COMP *cpi)
{
VP8_COMMON *cm = &cpi->common;
int prob_pred_filter_off = cm->prob_pred_filter_off;
// Force filter on/off if probability is extreme
if (prob_pred_filter_off >= 255 * 0.95)
cm->pred_filter_mode = 0; // Off at the frame level
else if (prob_pred_filter_off <= 255 * 0.05)
cm->pred_filter_mode = 1; // On at the frame level
else
cm->pred_filter_mode = 2; // Selectable at the MB level
}
void update_pred_filt_prob(VP8_COMP *cpi)
{
VP8_COMMON *cm = &cpi->common;
int prob_pred_filter_off;
// Based on the selection in the previous frame determine what mode
// to use for the current frame and work out the signaling probability
if ( cpi->pred_filter_on_count + cpi->pred_filter_off_count )
{
prob_pred_filter_off = cpi->pred_filter_off_count * 256 /
( cpi->pred_filter_on_count + cpi->pred_filter_off_count);
if (prob_pred_filter_off < 1)
prob_pred_filter_off = 1;
if (prob_pred_filter_off > 255)