diff options
author | Vittorio Giovara <vittorio.giovara@gmail.com> | 2015-07-15 18:41:21 +0100 |
---|---|---|
committer | Vittorio Giovara <vittorio.giovara@gmail.com> | 2015-07-20 15:06:47 +0100 |
commit | 5d3addb937946eca5391e40b5e6308e74ac6f77b (patch) | |
tree | e758d6b07dd07480a3b32901ccedc421d45b33c0 /libavcodec/dnxhdenc.c | |
parent | d6604b29ef544793479d7fb4e05ef6622bb3e534 (diff) | |
download | ffmpeg-5d3addb937946eca5391e40b5e6308e74ac6f77b.tar.gz |
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/dnxhdenc.c')
-rw-r--r-- | libavcodec/dnxhdenc.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/libavcodec/dnxhdenc.c b/libavcodec/dnxhdenc.c index 5c45fe0b3a..bccf5c8a48 100644 --- a/libavcodec/dnxhdenc.c +++ b/libavcodec/dnxhdenc.c @@ -1036,7 +1036,7 @@ static int dnxhd_encode_picture(AVCodecContext *avctx, AVPacket *pkt, DNXHDEncContext *ctx = avctx->priv_data; int first_field = 1; int offset, i, ret; - uint8_t *buf; + uint8_t *buf, *sd; if ((ret = ff_alloc_packet(pkt, ctx->cid_table->frame_size)) < 0) { av_log(avctx, AV_LOG_ERROR, @@ -1092,6 +1092,11 @@ encode_coding_unit: avctx->coded_frame->quality = ctx->qscale * FF_QP2LAMBDA; + sd = av_packet_new_side_data(pkt, AV_PKT_DATA_QUALITY_FACTOR, sizeof(int)); + if (!sd) + return AVERROR(ENOMEM); + *(int *)sd = ctx->qscale * FF_QP2LAMBDA; + pkt->flags |= AV_PKT_FLAG_KEY; *got_packet = 1; return 0; |