Merge "Add constrained-copy partition to speed features."
This commit is contained in:
commit
b03e7757d1
@ -1364,6 +1364,69 @@ static void set_fixed_partitioning(VP9_COMP *cpi, const TileInfo *const tile,
|
||||
}
|
||||
}
|
||||
|
||||
static void constrain_copy_partitioning(VP9_COMP *const cpi,
|
||||
const TileInfo *const tile,
|
||||
MODE_INFO **mi_8x8,
|
||||
MODE_INFO **prev_mi_8x8,
|
||||
int mi_row, int mi_col,
|
||||
BLOCK_SIZE bsize) {
|
||||
VP9_COMMON *const cm = &cpi->common;
|
||||
const int mis = cm->mi_stride;
|
||||
const int row8x8_remaining = tile->mi_row_end - mi_row;
|
||||
const int col8x8_remaining = tile->mi_col_end - mi_col;
|
||||
MODE_INFO *const mi_upper_left = cm->mi + mi_row * mis + mi_col;
|
||||
const int bh = num_8x8_blocks_high_lookup[bsize];
|
||||
const int bw = num_8x8_blocks_wide_lookup[bsize];
|
||||
int block_row, block_col;
|
||||
|
||||
assert((row8x8_remaining > 0) && (col8x8_remaining > 0));
|
||||
|
||||
// If the SB64 if it is all "in image".
|
||||
if ((col8x8_remaining >= MI_BLOCK_SIZE) &&
|
||||
(row8x8_remaining >= MI_BLOCK_SIZE)) {
|
||||
for (block_row = 0; block_row < MI_BLOCK_SIZE; block_row += bh) {
|
||||
for (block_col = 0; block_col < MI_BLOCK_SIZE; block_col += bw) {
|
||||
const int index = block_row * mis + block_col;
|
||||
MODE_INFO *prev_mi = prev_mi_8x8[index];
|
||||
const BLOCK_SIZE sb_type = prev_mi ? prev_mi->mbmi.sb_type : 0;
|
||||
// Use previous partition if block size is not larger than bsize.
|
||||
if (prev_mi && sb_type <= bsize) {
|
||||
int block_row2, block_col2;
|
||||
for (block_row2 = 0; block_row2 < bh; ++block_row2) {
|
||||
for (block_col2 = 0; block_col2 < bw; ++block_col2) {
|
||||
const int index2 = (block_row + block_row2) * mis +
|
||||
block_col + block_col2;
|
||||
prev_mi = prev_mi_8x8[index2];
|
||||
if (prev_mi) {
|
||||
const ptrdiff_t offset = prev_mi - cm->prev_mi;
|
||||
mi_8x8[index2] = cm->mi + offset;
|
||||
mi_8x8[index2]->mbmi.sb_type = prev_mi->mbmi.sb_type;
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// Otherwise, use fixed partition of size bsize.
|
||||
mi_8x8[index] = mi_upper_left + index;
|
||||
mi_8x8[index]->mbmi.sb_type = bsize;
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// Else this is a partial SB64, copy previous partition.
|
||||
for (block_row = 0; block_row < 8; ++block_row) {
|
||||
for (block_col = 0; block_col < 8; ++block_col) {
|
||||
MODE_INFO *const prev_mi = prev_mi_8x8[block_row * mis + block_col];
|
||||
const BLOCK_SIZE sb_type = prev_mi ? prev_mi->mbmi.sb_type : 0;
|
||||
if (prev_mi) {
|
||||
const ptrdiff_t offset = prev_mi - cm->prev_mi;
|
||||
mi_8x8[block_row * mis + block_col] = cm->mi + offset;
|
||||
mi_8x8[block_row * mis + block_col]->mbmi.sb_type = sb_type;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void copy_partitioning(VP9_COMMON *cm, MODE_INFO **mi_8x8,
|
||||
MODE_INFO **prev_mi_8x8) {
|
||||
const int mis = cm->mi_stride;
|
||||
@ -2372,7 +2435,12 @@ static void encode_rd_sb_row(VP9_COMP *cpi, const TileInfo *const tile,
|
||||
rd_pick_partition(cpi, tile, tp, mi_row, mi_col, BLOCK_64X64,
|
||||
&dummy_rate, &dummy_dist, 1, INT64_MAX);
|
||||
} else {
|
||||
copy_partitioning(cm, mi_8x8, prev_mi_8x8);
|
||||
if (sf->constrain_copy_partition &&
|
||||
sb_has_motion(cm, prev_mi_8x8))
|
||||
constrain_copy_partitioning(cpi, tile, mi_8x8, prev_mi_8x8,
|
||||
mi_row, mi_col, BLOCK_16X16);
|
||||
else
|
||||
copy_partitioning(cm, mi_8x8, prev_mi_8x8);
|
||||
rd_use_partition(cpi, tile, mi_8x8, tp, mi_row, mi_col, BLOCK_64X64,
|
||||
&dummy_rate, &dummy_dist, 1);
|
||||
}
|
||||
|
@ -209,6 +209,7 @@ static void set_rt_speed_feature(VP9_COMMON *cm, SPEED_FEATURES *sf,
|
||||
sf->use_square_partition_only = 1;
|
||||
sf->disable_filter_search_var_thresh = 100;
|
||||
sf->use_lastframe_partitioning = LAST_FRAME_PARTITION_ALL;
|
||||
sf->constrain_copy_partition = 1;
|
||||
sf->use_uv_intra_rd_estimate = 1;
|
||||
sf->skip_encode_sb = 1;
|
||||
sf->subpel_iters_per_step = 1;
|
||||
@ -310,6 +311,7 @@ void vp9_set_speed_features(VP9_COMP *cpi) {
|
||||
sf->min_partition_size = BLOCK_4X4;
|
||||
sf->adjust_partitioning_from_last_frame = 0;
|
||||
sf->last_partitioning_redo_frequency = 4;
|
||||
sf->constrain_copy_partition = 0;
|
||||
sf->disable_split_mask = 0;
|
||||
sf->mode_search_skip_flags = 0;
|
||||
sf->force_frame_boost = 0;
|
||||
|
@ -245,6 +245,12 @@ typedef struct {
|
||||
// use_lastframe_partitioning is set.
|
||||
int last_partitioning_redo_frequency;
|
||||
|
||||
// This enables constrained copy partitioning, which, given an input block
|
||||
// size bsize, will copy previous partition for partitions less than bsize,
|
||||
// otherwise bsize partition is used. bsize is currently set to 16x16.
|
||||
// Used for the case where motion is detected in superblock.
|
||||
int constrain_copy_partition;
|
||||
|
||||
// Disables sub 8x8 blocksizes in different scenarios: Choices are to disable
|
||||
// it always, to allow it for only Last frame and Intra, disable it for all
|
||||
// inter modes or to enable it always.
|
||||
|
Loading…
Reference in New Issue
Block a user