@@ -789,6 +789,13 @@ Defines how many threads are used to process a filter pipeline. Each pipeline
will produce a thread pool with this many threads available for parallel processing.
The default is the number of available CPUs.
+@item -filter_jobs @var{nb_jobs} (@emph{global})
+Defines how many jobs are used to process a filter pipeline. Each filter's work
+may be split into up to this many tasks for parallel processing, which are then
+dispatched to the thread pool of size @var{nb_threads}.
+The default is the number of available CPUs, times a multiplier determined based on
+the detected CPU topology. For homogenous systems, this multiplier is 1.
+
@item -pre[:@var{stream_specifier}] @var{preset_name} (@emph{output,per-stream})
Specify the preset for matching stream(s).
@@ -1916,6 +1923,11 @@ Defines how many threads are used to process a filter_complex graph.
Similar to filter_threads but used for @code{-filter_complex} graphs only.
The default is the number of available CPUs.
+@item -filter_complex_jobs @var{nb_jobs} (@emph{global})
+Defines how many jobs are used to process a filter_complex graph.
+Similar to filter_jobs but used for @code{-filter_complex} graphs only.
+The default is the number of available CPUs times a topology multiplier.
+
@item -lavfi @var{filtergraph} (@emph{global})
Define a complex filtergraph, i.e. one with arbitrary number of inputs and/or
outputs. Equivalent to @option{-filter_complex}.
@@ -621,6 +621,7 @@ static void ffmpeg_cleanup(int ret)
}
av_freep(&vstats_filename);
av_freep(&filter_nbthreads);
+ av_freep(&filter_nbjobs);
av_freep(&input_streams);
av_freep(&input_files);
@@ -679,7 +679,9 @@ extern AVIOContext *progress_avio;
extern float max_error_rate;
extern char *filter_nbthreads;
+extern char *filter_nbjobs;
extern int filter_complex_nbthreads;
+extern int filter_complex_nbjobs;
extern int vstats_version;
extern int auto_conversion_filters;
@@ -998,6 +998,12 @@ int configure_filtergraph(FilterGraph *fg)
av_opt_set(fg->graph, "threads", e->value, 0);
}
+ if (filter_nbjobs) {
+ ret = av_opt_set(fg->graph, "jobs", filter_nbjobs, 0);
+ if (ret < 0)
+ goto fail;
+ }
+
args[0] = 0;
e = NULL;
while ((e = av_dict_get(ost->sws_dict, "", e,
@@ -1020,6 +1026,7 @@ int configure_filtergraph(FilterGraph *fg)
av_opt_set(fg->graph, "aresample_swr_opts", args, 0);
} else {
fg->graph->nb_threads = filter_complex_nbthreads;
+ fg->graph->nb_jobs = filter_complex_nbjobs;
}
if ((ret = avfilter_graph_parse2(fg->graph, graph_desc, &inputs, &outputs)) < 0)
@@ -175,7 +175,9 @@ int qp_hist = 0;
int stdin_interaction = 1;
float max_error_rate = 2.0/3;
char *filter_nbthreads;
+char *filter_nbjobs;
int filter_complex_nbthreads = 0;
+int filter_complex_nbjobs = 0;
int vstats_version = 2;
int auto_conversion_filters = 1;
int64_t stats_period = 500000;
@@ -352,6 +354,13 @@ static int opt_filter_threads(void *optctx, const char *opt, const char *arg)
return 0;
}
+static int opt_filter_jobs(void *optctx, const char *opt, const char *arg)
+{
+ av_free(filter_nbjobs);
+ filter_nbjobs = av_strdup(arg);
+ return 0;
+}
+
static int opt_abort_on(void *optctx, const char *opt, const char *arg)
{
static const AVOption opts[] = {
@@ -3961,6 +3970,8 @@ const OptionDef options[] = {
"set stream filtergraph", "filter_graph" },
{ "filter_threads", HAS_ARG, { .func_arg = opt_filter_threads },
"number of non-complex filter threads" },
+ { "filter_jobs", HAS_ARG, { .func_arg = opt_filter_jobs },
+ "number of non-complex filter jobs" },
{ "filter_script", HAS_ARG | OPT_STRING | OPT_SPEC | OPT_OUTPUT, { .off = OFFSET(filter_scripts) },
"read stream filtergraph description from a file", "filename" },
{ "reinit_filter", HAS_ARG | OPT_INT | OPT_SPEC | OPT_INPUT, { .off = OFFSET(reinit_filters) },
@@ -3969,6 +3980,8 @@ const OptionDef options[] = {
"create a complex filtergraph", "graph_description" },
{ "filter_complex_threads", HAS_ARG | OPT_INT, { &filter_complex_nbthreads },
"number of threads for -filter_complex" },
+ { "filter_complex_jobs", HAS_ARG | OPT_INT, { &filter_complex_nbjobs },
+ "number of jobs for -filter_complex" },
{ "lavfi", HAS_ARG | OPT_EXPERT, { .func_arg = opt_filter_complex },
"create a complex filtergraph", "graph_description" },
{ "filter_complex_script", HAS_ARG | OPT_EXPERT, { .func_arg = opt_filter_complex_script },