History

avcodec/libvpxenc: return quantizer parameter for an encoded frame

Danil Chapovalov committed 4 years ago

Commit 53fd2d21 parent 0e038071 file · +6 −1Browse files

Unified · Split

libavcodec/libvpxenc.c+6−1
@@ -1247,9 +1247,11 @@ static inline void cx_pktcpy(struct FrameListData *dst, · 1246 unmodified lines
12471247 static int storeframe(AVCodecContext *avctx, struct FrameListData *cx_frame,
12481248 AVPacket *pkt)
12491249 {
1250+ VPxContext *ctx = avctx->priv_data;
12501251 int ret = ff_get_encode_buffer(avctx, pkt, cx_frame->sz, 0);
12511252 uint8_t *side_data;
12521253 int pict_type;
1254+ int quality;
12531255
12541256 if (ret < 0)
12551257 return ret;
@@ -1264,7 +1266,10 @@ static int storeframe(AVCodecContext *avctx, struct FrameListData *cx_frame, · 8 unmodified lines
12641266 pict_type = AV_PICTURE_TYPE_P;
12651267 }
12661268
1267− ff_side_data_set_encoder_stats(pkt, 0, cx_frame->sse + 1,
1269+ ret = vpx_codec_control(&ctx->encoder, VP8E_GET_LAST_QUANTIZER_64, &quality);
1270+ if (ret != VPX_CODEC_OK)
1271+ quality = 0;
1272+ ff_side_data_set_encoder_stats(pkt, quality * FF_QP2LAMBDA, cx_frame->sse + 1,
12681273 cx_frame->have_sse ? 3 : 0, pict_type);
12691274
12701275 if (cx_frame->have_sse) {

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t