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
1247static int storeframe(AVCodecContext *avctx, struct FrameListData *cx_frame,1247static int storeframe(AVCodecContext *avctx, struct FrameListData *cx_frame,
1248 AVPacket *pkt)1248 AVPacket *pkt)
1249{1249{
1250 VPxContext *ctx = avctx->priv_data;
1250 int ret = ff_get_encode_buffer(avctx, pkt, cx_frame->sz, 0);1251 int ret = ff_get_encode_buffer(avctx, pkt, cx_frame->sz, 0);
1251 uint8_t *side_data;1252 uint8_t *side_data;
1252 int pict_type;1253 int pict_type;
1254 int quality;
1253 1255
1254 if (ret < 0)1256 if (ret < 0)
1255 return ret;1257 return ret;
@@ -1264,7 +1266,10 @@ static int storeframe(AVCodecContext *avctx, struct FrameListData *cx_frame, · 8 unmodified lines
1264 pict_type = AV_PICTURE_TYPE_P;1266 pict_type = AV_PICTURE_TYPE_P;
1265 }1267 }
1266 1268
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,
1268 cx_frame->have_sse ? 3 : 0, pict_type);1273 cx_frame->have_sse ? 3 : 0, pict_type);
1269 1274
1270 if (cx_frame->have_sse) {1275 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