From: Loren Merritt Date: Wed, 8 Dec 2004 02:28:58 +0000 (+0000) Subject: apply ip_factor and pb_factor in constant quantiser encodes. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=bc0a1e9b79d725680418be2bf7cf584a739ca47b;p=libx264 apply ip_factor and pb_factor in constant quantiser encodes. git-svn-id: svn://svn.videolan.org/x264/trunk@65 df754926-b1dd-0310-bc7b-ec298dee348c --- diff --git a/encoder/ratecontrol.c b/encoder/ratecontrol.c index 89680a47..4baf165f 100644 --- a/encoder/ratecontrol.c +++ b/encoder/ratecontrol.c @@ -73,6 +73,7 @@ struct x264_ratecontrol_t int buffer_size; int rcbufrate; int init_qp; + int qp_constant[5]; /* 1st pass stuff */ int gop_qp; @@ -176,6 +177,10 @@ int x264_ratecontrol_new( x264_t *h ) rc->qpa = rc->qp; rc->qpm = rc->qp; + rc->qp_constant[SLICE_TYPE_P] = h->param.rc.i_qp_constant; + rc->qp_constant[SLICE_TYPE_I] = x264_clip3( (int)( qscale2qp( qp2qscale( h->param.rc.i_qp_constant ) / fabs( h->param.rc.f_ip_factor )) + 0.5 ), 0, 51 ); + rc->qp_constant[SLICE_TYPE_B] = x264_clip3( (int)( qscale2qp( qp2qscale( h->param.rc.i_qp_constant ) * fabs( h->param.rc.f_pb_factor )) + 0.5 ), 0, 51 ); + /* Init 1pass CBR algo */ if( h->param.rc.b_cbr ){ rc->buffer_size = h->param.rc.i_rc_buffer_size * 1000; @@ -360,6 +365,8 @@ void x264_ratecontrol_start( x264_t *h, int i_slice_type ) } else if( !h->param.rc.b_cbr ) { + rc->qpm = rc->qpa = rc->qp = + rc->qp_constant[ i_slice_type ]; return; }