Add the speed feature structure for codec dev
This commit re-structures the speed feature setup for the codec
development purpose. Instead of progressively reducing encoder
complexity at the expense of incremental coding loss, we allow a
separate set of speed features, each corresponds to a certain
category of coding units:
1 << 0: transform coding
1 << 1: inter prediction
1 << 2: intra prediction
1 << 3: block partition
1 << 4: loop filters
1 << 5: rd early skip
[6 - 7] are left open for next adjustment.
It is constructed to facilitate the codec development purpose.
When working on a coding functions, one could choose to turn on
one or more less related coding units to speed up the evaluation
process. For example, to test a transform related experiment, one
could set
--dev-sf=2, 6, or 22
which corresponds to turning on:
2 - inter prediction speed features,
6 - both inter / intra speed features,
22 - inter / intra, and loop filter features.
The goal is to allow faster experimental verification during the
development process. With the experiment in a stable state, we
can evaluate its performance in speed 0 at higher confidence level.
Change-Id: Ib46c7dea2d2a60204c399dc01f10262c976adf0d
diff --git a/av1/encoder/encoder.h b/av1/encoder/encoder.h
index e1ddd73..84dcb27 100644
--- a/av1/encoder/encoder.h
+++ b/av1/encoder/encoder.h
@@ -153,6 +153,7 @@
int noise_sensitivity; // pre processing blur: recommendation 0
int sharpness; // sharpening output: recommendation 0:
int speed;
+ int dev_sf;
// maximum allowed bitrate for any intra frame in % of bitrate target.
unsigned int rc_max_intra_bitrate_pct;
// maximum allowed bitrate for any inter frame in % of bitrate target.
diff --git a/av1/encoder/speed_features.c b/av1/encoder/speed_features.c
index 8833a7b..e81732c 100644
--- a/av1/encoder/speed_features.c
+++ b/av1/encoder/speed_features.c
@@ -363,6 +363,52 @@
cpi->find_fractional_mv_step = av1_return_min_sub_pixel_mv;
}
+static void set_dev_sf(AV1_COMP *cpi, SPEED_FEATURES *sf, int speed) {
+ AV1_COMMON *const cm = &cpi->common;
+
+ if (speed & TXFM_CODING_SF) {
+ sf->tx_size_search_init_depth_rect = 1;
+ sf->tx_size_search_init_depth_sqr = 1;
+ sf->tx_size_search_method = USE_FAST_RD;
+ sf->tx_type_search.fast_intra_tx_type_search = 1;
+ sf->tx_type_search.fast_inter_tx_type_search = 1;
+ }
+
+ if (speed & INTER_PRED_SF) {
+ sf->selective_ref_frame = 2;
+ sf->adaptive_motion_search = 1;
+ sf->mv.auto_mv_step_size = 1;
+ sf->adaptive_rd_thresh = 1;
+ sf->mv.subpel_iters_per_step = 1;
+ sf->adaptive_pred_interp_filter = 1;
+ }
+
+ if (speed & INTRA_PRED_SF) {
+ sf->max_intra_bsize = BLOCK_32X32;
+ }
+
+ if (speed & PARTITION_SF) {
+ if ((cpi->twopass.fr_content_type == FC_GRAPHICS_ANIMATION) ||
+ av1_internal_image_edge(cpi)) {
+ sf->use_square_partition_only = !frame_is_boosted(cpi);
+ } else {
+ sf->use_square_partition_only = !frame_is_intra_only(cm);
+ }
+ sf->less_rectangular_check = 1;
+#if CONFIG_EXT_PARTITION_TYPES
+ sf->prune_ext_partition_types_search = 1;
+#endif // CONFIG_EXT_PARTITION_TYPES
+ }
+
+ if (speed & LOOP_FILTER_SF) {
+ sf->fast_cdef_search = 1;
+ }
+
+ if (speed & RD_SKIP_SF) {
+ sf->use_rd_breakout = 1;
+ }
+}
+
void av1_set_speed_features_framesize_independent(AV1_COMP *cpi) {
AV1_COMMON *const cm = &cpi->common;
SPEED_FEATURES *const sf = &cpi->sf;
@@ -458,6 +504,8 @@
sf->gm_search_type = GM_FULL_SEARCH;
sf->use_fast_interpolation_filter_search = 0;
+ set_dev_sf(cpi, sf, oxcf->dev_sf);
+
if (oxcf->mode == GOOD
#if CONFIG_XIPHRC
|| oxcf->pass == 1
diff --git a/av1/encoder/speed_features.h b/av1/encoder/speed_features.h
index fedefaa..9f0a7a1 100644
--- a/av1/encoder/speed_features.h
+++ b/av1/encoder/speed_features.h
@@ -95,6 +95,17 @@
};
typedef enum {
+ TXFM_CODING_SF = 1,
+ INTER_PRED_SF = 2,
+ INTRA_PRED_SF = 4,
+ PARTITION_SF = 8,
+ LOOP_FILTER_SF = 16,
+ RD_SKIP_SF = 32,
+ RESERVE_2_SF = 64,
+ RESERVE_3_SF = 128,
+} DEV_SPEED_FEATURES;
+
+typedef enum {
DIAMOND = 0,
NSTEP = 1,
HEX = 2,