From 39a4c6fecaaa0d6cde8d89d31ef6cd1d25ab802b Mon Sep 17 00:00:00 2001 From: Jason Garrett-Glaser Date: Mon, 13 Feb 2012 16:40:32 -0800 Subject: [PATCH] Fix interlaced + extremal slice-max-size Broke if the first macroblock in the slice exceeded the set slice-max-size. --- encoder/encoder.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/encoder/encoder.c b/encoder/encoder.c index 4bb4ec50..c97d6f42 100644 --- a/encoder/encoder.c +++ b/encoder/encoder.c @@ -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; -- 2.47.3