Add flag to disable transform ML speed features
This is analogous to:
https://aomedia-review.googlesource.com/c/aom/+/104141
The default value is set to 0.
Change-Id: I73369ffedb56a740b7970ce752d8091d14badc18
diff --git a/aom/aomcx.h b/aom/aomcx.h
index 4ba4248..80b0926 100644
--- a/aom/aomcx.h
+++ b/aom/aomcx.h
@@ -1207,6 +1207,13 @@
* 0 : off, 1 : on
*/
AV1E_SET_DISABLE_ML_PARTITION_SPEED_FEATURES = 157,
+
+ /*!\brief Codec control function to disable ML based transform search speed
+ * features.
+ *
+ * 0 : off, 1 : on
+ */
+ AV1E_SET_DISABLE_ML_TX_SPEED_FEATURES = 158,
};
/*!\brief aom 1-D scaling mode
@@ -1415,6 +1422,9 @@
AOM_CTRL_USE_TYPE(AV1E_SET_DISABLE_ML_PARTITION_SPEED_FEATURES, int)
#define AOM_CTRL_AV1E_SET_DISABLE_ML_PARTITION_SPEED_FEATURES
+AOM_CTRL_USE_TYPE(AV1E_SET_DISABLE_ML_TX_SPEED_FEATURES, int)
+#define AOM_CTRL_AV1E_SET_DISABLE_ML_TX_SPEED_FEATURES
+
AOM_CTRL_USE_TYPE(AV1E_SET_ENABLE_RECT_PARTITIONS, int)
#define AOM_CTRL_AV1E_SET_ENABLE_RECT_PARTITIONS
diff --git a/apps/aomenc.c b/apps/aomenc.c
index 4b295f4..beeb6e6 100644
--- a/apps/aomenc.c
+++ b/apps/aomenc.c
@@ -447,6 +447,10 @@
ARG_DEF(NULL, "disable-ml-partition-speed-features", 1,
"Disable ML partition speed features "
"(0: false (default), 1: true)");
+static const arg_def_t disable_ml_tx_speed_features =
+ ARG_DEF(NULL, "disable-ml-tx-speed-features", 1,
+ "Disable ML transform speed features "
+ "(0: false (default), 1: true)");
static const arg_def_t enable_rect_partitions =
ARG_DEF(NULL, "enable-rect-partitions", 1,
"Enable rectangular partitions "
@@ -850,6 +854,7 @@
&lossless,
&enable_cdef,
&enable_restoration,
+ &disable_ml_tx_speed_features,
&disable_ml_partition_speed_features,
&enable_rect_partitions,
&enable_ab_partitions,
@@ -962,6 +967,7 @@
AV1E_SET_LOSSLESS,
AV1E_SET_ENABLE_CDEF,
AV1E_SET_ENABLE_RESTORATION,
+ AV1E_SET_DISABLE_ML_TX_SPEED_FEATURES,
AV1E_SET_DISABLE_ML_PARTITION_SPEED_FEATURES,
AV1E_SET_ENABLE_RECT_PARTITIONS,
AV1E_SET_ENABLE_AB_PARTITIONS,
diff --git a/av1/av1_cx_iface.c b/av1/av1_cx_iface.c
index 983b49e..21169f5 100644
--- a/av1/av1_cx_iface.c
+++ b/av1/av1_cx_iface.c
@@ -95,6 +95,7 @@
const char *film_grain_table_filename;
unsigned int motion_vector_unit_test;
unsigned int cdf_update_mode;
+ int disable_ml_tx_speed_features;
int disable_ml_partition_speed_features;
int enable_rect_partitions; // enable rectangular partitions for sequence
int enable_ab_partitions; // enable AB partitions for sequence
@@ -222,6 +223,7 @@
0, // film_grain_table_filename
0, // motion_vector_unit_test
1, // CDF update mode
+ 0, // disable ML based transform speed up features
0, // disable ML based partition speed up features
1, // enable rectangular partitions
1, // enable ab shape partitions
@@ -947,6 +949,7 @@
oxcf->monochrome = cfg->monochrome;
oxcf->full_still_picture_hdr = cfg->full_still_picture_hdr;
oxcf->enable_dual_filter = extra_cfg->enable_dual_filter;
+ oxcf->disable_ml_tx_speed_features = extra_cfg->disable_ml_tx_speed_features;
oxcf->disable_ml_partition_speed_features =
#if CONFIG_EXT_RECUR_PARTITIONS
1;
@@ -1394,6 +1397,14 @@
return update_extra_cfg(ctx, &extra_cfg);
}
+static aom_codec_err_t ctrl_set_disable_ml_tx_speed_features(
+ aom_codec_alg_priv_t *ctx, va_list args) {
+ struct av1_extracfg extra_cfg = ctx->extra_cfg;
+ extra_cfg.disable_ml_tx_speed_features =
+ CAST(AV1E_SET_DISABLE_ML_TX_SPEED_FEATURES, args);
+ return update_extra_cfg(ctx, &extra_cfg);
+}
+
static aom_codec_err_t ctrl_set_disable_ml_partition_speed_features(
aom_codec_alg_priv_t *ctx, va_list args) {
struct av1_extracfg extra_cfg = ctx->extra_cfg;
@@ -2674,6 +2685,8 @@
{ AV1E_SET_FRAME_PARALLEL_DECODING, ctrl_set_frame_parallel_decoding_mode },
{ AV1E_SET_ERROR_RESILIENT_MODE, ctrl_set_error_resilient_mode },
{ AV1E_SET_S_FRAME_MODE, ctrl_set_s_frame_mode },
+ { AV1E_SET_DISABLE_ML_TX_SPEED_FEATURES,
+ ctrl_set_disable_ml_tx_speed_features },
{ AV1E_SET_DISABLE_ML_PARTITION_SPEED_FEATURES,
ctrl_set_disable_ml_partition_speed_features },
{ AV1E_SET_ENABLE_RECT_PARTITIONS, ctrl_set_enable_rect_partitions },
diff --git a/av1/encoder/encoder.h b/av1/encoder/encoder.h
index 19bdf0a..19174ee 100644
--- a/av1/encoder/encoder.h
+++ b/av1/encoder/encoder.h
@@ -368,6 +368,7 @@
int enable_dual_filter;
unsigned int motion_vector_unit_test;
unsigned int sb_multipass_unit_test;
+ int disable_ml_tx_speed_features;
int disable_ml_partition_speed_features;
int enable_rect_partitions;
int enable_ab_partitions;
diff --git a/av1/encoder/speed_features.c b/av1/encoder/speed_features.c
index d304532..0077a0f 100644
--- a/av1/encoder/speed_features.c
+++ b/av1/encoder/speed_features.c
@@ -711,6 +711,11 @@
}
}
+static void av1_disable_ml_based_tx_sf(SPEED_FEATURES *const sf) {
+ sf->tx_type_search.prune_mode = NO_PRUNE;
+ sf->tx_type_search.ml_tx_split_thresh = -1;
+}
+
static void av1_disable_ml_based_partition_sf(SPEED_FEATURES *const sf) {
sf->ml_prune_4_partition = 0;
sf->ml_prune_ab_partition = 0;
@@ -743,6 +748,7 @@
if (oxcf->disable_ml_partition_speed_features)
av1_disable_ml_based_partition_sf(sf);
+ if (oxcf->disable_ml_tx_speed_features) av1_disable_ml_based_tx_sf(sf);
}
void av1_set_speed_features_framesize_independent(AV1_COMP *cpi, int speed) {