Commit 0abe813c authored by Dmitry Kovalev's avatar Dmitry Kovalev
Browse files

Moving thresh_mult{,_sub8x8} from SPEED_FEATURES to VP9_COMP.

SPEED_FEATURES should contain only configuration parameters.

Change-Id: I7d6d0636879c3e87dad09bc9455c1cf1dc039da8
parent 2ec04d1f
......@@ -465,120 +465,118 @@ static int is_slowest_mode(int mode) {
}
static void set_rd_speed_thresholds(VP9_COMP *cpi) {
SPEED_FEATURES *sf = &cpi->sf;
int i;
// Set baseline threshold values
for (i = 0; i < MAX_MODES; ++i)
sf->thresh_mult[i] = is_slowest_mode(cpi->oxcf.mode) ? -500 : 0;
sf->thresh_mult[THR_NEARESTMV] = 0;
sf->thresh_mult[THR_NEARESTG] = 0;
sf->thresh_mult[THR_NEARESTA] = 0;
sf->thresh_mult[THR_DC] += 1000;
sf->thresh_mult[THR_NEWMV] += 1000;
sf->thresh_mult[THR_NEWA] += 1000;
sf->thresh_mult[THR_NEWG] += 1000;
sf->thresh_mult[THR_NEARMV] += 1000;
sf->thresh_mult[THR_NEARA] += 1000;
sf->thresh_mult[THR_COMP_NEARESTLA] += 1000;
sf->thresh_mult[THR_COMP_NEARESTGA] += 1000;
sf->thresh_mult[THR_TM] += 1000;
sf->thresh_mult[THR_COMP_NEARLA] += 1500;
sf->thresh_mult[THR_COMP_NEWLA] += 2000;
sf->thresh_mult[THR_NEARG] += 1000;
sf->thresh_mult[THR_COMP_NEARGA] += 1500;
sf->thresh_mult[THR_COMP_NEWGA] += 2000;
sf->thresh_mult[THR_ZEROMV] += 2000;
sf->thresh_mult[THR_ZEROG] += 2000;
sf->thresh_mult[THR_ZEROA] += 2000;
sf->thresh_mult[THR_COMP_ZEROLA] += 2500;
sf->thresh_mult[THR_COMP_ZEROGA] += 2500;
sf->thresh_mult[THR_H_PRED] += 2000;
sf->thresh_mult[THR_V_PRED] += 2000;
sf->thresh_mult[THR_D45_PRED ] += 2500;
sf->thresh_mult[THR_D135_PRED] += 2500;
sf->thresh_mult[THR_D117_PRED] += 2500;
sf->thresh_mult[THR_D153_PRED] += 2500;
sf->thresh_mult[THR_D207_PRED] += 2500;
sf->thresh_mult[THR_D63_PRED] += 2500;
cpi->rd_thresh_mult[i] = is_slowest_mode(cpi->oxcf.mode) ? -500 : 0;
cpi->rd_thresh_mult[THR_NEARESTMV] = 0;
cpi->rd_thresh_mult[THR_NEARESTG] = 0;
cpi->rd_thresh_mult[THR_NEARESTA] = 0;
cpi->rd_thresh_mult[THR_DC] += 1000;
cpi->rd_thresh_mult[THR_NEWMV] += 1000;
cpi->rd_thresh_mult[THR_NEWA] += 1000;
cpi->rd_thresh_mult[THR_NEWG] += 1000;
cpi->rd_thresh_mult[THR_NEARMV] += 1000;
cpi->rd_thresh_mult[THR_NEARA] += 1000;
cpi->rd_thresh_mult[THR_COMP_NEARESTLA] += 1000;
cpi->rd_thresh_mult[THR_COMP_NEARESTGA] += 1000;
cpi->rd_thresh_mult[THR_TM] += 1000;
cpi->rd_thresh_mult[THR_COMP_NEARLA] += 1500;
cpi->rd_thresh_mult[THR_COMP_NEWLA] += 2000;
cpi->rd_thresh_mult[THR_NEARG] += 1000;
cpi->rd_thresh_mult[THR_COMP_NEARGA] += 1500;
cpi->rd_thresh_mult[THR_COMP_NEWGA] += 2000;
cpi->rd_thresh_mult[THR_ZEROMV] += 2000;
cpi->rd_thresh_mult[THR_ZEROG] += 2000;
cpi->rd_thresh_mult[THR_ZEROA] += 2000;
cpi->rd_thresh_mult[THR_COMP_ZEROLA] += 2500;
cpi->rd_thresh_mult[THR_COMP_ZEROGA] += 2500;
cpi->rd_thresh_mult[THR_H_PRED] += 2000;
cpi->rd_thresh_mult[THR_V_PRED] += 2000;
cpi->rd_thresh_mult[THR_D45_PRED ] += 2500;
cpi->rd_thresh_mult[THR_D135_PRED] += 2500;
cpi->rd_thresh_mult[THR_D117_PRED] += 2500;
cpi->rd_thresh_mult[THR_D153_PRED] += 2500;
cpi->rd_thresh_mult[THR_D207_PRED] += 2500;
cpi->rd_thresh_mult[THR_D63_PRED] += 2500;
/* disable frame modes if flags not set */
if (!(cpi->ref_frame_flags & VP9_LAST_FLAG)) {
sf->thresh_mult[THR_NEWMV ] = INT_MAX;
sf->thresh_mult[THR_NEARESTMV] = INT_MAX;
sf->thresh_mult[THR_ZEROMV ] = INT_MAX;
sf->thresh_mult[THR_NEARMV ] = INT_MAX;
cpi->rd_thresh_mult[THR_NEWMV ] = INT_MAX;
cpi->rd_thresh_mult[THR_NEARESTMV] = INT_MAX;
cpi->rd_thresh_mult[THR_ZEROMV ] = INT_MAX;
cpi->rd_thresh_mult[THR_NEARMV ] = INT_MAX;
}
if (!(cpi->ref_frame_flags & VP9_GOLD_FLAG)) {
sf->thresh_mult[THR_NEARESTG ] = INT_MAX;
sf->thresh_mult[THR_ZEROG ] = INT_MAX;
sf->thresh_mult[THR_NEARG ] = INT_MAX;
sf->thresh_mult[THR_NEWG ] = INT_MAX;
cpi->rd_thresh_mult[THR_NEARESTG ] = INT_MAX;
cpi->rd_thresh_mult[THR_ZEROG ] = INT_MAX;
cpi->rd_thresh_mult[THR_NEARG ] = INT_MAX;
cpi->rd_thresh_mult[THR_NEWG ] = INT_MAX;
}
if (!(cpi->ref_frame_flags & VP9_ALT_FLAG)) {
sf->thresh_mult[THR_NEARESTA ] = INT_MAX;
sf->thresh_mult[THR_ZEROA ] = INT_MAX;
sf->thresh_mult[THR_NEARA ] = INT_MAX;
sf->thresh_mult[THR_NEWA ] = INT_MAX;
cpi->rd_thresh_mult[THR_NEARESTA ] = INT_MAX;
cpi->rd_thresh_mult[THR_ZEROA ] = INT_MAX;
cpi->rd_thresh_mult[THR_NEARA ] = INT_MAX;
cpi->rd_thresh_mult[THR_NEWA ] = INT_MAX;
}
if ((cpi->ref_frame_flags & (VP9_LAST_FLAG | VP9_ALT_FLAG)) !=
(VP9_LAST_FLAG | VP9_ALT_FLAG)) {
sf->thresh_mult[THR_COMP_ZEROLA ] = INT_MAX;
sf->thresh_mult[THR_COMP_NEARESTLA] = INT_MAX;
sf->thresh_mult[THR_COMP_NEARLA ] = INT_MAX;
sf->thresh_mult[THR_COMP_NEWLA ] = INT_MAX;
cpi->rd_thresh_mult[THR_COMP_ZEROLA ] = INT_MAX;
cpi->rd_thresh_mult[THR_COMP_NEARESTLA] = INT_MAX;
cpi->rd_thresh_mult[THR_COMP_NEARLA ] = INT_MAX;
cpi->rd_thresh_mult[THR_COMP_NEWLA ] = INT_MAX;
}
if ((cpi->ref_frame_flags & (VP9_GOLD_FLAG | VP9_ALT_FLAG)) !=
(VP9_GOLD_FLAG | VP9_ALT_FLAG)) {
sf->thresh_mult[THR_COMP_ZEROGA ] = INT_MAX;
sf->thresh_mult[THR_COMP_NEARESTGA] = INT_MAX;
sf->thresh_mult[THR_COMP_NEARGA ] = INT_MAX;
sf->thresh_mult[THR_COMP_NEWGA ] = INT_MAX;
cpi->rd_thresh_mult[THR_COMP_ZEROGA ] = INT_MAX;
cpi->rd_thresh_mult[THR_COMP_NEARESTGA] = INT_MAX;
cpi->rd_thresh_mult[THR_COMP_NEARGA ] = INT_MAX;
cpi->rd_thresh_mult[THR_COMP_NEWGA ] = INT_MAX;
}
}
static void set_rd_speed_thresholds_sub8x8(VP9_COMP *cpi) {
SPEED_FEATURES *sf = &cpi->sf;
const SPEED_FEATURES *const sf = &cpi->sf;
int i;
for (i = 0; i < MAX_REFS; ++i)
sf->thresh_mult_sub8x8[i] = is_slowest_mode(cpi->oxcf.mode) ? -500 : 0;
cpi->rd_thresh_mult_sub8x8[i] = is_slowest_mode(cpi->oxcf.mode) ? -500 : 0;
sf->thresh_mult_sub8x8[THR_LAST] += 2500;
sf->thresh_mult_sub8x8[THR_GOLD] += 2500;
sf->thresh_mult_sub8x8[THR_ALTR] += 2500;
sf->thresh_mult_sub8x8[THR_INTRA] += 2500;
sf->thresh_mult_sub8x8[THR_COMP_LA] += 4500;
sf->thresh_mult_sub8x8[THR_COMP_GA] += 4500;
cpi->rd_thresh_mult_sub8x8[THR_LAST] += 2500;
cpi->rd_thresh_mult_sub8x8[THR_GOLD] += 2500;
cpi->rd_thresh_mult_sub8x8[THR_ALTR] += 2500;
cpi->rd_thresh_mult_sub8x8[THR_INTRA] += 2500;
cpi->rd_thresh_mult_sub8x8[THR_COMP_LA] += 4500;
cpi->rd_thresh_mult_sub8x8[THR_COMP_GA] += 4500;
// Check for masked out split cases.
for (i = 0; i < MAX_REFS; i++) {
for (i = 0; i < MAX_REFS; i++)
if (sf->disable_split_mask & (1 << i))
sf->thresh_mult_sub8x8[i] = INT_MAX;
}
cpi->rd_thresh_mult_sub8x8[i] = INT_MAX;
// disable mode test if frame flag is not set
if (!(cpi->ref_frame_flags & VP9_LAST_FLAG))
sf->thresh_mult_sub8x8[THR_LAST] = INT_MAX;
cpi->rd_thresh_mult_sub8x8[THR_LAST] = INT_MAX;
if (!(cpi->ref_frame_flags & VP9_GOLD_FLAG))
sf->thresh_mult_sub8x8[THR_GOLD] = INT_MAX;
cpi->rd_thresh_mult_sub8x8[THR_GOLD] = INT_MAX;
if (!(cpi->ref_frame_flags & VP9_ALT_FLAG))
sf->thresh_mult_sub8x8[THR_ALTR] = INT_MAX;
cpi->rd_thresh_mult_sub8x8[THR_ALTR] = INT_MAX;
if ((cpi->ref_frame_flags & (VP9_LAST_FLAG | VP9_ALT_FLAG)) !=
(VP9_LAST_FLAG | VP9_ALT_FLAG))
sf->thresh_mult_sub8x8[THR_COMP_LA] = INT_MAX;
cpi->rd_thresh_mult_sub8x8[THR_COMP_LA] = INT_MAX;
if ((cpi->ref_frame_flags & (VP9_GOLD_FLAG | VP9_ALT_FLAG)) !=
(VP9_GOLD_FLAG | VP9_ALT_FLAG))
sf->thresh_mult_sub8x8[THR_COMP_GA] = INT_MAX;
cpi->rd_thresh_mult_sub8x8[THR_COMP_GA] = INT_MAX;
}
static void set_good_speed_feature(VP9_COMMON *cm,
......
......@@ -240,13 +240,6 @@ typedef struct {
// Control when to stop subpel search
int subpel_force_stop;
// Thresh_mult is used to set a threshold for the rd score. A higher value
// means that we will accept the best mode so far more often. This number
// is used in combination with the current block size, and thresh_freq_fact
// to pick a threshold.
int thresh_mult[MAX_MODES];
int thresh_mult_sub8x8[MAX_REFS];
// This parameter controls the number of steps we'll do in a diamond
// search.
int max_step_search_steps;
......@@ -649,6 +642,13 @@ typedef struct VP9_COMP {
// Ambient reconstruction err target for force key frames
int ambient_err;
// Thresh_mult is used to set a threshold for the rd score. A higher value
// means that we will accept the best mode so far more often. This number
// is used in combination with the current block size, and thresh_freq_fact
// to pick a threshold.
int rd_thresh_mult[MAX_MODES];
int rd_thresh_mult_sub8x8[MAX_REFS];
int rd_threshes[MAX_SEGMENTS][BLOCK_SIZES][MAX_MODES];
int rd_thresh_freq_fact[BLOCK_SIZES][MAX_MODES];
int rd_thresh_sub8x8[MAX_SEGMENTS][BLOCK_SIZES][MAX_REFS];
......
......@@ -244,7 +244,6 @@ void vp9_initialize_me_consts(VP9_COMP *cpi, int qindex) {
static void set_block_thresholds(VP9_COMP *cpi) {
const VP9_COMMON *const cm = &cpi->common;
const SPEED_FEATURES *const sf = &cpi->sf;
int i, bsize, segment_id;
for (segment_id = 0; segment_id < MAX_SEGMENTS; ++segment_id) {
......@@ -261,13 +260,13 @@ static void set_block_thresholds(VP9_COMP *cpi) {
for (i = 0; i < MAX_MODES; ++i)
cpi->rd_threshes[segment_id][bsize][i] =
sf->thresh_mult[i] < thresh_max ? sf->thresh_mult[i] * t / 4
cpi->rd_thresh_mult[i] < thresh_max ? cpi->rd_thresh_mult[i] * t / 4
: INT_MAX;
for (i = 0; i < MAX_REFS; ++i) {
cpi->rd_thresh_sub8x8[segment_id][bsize][i] =
sf->thresh_mult_sub8x8[i] < thresh_max
? sf->thresh_mult_sub8x8[i] * t / 4
cpi->rd_thresh_mult_sub8x8[i] < thresh_max
? cpi->rd_thresh_mult_sub8x8[i] * t / 4
: INT_MAX;
}
}
......
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