Mercurial > libavcodec.hg
comparison x264.c @ 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 | e5af3bc1d038 |
children | f06d5bf3da71 |
comparison
equal
deleted
inserted
replaced
2562:d0a58dca5ad2 | 2563:1e52ef4887b5 |
---|---|
102 case X264_TYPE_BREF: | 102 case X264_TYPE_BREF: |
103 x4->out_pic.pict_type = FF_B_TYPE; | 103 x4->out_pic.pict_type = FF_B_TYPE; |
104 break; | 104 break; |
105 } | 105 } |
106 | 106 |
107 x4->out_pic.key_frame = x4->out_pic.key_frame == FF_I_TYPE; | 107 x4->out_pic.key_frame = pic_out.i_type == X264_TYPE_IDR; |
108 x4->out_pic.quality = (pic_out.i_qpplus1 - 1) * FF_QP2LAMBDA; | |
108 | 109 |
109 return bufsize; | 110 return bufsize; |
110 } | 111 } |
111 | 112 |
112 static int | 113 static int |
137 x4->params.rc.b_cbr = 1; | 138 x4->params.rc.b_cbr = 1; |
138 x4->params.rc.i_qp_min = avctx->qmin; | 139 x4->params.rc.i_qp_min = avctx->qmin; |
139 x4->params.rc.i_qp_max = avctx->qmax; | 140 x4->params.rc.i_qp_max = avctx->qmax; |
140 x4->params.rc.i_qp_step = avctx->max_qdiff; | 141 x4->params.rc.i_qp_step = avctx->max_qdiff; |
141 | 142 |
143 if(avctx->flags & CODEC_FLAG_QSCALE && avctx->global_quality > 0) | |
144 x4->params.rc.i_qp_constant = | |
145 12 + 6 * log2((double) avctx->global_quality / FF_QP2LAMBDA); | |
146 | |
142 x4->params.i_width = avctx->width; | 147 x4->params.i_width = avctx->width; |
143 x4->params.i_height = avctx->height; | 148 x4->params.i_height = avctx->height; |
144 x4->params.vui.i_sar_width = avctx->sample_aspect_ratio.num; | 149 x4->params.vui.i_sar_width = avctx->sample_aspect_ratio.num; |
145 x4->params.vui.i_sar_height = avctx->sample_aspect_ratio.den; | 150 x4->params.vui.i_sar_height = avctx->sample_aspect_ratio.den; |
146 x4->params.i_fps_num = avctx->frame_rate; | 151 x4->params.i_fps_num = avctx->frame_rate; |