From 7fc5f99d43b5c2498b368e6f5c1620f591bd2a45 Mon Sep 17 00:00:00 2001 From: Loren Merritt Date: Fri, 7 Jan 2005 18:45:11 +0000 Subject: [PATCH] allow constant qp on Nth pass (e.g. for forcing frame types) git-svn-id: svn://svn.videolan.org/x264/trunk@87 df754926-b1dd-0310-bc7b-ec298dee348c --- encoder/ratecontrol.c | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/encoder/ratecontrol.c b/encoder/ratecontrol.c index e73c9e35..147d4c4b 100644 --- a/encoder/ratecontrol.c +++ b/encoder/ratecontrol.c @@ -173,10 +173,6 @@ int x264_ratecontrol_new( x264_t *h ) rc->bitrate = h->param.rc.i_bitrate * 1000; rc->nmb = h->mb.i_mb_count; - rc->qp = h->param.rc.i_qp_constant; - 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 ); @@ -351,7 +347,13 @@ void x264_ratecontrol_start( x264_t *h, int i_slice_type ) x264_cpu_restore( h->param.cpu ); - if( h->param.rc.b_stat_read ) + if( !h->param.rc.b_cbr ) + { + rc->qpm = rc->qpa = rc->qp = + rc->qp_constant[ i_slice_type ]; + return; + } + else if( h->param.rc.b_stat_read ) { int frame = h->fenc->i_frame; ratecontrol_entry_t *rce = &h->rc->entry[frame]; @@ -363,12 +365,6 @@ void x264_ratecontrol_start( x264_t *h, int i_slice_type ) (int)(qscale2qp(rce->new_qscale) + 0.5); return; } - else if( !h->param.rc.b_cbr ) - { - rc->qpm = rc->qpa = rc->qp = - rc->qp_constant[ i_slice_type ]; - return; - } switch(i_slice_type){ case SLICE_TYPE_I: -- 2.47.3