diff mbox series

[FFmpeg-devel] Attach quantizer parameter to an encoded frame in libvpx wrapper

Message ID CACQca=fFu8Wmfe_7Zxg9Gc+hXwDxfxkgzaWet_jFqrRApbRsSg@mail.gmail.com
State New
Headers show
Series [FFmpeg-devel] Attach quantizer parameter to an encoded frame in libvpx wrapper | expand

Checks

Context Check Description
yinshiyou/configure_loongarch64 warning Failed to apply patch
andriy/configure_armv7_RPi4 warning Failed to apply patch
andriy/configure_aarch64_jetson warning Failed to apply patch

Commit Message

Danil Chapovalov March 9, 2022, 2:13 p.m. UTC
Signed-off-by: Danil Chapovalov <danilchap@webrtc.org>
---
 libavcodec/libvpxenc.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

         return ret;
@@ -1261,7 +1262,13 @@ static int storeframe(AVCodecContext *avctx,
struct FrameListData *cx_frame,
         pict_type = AV_PICTURE_TYPE_P;
     }

-    ff_side_data_set_encoder_stats(pkt, 0, cx_frame->sse + 1,
+    ret = vpx_codec_control(&((VPxContext *)avctx->priv_data)->encoder,
+                            VP8E_GET_LAST_QUANTIZER_64, &quality);
+    if (ret != VPX_CODEC_OK) {
+        quality = 0;
+    }
+
+    ff_side_data_set_encoder_stats(pkt, quality, cx_frame->sse + 1,
                                    cx_frame->have_sse ? 3 : 0, pict_type);

     if (cx_frame->have_sse) {
diff mbox series

Patch

diff --git a/libavcodec/libvpxenc.c b/libavcodec/libvpxenc.c
index 8f94ba15dc..581282682c 100644
--- a/libavcodec/libvpxenc.c
+++ b/libavcodec/libvpxenc.c
@@ -1247,6 +1247,7 @@  static int storeframe(AVCodecContext *avctx,
struct FrameListData *cx_frame,
     int ret = ff_get_encode_buffer(avctx, pkt, cx_frame->sz, 0);
     uint8_t *side_data;
     int pict_type;
+    int quality;

     if (ret < 0)