Commit e832d578 authored by Debargha Mukherjee's avatar Debargha Mukherjee

Make global model acceptance depend on params cost

lowres:
BDRATE (overall PSNR): -1.661% (up from -1542%)

Change-Id: I612cb16f1d2362ab6375a5ef3258a4ed0777ac29
parent 52ece884
......@@ -5183,30 +5183,32 @@ static void encode_frame_internal(AV1_COMP *cpi) {
}
}
}
// If the best error advantage found doesn't meet the threshold for
// this motion type, revert to IDENTITY.
if (best_erroradvantage >
gm_advantage_thresh[cm->global_motion[frame].wmtype]) {
set_default_gmparams(&cm->global_motion[frame]);
}
if (cm->global_motion[frame].wmtype <= AFFINE)
if (!get_shear_params(&cm->global_motion[frame]))
set_default_gmparams(&cm->global_motion[frame]);
if (cm->global_motion[frame].wmtype != IDENTITY) {
if (cm->global_motion[frame].wmtype == TRANSLATION) {
cm->global_motion[frame].wmmat[0] =
convert_to_trans_prec(cm->allow_high_precision_mv,
cm->global_motion[frame].wmmat[0]) *
GM_TRANS_ONLY_DECODE_FACTOR;
cm->global_motion[frame].wmmat[1] =
convert_to_trans_prec(cm->allow_high_precision_mv,
cm->global_motion[frame].wmmat[1]) *
GM_TRANS_ONLY_DECODE_FACTOR;
}
break;
if (cm->global_motion[frame].wmtype == TRANSLATION) {
cm->global_motion[frame].wmmat[0] =
convert_to_trans_prec(cm->allow_high_precision_mv,
cm->global_motion[frame].wmmat[0]) *
GM_TRANS_ONLY_DECODE_FACTOR;
cm->global_motion[frame].wmmat[1] =
convert_to_trans_prec(cm->allow_high_precision_mv,
cm->global_motion[frame].wmmat[1]) *
GM_TRANS_ONLY_DECODE_FACTOR;
}
// If the best error advantage found doesn't meet the threshold for
// this motion type, revert to IDENTITY.
if (!is_enough_erroradvantage(
best_erroradvantage,
gm_get_params_cost(&cm->global_motion[frame],
&cm->prev_frame->global_motion[frame],
cm->allow_high_precision_mv))) {
set_default_gmparams(&cm->global_motion[frame]);
}
if (cm->global_motion[frame].wmtype != IDENTITY) break;
}
aom_clear_system_state();
}
......
......@@ -32,15 +32,13 @@
// Border over which to compute the global motion
#define ERRORADV_BORDER 0
const double gm_advantage_thresh[TRANS_TYPES] = {
1.00, // Identity (not used)
0.85, // Translation
0.75, // Rot zoom
0.65, // Affine
0.65, // Hor Trapezoid
0.65, // Ver Trapezoid
0.50, // Homography
};
#define ERRORADV_MAX_THRESH 0.995
#define ERRORADV_COST_PRODUCT_THRESH 26000
int is_enough_erroradvantage(double best_erroradvantage, int params_cost) {
return best_erroradvantage < ERRORADV_MAX_THRESH &&
best_erroradvantage * params_cost < ERRORADV_COST_PRODUCT_THRESH;
}
void convert_to_params(const double *params, int32_t *model) {
int i;
......
......@@ -22,10 +22,10 @@ extern "C" {
#define RANSAC_NUM_MOTIONS 1
extern const double gm_advantage_thresh[TRANS_TYPES];
void convert_model_to_params(const double *params, WarpedMotionParams *model);
int is_enough_erroradvantage(double erroradv, int params_cost);
// Adds some offset to a global motion parameter and handles
// all of the necessary precision shifts, clamping, and
// zero-centering.
......
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