[FFmpeg-devel] [PATCH v2] libsvtav1: Add logical_processors option

Christopher Degawa ccom at randomderp.com
Wed Mar 31 01:30:16 EEST 2021


From: Christopher Degawa <christopher.degawa at intel.com>

Used as a thread count multiplier with a max of the logical cores
available

Signed-off-by: Christopher Degawa <christopher.degawa at intel.com>
---
 doc/encoders.texi      | 3 +++
 libavcodec/libsvtav1.c | 7 +++++++
 2 files changed, 10 insertions(+)

diff --git a/doc/encoders.texi b/doc/encoders.texi
index c9c8785afb..89e5593772 100644
--- a/doc/encoders.texi
+++ b/doc/encoders.texi
@@ -1795,6 +1795,9 @@ Set log2 of the number of rows of tiles to use (0-6).
 @item tile_columns
 Set log2 of the number of columns of tiles to use (0-4).

+ at item logical_processors
+Thread count multiplier (0 - ncpus).
+
 @end table

 @section libkvazaar
diff --git a/libavcodec/libsvtav1.c b/libavcodec/libsvtav1.c
index eb6043bcac..b6f9cc1c6b 100644
--- a/libavcodec/libsvtav1.c
+++ b/libavcodec/libsvtav1.c
@@ -71,6 +71,8 @@ typedef struct SvtContext {

     int tile_columns;
     int tile_rows;
+
+    uint32_t logical_processors;
 } SvtContext;

 static const struct {
@@ -218,6 +220,8 @@ static int config_enc_params(EbSvtAv1EncConfiguration *param,
     param->tile_columns = svt_enc->tile_columns;
     param->tile_rows    = svt_enc->tile_rows;

+    param->logical_processors = svt_enc->logical_processors;
+
     return 0;
 }

@@ -533,6 +537,9 @@ static const AVOption options[] = {
     { "tile_columns", "Log2 of number of tile columns to use", OFFSET(tile_columns), AV_OPT_TYPE_INT, {.i64 = 0}, 0, 4, VE},
     { "tile_rows", "Log2 of number of tile rows to use", OFFSET(tile_rows), AV_OPT_TYPE_INT, {.i64 = 0}, 0, 6, VE},

+    { "logical_processors", "Thread count multiplier with a max of the number of logical cores available", OFFSET(logical_processors),
+      AV_OPT_TYPE_INT, { .i64 = 0 }, 0,  UINT_MAX, VE },
+
     {NULL},
 };

--
2.27.0


More information about the ffmpeg-devel mailing list