Commit 5394872f authored by James Darnley's avatar James Darnley Committed by Fiona Glaser

Fix bug in reference frame autoadjustment

For some types of input file, x264 did the adjustment before width/height were known.
parent c08cdc86
......@@ -822,24 +822,6 @@ generic_option:
param->analyse.i_trellis = 0;
}
/* Automatically reduce reference frame count to match the user's target level
* if the user didn't explicitly set a reference frame count. */
if( !b_user_ref )
{
int mbs = (((param->i_width)+15)>>4) * (((param->i_height)+15)>>4);
int i;
for( i = 0; x264_levels[i].level_idc != 0; i++ )
if( param->i_level_idc == x264_levels[i].level_idc )
{
while( mbs * 384 * param->i_frame_reference > x264_levels[i].dpb
&& param->i_frame_reference > 1 )
{
param->i_frame_reference--;
}
break;
}
}
/* Apply profile restrictions. */
if( profile )
{
......@@ -972,6 +954,26 @@ generic_option:
}
#endif
/* Automatically reduce reference frame count to match the user's target level
* if the user didn't explicitly set a reference frame count. */
if( !b_user_ref )
{
int mbs = (((param->i_width)+15)>>4) * (((param->i_height)+15)>>4);
int i;
for( i = 0; x264_levels[i].level_idc != 0; i++ )
if( param->i_level_idc == x264_levels[i].level_idc )
{
while( mbs * 384 * param->i_frame_reference > x264_levels[i].dpb
&& param->i_frame_reference > 1 )
{
param->i_frame_reference--;
}
break;
}
}
return 0;
}
......
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