From: Loren Merritt Date: Tue, 21 Jun 2005 04:45:49 +0000 (+0000) Subject: adjust coded buffer size based on input resolution and QP (old default wasn't enough... X-Git-Url: http://www.zmx.ovh/git.videolan.org/?a=commitdiff_plain;h=7a77a1e7295b99a418c4fad2a5ab91f0dc896115;p=x264.git adjust coded buffer size based on input resolution and QP (old default wasn't enough for HD lossless) git-svn-id: svn://svn.videolan.org/x264/trunk@268 df754926-b1dd-0310-bc7b-ec298dee348c --- diff --git a/encoder/encoder.c b/encoder/encoder.c index 32c5072c..b562b2f4 100644 --- a/encoder/encoder.c +++ b/encoder/encoder.c @@ -515,7 +515,9 @@ x264_t *x264_encoder_open ( x264_param_t *param ) /* Init x264_t */ h->out.i_nal = 0; - h->out.i_bitstream = 1000000; /* FIXME estimate max size (idth/height) */ + h->out.i_bitstream = X264_MAX( 1000000, h->param.i_width * h->param.i_height * 1.7 + * ( h->param.rc.b_cbr ? pow( 0.5, h->param.rc.i_qp_min ) + : pow( 0.5, h->param.rc.i_qp_constant ) * X264_MAX( 1, h->param.rc.f_ip_factor ))); h->out.p_bitstream = x264_malloc( h->out.i_bitstream ); h->i_frame = 0; diff --git a/x264.c b/x264.c index f81eb188..0901ab78 100644 --- a/x264.c +++ b/x264.c @@ -501,9 +501,13 @@ static int Parse( int argc, char **argv, break; case 'i': param->i_keyint_min = atol( optarg ); + if( param->i_keyint_max < param->i_keyint_min ) + param->i_keyint_max = param->i_keyint_min; break; case 'I': param->i_keyint_max = atol( optarg ); + if( param->i_keyint_min > param->i_keyint_max ) + param->i_keyint_min = param->i_keyint_max; break; case OPT_SCENECUT: param->i_scenecut_threshold = atol( optarg );