Merge "Add early termination in transform size search"
This commit is contained in:
commit
4d98b50be5
@ -490,18 +490,18 @@ static void choose_tx_size_from_rd(VP9_COMP *cpi, MACROBLOCK *x,
|
||||
{INT64_MAX, INT64_MAX},
|
||||
{INT64_MAX, INT64_MAX},
|
||||
{INT64_MAX, INT64_MAX}};
|
||||
TX_SIZE n, m;
|
||||
int n, m;
|
||||
int s0, s1;
|
||||
const TX_SIZE max_mode_tx_size = tx_mode_to_biggest_tx_size[cm->tx_mode];
|
||||
int64_t best_rd = INT64_MAX;
|
||||
TX_SIZE best_tx = TX_4X4;
|
||||
TX_SIZE best_tx = max_tx_size;
|
||||
|
||||
const vp9_prob *tx_probs = get_tx_probs2(max_tx_size, xd, &cm->fc.tx_probs);
|
||||
assert(skip_prob > 0);
|
||||
s0 = vp9_cost_bit(skip_prob, 0);
|
||||
s1 = vp9_cost_bit(skip_prob, 1);
|
||||
|
||||
for (n = TX_4X4; n <= max_tx_size; n++) {
|
||||
for (n = max_tx_size; n >= 0; n--) {
|
||||
txfm_rd_in_plane(x, &r[n][0], &d[n], &s[n],
|
||||
&sse[n], ref_best_rd, 0, bs, n,
|
||||
cpi->sf.use_fast_coef_costing);
|
||||
@ -523,6 +523,13 @@ static void choose_tx_size_from_rd(VP9_COMP *cpi, MACROBLOCK *x,
|
||||
rd[n][1] = RDCOST(x->rdmult, x->rddiv, r[n][1] + s0, d[n]);
|
||||
}
|
||||
|
||||
// Early termination in transform size search.
|
||||
if (cpi->sf.tx_size_search_breakout &&
|
||||
(rd[n][1] == INT64_MAX ||
|
||||
(n < max_tx_size && rd[n][1] > rd[n + 1][1]) ||
|
||||
s[n] == 1))
|
||||
break;
|
||||
|
||||
if (rd[n][1] < best_rd) {
|
||||
best_tx = n;
|
||||
best_rd = rd[n][1];
|
||||
|
@ -59,8 +59,6 @@ static void set_good_speed_feature(VP9_COMP *cpi, VP9_COMMON *cm,
|
||||
if (speed >= 1) {
|
||||
sf->use_square_partition_only = !frame_is_intra_only(cm);
|
||||
sf->less_rectangular_check = 1;
|
||||
sf->tx_size_search_method = frame_is_boosted(cpi) ? USE_FULL_RD
|
||||
: USE_LARGESTALL;
|
||||
|
||||
if (MIN(cm->width, cm->height) >= 720)
|
||||
sf->disable_split_mask = cm->show_frame ? DISABLE_ALL_SPLIT
|
||||
@ -80,9 +78,14 @@ static void set_good_speed_feature(VP9_COMP *cpi, VP9_COMMON *cm,
|
||||
sf->intra_uv_mode_mask[TX_32X32] = INTRA_DC_H_V;
|
||||
sf->intra_y_mode_mask[TX_16X16] = INTRA_DC_H_V;
|
||||
sf->intra_uv_mode_mask[TX_16X16] = INTRA_DC_H_V;
|
||||
|
||||
sf->tx_size_search_breakout = 1;
|
||||
}
|
||||
|
||||
if (speed >= 2) {
|
||||
sf->tx_size_search_method = frame_is_boosted(cpi) ? USE_FULL_RD
|
||||
: USE_LARGESTALL;
|
||||
|
||||
if (MIN(cm->width, cm->height) >= 720) {
|
||||
sf->lf_motion_threshold = LOW_MOTION_THRESHOLD;
|
||||
sf->last_partitioning_redo_frequency = 3;
|
||||
@ -391,6 +394,7 @@ void vp9_set_speed_features(VP9_COMP *cpi) {
|
||||
// Recode loop tolerence %.
|
||||
sf->recode_tolerance = 25;
|
||||
sf->default_interp_filter = SWITCHABLE;
|
||||
sf->tx_size_search_breakout = 0;
|
||||
|
||||
if (oxcf->mode == REALTIME) {
|
||||
set_rt_speed_feature(cpi, sf, oxcf->speed, oxcf->content);
|
||||
|
@ -376,6 +376,10 @@ typedef struct SPEED_FEATURES {
|
||||
|
||||
// default interp filter choice
|
||||
INTERP_FILTER default_interp_filter;
|
||||
|
||||
// Early termination in transform size search, which only applies while
|
||||
// tx_size_search_method is USE_FULL_RD.
|
||||
int tx_size_search_breakout;
|
||||
} SPEED_FEATURES;
|
||||
|
||||
struct VP9_COMP;
|
||||
|
Loading…
Reference in New Issue
Block a user