[FFmpeg-devel] [PATCH 1/3] lavc/libsvtav1: Enable svtav1-params like x264-params in libx264

Lynne dev at lynne.ee
Sun Jul 4 15:16:34 EEST 2021


4 Jul 2021, 03:40 by mypopydev at gmail.com:

> From: Jun Zhao <barryjzhao at tencent.com>
>
> Enabled the svtav1-params, then we can set all the params
>

The whole purpose of the params field was to give it off to the encoder
and have it do its own parsing, such that we wouldn't have to keep up
adding more and more options.
But svt-av1 cannot parse a generic option field on its own, so no, add
those as separate options rather than a generic text field.



> Signed-off-by: Jun Zhao <barryjzhao at tencent.com>
> ---
>  libavcodec/libsvtav1.c | 337 +++++++++++++++++++++++++++++++++++++++++
>  1 file changed, 337 insertions(+)
>
> diff --git a/libavcodec/libsvtav1.c b/libavcodec/libsvtav1.c
> index fabc4e6428..9d72a35f6c 100644
> --- a/libavcodec/libsvtav1.c
> +++ b/libavcodec/libsvtav1.c
> @@ -71,6 +71,8 @@ typedef struct SvtContext {
>  
>  int tile_columns;
>  int tile_rows;
> +
> +    AVDictionary *svt_av1_params;
>  } SvtContext;
>  
>  static const struct {
> @@ -146,11 +148,334 @@ static int alloc_buffer(EbSvtAv1EncConfiguration *config, SvtContext *svt_enc)
>  
>  }
>  
> +static void set_asm_type(EbSvtAv1EncConfiguration *p, const char *value)
> +{
> +    const struct {
> +        const char *name;
> +        CPU_FLAGS   flags;
> +    } param_maps[] = {
> +        {"c", 0},
> +        {"0", 0},
> +
> +        {"mmx", (CPU_FLAGS_MMX << 1) - 1},
> +        {"1",   (CPU_FLAGS_MMX << 1) - 1},
> +
> +        {"sse", (CPU_FLAGS_SSE << 1) - 1},
> +        {"2",   (CPU_FLAGS_SSE << 1) - 1},
> +
> +        {"sse2", (CPU_FLAGS_SSE2 << 1) - 1},
> +        {"3",    (CPU_FLAGS_SSE2 << 1) - 1},
> +
> +        {"sse3", (CPU_FLAGS_SSE3 << 1) - 1},
> +        {"4",    (CPU_FLAGS_SSE3 << 1) - 1},
> +
> +        {"ssse3", (CPU_FLAGS_SSSE3 << 1) - 1},
> +        {"5",     (CPU_FLAGS_SSSE3 << 1) - 1},
> +
> +        {"sse4_1", (CPU_FLAGS_SSE4_1 << 1) - 1},
> +        {"6",      (CPU_FLAGS_SSE4_1 << 1) - 1},
> +
> +        {"sse4_2", (CPU_FLAGS_SSE4_2 << 1) - 1},
> +        {"7",      (CPU_FLAGS_SSE4_2 << 1) - 1},
> +
> +        {"avx", (CPU_FLAGS_AVX << 1) - 1},
> +        {"8",   (CPU_FLAGS_AVX << 1) - 1},
> +
> +        {"avx2", (CPU_FLAGS_AVX2 << 1) - 1},
> +        {"9",    (CPU_FLAGS_AVX2 << 1) - 1},
> +
> +        {"avx512", (CPU_FLAGS_AVX512VL << 1) - 1},
> +        {"10",     (CPU_FLAGS_AVX512VL << 1) - 1},
> +
> +        {"max", CPU_FLAGS_ALL},
> +        {"11",  CPU_FLAGS_ALL},
> +    };
>

We already have a generic way to set up cpuflags, you should use that
instead of adding another field.


More information about the ffmpeg-devel mailing list