diff mbox series

[FFmpeg-devel] libsvtav1: Add lp option

Message ID 20210209185816.3230510-1-ccom@randomderp.com
State New
Headers show
Series [FFmpeg-devel] libsvtav1: Add lp option | expand

Checks

Context Check Description
andriy/x86_make success Make finished
andriy/x86_make_fate success Make fate finished
andriy/PPC64_make success Make finished
andriy/PPC64_make_fate success Make fate finished

Commit Message

Christopher Degawa Feb. 9, 2021, 6:58 p.m. UTC
From: Christopher Degawa <christopher.degawa@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@intel.com>
---
 libavcodec/libsvtav1.c | 7 +++++++
 1 file changed, 7 insertions(+)

Comments

Anton Khirnov Feb. 10, 2021, 10:12 a.m. UTC | #1
Quoting Christopher Degawa (2021-02-09 19:58:16)
> From: Christopher Degawa <christopher.degawa@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

It is very non-obvious what "lp" means, "logical_processors" would be
better IMO.
Christopher Degawa Feb. 10, 2021, 5:17 p.m. UTC | #2
>
> It is very non-obvious what "lp" means, "logical_processors" would be
> better IMO.
>

Okay, I will change it to `-logical_processors`
diff mbox series

Patch

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},
 };