diff options
author | Vittorio Giovara <vittorio.giovara@gmail.com> | 2015-07-15 20:41:21 +0300 |
---|---|---|
committer | Vittorio Giovara <vittorio.giovara@gmail.com> | 2015-07-20 17:06:47 +0300 |
commit | 5d3addb937946eca5391e40b5e6308e74ac6f77b (patch) | |
tree | e758d6b07dd07480a3b32901ccedc421d45b33c0 /libavcodec/libxvid.c | |
parent | d6604b29ef544793479d7fb4e05ef6622bb3e534 (diff) |
Add a quality factor packet side data
This is necessary to preserve the quality information currently exported
with coded_frame. Add the new side data to every encoder that needs it,
and use it in avconv.
Signed-off-by: Vittorio Giovara <vittorio.giovara@gmail.com>
Diffstat (limited to 'libavcodec/libxvid.c')
-rw-r--r-- | libavcodec/libxvid.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/libavcodec/libxvid.c b/libavcodec/libxvid.c index 5282ea7a19..b440ac2d92 100644 --- a/libavcodec/libxvid.c +++ b/libavcodec/libxvid.c @@ -743,6 +743,12 @@ 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; + *got_packet = 1; avctx->coded_frame->quality = xvid_enc_stats.quant * FF_QP2LAMBDA; |