[FFmpeg-devel] [PATCH] Allow to modify max qp configuration parameter in libvpx without reseting the encoder

Danil Chapovalov danilchap at google.com
Wed Mar 16 14:13:05 EET 2022


On Mon, Mar 14, 2022 at 4:28 PM Jan Ekström <jeebjp at gmail.com> wrote:
>
> On Mon, Mar 14, 2022 at 3:05 PM Danil Chapovalov
> <danilchap-at-google.com at ffmpeg.org> wrote:
> >
> > ---
>
> Probably something a la
>
> avcodec/libvpxenc: enable dynamic quantizer reconfiguration
>
> ?

Thank you, resubmitted with new title

>
> >  libavcodec/libvpxenc.c | 7 +++++++
> >  1 file changed, 7 insertions(+)
> >
> > diff --git a/libavcodec/libvpxenc.c b/libavcodec/libvpxenc.c
> > index 8f94ba15dc..45baeed435 100644
> > --- a/libavcodec/libvpxenc.c
> > +++ b/libavcodec/libvpxenc.c
> > @@ -1658,6 +1658,13 @@ static int vpx_encode(AVCodecContext *avctx, AVPacket *pkt,
> >                  flags |= strtoul(en->value, NULL, 10);
> >              }
> >
> > +            en = av_dict_get(frame->metadata, "max-quantizer", NULL, 0);
> > +            if (en) {
> > +                struct vpx_codec_enc_cfg cfg = *enccfg;
> > +                cfg.rc_max_quantizer = strtoul(en->value, NULL, 10);
> > +                vpx_codec_enc_config_set(&ctx->encoder, &cfg);
> > +            }
> > +
>
> There is side data already defined for quantizers, AVVideoEncParams /
> AV_FRAME_DATA_VIDEO_ENC_PARAMS .
>
> In other words, this should be handled in a similar manner to ROI, not
> as an ad-hoc metadata key in the AVFrame.

I've checked struct AVVideoEncParams, it doesn't look fitting: it
contains exact qp (plus qp per plane), while my patch suggests
changing max-qp limit for current and following frames.
AVVideoEncParams also has some extra fields that I'm unsure how to
handle (they are unrelated to what I'm trying to do),
I haven't found any other struct that would contain something like max qp.
What is ROI? What code can I use as an example of your suggestion?


>
> Cheers,
> Jan
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel at ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
> To unsubscribe, visit link above, or email
> ffmpeg-devel-request at ffmpeg.org with subject "unsubscribe".
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 4002 bytes
Desc: S/MIME Cryptographic Signature
URL: <https://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20220316/f4fe081e/attachment.bin>


More information about the ffmpeg-devel mailing list