aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDanil Chapovalov <danilchap@google.com>2022-04-05 16:20:46 +0200
committerJames Almer <jamrial@gmail.com>2022-04-05 11:25:43 -0300
commit53fd2d2203451434abd4ce22a758b1137edbe3fe (patch)
treee9295da4a6d6aa29ae61f91895068e7c24f75a56
parent0e03807f698e3ee5584d89a8c77e7c9cf502b2e1 (diff)
downloadffmpeg-53fd2d2203451434abd4ce22a758b1137edbe3fe.tar.gz
avcodec/libvpxenc: return quantizer parameter for an encoded frame
-rw-r--r--libavcodec/libvpxenc.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/libavcodec/libvpxenc.c b/libavcodec/libvpxenc.c
index dff1d06b0e..302f3bc55b 100644
--- a/libavcodec/libvpxenc.c
+++ b/libavcodec/libvpxenc.c
@@ -1247,9 +1247,11 @@ static inline void cx_pktcpy(struct FrameListData *dst,
static int storeframe(AVCodecContext *avctx, struct FrameListData *cx_frame,
AVPacket *pkt)
{
+ VPxContext *ctx = avctx->priv_data;
int ret = ff_get_encode_buffer(avctx, pkt, cx_frame->sz, 0);
uint8_t *side_data;
int pict_type;
+ int quality;
if (ret < 0)
return ret;
@@ -1264,7 +1266,10 @@ 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(&ctx->encoder, VP8E_GET_LAST_QUANTIZER_64, &quality);
+ if (ret != VPX_CODEC_OK)
+ quality = 0;
+ ff_side_data_set_encoder_stats(pkt, quality * FF_QP2LAMBDA, cx_frame->sse + 1,
cx_frame->have_sse ? 3 : 0, pict_type);
if (cx_frame->have_sse) {