Commit 2ae5b902 authored by Anton Mitrofanov's avatar Anton Mitrofanov Committed by Fiona Glaser

Hotfix for some bugs in VBV emergency

parent 2f676f6f
......@@ -265,9 +265,9 @@ static void x264_cabac_mb_qp_delta( x264_t *h, x264_cabac_t *cb )
if( i_dqp != 0 )
{
int val = i_dqp <= 0 ? (-2*i_dqp) : (2*i_dqp - 1);
/* dqp is interpreted modulo (QP_MAX+1) */
if( val >= QP_MAX && val != QP_MAX+1 )
val = 2*QP_MAX+1 - val;
/* dqp is interpreted modulo (QP_MAX_SPEC+1) */
if( val >= QP_MAX_SPEC && val != QP_MAX_SPEC+1 )
val = 2*QP_MAX_SPEC+1 - val;
do
{
x264_cabac_encode_decision( cb, 60 + ctx, 1 );
......
......@@ -222,10 +222,10 @@ static void cavlc_qp_delta( x264_t *h )
if( i_dqp )
{
if( i_dqp < -(QP_MAX+1)/2 )
i_dqp += QP_MAX+1;
else if( i_dqp > QP_MAX/2 )
i_dqp -= QP_MAX+1;
if( i_dqp < -(QP_MAX_SPEC+1)/2 )
i_dqp += QP_MAX_SPEC+1;
else if( i_dqp > QP_MAX_SPEC/2 )
i_dqp -= QP_MAX_SPEC+1;
}
bs_write_se( s, i_dqp );
}
......
......@@ -1066,7 +1066,7 @@ x264_t *x264_encoder_open( x264_param_t *param )
x264_log( h, X264_LOG_INFO, "%s\n", buf );
int qp_max = h->param.rc.i_qp_max == QP_MAX_SPEC ? QP_MAX : h->param.rc.i_qp_max;
for( qp = h->param.rc.i_qp_min; qp <= qp_max; qp++ )
for( qp = X264_MIN( h->param.rc.i_qp_min, QP_MAX_SPEC ); qp <= qp_max; qp++ )
if( x264_analyse_init_costs( h, qp ) )
goto fail;
if( x264_analyse_init_costs( h, X264_LOOKAHEAD_QP ) )
......
......@@ -445,7 +445,7 @@ void x264_pps_init( x264_pps_t *pps, int i_id, x264_param_t *param, x264_sps_t *
pps->b_weighted_pred = param->analyse.i_weighted_pred > 0;
pps->b_weighted_bipred = param->analyse.b_weighted_bipred ? 2 : 0;
pps->i_pic_init_qp = param->rc.i_rc_method == X264_RC_ABR ? 26 + QP_BD_OFFSET : param->rc.i_qp_constant;
pps->i_pic_init_qp = param->rc.i_rc_method == X264_RC_ABR ? 26 + QP_BD_OFFSET : SPEC_QP( param->rc.i_qp_constant );
pps->i_pic_init_qs = 26 + QP_BD_OFFSET;
pps->i_chroma_qp_index_offset = param->analyse.i_chroma_qp_offset;
......
......@@ -568,7 +568,7 @@ static void help( x264_param_t *defaults, int longhelp )
H0( "\n" );
H1( " -q, --qp <integer> Force constant QP (0-%d, 0=lossless)\n", QP_MAX );
H0( " -B, --bitrate <integer> Set bitrate (kbit/s)\n" );
H0( " --crf <float> Quality-based VBR (%d-51) [%.1f]\n", 51 - QP_MAX, defaults->rc.f_rf_constant );
H0( " --crf <float> Quality-based VBR (%d-51) [%.1f]\n", 51 - QP_MAX_SPEC, defaults->rc.f_rf_constant );
H1( " --rc-lookahead <integer> Number of frames for frametype lookahead [%d]\n", defaults->rc.i_lookahead );
H0( " --vbv-maxrate <integer> Max local bitrate (kbit/s) [%d]\n", defaults->rc.i_vbv_max_bitrate );
H0( " --vbv-bufsize <integer> Set size of the VBV buffer (kbit) [%d]\n", defaults->rc.i_vbv_buffer_size );
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment