Commit 02b3b052 authored by paulwilkins's avatar paulwilkins Committed by Gerrit Code Review

Merge "Alter partition search at image edge."

parents 8051b6d2 99f8bd72
......@@ -2123,6 +2123,39 @@ static const BLOCK_SIZE max_partition_size[BLOCK_SIZES] = {
BLOCK_64X64
};
// Checks to see if a macro block is at the edge of the active image.
// In most cases this is the "real" edge unless there are formatting
// bars embedded in the stream.
static int active_edge_sb(VP9_COMP *cpi,
int mi_row, int mi_col) {
int is_active_edge = 0;
int top_edge = 0;
int bottom_edge = cpi->common.mi_rows;
int left_edge = 0;
int right_edge = cpi->common.mi_cols;
// For two pass account for any formatting bars detected.
if (cpi->oxcf.pass == 2) {
TWO_PASS *twopass = &cpi->twopass;
// The inactive region is specified in MBs not mi units.
// The image edge is in the following MB row.
top_edge += (int)(twopass->this_frame_stats.inactive_zone_rows * 2);
bottom_edge -= (int)(twopass->this_frame_stats.inactive_zone_rows * 2);
bottom_edge = MAX(top_edge, bottom_edge);
}
if (((top_edge >= mi_row) && (top_edge < (mi_row + MI_BLOCK_SIZE))) ||
((bottom_edge >= mi_row) && (bottom_edge < (mi_row + MI_BLOCK_SIZE))) ||
((left_edge >= mi_col) && (left_edge < (mi_col + MI_BLOCK_SIZE))) ||
((right_edge >= mi_col) && (right_edge < (mi_col + MI_BLOCK_SIZE)))) {
is_active_edge = 1;
}
return is_active_edge;
}
// Look at all the mode_info entries for blocks that are part of this
// partition and find the min and max values for sb_type.
// At the moment this is designed to work on a 64x64 SB but could be
......@@ -2217,7 +2250,15 @@ static void rd_auto_partition_range(VP9_COMP *cpi, const TileInfo *const tile,
max_size = find_partition_size(max_size,
row8x8_remaining, col8x8_remaining,
&bh, &bw);
min_size = MIN(cpi->sf.rd_auto_partition_min_limit, MIN(min_size, max_size));
// Test for blocks at the edge of the active image.
// This may be the actual edge of the image or where there are formatting
// bars.
if (active_edge_sb(cpi, mi_row, mi_col)) {
min_size = BLOCK_4X4;
} else {
min_size = MIN(cpi->sf.rd_auto_partition_min_limit,
MIN(min_size, max_size));
}
// When use_square_partition_only is true, make sure at least one square
// partition is allowed by selecting the next smaller square size as
......
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