summaryrefslogtreecommitdiff
path: root/libavcodec/x264.c
diff options
context:
space:
mode:
authorMåns Rullgård <mans@mansr.com>2005-03-16 13:09:30 +0000
committerMåns Rullgård <mans@mansr.com>2005-03-16 13:09:30 +0000
commit68c6d60fdfc76976d0ac48b2dbb81a539f219c60 (patch)
tree17f1fc98801350a06084637088b9ef0036c30b9e /libavcodec/x264.c
parent0fa04b7fde614c4d1778ecfc60bfbdb8c3ac8b1e (diff)
set constant QP from AVCodecContext.global_quality.
set key_frame flag on coded_picture correctly. Originally committed as revision 4045 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavcodec/x264.c')
-rw-r--r--libavcodec/x264.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/libavcodec/x264.c b/libavcodec/x264.c
index 3f3aba68ef..4fc2c64487 100644
--- a/libavcodec/x264.c
+++ b/libavcodec/x264.c
@@ -104,7 +104,8 @@ X264_frame(AVCodecContext *ctx, uint8_t *buf, int bufsize, void *data)
break;
}
- x4->out_pic.key_frame = x4->out_pic.key_frame == FF_I_TYPE;
+ x4->out_pic.key_frame = pic_out.i_type == X264_TYPE_IDR;
+ x4->out_pic.quality = (pic_out.i_qpplus1 - 1) * FF_QP2LAMBDA;
return bufsize;
}
@@ -139,6 +140,10 @@ X264_init(AVCodecContext *avctx)
x4->params.rc.i_qp_max = avctx->qmax;
x4->params.rc.i_qp_step = avctx->max_qdiff;
+ if(avctx->flags & CODEC_FLAG_QSCALE && avctx->global_quality > 0)
+ x4->params.rc.i_qp_constant =
+ 12 + 6 * log2((double) avctx->global_quality / FF_QP2LAMBDA);
+
x4->params.i_width = avctx->width;
x4->params.i_height = avctx->height;
x4->params.vui.i_sar_width = avctx->sample_aspect_ratio.num;