[FFmpeg-devel] [PATCH] avcodec/libvpxenc: enable dynamic max quantizer parameter reconfiguration
Danil Chapovalov
danilchap at google.com
Thu Mar 17 21:07:34 EET 2022
---
libavcodec/libvpxenc.c | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/libavcodec/libvpxenc.c b/libavcodec/libvpxenc.c
index 8f94ba15dc..4735e57620 100644
--- a/libavcodec/libvpxenc.c
+++ b/libavcodec/libvpxenc.c
@@ -44,6 +44,7 @@
#include "libavutil/mathematics.h"
#include "libavutil/opt.h"
#include "libavutil/pixdesc.h"
+#include "libavutil/video_enc_params.h"
/**
* Portion of struct vpx_codec_cx_pkt from vpx_encoder.h.
@@ -1698,6 +1699,14 @@ static int vpx_encode(AVCodecContext *avctx, AVPacket *pkt,
}
}
+ sd = av_frame_get_side_data(frame, AV_FRAME_DATA_VIDEO_ENC_PARAMS);
+ if (sd) {
+ const AVVideoEncParams* enc_params = sd->data;
+ struct vpx_codec_enc_cfg cfg = *enccfg;
+ cfg.rc_max_quantizer = enc_params->qp;
+ vpx_codec_enc_config_set(&ctx->encoder, &cfg);
+ }
+
if (ctx->hdr10_plus_fifo) {
AVFrameSideData *hdr10_plus_metadata;
// Add HDR10+ metadata to queue.
--
2.35.1.894.gb6a874cedc-goog
More information about the ffmpeg-devel
mailing list