Add a mechanism to provide preset config strings
If the --subgop-config-str parameter provided is one of
the known preset tags, the in-built preset config string
is used instead.
Therefore, --subgop-config-str=enh will automatically now
invoke the subgop_config_str_enh preset config string.
Change-Id: I3969ce66c9004820655749bd2ffeac7b662b948e
diff --git a/av1/av1_cx_iface.c b/av1/av1_cx_iface.c
index 3b1fc81..07723b9 100644
--- a/av1/av1_cx_iface.c
+++ b/av1/av1_cx_iface.c
@@ -237,6 +237,17 @@
"16:1:1V5/2V4/3V5/4V3/5V5/6V4/7V5/8V2/"
"9V5/10V4/11V5/12V3/13V5/14V1/15V5/16V5";
+typedef struct {
+ const char *preset_tag;
+ const char *preset_str;
+} subgop_config_str_preset_map_type;
+
+const subgop_config_str_preset_map_type subgop_config_str_preset_map[] = {
+ { "def", subgop_config_str_def }, { "enh", subgop_config_str_enh },
+ { "asym", subgop_config_str_enh }, { "ts", subgop_config_str_ts },
+ { "ld", subgop_config_str_ld },
+};
+
static struct av1_extracfg default_extra_cfg = {
0, // cpu_used
1, // enable_auto_alt_ref
@@ -1091,6 +1102,20 @@
oxcf->subgop_config_str = extra_cfg->subgop_config_str;
oxcf->subgop_config_path = extra_cfg->subgop_config_path;
+ // check if subgop_config_str is a preset tag
+ if (oxcf->subgop_config_str) {
+ int num_preset_configs = sizeof(subgop_config_str_preset_map) /
+ sizeof(*subgop_config_str_preset_map);
+ int p;
+ for (p = 0; p < num_preset_configs; ++p) {
+ if (!strcmp(oxcf->subgop_config_str,
+ subgop_config_str_preset_map[p].preset_tag)) {
+ oxcf->subgop_config_str = subgop_config_str_preset_map[p].preset_str;
+ break;
+ }
+ }
+ }
+
// Set tune related configuration.
tune_cfg->tuning = extra_cfg->tuning;
tune_cfg->vmaf_model_path = extra_cfg->vmaf_model_path;