Improved auto_partition_range.

The code now takes into account temporal and spatial
information to determine the partition size range, but the
frequency counts have been removed.

The net effect is similar in quality but about 10% faster.

Change-Id: I39a513fb79cec9177b73b2a7218f0da70963ae95
This commit is contained in:
Paul Wilkins 2013-09-27 12:59:06 +01:00
Родитель a76caa7ff4
Коммит 65b93c7e52
3 изменённых файлов: 44 добавлений и 53 удалений

Просмотреть файл

@ -507,8 +507,7 @@ static void set_offsets(VP9_COMP *cpi, int mi_row, int mi_col,
// cannot be used.
xd->last_mi = cm->prev_mi ? xd->prev_mi_8x8[0] : NULL;
xd->this_mi =
xd->mi_8x8[0] = cm->mi + idx_str;
xd->this_mi = xd->mi_8x8[0] = cm->mi + idx_str;
mbmi = &xd->this_mi->mbmi;
@ -1261,37 +1260,40 @@ static void get_sb_partition_size_range(VP9_COMP *cpi, MODE_INFO ** mi_8x8,
static void rd_auto_partition_range(VP9_COMP *cpi, int row, int col,
BLOCK_SIZE *min_block_size,
BLOCK_SIZE *max_block_size) {
VP9_COMMON * const cm = &cpi->common;
MACROBLOCKD *const xd = &cpi->mb.e_mbd;
MODE_INFO ** mi_8x8 = xd->mi_8x8;
MODE_INFO ** prev_mi_8x8 = xd->prev_mi_8x8;
const int left_in_image = xd->left_available && mi_8x8[-1];
const int above_in_image = xd->up_available &&
mi_8x8[-xd->mode_info_stride];
MODE_INFO ** above_sb64_mi_8x8;
MODE_INFO ** left_sb64_mi_8x8;
// Frequency check
if (cpi->sf.auto_min_max_partition_count <= 0) {
cpi->sf.auto_min_max_partition_count =
cpi->sf.auto_min_max_partition_interval;
*min_block_size = BLOCK_4X4;
*max_block_size = BLOCK_64X64;
} else {
--cpi->sf.auto_min_max_partition_count;
// Set default values if no left or above neighbour
if (!left_in_image && !above_in_image) {
*min_block_size = BLOCK_4X4;
*max_block_size = BLOCK_64X64;
} else {
VP9_COMMON *const cm = &cpi->common;
int row8x8_remaining = cm->cur_tile_mi_row_end - row;
int col8x8_remaining = cm->cur_tile_mi_col_end - col;
int bh, bw;
// Trap case where we do not have a prediction.
if (!left_in_image && !above_in_image &&
((cm->frame_type == KEY_FRAME) || !cm->prev_mi)) {
*min_block_size = BLOCK_4X4;
*max_block_size = BLOCK_64X64;
} else {
// Default "min to max" and "max to min"
*min_block_size = BLOCK_64X64;
*max_block_size = BLOCK_4X4;
// NOTE: each call to get_sb_partition_size_range() uses the previous
// passed in values for min and max as a starting point.
//
// Find the min and max partition used in previous frame at this location
if (cm->prev_mi && (cm->frame_type != KEY_FRAME)) {
get_sb_partition_size_range(cpi, prev_mi_8x8,
min_block_size, max_block_size);
}
// Find the min and max partition sizes used in the left SB64
if (left_in_image) {
left_sb64_mi_8x8 = &mi_8x8[-MI_BLOCK_SIZE];
@ -1299,13 +1301,13 @@ static void rd_auto_partition_range(VP9_COMP *cpi, int row, int col,
min_block_size, max_block_size);
}
// Find the min and max partition sizes used in the above SB64 taking
// the values found for left as a starting point.
// Find the min and max partition sizes used in the above SB64.
if (above_in_image) {
above_sb64_mi_8x8 = &mi_8x8[-xd->mode_info_stride * MI_BLOCK_SIZE];
get_sb_partition_size_range(cpi, above_sb64_mi_8x8,
min_block_size, max_block_size);
}
}
// Give a bit of leaway either side of the observed min and max
*min_block_size = min_partition_size[*min_block_size];
@ -1317,8 +1319,6 @@ static void rd_auto_partition_range(VP9_COMP *cpi, int row, int col,
&bh, &bw);
*min_block_size = MIN(*min_block_size, *max_block_size);
}
}
}
static void compute_fast_motion_search_level(VP9_COMP *cpi, BLOCK_SIZE bsize) {
VP9_COMMON *const cm = &cpi->common;
@ -1895,13 +1895,11 @@ static void encode_frame_internal(VP9_COMP *cpi) {
xd->mi_8x8 = cm->mi_grid_visible;
// required for vp9_frame_init_quantizer
xd->this_mi =
xd->mi_8x8[0] = cm->mi;
xd->this_mi = xd->mi_8x8[0] = cm->mi;
xd->mic_stream_ptr = cm->mi;
xd->last_mi = cm->prev_mi;
vp9_zero(cpi->NMVcount);
vp9_zero(cpi->coef_counts);
vp9_zero(cm->counts.eob_branch);

Просмотреть файл

@ -707,8 +707,6 @@ void vp9_set_speed_features(VP9_COMP *cpi) {
sf->less_rectangular_check = 0;
sf->use_square_partition_only = 0;
sf->auto_min_max_partition_size = 0;
sf->auto_min_max_partition_interval = 0;
sf->auto_min_max_partition_count = 0;
sf->max_partition_size = BLOCK_64X64;
sf->min_partition_size = BLOCK_4X4;
sf->adjust_partitioning_from_last_frame = 0;
@ -773,7 +771,6 @@ void vp9_set_speed_features(VP9_COMP *cpi) {
sf->auto_mv_step_size = 1;
sf->auto_min_max_partition_size = 1;
sf->auto_min_max_partition_interval = 1;
// FIXME(jingning): temporarily turn off disable_split_var_thresh
// during refactoring process. will get this back after finishing
// the main framework of partition search type.
@ -818,7 +815,6 @@ void vp9_set_speed_features(VP9_COMP *cpi) {
sf->subpel_iters_per_step = 1;
sf->use_fast_lpf_pick = 1;
sf->auto_min_max_partition_size = 1;
sf->auto_min_max_partition_interval = 2;
sf->disable_split_var_thresh = 32;
sf->disable_filter_search_var_thresh = 32;
sf->use_fast_coef_updates = 2;
@ -856,7 +852,6 @@ void vp9_set_speed_features(VP9_COMP *cpi) {
sf->subpel_iters_per_step = 1;
sf->use_fast_lpf_pick = 1;
sf->auto_min_max_partition_size = 1;
sf->auto_min_max_partition_interval = 2;
sf->disable_split_var_thresh = 64;
sf->disable_filter_search_var_thresh = 64;
sf->use_fast_coef_updates = 2;

Просмотреть файл

@ -257,8 +257,6 @@ typedef struct {
int reference_masking;
BLOCK_SIZE always_this_block_size;
int auto_min_max_partition_size;
int auto_min_max_partition_interval;
int auto_min_max_partition_count;
BLOCK_SIZE min_partition_size;
BLOCK_SIZE max_partition_size;
int adjust_partitioning_from_last_frame;