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

Michael Niedermayer michael at niedermayer.cc
Wed Dec 4 04:07:40 EET 2024


On Mon, Dec 02, 2024 at 01:08:24PM +0900, Lynne via ffmpeg-devel wrote:
> On 02/12/2024 11:15, Michael Niedermayer wrote:
> 
> > Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>
> > ---
> >   libavcodec/ffv1enc.c        | 8 +++++++-
> >   libavcodec/ffv1enc.h        | 6 ++++++
> >   libavcodec/ffv1enc_vulkan.c | 8 +++++++-
> >   3 files changed, 20 insertions(+), 2 deletions(-)
> > 
> > diff --git a/libavcodec/ffv1enc.c b/libavcodec/ffv1enc.c
> > index c96c71b1096..696823b7967 100644
> > --- a/libavcodec/ffv1enc.c
> > +++ b/libavcodec/ffv1enc.c
> > @@ -1346,7 +1346,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 }
> >   };
> > diff --git a/libavcodec/ffv1enc.h b/libavcodec/ffv1enc.h
> > index e22693f2a89..2ecc2d16ec9 100644
> > --- a/libavcodec/ffv1enc.h
> > +++ b/libavcodec/ffv1enc.h
> > @@ -25,6 +25,12 @@
> >   #include "avcodec.h"
> > +enum {
> > +    QTABLE_DEFAULT = -1,
> > +    QTABLE_8BIT,
> > +    QTABLE_GT8BIT,
> > +};
> > +
> >   av_cold int ff_ffv1_encode_init(AVCodecContext *avctx);
> >   av_cold int ff_ffv1_write_extradata(AVCodecContext *avctx);
> >   av_cold int ff_ffv1_encode_setup_plane_info(AVCodecContext *avctx,
> > diff --git a/libavcodec/ffv1enc_vulkan.c b/libavcodec/ffv1enc_vulkan.c
> > index cdb0096969e..41d396fb32c 100644
> > --- a/libavcodec/ffv1enc_vulkan.c
> > +++ b/libavcodec/ffv1enc_vulkan.c
> > @@ -1795,7 +1795,13 @@ static const AVOption vulkan_encode_ffv1_options[] = {
> >           { "range_tab", "Range with custom table", 0, AV_OPT_TYPE_CONST,
> >               { .i64 = AC_RANGE_CUSTOM_TAB }, INT_MIN, INT_MAX, VE, .unit = "coder" },
> >       { "qtable", "Quantization table", OFFSET(ctx.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" },
> >       { "slices_h", "Number of horizontal slices", OFFSET(num_h_slices), AV_OPT_TYPE_INT,
> >               { .i64 = -1 }, -1, 1024, VE },
> 
> 
> Thanks, tested and it works fine.

will apply

thx

[...]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

In a rich man's house there is no place to spit but his face.
-- Diogenes of Sinope
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 195 bytes
Desc: not available
URL: <https://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20241204/4183e1fd/attachment.sig>


More information about the ffmpeg-devel mailing list