* [FFmpeg-devel] [PATCH] Allow to modify max qp configuration parameter in libvpx without reseting the encoder
@ 2022-03-14 13:04 Danil Chapovalov
2022-03-14 15:27 ` Jan Ekström
0 siblings, 1 reply; 6+ messages in thread
From: Danil Chapovalov @ 2022-03-14 13:04 UTC (permalink / raw)
To: ffmpeg-devel; +Cc: Danil Chapovalov
---
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);
+ }
+
memset(&layer_id, 0, sizeof(layer_id));
en = av_dict_get(frame->metadata, "temporal_id", NULL, 0);
--
2.35.1.723.g4982287a31-goog
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [FFmpeg-devel] [PATCH] Allow to modify max qp configuration parameter in libvpx without reseting the encoder
2022-03-14 13:04 [FFmpeg-devel] [PATCH] Allow to modify max qp configuration parameter in libvpx without reseting the encoder Danil Chapovalov
@ 2022-03-14 15:27 ` Jan Ekström
2022-03-16 12:13 ` Danil Chapovalov
0 siblings, 1 reply; 6+ messages in thread
From: Jan Ekström @ 2022-03-14 15:27 UTC (permalink / raw)
To: FFmpeg development discussions and patches
On Mon, Mar 14, 2022 at 3:05 PM Danil Chapovalov
<danilchap-at-google.com@ffmpeg.org> wrote:
>
> ---
Probably something a la
avcodec/libvpxenc: enable dynamic quantizer reconfiguration
?
> 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.
Cheers,
Jan
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [FFmpeg-devel] [PATCH] Allow to modify max qp configuration parameter in libvpx without reseting the encoder
2022-03-14 15:27 ` Jan Ekström
@ 2022-03-16 12:13 ` Danil Chapovalov
2022-03-16 12:37 ` Lynne
0 siblings, 1 reply; 6+ messages in thread
From: Danil Chapovalov @ 2022-03-16 12:13 UTC (permalink / raw)
To: FFmpeg development discussions and patches
[-- Attachment #1.1: Type: text/plain, Size: 2098 bytes --]
On Mon, Mar 14, 2022 at 4:28 PM Jan Ekström <jeebjp@gmail.com> wrote:
>
> On Mon, Mar 14, 2022 at 3:05 PM Danil Chapovalov
> <danilchap-at-google.com@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@ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
> To unsubscribe, visit link above, or email
> ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
[-- Attachment #1.2: S/MIME Cryptographic Signature --]
[-- Type: application/pkcs7-signature, Size: 4002 bytes --]
[-- Attachment #2: Type: text/plain, Size: 251 bytes --]
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [FFmpeg-devel] [PATCH] Allow to modify max qp configuration parameter in libvpx without reseting the encoder
2022-03-16 12:13 ` Danil Chapovalov
@ 2022-03-16 12:37 ` Lynne
2022-03-19 14:25 ` Anton Khirnov
0 siblings, 1 reply; 6+ messages in thread
From: Lynne @ 2022-03-16 12:37 UTC (permalink / raw)
To: FFmpeg development discussions and patches
16 Mar 2022, 13:13 by danilchap-at-google.com@ffmpeg.org:
> On Mon, Mar 14, 2022 at 4:28 PM Jan Ekström <jeebjp@gmail.com> wrote:
>
>>
>> On Mon, Mar 14, 2022 at 3:05 PM Danil Chapovalov
>> <danilchap-at-google.com@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?
>
If the encoder is operating under bitrate mode, then I think it would
be fine to interpret the qp field as a max qp field.
IIRC Youtube run libvpx and libaom under constant bitrate mode and
adjust the max quantizer per frame, because no one can fix the
rate control system of either library.
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [FFmpeg-devel] [PATCH] Allow to modify max qp configuration parameter in libvpx without reseting the encoder
2022-03-16 12:37 ` Lynne
@ 2022-03-19 14:25 ` Anton Khirnov
0 siblings, 0 replies; 6+ messages in thread
From: Anton Khirnov @ 2022-03-19 14:25 UTC (permalink / raw)
To: FFmpeg development discussions and patches
Quoting Lynne (2022-03-16 13:37:55)
> 16 Mar 2022, 13:13 by danilchap-at-google.com@ffmpeg.org:
>
> > On Mon, Mar 14, 2022 at 4:28 PM Jan Ekström <jeebjp@gmail.com> wrote:
> >
> >>
> >> On Mon, Mar 14, 2022 at 3:05 PM Danil Chapovalov
> >> <danilchap-at-google.com@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?
> >
>
> If the encoder is operating under bitrate mode, then I think it would
> be fine to interpret the qp field as a max qp field.
> IIRC Youtube run libvpx and libaom under constant bitrate mode and
> adjust the max quantizer per frame, because no one can fix the
> rate control system of either library.
Why not just update AVCodecContext.qmax?
--
Anton Khirnov
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
^ permalink raw reply [flat|nested] 6+ messages in thread
* [FFmpeg-devel] [PATCH] Allow to modify max qp configuration parameter in libvpx without reseting the encoder
@ 2022-03-09 13:27 Danil Chapovalov
0 siblings, 0 replies; 6+ messages in thread
From: Danil Chapovalov @ 2022-03-09 13:27 UTC (permalink / raw)
To: ffmpeg-devel
Signed-off-by: Danil Chapovalov <danilchap@webrtc.org>
---
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);
+ }
+
memset(&layer_id, 0, sizeof(layer_id));
en = av_dict_get(frame->metadata, "temporal_id", NULL, 0);
--
2.35.1.616.g0bdcbb4464-goog
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2022-03-19 14:25 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-03-14 13:04 [FFmpeg-devel] [PATCH] Allow to modify max qp configuration parameter in libvpx without reseting the encoder Danil Chapovalov
2022-03-14 15:27 ` Jan Ekström
2022-03-16 12:13 ` Danil Chapovalov
2022-03-16 12:37 ` Lynne
2022-03-19 14:25 ` Anton Khirnov
-- strict thread matches above, loose matches on Subject: below --
2022-03-09 13:27 Danil Chapovalov
Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
This inbox may be cloned and mirrored by anyone:
git clone --mirror https://master.gitmailbox.com/ffmpegdev/0 ffmpegdev/git/0.git
# If you have public-inbox 1.1+ installed, you may
# initialize and index your mirror using the following commands:
public-inbox-init -V2 ffmpegdev ffmpegdev/ https://master.gitmailbox.com/ffmpegdev \
ffmpegdev@gitmailbox.com
public-inbox-index ffmpegdev
Example config snippet for mirrors.
AGPL code for this site: git clone https://public-inbox.org/public-inbox.git