changeset 2563:1e52ef4887b5 libavcodec

set constant QP from AVCodecContext.global_quality. set key_frame flag on coded_picture correctly.
author mru
date Wed, 16 Mar 2005 13:09:30 +0000
parents d0a58dca5ad2
children ad15cccd015f
files x264.c
diffstat 1 files changed, 6 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/x264.c	Tue Mar 15 21:05:34 2005 +0000
+++ b/x264.c	Wed Mar 16 13:09:30 2005 +0000
@@ -104,7 +104,8 @@
         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 @@
     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;