Broke if the first macroblock in the slice exceeded the set slice-max-size.
int total_bits = bs_pos(&h->out.bs) + x264_cabac_pos(&h->cabac);
int mb_size = total_bits - mb_spos;
- if( slice_max_size )
+ if( slice_max_size && (!SLICE_MBAFF || (i_mb_y&1)) )
{
/* Count the skip run, just in case. */
if( !h->param.b_cabac )
/* We'll just re-encode this last macroblock if we go over the max slice size. */
if( total_bits - starting_bits > slice_max_size && !h->mb.b_reencode_mb )
{
- if( mb_xy != h->sh.i_first_mb )
+ if( mb_xy-SLICE_MBAFF*h->mb.i_mb_stride != h->sh.i_first_mb )
{
h->stat.frame.i_mv_bits = mv_bits_bak;
h->stat.frame.i_tex_bits = tex_bits_bak;