Allow to set min_partition_size and max_partition_size min_partition_size and max_partition_size can be set by users. This CL enables they can also be set by speed features. Change-Id: I37082762568ee468e05ee3555bed0d85b9f88fea
diff --git a/av1/encoder/encodeframe.c b/av1/encoder/encodeframe.c index 0b62a12..5db694f 100644 --- a/av1/encoder/encodeframe.c +++ b/av1/encoder/encodeframe.c
@@ -4107,28 +4107,8 @@ #if CONFIG_COLLECT_COMPONENT_TIMING start_timing(cpi, rd_pick_partition_time); #endif - BLOCK_SIZE max_sq_size = BLOCK_128X128; - switch (cpi->oxcf.max_partition_size) { - case 4: max_sq_size = BLOCK_4X4; break; - case 8: max_sq_size = BLOCK_8X8; break; - case 16: max_sq_size = BLOCK_16X16; break; - case 32: max_sq_size = BLOCK_32X32; break; - case 64: max_sq_size = BLOCK_64X64; break; - case 128: max_sq_size = BLOCK_128X128; break; - default: assert(0); break; - } - max_sq_size = AOMMIN(max_sq_size, sb_size); - - BLOCK_SIZE min_sq_size = BLOCK_4X4; - switch (cpi->oxcf.min_partition_size) { - case 4: min_sq_size = BLOCK_4X4; break; - case 8: min_sq_size = BLOCK_8X8; break; - case 16: min_sq_size = BLOCK_16X16; break; - case 32: min_sq_size = BLOCK_32X32; break; - case 64: min_sq_size = BLOCK_64X64; break; - case 128: min_sq_size = BLOCK_128X128; break; - default: assert(0); break; - } + BLOCK_SIZE max_sq_size = x->max_partition_size; + BLOCK_SIZE min_sq_size = x->min_partition_size; if (use_auto_max_partition(cpi, sb_size, mi_row, mi_col)) { float features[FEATURE_SIZE_MAX_MIN_PART_PRED] = { 0.0f }; @@ -4585,8 +4565,6 @@ RD_COUNTS *const rdc = &cpi->td.rd_counts; int i; - x->min_partition_size = AOMMIN(x->min_partition_size, cm->seq_params.sb_size); - x->max_partition_size = AOMMIN(x->max_partition_size, cm->seq_params.sb_size); #if CONFIG_DIST_8X8 x->using_dist_8x8 = cpi->oxcf.using_dist_8x8; x->tune_metric = cpi->oxcf.tuning;
diff --git a/av1/encoder/speed_features.c b/av1/encoder/speed_features.c index b643fd5..d45bc41 100644 --- a/av1/encoder/speed_features.c +++ b/av1/encoder/speed_features.c
@@ -96,6 +96,18 @@ } } +static BLOCK_SIZE dim_to_size(int dim) { + switch (dim) { + case 4: return BLOCK_4X4; + case 8: return BLOCK_8X8; + case 16: return BLOCK_16X16; + case 32: return BLOCK_32X32; + case 64: return BLOCK_64X64; + case 128: return BLOCK_128X128; + default: assert(0); return 0; + } +} + static void set_good_speed_feature_framesize_dependent( const AV1_COMP *const cpi, SPEED_FEATURES *const sf, int speed) { const AV1_COMMON *const cm = &cpi->common; @@ -873,8 +885,12 @@ cpi->find_fractional_mv_step = av1_find_best_sub_pixel_tree_pruned_evenmore; } - x->min_partition_size = sf->default_min_partition_size; - x->max_partition_size = sf->default_max_partition_size; + x->min_partition_size = AOMMAX(sf->default_min_partition_size, + dim_to_size(cpi->oxcf.min_partition_size)); + x->max_partition_size = AOMMIN(sf->default_max_partition_size, + dim_to_size(cpi->oxcf.max_partition_size)); + x->min_partition_size = AOMMIN(x->min_partition_size, cm->seq_params.sb_size); + x->max_partition_size = AOMMIN(x->max_partition_size, cm->seq_params.sb_size); // This is only used in motion vector unit test. if (cpi->oxcf.motion_vector_unit_test == 1)
diff --git a/av1/encoder/speed_features.h b/av1/encoder/speed_features.h index c449c8d..d66db76 100644 --- a/av1/encoder/speed_features.h +++ b/av1/encoder/speed_features.h
@@ -410,7 +410,7 @@ // go down at least to the specified level. BLOCK_SIZE rd_auto_partition_min_limit; - // Min and max partition size we enable (block_size) as per auto + // Min and max square partition size we enable (block_size) as per auto // min max, but also used by adjust partitioning, and pick_partitioning. BLOCK_SIZE default_min_partition_size; BLOCK_SIZE default_max_partition_size;