[FFmpeg-devel] [PATCH] libsvtav1: Add lp option

Christopher Degawa ccom at randomderp.com
Tue Feb 9 20:58:16 EET 2021


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

Equivalent to the --lp option for SvtAv1EncApp, and is the only way
to control how much cpu power svt-av1 uses for now

Not using thread_count as it would be preferable to reserve that until
svt-av1 properly implements a threads option

0 == getconf _NPROCESSORS_ONLN

Signed-off-by: Christopher Degawa <christopher.degawa at intel.com>
---
 libavcodec/libsvtav1.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/libavcodec/libsvtav1.c b/libavcodec/libsvtav1.c
index eb6043bcac..260acc3d78 100644
--- a/libavcodec/libsvtav1.c
+++ b/libavcodec/libsvtav1.c
@@ -71,6 +71,8 @@ typedef struct SvtContext {
 
     int tile_columns;
     int tile_rows;
+
+    unsigned 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},
 
+    { "lp", "Number of logical processors to run the encoder on, threads are managed by the OS scheduler", OFFSET(logical_processors),
+      AV_OPT_TYPE_INT, { .i64 = 0 }, 0,  INT_MAX, VE },
+
     {NULL},
 };
 
-- 
2.25.1



More information about the ffmpeg-devel mailing list