diff options
author | Michael Niedermayer <michael@niedermayer.cc> | 2015-07-21 14:23:29 +0300 |
---|---|---|
committer | Michael Niedermayer <michael@niedermayer.cc> | 2015-07-22 20:31:52 +0300 |
commit | c40ecffd31d0e0be531425e48a98c1a8fcaaffa2 (patch) | |
tree | 0ba43d0eca37012a0185646605b2f39d83d93180 /libavcodec/libxvid.c | |
parent | a906e86a8dbd70d1ca858abc498c25e536fa87a9 (diff) |
Replace AV_PKT_DATA_QUALITY_FACTOR by AV_PKT_DATA_QUALITY_STATS
The stats are a superset of the quality factor, also allowing the picture type and encoder "PSNR" stats to be exported
This also replaces the native by fixed little endian order for the affected side data
AV_PKT_DATA_QUALITY_FACTOR is left as a synonym of AV_PKT_DATA_QUALITY_STATS
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
Diffstat (limited to 'libavcodec/libxvid.c')
-rw-r--r-- | libavcodec/libxvid.c | 25 |
1 files changed, 13 insertions, 12 deletions
diff --git a/libavcodec/libxvid.c b/libavcodec/libxvid.c index 25c2476573..6979346f62 100644 --- a/libavcodec/libxvid.c +++ b/libavcodec/libxvid.c @@ -771,27 +771,28 @@ static int xvid_encode_frame(AVCodecContext *avctx, AVPacket *pkt, } if (xerr > 0) { - uint8_t *sd = av_packet_new_side_data(pkt, AV_PKT_DATA_QUALITY_FACTOR, - sizeof(int)); - if (!sd) - return AVERROR(ENOMEM); - *(int *)sd = xvid_enc_stats.quant * FF_QP2LAMBDA; + int pict_type; *got_packet = 1; -#if FF_API_CODED_FRAME -FF_DISABLE_DEPRECATION_WARNINGS - avctx->coded_frame->quality = xvid_enc_stats.quant * FF_QP2LAMBDA; if (xvid_enc_stats.type == XVID_TYPE_PVOP) - avctx->coded_frame->pict_type = AV_PICTURE_TYPE_P; + pict_type = AV_PICTURE_TYPE_P; else if (xvid_enc_stats.type == XVID_TYPE_BVOP) - avctx->coded_frame->pict_type = AV_PICTURE_TYPE_B; + pict_type = AV_PICTURE_TYPE_B; else if (xvid_enc_stats.type == XVID_TYPE_SVOP) - avctx->coded_frame->pict_type = AV_PICTURE_TYPE_S; + pict_type = AV_PICTURE_TYPE_S; else - avctx->coded_frame->pict_type = AV_PICTURE_TYPE_I; + pict_type = AV_PICTURE_TYPE_I; + +#if FF_API_CODED_FRAME +FF_DISABLE_DEPRECATION_WARNINGS + avctx->coded_frame->pict_type = pict_type; + avctx->coded_frame->quality = xvid_enc_stats.quant * FF_QP2LAMBDA; FF_ENABLE_DEPRECATION_WARNINGS #endif + + ff_side_data_set_encoder_stats(pkt, xvid_enc_stats.quant * FF_QP2LAMBDA, NULL, 0, pict_type); + if (xvid_enc_frame.out_flags & XVID_KEYFRAME) { #if FF_API_CODED_FRAME FF_DISABLE_DEPRECATION_WARNINGS |