]> granicus.if.org Git - libx264/commitdiff
Fix interlaced + extremal slice-max-size
authorFiona Glaser <fiona@x264.com>
Tue, 14 Feb 2012 00:40:32 +0000 (16:40 -0800)
committerFiona Glaser <fiona@x264.com>
Wed, 15 Feb 2012 22:23:19 +0000 (14:23 -0800)
Broke if the first macroblock in the slice exceeded the set slice-max-size.

encoder/encoder.c

index 3078d3500dabf0373abf8c67b2c3aa4caa4aa448..38d2856af238644844c2bb37c67e2acb5a550112 100644 (file)
@@ -2221,7 +2221,7 @@ reencode:
         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 )
@@ -2237,7 +2237,7 @@ reencode:
             /* 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;