| Index: source/libvpx/vp9/encoder/vp9_speed_features.c
|
| diff --git a/source/libvpx/vp9/encoder/vp9_speed_features.c b/source/libvpx/vp9/encoder/vp9_speed_features.c
|
| index 4b206ba7bd3e4446b476adafc1837863a0c92532..6c6c4ed302299414046f7d7c085e7eb0b037185a 100644
|
| --- a/source/libvpx/vp9/encoder/vp9_speed_features.c
|
| +++ b/source/libvpx/vp9/encoder/vp9_speed_features.c
|
| @@ -19,9 +19,33 @@ static int frame_is_boosted(const VP9_COMP *cpi) {
|
| return frame_is_kf_gf_arf(cpi) || vp9_is_upper_layer_key_frame(cpi);
|
| }
|
|
|
| -static void set_good_speed_feature_framesize_dependent(VP9_COMMON *cm,
|
| +// Sets a partition size down to which the auto partition code will always
|
| +// search (can go lower), based on the image dimensions. The logic here
|
| +// is that the extent to which ringing artefacts are offensive, depends
|
| +// partly on the screen area that over which they propogate. Propogation is
|
| +// limited by transform block size but the screen area take up by a given block
|
| +// size will be larger for a small image format stretched to full screen.
|
| +static BLOCK_SIZE set_partition_min_limit(VP9_COMMON *const cm) {
|
| + unsigned int screen_area = (cm->width * cm->height);
|
| +
|
| + // Select block size based on image format size.
|
| + if (screen_area < 1280 * 720) {
|
| + // Formats smaller in area than 720P
|
| + return BLOCK_4X4;
|
| + } else if (screen_area < 1920 * 1080) {
|
| + // Format >= 720P and < 1080P
|
| + return BLOCK_8X8;
|
| + } else {
|
| + // Formats 1080P and up
|
| + return BLOCK_16X16;
|
| + }
|
| +}
|
| +
|
| +static void set_good_speed_feature_framesize_dependent(VP9_COMP *cpi,
|
| SPEED_FEATURES *sf,
|
| int speed) {
|
| + VP9_COMMON *const cm = &cpi->common;
|
| +
|
| if (speed >= 1) {
|
| if (MIN(cm->width, cm->height) >= 720) {
|
| sf->disable_split_mask = cm->show_frame ? DISABLE_ALL_SPLIT
|
| @@ -45,6 +69,7 @@ static void set_good_speed_feature_framesize_dependent(VP9_COMMON *cm,
|
| sf->partition_search_breakout_dist_thr = (1 << 22);
|
| sf->partition_search_breakout_rate_thr = 100;
|
| }
|
| + sf->rd_auto_partition_min_limit = set_partition_min_limit(cm);
|
| }
|
|
|
| if (speed >= 3) {
|
| @@ -62,6 +87,13 @@ static void set_good_speed_feature_framesize_dependent(VP9_COMMON *cm,
|
| }
|
| }
|
|
|
| + // If this is a two pass clip that fits the criteria for animated or
|
| + // graphics content then reset disable_split_mask for speeds 1-4.
|
| + if ((speed >= 1) && (cpi->oxcf.pass == 2) &&
|
| + (cpi->twopass.fr_content_type == FC_GRAPHICS_ANIMATION)) {
|
| + sf->disable_split_mask = DISABLE_COMPOUND_SPLIT;
|
| + }
|
| +
|
| if (speed >= 4) {
|
| if (MIN(cm->width, cm->height) >= 720) {
|
| sf->partition_search_breakout_dist_thr = (1 << 26);
|
| @@ -72,29 +104,6 @@ static void set_good_speed_feature_framesize_dependent(VP9_COMMON *cm,
|
| }
|
| }
|
|
|
| -// Sets a partition size down to which the auto partition code will always
|
| -// search (can go lower), based on the image dimensions. The logic here
|
| -// is that the extent to which ringing artefacts are offensive, depends
|
| -// partly on the screen area that over which they propogate. Propogation is
|
| -// limited by transform block size but the screen area take up by a given block
|
| -// size will be larger for a small image format stretched to full screen.
|
| -static BLOCK_SIZE set_partition_min_limit(VP9_COMP *cpi) {
|
| - VP9_COMMON *const cm = &cpi->common;
|
| - unsigned int screen_area = (cm->width * cm->height);
|
| -
|
| - // Select block size based on image format size.
|
| - if (screen_area < 1280 * 720) {
|
| - // Formats smaller in area than 720P
|
| - return BLOCK_4X4;
|
| - } else if (screen_area < 1920 * 1080) {
|
| - // Format >= 720P and < 1080P
|
| - return BLOCK_8X8;
|
| - } else {
|
| - // Formats 1080P and up
|
| - return BLOCK_16X16;
|
| - }
|
| -}
|
| -
|
| static void set_good_speed_feature(VP9_COMP *cpi, VP9_COMMON *cm,
|
| SPEED_FEATURES *sf, int speed) {
|
| const int boosted = frame_is_boosted(cpi);
|
| @@ -139,7 +148,6 @@ static void set_good_speed_feature(VP9_COMP *cpi, VP9_COMMON *cm,
|
| sf->disable_filter_search_var_thresh = 100;
|
| sf->comp_inter_joint_search_thresh = BLOCK_SIZES;
|
| sf->auto_min_max_partition_size = RELAXED_NEIGHBORING_MIN_MAX;
|
| - sf->rd_auto_partition_min_limit = set_partition_min_limit(cpi);
|
| sf->allow_partition_search_skip = 1;
|
| }
|
|
|
| @@ -383,7 +391,6 @@ static void set_rt_speed_feature(VP9_COMP *cpi, SPEED_FEATURES *sf,
|
|
|
| void vp9_set_speed_features_framesize_dependent(VP9_COMP *cpi) {
|
| SPEED_FEATURES *const sf = &cpi->sf;
|
| - VP9_COMMON *const cm = &cpi->common;
|
| const VP9EncoderConfig *const oxcf = &cpi->oxcf;
|
| RD_OPT *const rd = &cpi->rd;
|
| int i;
|
| @@ -391,7 +398,7 @@ void vp9_set_speed_features_framesize_dependent(VP9_COMP *cpi) {
|
| if (oxcf->mode == REALTIME) {
|
| set_rt_speed_feature_framesize_dependent(cpi, sf, oxcf->speed);
|
| } else if (oxcf->mode == GOOD) {
|
| - set_good_speed_feature_framesize_dependent(cm, sf, oxcf->speed);
|
| + set_good_speed_feature_framesize_dependent(cpi, sf, oxcf->speed);
|
| }
|
|
|
| if (sf->disable_split_mask == DISABLE_ALL_SPLIT) {
|
|
|