[FFmpeg-devel] [PATCH 1/2] avcodec/ffv1enc: Add enum for qtable

Lynne dev at lynne.ee
Sat Nov 30 09:22:13 EET 2024


On 30/11/2024 04:33, Michael Niedermayer wrote:

> Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>
> ---
>   libavcodec/ffv1enc.c | 14 +++++++++++++-
>   1 file changed, 13 insertions(+), 1 deletion(-)
>
> diff --git a/libavcodec/ffv1enc.c b/libavcodec/ffv1enc.c
> index c96c71b1096..742db549e5f 100644
> --- a/libavcodec/ffv1enc.c
> +++ b/libavcodec/ffv1enc.c
> @@ -41,6 +41,12 @@
>   #include "ffv1.h"
>   #include "ffv1enc.h"
>   
> +enum {
> +    QTABLE_DEFAULT = -1,
> +    QTABLE_8BIT,
> +    QTABLE_GT8BIT,
> +};
> +
>   static const int8_t quant5_10bit[256] = {
>        0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  1,  1,  1,  1,
>        1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,
> @@ -1346,7 +1352,13 @@ static const AVOption options[] = {
>       { "context", "Context model", OFFSET(context_model), AV_OPT_TYPE_INT,
>               { .i64 = 0 }, 0, 1, VE },
>       { "qtable", "Quantization table", OFFSET(qtable), AV_OPT_TYPE_INT,
> -            { .i64 = -1 }, -1, 2, VE },
> +            { .i64 = -1 }, -1, 2, VE , .unit = "qtable"},
> +        { "default", NULL, 0, AV_OPT_TYPE_CONST,
> +            { .i64 = QTABLE_DEFAULT }, INT_MIN, INT_MAX, VE, .unit = "qtable" },
> +        { "8bit", NULL, 0, AV_OPT_TYPE_CONST,
> +            { .i64 = QTABLE_8BIT }, INT_MIN, INT_MAX, VE, .unit = "qtable" },
> +        { "greater8bit", NULL, 0, AV_OPT_TYPE_CONST,
> +            { .i64 = QTABLE_GT8BIT }, INT_MIN, INT_MAX, VE, .unit = "qtable" },
>   
>       { NULL }
>   };


Could you apply this to ffv1enc_vulkan.c as well? It uses the same 
quantization table

that the software encoder initializes, as well as the same option 
definition, so it

should work.


More information about the ffmpeg-devel mailing list