Alter partition search at image edge.
Added code to reduce the minimum partition size searched for super blocks at or straddling the edge of the image. If the first pass has detected formatting bars the "active" edge may not be the real edge. Change-Id: I9c4bdd1477e60f162a75fac95ba6be7c3521e05c
This commit is contained in:
parent
dc19f352af
commit
99f8bd72cb
@ -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
|
||||
|
Loading…
x
Reference in New Issue
Block a user