mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2024-12-28 20:53:54 +02:00
avcodec/libvpxenc: return quantizer parameter for an encoded frame
This commit is contained in:
parent
0e03807f69
commit
53fd2d2203
@ -1247,9 +1247,11 @@ static inline void cx_pktcpy(struct FrameListData *dst,
|
|||||||
static int storeframe(AVCodecContext *avctx, struct FrameListData *cx_frame,
|
static int storeframe(AVCodecContext *avctx, struct FrameListData *cx_frame,
|
||||||
AVPacket *pkt)
|
AVPacket *pkt)
|
||||||
{
|
{
|
||||||
|
VPxContext *ctx = avctx->priv_data;
|
||||||
int ret = ff_get_encode_buffer(avctx, pkt, cx_frame->sz, 0);
|
int ret = ff_get_encode_buffer(avctx, pkt, cx_frame->sz, 0);
|
||||||
uint8_t *side_data;
|
uint8_t *side_data;
|
||||||
int pict_type;
|
int pict_type;
|
||||||
|
int quality;
|
||||||
|
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
return ret;
|
return ret;
|
||||||
@ -1264,7 +1266,10 @@ static int storeframe(AVCodecContext *avctx, struct FrameListData *cx_frame,
|
|||||||
pict_type = AV_PICTURE_TYPE_P;
|
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);
|
cx_frame->have_sse ? 3 : 0, pict_type);
|
||||||
|
|
||||||
if (cx_frame->have_sse) {
|
if (cx_frame->have_sse) {
|
||||||
|
Loading…
Reference in New Issue
Block a user