Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
 help / color / mirror / Atom feed
* [FFmpeg-devel] [PATCH] lavfi: make job count configurable separately from thread count
@ 2022-09-20 17:50 rcombs
  2022-09-20 17:50 ` [FFmpeg-devel] [PATCH 1/7] lavu/cpu: add av_cpu_job_count() rcombs
                   ` (6 more replies)
  0 siblings, 7 replies; 13+ messages in thread
From: rcombs @ 2022-09-20 17:50 UTC (permalink / raw)
  To: ffmpeg-devel

Slicing frames into a larger number of jobs can improve performance significantly on asymmetric-multiprocessing systems.
On my M1 Max, performance on the two filters transitioned to the new model in this patchset (vf_scale and vf_unsharp, chosen somewhat arbitrarily as reasonable test cases) improved by roughly 15%.


_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [FFmpeg-devel] [PATCH 1/7] lavu/cpu: add av_cpu_job_count()
  2022-09-20 17:50 [FFmpeg-devel] [PATCH] lavfi: make job count configurable separately from thread count rcombs
@ 2022-09-20 17:50 ` rcombs
  2022-09-22 13:49   ` Anton Khirnov
  2022-09-20 17:50 ` [FFmpeg-devel] [PATCH 2/7] sws: add jobs option, distinct from threads rcombs
                   ` (5 subsequent siblings)
  6 siblings, 1 reply; 13+ messages in thread
From: rcombs @ 2022-09-20 17:50 UTC (permalink / raw)
  To: ffmpeg-devel

This estimates an appropriate number of jobs for a task to be broken up into.
This may be higher than the core count in a heterogeneous system.

Currently implemented only on Apple platforms; otherwise, we assume homogeneity.
---
 doc/APIchanges      |  3 +++
 libavutil/cpu.c     | 37 +++++++++++++++++++++++++++++++++++++
 libavutil/cpu.h     | 11 +++++++++++
 libavutil/version.h |  4 ++--
 4 files changed, 53 insertions(+), 2 deletions(-)

diff --git a/doc/APIchanges b/doc/APIchanges
index 729f56be7b..6059b495dd 100644
--- a/doc/APIchanges
+++ b/doc/APIchanges
@@ -14,6 +14,9 @@ libavutil:     2021-04-27
 
 API changes, most recent first:
 
+2022-09-20 - xxxxxxxxxx - lavu 57.37.100 - cpu.h
+  Add av_cpu_job_count() and av_cpu_force_job_count().
+
 2022-09-03 - xxxxxxxxxx - lavu 57.36.100 - pixfmt.h
   Add AV_PIX_FMT_P012, AV_PIX_FMT_Y212, AV_PIX_FMT_XV30, AV_PIX_FMT_XV36
 
diff --git a/libavutil/cpu.c b/libavutil/cpu.c
index 0035e927a5..b846a4a2d5 100644
--- a/libavutil/cpu.c
+++ b/libavutil/cpu.c
@@ -51,6 +51,7 @@
 
 static atomic_int cpu_flags = ATOMIC_VAR_INIT(-1);
 static atomic_int cpu_count = ATOMIC_VAR_INIT(-1);
+static atomic_int job_count = ATOMIC_VAR_INIT(-1);
 
 static int get_cpu_flags(void)
 {
@@ -251,6 +252,42 @@ void av_cpu_force_count(int count)
     atomic_store_explicit(&cpu_count, count, memory_order_relaxed);
 }
 
+int av_cpu_job_count(void)
+{
+    static atomic_int printed = ATOMIC_VAR_INIT(0);
+    int loaded = 0;
+
+    int jobs = av_cpu_count();
+
+#if __APPLE__
+    int nperflevels = 1;
+    size_t len = sizeof(nperflevels);
+
+    if (sysctlbyname("hw.nperflevels", &nperflevels, &len, NULL, 0) == -1)
+        nperflevels = 1;
+
+    if (nperflevels > 1)
+        jobs *= 3;
+#endif
+
+    if (!atomic_exchange_explicit(&printed, 1, memory_order_relaxed))
+        av_log(NULL, AV_LOG_DEBUG, "computed default job factor of %d\n", jobs);
+
+    loaded = atomic_load_explicit(&job_count, memory_order_relaxed);
+
+    if (loaded > 0) {
+        jobs = loaded;
+        av_log(NULL, AV_LOG_DEBUG, "overriding to job factor of %d\n", jobs);
+    }
+
+    return jobs;
+}
+
+void av_cpu_force_job_count(int factor)
+{
+    atomic_store_explicit(&job_count, factor, memory_order_relaxed);
+}
+
 size_t av_cpu_max_align(void)
 {
 #if ARCH_MIPS
diff --git a/libavutil/cpu.h b/libavutil/cpu.h
index 9711e574c5..20f037afe1 100644
--- a/libavutil/cpu.h
+++ b/libavutil/cpu.h
@@ -110,6 +110,17 @@ int av_cpu_count(void);
  */
 void av_cpu_force_count(int count);
 
+/**
+ * @return an estimated optimal maximum number of jobs for tasks to be sliced into.
+ */
+int av_cpu_job_count(void);
+
+/**
+ * Overrides job count computation and forces the specified count.
+ * Count < 1 disables forcing of specific count.
+ */
+void av_cpu_force_job_count(int count);
+
 /**
  * Get the maximum data alignment that may be required by FFmpeg.
  *
diff --git a/libavutil/version.h b/libavutil/version.h
index 0585fa7b80..9c44cef6aa 100644
--- a/libavutil/version.h
+++ b/libavutil/version.h
@@ -79,8 +79,8 @@
  */
 
 #define LIBAVUTIL_VERSION_MAJOR  57
-#define LIBAVUTIL_VERSION_MINOR  36
-#define LIBAVUTIL_VERSION_MICRO 102
+#define LIBAVUTIL_VERSION_MINOR  37
+#define LIBAVUTIL_VERSION_MICRO 100
 
 #define LIBAVUTIL_VERSION_INT   AV_VERSION_INT(LIBAVUTIL_VERSION_MAJOR, \
                                                LIBAVUTIL_VERSION_MINOR, \
-- 
2.37.2

_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [FFmpeg-devel] [PATCH 2/7] sws: add jobs option, distinct from threads
  2022-09-20 17:50 [FFmpeg-devel] [PATCH] lavfi: make job count configurable separately from thread count rcombs
  2022-09-20 17:50 ` [FFmpeg-devel] [PATCH 1/7] lavu/cpu: add av_cpu_job_count() rcombs
@ 2022-09-20 17:50 ` rcombs
  2022-09-21  8:37   ` Michael Niedermayer
  2022-09-21 18:25   ` James Almer
  2022-09-20 17:50 ` [FFmpeg-devel] [PATCH 3/7] lavfi: add jobs args rcombs
                   ` (4 subsequent siblings)
  6 siblings, 2 replies; 13+ messages in thread
From: rcombs @ 2022-09-20 17:50 UTC (permalink / raw)
  To: ffmpeg-devel

This allows for more efficient use of asymmetric-multiprocessing systems.
---
 libswscale/options.c          | 2 ++
 libswscale/swscale_internal.h | 1 +
 libswscale/utils.c            | 9 ++++++---
 libswscale/version.h          | 2 +-
 4 files changed, 10 insertions(+), 4 deletions(-)

diff --git a/libswscale/options.c b/libswscale/options.c
index 4d41b835b1..5765daa100 100644
--- a/libswscale/options.c
+++ b/libswscale/options.c
@@ -81,6 +81,8 @@ static const AVOption swscale_options[] = {
 
     { "threads",         "number of threads",             OFFSET(nb_threads),   AV_OPT_TYPE_INT, {.i64 = 1 }, 0, INT_MAX, VE, "threads" },
         { "auto",        NULL,                            0,                  AV_OPT_TYPE_CONST, {.i64 = 0 },    .flags = VE, "threads" },
+    { "jobs",            "number of jobs",                OFFSET(nb_jobs),      AV_OPT_TYPE_INT, {.i64 = 0 }, 0, INT_MAX, VE, "jobs" },
+        { "auto",        NULL,                            0,                  AV_OPT_TYPE_CONST, {.i64 = 0 },    .flags = VE, "jobs" },
 
     { NULL }
 };
diff --git a/libswscale/swscale_internal.h b/libswscale/swscale_internal.h
index abeebbb002..602082e12c 100644
--- a/libswscale/swscale_internal.h
+++ b/libswscale/swscale_internal.h
@@ -339,6 +339,7 @@ typedef struct SwsContext {
     int vChrDrop;                 ///< Binary logarithm of extra vertical subsampling factor in source image chroma planes specified by user.
     int sliceDir;                 ///< Direction that slices are fed to the scaler (1 = top-to-bottom, -1 = bottom-to-top).
     int nb_threads;               ///< Number of threads used for scaling
+    int nb_jobs;                  ///< Number of slice jobs used for scaling
     double param[2];              ///< Input parameters for scaling algorithms that need them.
 
     AVFrame *frame_src;
diff --git a/libswscale/utils.c b/libswscale/utils.c
index 45baa22b23..c9ff9db957 100644
--- a/libswscale/utils.c
+++ b/libswscale/utils.c
@@ -1277,18 +1277,21 @@ static int context_init_threaded(SwsContext *c,
                                     ff_sws_slice_worker, NULL, c->nb_threads);
     if (ret == AVERROR(ENOSYS)) {
         c->nb_threads = 1;
+        c->nb_jobs = 1;
         return 0;
     } else if (ret < 0)
         return ret;
 
     c->nb_threads = ret;
+    if (c->nb_jobs < 1)
+        c->nb_jobs = av_cpu_job_count();
 
-    c->slice_ctx = av_calloc(c->nb_threads, sizeof(*c->slice_ctx));
-    c->slice_err = av_calloc(c->nb_threads, sizeof(*c->slice_err));
+    c->slice_ctx = av_calloc(c->nb_jobs, sizeof(*c->slice_ctx));
+    c->slice_err = av_calloc(c->nb_jobs, sizeof(*c->slice_err));
     if (!c->slice_ctx || !c->slice_err)
         return AVERROR(ENOMEM);
 
-    for (int i = 0; i < c->nb_threads; i++) {
+    for (int i = 0; i < c->nb_jobs; i++) {
         c->slice_ctx[i] = sws_alloc_context();
         if (!c->slice_ctx[i])
             return AVERROR(ENOMEM);
diff --git a/libswscale/version.h b/libswscale/version.h
index 9bb3b171a7..4529a2d7d4 100644
--- a/libswscale/version.h
+++ b/libswscale/version.h
@@ -29,7 +29,7 @@
 #include "version_major.h"
 
 #define LIBSWSCALE_VERSION_MINOR   8
-#define LIBSWSCALE_VERSION_MICRO 112
+#define LIBSWSCALE_VERSION_MICRO 113
 
 #define LIBSWSCALE_VERSION_INT  AV_VERSION_INT(LIBSWSCALE_VERSION_MAJOR, \
                                                LIBSWSCALE_VERSION_MINOR, \
-- 
2.37.2

_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [FFmpeg-devel] [PATCH 3/7] lavfi: add jobs args
  2022-09-20 17:50 [FFmpeg-devel] [PATCH] lavfi: make job count configurable separately from thread count rcombs
  2022-09-20 17:50 ` [FFmpeg-devel] [PATCH 1/7] lavu/cpu: add av_cpu_job_count() rcombs
  2022-09-20 17:50 ` [FFmpeg-devel] [PATCH 2/7] sws: add jobs option, distinct from threads rcombs
@ 2022-09-20 17:50 ` rcombs
  2022-09-20 17:50 ` [FFmpeg-devel] [PATCH 4/7] ffmpeg: add filter_jobs and filter_complex_jobs args rcombs
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 13+ messages in thread
From: rcombs @ 2022-09-20 17:50 UTC (permalink / raw)
  To: ffmpeg-devel

This allows tuning the number of tasks that frames are sliced into
independently from the number of execution pool threads, which can improve
performance significantly on asymmetric-multiprocessing systems.
---
 doc/APIchanges              |  3 +++
 libavfilter/avfilter.c      |  9 +++++++++
 libavfilter/avfilter.h      | 14 ++++++++++++++
 libavfilter/avfiltergraph.c |  4 ++++
 libavfilter/internal.h      |  6 ++++++
 libavfilter/pthread.c       |  5 +++++
 libavfilter/version.h       |  2 +-
 7 files changed, 42 insertions(+), 1 deletion(-)

diff --git a/doc/APIchanges b/doc/APIchanges
index 6059b495dd..ae8b0bf0b4 100644
--- a/doc/APIchanges
+++ b/doc/APIchanges
@@ -14,6 +14,9 @@ libavutil:     2021-04-27
 
 API changes, most recent first:
 
+2022-09-20 - xxxxxxxxxx - lavfi 8.50.100 - avfilter.h
+  Add AVFilterContext.nb_jobs and AVFilterGraph.nb_jobs.
+
 2022-09-20 - xxxxxxxxxx - lavu 57.37.100 - cpu.h
   Add av_cpu_job_count() and av_cpu_force_job_count().
 
diff --git a/libavfilter/avfilter.c b/libavfilter/avfilter.c
index f34204e650..4e16e312c6 100644
--- a/libavfilter/avfilter.c
+++ b/libavfilter/avfilter.c
@@ -621,6 +621,8 @@ static const AVOption avfilter_options[] = {
     { "enable", "set enable expression", OFFSET(enable_str), AV_OPT_TYPE_STRING, {.str=NULL}, .flags = TFLAGS },
     { "threads", "Allowed number of threads", OFFSET(nb_threads), AV_OPT_TYPE_INT,
         { .i64 = 0 }, 0, INT_MAX, FLAGS },
+    { "jobs", "Allowed number of jobs", OFFSET(nb_jobs), AV_OPT_TYPE_INT,
+        { .i64 = 0 }, 0, INT_MAX, FLAGS },
     { "extra_hw_frames", "Number of extra hardware frames to allocate for the user",
         OFFSET(extra_hw_frames), AV_OPT_TYPE_INT, { .i64 = -1 }, -1, INT_MAX, FLAGS },
     { NULL },
@@ -797,6 +799,13 @@ int ff_filter_get_nb_threads(AVFilterContext *ctx)
     return ctx->graph->nb_threads;
 }
 
+int ff_filter_get_nb_jobs(AVFilterContext *ctx)
+{
+    if (ctx->nb_jobs > 0)
+        return FFMIN(ctx->nb_jobs, ctx->graph->nb_jobs);
+    return ctx->graph->nb_jobs;
+}
+
 static int process_options(AVFilterContext *ctx, AVDictionary **options,
                            const char *args)
 {
diff --git a/libavfilter/avfilter.h b/libavfilter/avfilter.h
index 2e8197c9a6..aadeadd41c 100644
--- a/libavfilter/avfilter.h
+++ b/libavfilter/avfilter.h
@@ -492,6 +492,13 @@ struct AVFilterContext {
      * configured.
      */
     int extra_hw_frames;
+
+    /**
+     * Max number of jobs allowed in this filter instance.
+     * If <= 0, its value is ignored.
+     * Overrides global number of jobs set per filter graph.
+     */
+    int nb_jobs;
 };
 
 /**
@@ -935,6 +942,13 @@ typedef struct AVFilterGraph {
     int sink_links_count;
 
     unsigned disable_auto_convert;
+
+    /**
+     * Maximum number of jobs used by filters in this graph. May be set by
+     * the caller before adding any filters to the filtergraph. Zero (the
+     * default) means that the number of jobs is determined automatically.
+     */
+    int nb_jobs;
 } AVFilterGraph;
 
 /**
diff --git a/libavfilter/avfiltergraph.c b/libavfilter/avfiltergraph.c
index 53f468494d..4aac62c6c3 100644
--- a/libavfilter/avfiltergraph.c
+++ b/libavfilter/avfiltergraph.c
@@ -51,6 +51,9 @@ static const AVOption filtergraph_options[] = {
     { "threads",     "Maximum number of threads", OFFSET(nb_threads), AV_OPT_TYPE_INT,
         { .i64 = 0 }, 0, INT_MAX, F|V|A, "threads"},
         {"auto", "autodetect a suitable number of threads to use", 0, AV_OPT_TYPE_CONST, {.i64 = 0 }, .flags = F|V|A, .unit = "threads"},
+    { "jobs",        "Maximum number of jobs", OFFSET(nb_jobs), AV_OPT_TYPE_INT,
+        { .i64 = 0 }, 0, INT_MAX, F|V|A, "jobs"},
+        {"auto", "autodetect a suitable number of jobs to use", 0, AV_OPT_TYPE_CONST, {.i64 = 0 }, .flags = F|V|A, .unit = "jobs"},
     {"scale_sws_opts"       , "default scale filter options"        , OFFSET(scale_sws_opts)        ,
         AV_OPT_TYPE_STRING, {.str = NULL}, 0, 0, F|V },
     {"aresample_swr_opts"   , "default aresample filter options"    , OFFSET(aresample_swr_opts)    ,
@@ -75,6 +78,7 @@ int ff_graph_thread_init(AVFilterGraph *graph)
 {
     graph->thread_type = 0;
     graph->nb_threads  = 1;
+    graph->nb_jobs     = 1;
     return 0;
 }
 #endif
diff --git a/libavfilter/internal.h b/libavfilter/internal.h
index 0128820be0..be05e8550b 100644
--- a/libavfilter/internal.h
+++ b/libavfilter/internal.h
@@ -384,6 +384,12 @@ int ff_filter_graph_run_once(AVFilterGraph *graph);
  */
 int ff_filter_get_nb_threads(AVFilterContext *ctx) av_pure;
 
+/**
+ * Get number of jobs for current filter instance.
+ * This number is always same or less than graph->nb_jobs.
+ */
+int ff_filter_get_nb_jobs(AVFilterContext *ctx) av_pure;
+
 /**
  * Generic processing of user supplied commands that are set
  * in the same way as the filter options.
diff --git a/libavfilter/pthread.c b/libavfilter/pthread.c
index 1a063d3cc0..589e32e263 100644
--- a/libavfilter/pthread.c
+++ b/libavfilter/pthread.c
@@ -23,6 +23,7 @@
 
 #include <stddef.h>
 
+#include "libavutil/cpu.h"
 #include "libavutil/error.h"
 #include "libavutil/macros.h"
 #include "libavutil/mem.h"
@@ -98,10 +99,14 @@ int ff_graph_thread_init(AVFilterGraph *graph)
         av_freep(&graph->internal->thread);
         graph->thread_type = 0;
         graph->nb_threads  = 1;
+        graph->nb_jobs     = 1;
         return (ret < 0) ? ret : 0;
     }
     graph->nb_threads = ret;
 
+    if (graph->nb_jobs < 1)
+        graph->nb_jobs = av_cpu_job_count();
+
     graph->internal->thread_execute = thread_execute;
 
     return 0;
diff --git a/libavfilter/version.h b/libavfilter/version.h
index 5aac9c513a..436c2b8b17 100644
--- a/libavfilter/version.h
+++ b/libavfilter/version.h
@@ -31,7 +31,7 @@
 
 #include "version_major.h"
 
-#define LIBAVFILTER_VERSION_MINOR  49
+#define LIBAVFILTER_VERSION_MINOR  50
 #define LIBAVFILTER_VERSION_MICRO 100
 
 
-- 
2.37.2

_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [FFmpeg-devel] [PATCH 4/7] ffmpeg: add filter_jobs and filter_complex_jobs args
  2022-09-20 17:50 [FFmpeg-devel] [PATCH] lavfi: make job count configurable separately from thread count rcombs
                   ` (2 preceding siblings ...)
  2022-09-20 17:50 ` [FFmpeg-devel] [PATCH 3/7] lavfi: add jobs args rcombs
@ 2022-09-20 17:50 ` rcombs
  2022-09-20 17:50 ` [FFmpeg-devel] [PATCH 5/7] ffplay: add filter_jobs arg rcombs
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 13+ messages in thread
From: rcombs @ 2022-09-20 17:50 UTC (permalink / raw)
  To: ffmpeg-devel

These are similar to filter_threads and filter_complex_threads,
but control job count.
---
 doc/ffmpeg.texi         | 12 ++++++++++++
 fftools/ffmpeg.c        |  1 +
 fftools/ffmpeg.h        |  2 ++
 fftools/ffmpeg_filter.c |  7 +++++++
 fftools/ffmpeg_opt.c    | 13 +++++++++++++
 5 files changed, 35 insertions(+)

diff --git a/doc/ffmpeg.texi b/doc/ffmpeg.texi
index 42440d93b4..6b8248df3b 100644
--- a/doc/ffmpeg.texi
+++ b/doc/ffmpeg.texi
@@ -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}.
diff --git a/fftools/ffmpeg.c b/fftools/ffmpeg.c
index 0e1477299d..9ff48141cd 100644
--- a/fftools/ffmpeg.c
+++ b/fftools/ffmpeg.c
@@ -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);
diff --git a/fftools/ffmpeg.h b/fftools/ffmpeg.h
index ede0b2bd96..89ee9caca7 100644
--- a/fftools/ffmpeg.h
+++ b/fftools/ffmpeg.h
@@ -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;
 
diff --git a/fftools/ffmpeg_filter.c b/fftools/ffmpeg_filter.c
index 7a5308425d..34e0fce7ab 100644
--- a/fftools/ffmpeg_filter.c
+++ b/fftools/ffmpeg_filter.c
@@ -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)
diff --git a/fftools/ffmpeg_opt.c b/fftools/ffmpeg_opt.c
index 5febe319e4..196064d1b9 100644
--- a/fftools/ffmpeg_opt.c
+++ b/fftools/ffmpeg_opt.c
@@ -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 },
-- 
2.37.2

_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [FFmpeg-devel] [PATCH 5/7] ffplay: add filter_jobs arg
  2022-09-20 17:50 [FFmpeg-devel] [PATCH] lavfi: make job count configurable separately from thread count rcombs
                   ` (3 preceding siblings ...)
  2022-09-20 17:50 ` [FFmpeg-devel] [PATCH 4/7] ffmpeg: add filter_jobs and filter_complex_jobs args rcombs
@ 2022-09-20 17:50 ` rcombs
  2022-09-20 17:50 ` [FFmpeg-devel] [PATCH 6/7] lavfi/vf_unsharp: use ff_filter_get_nb_jobs rcombs
  2022-09-20 17:50 ` [FFmpeg-devel] [PATCH 7/7] lavfi/vf_scale: set sws job count using ff_filter_get_nb_jobs rcombs
  6 siblings, 0 replies; 13+ messages in thread
From: rcombs @ 2022-09-20 17:50 UTC (permalink / raw)
  To: ffmpeg-devel

This is similar to filter_threads, but controls job count.
---
 doc/ffplay.texi  | 5 +++++
 fftools/ffplay.c | 4 ++++
 2 files changed, 9 insertions(+)

diff --git a/doc/ffplay.texi b/doc/ffplay.texi
index 5dd860b846..abc857013f 100644
--- a/doc/ffplay.texi
+++ b/doc/ffplay.texi
@@ -196,6 +196,11 @@ will produce a thread pool with this many threads available for parallel
 processing. The default is 0 which means that the thread count will be
 determined by the number of available CPUs.
 
+@item -filter_jobs @var{nb_jobs}
+Defines how many distinct jobs a filter pipeline will break frames into.
+The default is 0 which means that the thread count will be determined
+by the CPU topology.
+
 @end table
 
 @section While playing
diff --git a/fftools/ffplay.c b/fftools/ffplay.c
index bcc00afe31..bce1d20c49 100644
--- a/fftools/ffplay.c
+++ b/fftools/ffplay.c
@@ -355,6 +355,7 @@ static char *afilters = NULL;
 static int autorotate = 1;
 static int find_stream_info = 1;
 static int filter_nbthreads = 0;
+static int filter_nbjobs = 0;
 
 /* current context */
 static int is_full_screen;
@@ -1963,6 +1964,7 @@ static int configure_audio_filters(VideoState *is, const char *afilters, int for
     if (!(is->agraph = avfilter_graph_alloc()))
         return AVERROR(ENOMEM);
     is->agraph->nb_threads = filter_nbthreads;
+    is->agraph->nb_jobs = filter_nbjobs;
 
     av_bprint_init(&bp, 0, AV_BPRINT_SIZE_AUTOMATIC);
 
@@ -2168,6 +2170,7 @@ static int video_thread(void *arg)
                 goto the_end;
             }
             graph->nb_threads = filter_nbthreads;
+            graph->nb_jobs = filter_nbjobs;
             if ((ret = configure_video_filters(graph, is, vfilters_list ? vfilters_list[is->vfilter_idx] : NULL, frame)) < 0) {
                 SDL_Event event;
                 event.type = FF_QUIT_EVENT;
@@ -3615,6 +3618,7 @@ static const OptionDef options[] = {
     { "find_stream_info", OPT_BOOL | OPT_INPUT | OPT_EXPERT, { &find_stream_info },
         "read and decode the streams to fill missing information with heuristics" },
     { "filter_threads", HAS_ARG | OPT_INT | OPT_EXPERT, { &filter_nbthreads }, "number of filter threads per graph" },
+    { "filter_jobs", HAS_ARG | OPT_INT | OPT_EXPERT, { &filter_nbjobs }, "number of filter jobs per graph" },
     { NULL, },
 };
 
-- 
2.37.2

_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [FFmpeg-devel] [PATCH 6/7] lavfi/vf_unsharp: use ff_filter_get_nb_jobs
  2022-09-20 17:50 [FFmpeg-devel] [PATCH] lavfi: make job count configurable separately from thread count rcombs
                   ` (4 preceding siblings ...)
  2022-09-20 17:50 ` [FFmpeg-devel] [PATCH 5/7] ffplay: add filter_jobs arg rcombs
@ 2022-09-20 17:50 ` rcombs
  2022-09-20 17:50 ` [FFmpeg-devel] [PATCH 7/7] lavfi/vf_scale: set sws job count using ff_filter_get_nb_jobs rcombs
  6 siblings, 0 replies; 13+ messages in thread
From: rcombs @ 2022-09-20 17:50 UTC (permalink / raw)
  To: ffmpeg-devel

Improves performance by roughly 15% on M1 Max
---
 libavfilter/unsharp.h    |  2 +-
 libavfilter/vf_unsharp.c | 20 ++++++++++----------
 2 files changed, 11 insertions(+), 11 deletions(-)

diff --git a/libavfilter/unsharp.h b/libavfilter/unsharp.h
index 0da6f05036..7af32b0467 100644
--- a/libavfilter/unsharp.h
+++ b/libavfilter/unsharp.h
@@ -54,7 +54,7 @@ typedef struct UnsharpContext {
     int nb_planes;
     int bitdepth;
     int bps;
-    int nb_threads;
+    int nb_jobs;
     int (* apply_unsharp)(AVFilterContext *ctx, AVFrame *in, AVFrame *out);
     int (* unsharp_slice)(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs);
 } UnsharpContext;
diff --git a/libavfilter/vf_unsharp.c b/libavfilter/vf_unsharp.c
index e88e732c9e..9632058daf 100644
--- a/libavfilter/vf_unsharp.c
+++ b/libavfilter/vf_unsharp.c
@@ -166,7 +166,7 @@ static int apply_unsharp_c(AVFilterContext *ctx, AVFrame *in, AVFrame *out)
         td.dst_stride = out->linesize[i];
         td.src_stride = in->linesize[i];
         ff_filter_execute(ctx, s->unsharp_slice, &td, NULL,
-                          FFMIN(plane_h[i], s->nb_threads));
+                          FFMIN(plane_h[i], s->nb_jobs));
     }
     return 0;
 }
@@ -229,12 +229,12 @@ static int init_filter_param(AVFilterContext *ctx, UnsharpFilterParam *fp, const
     av_log(ctx, AV_LOG_VERBOSE, "effect:%s type:%s msize_x:%d msize_y:%d amount:%0.2f\n",
            effect, effect_type, fp->msize_x, fp->msize_y, fp->amount / 65535.0);
 
-    fp->sr = av_malloc_array((MAX_MATRIX_SIZE - 1) * s->nb_threads, sizeof(uint32_t));
-    fp->sc = av_calloc(fp->steps_y * s->nb_threads, 2 * sizeof(*fp->sc));
+    fp->sr = av_malloc_array((MAX_MATRIX_SIZE - 1) * s->nb_jobs, sizeof(uint32_t));
+    fp->sc = av_calloc(fp->steps_y * s->nb_jobs, 2 * sizeof(*fp->sc));
     if (!fp->sr || !fp->sc)
         return AVERROR(ENOMEM);
 
-    for (z = 0; z < 2 * fp->steps_y * s->nb_threads; z++)
+    for (z = 0; z < 2 * fp->steps_y * s->nb_jobs; z++)
         if (!(fp->sc[z] = av_malloc_array(width + 2 * fp->steps_x,
                                           sizeof(*(fp->sc[z])))))
             return AVERROR(ENOMEM);
@@ -255,9 +255,9 @@ static int config_input(AVFilterLink *inlink)
     s->bps = s->bitdepth > 8 ? 2 : 1;
     s->unsharp_slice = s->bitdepth > 8 ? unsharp_slice_16 : unsharp_slice_8;
 
-    // ensure (height / nb_threads) > 4 * steps_y,
+    // ensure (height / nb_jobs) > 4 * steps_y,
     // so that we don't have too much overlap between two threads
-    s->nb_threads = FFMIN(ff_filter_get_nb_threads(inlink->dst),
+    s->nb_jobs = FFMIN(ff_filter_get_nb_jobs(inlink->dst),
                           inlink->h / (4 * s->luma.steps_y));
 
     ret = init_filter_param(inlink->dst, &s->luma,   "luma",   inlink->w);
@@ -270,12 +270,12 @@ static int config_input(AVFilterLink *inlink)
     return 0;
 }
 
-static void free_filter_param(UnsharpFilterParam *fp, int nb_threads)
+static void free_filter_param(UnsharpFilterParam *fp, int nb_jobs)
 {
     int z;
 
     if (fp->sc) {
-        for (z = 0; z < 2 * fp->steps_y * nb_threads; z++)
+        for (z = 0; z < 2 * fp->steps_y * nb_jobs; z++)
             av_freep(&fp->sc[z]);
         av_freep(&fp->sc);
     }
@@ -286,8 +286,8 @@ static av_cold void uninit(AVFilterContext *ctx)
 {
     UnsharpContext *s = ctx->priv;
 
-    free_filter_param(&s->luma, s->nb_threads);
-    free_filter_param(&s->chroma, s->nb_threads);
+    free_filter_param(&s->luma, s->nb_jobs);
+    free_filter_param(&s->chroma, s->nb_jobs);
 }
 
 static int filter_frame(AVFilterLink *link, AVFrame *in)
-- 
2.37.2

_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [FFmpeg-devel] [PATCH 7/7] lavfi/vf_scale: set sws job count using ff_filter_get_nb_jobs
  2022-09-20 17:50 [FFmpeg-devel] [PATCH] lavfi: make job count configurable separately from thread count rcombs
                   ` (5 preceding siblings ...)
  2022-09-20 17:50 ` [FFmpeg-devel] [PATCH 6/7] lavfi/vf_unsharp: use ff_filter_get_nb_jobs rcombs
@ 2022-09-20 17:50 ` rcombs
  6 siblings, 0 replies; 13+ messages in thread
From: rcombs @ 2022-09-20 17:50 UTC (permalink / raw)
  To: ffmpeg-devel

This mirrors the existing handling for thread count.
---
 libavfilter/vf_scale.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/libavfilter/vf_scale.c b/libavfilter/vf_scale.c
index 2b12cf283c..db984725bd 100644
--- a/libavfilter/vf_scale.c
+++ b/libavfilter/vf_scale.c
@@ -544,6 +544,7 @@ static int config_props(AVFilterLink *outlink)
             av_opt_set_int(s, "param0", scale->param[0], 0);
             av_opt_set_int(s, "param1", scale->param[1], 0);
             av_opt_set_int(s, "threads", ff_filter_get_nb_threads(ctx), 0);
+            av_opt_set_int(s, "jobs",    ff_filter_get_nb_jobs(ctx), 0);
             if (scale->in_range != AVCOL_RANGE_UNSPECIFIED)
                 av_opt_set_int(s, "src_range",
                                scale->in_range == AVCOL_RANGE_JPEG, 0);
-- 
2.37.2

_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [FFmpeg-devel] [PATCH 2/7] sws: add jobs option, distinct from threads
  2022-09-20 17:50 ` [FFmpeg-devel] [PATCH 2/7] sws: add jobs option, distinct from threads rcombs
@ 2022-09-21  8:37   ` Michael Niedermayer
  2022-09-21  9:04     ` Michael Niedermayer
  2022-09-21 18:25   ` James Almer
  1 sibling, 1 reply; 13+ messages in thread
From: Michael Niedermayer @ 2022-09-21  8:37 UTC (permalink / raw)
  To: FFmpeg development discussions and patches


[-- Attachment #1.1: Type: text/plain, Size: 984 bytes --]

On Tue, Sep 20, 2022 at 12:50:16PM -0500, rcombs wrote:
> This allows for more efficient use of asymmetric-multiprocessing systems.
> ---
>  libswscale/options.c          | 2 ++
>  libswscale/swscale_internal.h | 1 +
>  libswscale/utils.c            | 9 ++++++---
>  libswscale/version.h          | 2 +-
>  4 files changed, 10 insertions(+), 4 deletions(-)

This chnages the output from
./ffmpeg -i ~/tickets/1984/00186002.avi -vframes 100 -qscale 1 -an -bitexact file-1984-ref.avi
(i suspect its all yuv410p indeo videos not just this one)

I presume thats unintended
also the jobs number ideally, especially with bitexact should not change
the output

but maybe iam missing something

thx


[...]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Whats the most studid thing your enemy could do ? Blow himself up
Whats the most studid thing you could do ? Give up your rights and
freedom because your enemy blew himself up.


[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 195 bytes --]

[-- Attachment #2: Type: text/plain, Size: 251 bytes --]

_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [FFmpeg-devel] [PATCH 2/7] sws: add jobs option, distinct from threads
  2022-09-21  8:37   ` Michael Niedermayer
@ 2022-09-21  9:04     ` Michael Niedermayer
  0 siblings, 0 replies; 13+ messages in thread
From: Michael Niedermayer @ 2022-09-21  9:04 UTC (permalink / raw)
  To: FFmpeg development discussions and patches


[-- Attachment #1.1: Type: text/plain, Size: 1116 bytes --]

On Wed, Sep 21, 2022 at 10:37:04AM +0200, Michael Niedermayer wrote:
> On Tue, Sep 20, 2022 at 12:50:16PM -0500, rcombs wrote:
> > This allows for more efficient use of asymmetric-multiprocessing systems.
> > ---
> >  libswscale/options.c          | 2 ++
> >  libswscale/swscale_internal.h | 1 +
> >  libswscale/utils.c            | 9 ++++++---
> >  libswscale/version.h          | 2 +-
> >  4 files changed, 10 insertions(+), 4 deletions(-)
> 
> This chnages the output from
> ./ffmpeg -i ~/tickets/1984/00186002.avi -vframes 100 -qscale 1 -an -bitexact file-1984-ref.avi
> (i suspect its all yuv410p indeo videos not just this one)
> 
> I presume thats unintended
> also the jobs number ideally, especially with bitexact should not change
> the output
> 
> but maybe iam missing something

"same" issue appears with some dxtory, snow and 10bit h264 inputs

[...]

-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

No human being will ever know the Truth, for even if they happen to say it
by chance, they would not even known they had done so. -- Xenophanes

[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 195 bytes --]

[-- Attachment #2: Type: text/plain, Size: 251 bytes --]

_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [FFmpeg-devel] [PATCH 2/7] sws: add jobs option, distinct from threads
  2022-09-20 17:50 ` [FFmpeg-devel] [PATCH 2/7] sws: add jobs option, distinct from threads rcombs
  2022-09-21  8:37   ` Michael Niedermayer
@ 2022-09-21 18:25   ` James Almer
  1 sibling, 0 replies; 13+ messages in thread
From: James Almer @ 2022-09-21 18:25 UTC (permalink / raw)
  To: ffmpeg-devel

On 9/20/2022 2:50 PM, rcombs wrote:
> This allows for more efficient use of asymmetric-multiprocessing systems.
> ---
>   libswscale/options.c          | 2 ++
>   libswscale/swscale_internal.h | 1 +
>   libswscale/utils.c            | 9 ++++++---
>   libswscale/version.h          | 2 +-
>   4 files changed, 10 insertions(+), 4 deletions(-)
> 
> diff --git a/libswscale/options.c b/libswscale/options.c
> index 4d41b835b1..5765daa100 100644
> --- a/libswscale/options.c
> +++ b/libswscale/options.c
> @@ -81,6 +81,8 @@ static const AVOption swscale_options[] = {
>   
>       { "threads",         "number of threads",             OFFSET(nb_threads),   AV_OPT_TYPE_INT, {.i64 = 1 }, 0, INT_MAX, VE, "threads" },
>           { "auto",        NULL,                            0,                  AV_OPT_TYPE_CONST, {.i64 = 0 },    .flags = VE, "threads" },
> +    { "jobs",            "number of jobs",                OFFSET(nb_jobs),      AV_OPT_TYPE_INT, {.i64 = 0 }, 0, INT_MAX, VE, "jobs" },

Default should probably be 1.

> +        { "auto",        NULL,                            0,                  AV_OPT_TYPE_CONST, {.i64 = 0 },    .flags = VE, "jobs" },
>   
>       { NULL }
>   };
> diff --git a/libswscale/swscale_internal.h b/libswscale/swscale_internal.h
> index abeebbb002..602082e12c 100644
> --- a/libswscale/swscale_internal.h
> +++ b/libswscale/swscale_internal.h
> @@ -339,6 +339,7 @@ typedef struct SwsContext {
>       int vChrDrop;                 ///< Binary logarithm of extra vertical subsampling factor in source image chroma planes specified by user.
>       int sliceDir;                 ///< Direction that slices are fed to the scaler (1 = top-to-bottom, -1 = bottom-to-top).
>       int nb_threads;               ///< Number of threads used for scaling
> +    int nb_jobs;                  ///< Number of slice jobs used for scaling
>       double param[2];              ///< Input parameters for scaling algorithms that need them.
>   
>       AVFrame *frame_src;
> diff --git a/libswscale/utils.c b/libswscale/utils.c
> index 45baa22b23..c9ff9db957 100644
> --- a/libswscale/utils.c
> +++ b/libswscale/utils.c
> @@ -1277,18 +1277,21 @@ static int context_init_threaded(SwsContext *c,
>                                       ff_sws_slice_worker, NULL, c->nb_threads);
>       if (ret == AVERROR(ENOSYS)) {
>           c->nb_threads = 1;
> +        c->nb_jobs = 1;
>           return 0;
>       } else if (ret < 0)
>           return ret;
>   
>       c->nb_threads = ret;
> +    if (c->nb_jobs < 1)

Can c->nb_jobs even be -1? The AVOption range above is 0..INT_MAX

> +        c->nb_jobs = av_cpu_job_count();
>   
> -    c->slice_ctx = av_calloc(c->nb_threads, sizeof(*c->slice_ctx));
> -    c->slice_err = av_calloc(c->nb_threads, sizeof(*c->slice_err));
> +    c->slice_ctx = av_calloc(c->nb_jobs, sizeof(*c->slice_ctx));
> +    c->slice_err = av_calloc(c->nb_jobs, sizeof(*c->slice_err));
>       if (!c->slice_ctx || !c->slice_err)
>           return AVERROR(ENOMEM);
>   
> -    for (int i = 0; i < c->nb_threads; i++) {
> +    for (int i = 0; i < c->nb_jobs; i++) {
>           c->slice_ctx[i] = sws_alloc_context();
>           if (!c->slice_ctx[i])
>               return AVERROR(ENOMEM);
> diff --git a/libswscale/version.h b/libswscale/version.h
> index 9bb3b171a7..4529a2d7d4 100644
> --- a/libswscale/version.h
> +++ b/libswscale/version.h
> @@ -29,7 +29,7 @@
>   #include "version_major.h"
>   
>   #define LIBSWSCALE_VERSION_MINOR   8
> -#define LIBSWSCALE_VERSION_MICRO 112
> +#define LIBSWSCALE_VERSION_MICRO 113
>   
>   #define LIBSWSCALE_VERSION_INT  AV_VERSION_INT(LIBSWSCALE_VERSION_MAJOR, \
>                                                  LIBSWSCALE_VERSION_MINOR, \
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [FFmpeg-devel] [PATCH 1/7] lavu/cpu: add av_cpu_job_count()
  2022-09-20 17:50 ` [FFmpeg-devel] [PATCH 1/7] lavu/cpu: add av_cpu_job_count() rcombs
@ 2022-09-22 13:49   ` Anton Khirnov
  2022-09-22 14:56     ` Ronald S. Bultje
  0 siblings, 1 reply; 13+ messages in thread
From: Anton Khirnov @ 2022-09-22 13:49 UTC (permalink / raw)
  To: FFmpeg development discussions and patches

It is very nonobvious to me that it makes sense to define a global job
count that is independent of the task at hand.

And we could really do with fewer global variables, not more.

-- 
Anton Khirnov
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [FFmpeg-devel] [PATCH 1/7] lavu/cpu: add av_cpu_job_count()
  2022-09-22 13:49   ` Anton Khirnov
@ 2022-09-22 14:56     ` Ronald S. Bultje
  0 siblings, 0 replies; 13+ messages in thread
From: Ronald S. Bultje @ 2022-09-22 14:56 UTC (permalink / raw)
  To: FFmpeg development discussions and patches

Hi,

On Thu, Sep 22, 2022 at 9:49 AM Anton Khirnov <anton@khirnov.net> wrote:

> It is very nonobvious to me that it makes sense to define a global job
> count that is independent of the task at hand.
>

I agree with Anton here. This is very heuristical and dependent on the type
of job. This therefore belongs as an implementation detail where it is
used, not as a global public API.

Ronald
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".

^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2022-09-22 14:57 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-09-20 17:50 [FFmpeg-devel] [PATCH] lavfi: make job count configurable separately from thread count rcombs
2022-09-20 17:50 ` [FFmpeg-devel] [PATCH 1/7] lavu/cpu: add av_cpu_job_count() rcombs
2022-09-22 13:49   ` Anton Khirnov
2022-09-22 14:56     ` Ronald S. Bultje
2022-09-20 17:50 ` [FFmpeg-devel] [PATCH 2/7] sws: add jobs option, distinct from threads rcombs
2022-09-21  8:37   ` Michael Niedermayer
2022-09-21  9:04     ` Michael Niedermayer
2022-09-21 18:25   ` James Almer
2022-09-20 17:50 ` [FFmpeg-devel] [PATCH 3/7] lavfi: add jobs args rcombs
2022-09-20 17:50 ` [FFmpeg-devel] [PATCH 4/7] ffmpeg: add filter_jobs and filter_complex_jobs args rcombs
2022-09-20 17:50 ` [FFmpeg-devel] [PATCH 5/7] ffplay: add filter_jobs arg rcombs
2022-09-20 17:50 ` [FFmpeg-devel] [PATCH 6/7] lavfi/vf_unsharp: use ff_filter_get_nb_jobs rcombs
2022-09-20 17:50 ` [FFmpeg-devel] [PATCH 7/7] lavfi/vf_scale: set sws job count using ff_filter_get_nb_jobs rcombs

Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://master.gitmailbox.com/ffmpegdev/0 ffmpegdev/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 ffmpegdev ffmpegdev/ https://master.gitmailbox.com/ffmpegdev \
		ffmpegdev@gitmailbox.com
	public-inbox-index ffmpegdev

Example config snippet for mirrors.


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git