From 1ca118652901b8ea8beccc71bc7079c77cc5554d Mon Sep 17 00:00:00 2001 From: Yaowu Xu Date: Wed, 29 Jan 2014 10:03:07 -0800 Subject: [PATCH] Add a strict mode for auto_min_max_partition_size feature In this new mode, the size range is strictly determined by the min and max partition size in neighborhood blocks. Niklas720 encoding time at cpu-used -5 goes from 56250ms to 50676ms, a 10% reduction. Change-Id: I316b0e2ac967ff3fad57b28d69c0ec80b7d8b34e --- vp9/encoder/vp9_encodeframe.c | 24 +++++++++++++++--------- vp9/encoder/vp9_onyx_if.c | 1 + vp9/encoder/vp9_onyx_int.h | 11 ++++++++--- 3 files changed, 24 insertions(+), 12 deletions(-) diff --git a/vp9/encoder/vp9_encodeframe.c b/vp9/encoder/vp9_encodeframe.c index 4624a5c89..70a88ab93 100644 --- a/vp9/encoder/vp9_encodeframe.c +++ b/vp9/encoder/vp9_encodeframe.c @@ -1446,15 +1446,19 @@ static void rd_use_partition(VP9_COMP *cpi, } static const BLOCK_SIZE min_partition_size[BLOCK_SIZES] = { - BLOCK_4X4, BLOCK_4X4, BLOCK_4X4, BLOCK_4X4, - BLOCK_4X4, BLOCK_4X4, BLOCK_8X8, BLOCK_8X8, - BLOCK_8X8, BLOCK_16X16, BLOCK_16X16, BLOCK_16X16, BLOCK_16X16 + BLOCK_4X4, BLOCK_4X4, BLOCK_4X4, + BLOCK_4X4, BLOCK_4X4, BLOCK_4X4, + BLOCK_8X8, BLOCK_8X8, BLOCK_8X8, + BLOCK_16X16, BLOCK_16X16, BLOCK_16X16, + BLOCK_16X16 }; static const BLOCK_SIZE max_partition_size[BLOCK_SIZES] = { - BLOCK_8X8, BLOCK_16X16, BLOCK_16X16, BLOCK_16X16, - BLOCK_32X32, BLOCK_32X32, BLOCK_32X32, BLOCK_64X64, - BLOCK_64X64, BLOCK_64X64, BLOCK_64X64, BLOCK_64X64, BLOCK_64X64 + BLOCK_8X8, BLOCK_16X16, BLOCK_16X16, + BLOCK_16X16, BLOCK_32X32, BLOCK_32X32, + BLOCK_32X32, BLOCK_64X64, BLOCK_64X64, + BLOCK_64X64, BLOCK_64X64, BLOCK_64X64, + BLOCK_64X64 }; // Look at all the mode_info entries for blocks that are part of this @@ -1540,9 +1544,11 @@ static void rd_auto_partition_range(VP9_COMP *cpi, const TileInfo *const tile, } } - // Give a bit of leaway either side of the observed min and max - *min_block_size = min_partition_size[*min_block_size]; - *max_block_size = max_partition_size[*max_block_size]; + // adjust observed min and max + if (cpi->sf.auto_min_max_partition_size == RELAXED_NEIGHBORING_MIN_MAX) { + *min_block_size = min_partition_size[*min_block_size]; + *max_block_size = max_partition_size[*max_block_size]; + } // Check border cases where max and min from neighbours may not be legal. *max_block_size = find_partition_size(*max_block_size, diff --git a/vp9/encoder/vp9_onyx_if.c b/vp9/encoder/vp9_onyx_if.c index 8f06af14b..4a0138eb2 100644 --- a/vp9/encoder/vp9_onyx_if.c +++ b/vp9/encoder/vp9_onyx_if.c @@ -839,6 +839,7 @@ static void set_rt_speed_feature(VP9_COMMON *cm, if (speed >= 5) { int i; sf->disable_split_mask = DISABLE_ALL_SPLIT; + sf->auto_min_max_partition_size = 2; sf->subpel_force_stop = 1; for (i = 0; i < TX_SIZES; i++) { sf->intra_y_mode_mask[i] = INTRA_DC_H_V; diff --git a/vp9/encoder/vp9_onyx_int.h b/vp9/encoder/vp9_onyx_int.h index 7a12f1262..ec00b3d91 100644 --- a/vp9/encoder/vp9_onyx_int.h +++ b/vp9/encoder/vp9_onyx_int.h @@ -189,6 +189,12 @@ typedef enum { USE_LARGESTALL } TX_SIZE_SEARCH_METHOD; +typedef enum { + NOT_IN_USE = 0, + RELAXED_NEIGHBORING_MIN_MAX = 1, + STRICT_NEIGHBORING_MIN_MAX = 2 +} AUTO_MIN_MAX_MODE; + typedef enum { // Values should be powers of 2 so that they can be selected as bits of // an integer flags field @@ -346,9 +352,8 @@ typedef struct { BLOCK_SIZE always_this_block_size; // Sets min and max partition sizes for this 64x64 region based on the - // same superblock in last encoded frame, and the left and above neighbor - // in this block. - int auto_min_max_partition_size; + // same 64x64 in last encoded frame, and the left and above neighbor. + AUTO_MIN_MAX_MODE auto_min_max_partition_size; // Min and max partition size we enable (block_size) as per auto // min max, but also used by adjust partitioning, and pick_partitioning. -- 2.40.0