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

Mark Thompson sw at jkqxz.net
Thu Feb 11 00:01:20 EET 2021


On 10/02/2021 17:16, Christopher Degawa wrote:
> 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

Then what does it actually do?  The description below about the number of logical threads to run sounds pretty much exactly like what the threads option does.

> 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..2296735f25 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},
>   
> +    { "logical_processors", "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},
>   };
>   
> 

- Mark


More information about the ffmpeg-devel mailing list