From: Simon Horlick Date: Wed, 23 Mar 2011 21:55:03 +0000 (+0000) Subject: MBAFF: Add support for slice-max-size X-Git-Url: http://www.zmx.ovh/git.videolan.org/?a=commitdiff_plain;h=87b054dc73ecf613df462786d442e923da878715;p=x264.git MBAFF: Add support for slice-max-size Also add slice-max-size to the regression tests. --- diff --git a/encoder/encoder.c b/encoder/encoder.c index 20c7b129..9bb40c67 100644 --- a/encoder/encoder.c +++ b/encoder/encoder.c @@ -572,11 +572,6 @@ static int x264_validate_parameters( x264_t *h, int b_open ) h->param.rc.i_vbv_max_bitrate = 0; } - if( h->param.b_interlaced && h->param.i_slice_max_size ) - { - x264_log( h, X264_LOG_WARNING, "interlaced + slice-max-size is not implemented\n" ); - h->param.i_slice_max_size = 0; - } h->param.i_slice_max_size = X264_MAX( h->param.i_slice_max_size, 0 ); h->param.i_slice_max_mbs = X264_MAX( h->param.i_slice_max_mbs, 0 ); @@ -2026,7 +2021,7 @@ static int x264_slice_write( x264_t *h ) if( x264_bitstream_check_buffer( h ) ) return -1; - if( back_up_bitstream ) + if( back_up_bitstream && (!h->sh.b_mbaff || (i_mb_y&1) == 0) ) { mv_bits_bak = h->stat.frame.i_mv_bits; tex_bits_bak = h->stat.frame.i_tex_bits; @@ -2151,7 +2146,16 @@ reencode: i_skip = i_skip_bak; } h->mb.b_reencode_mb = 1; - h->sh.i_last_mb = mb_xy-1; + if( h->sh.b_mbaff ) + { + // set to bottom of previous mbpair + if( i_mb_x ) + h->sh.i_last_mb = mb_xy-1+h->mb.i_mb_stride*(!(i_mb_y&1)); + else + h->sh.i_last_mb = (i_mb_y-2+!(i_mb_y&1))*h->mb.i_mb_stride + h->mb.i_mb_width - 1; + } + else + h->sh.i_last_mb = mb_xy-1; break; } else diff --git a/tools/test_x264.py b/tools/test_x264.py index c02e5dcf..bb98b655 100755 --- a/tools/test_x264.py +++ b/tools/test_x264.py @@ -35,6 +35,7 @@ OPTIONS = [ ("", "--intra-refresh"), ("", "--no-cabac"), ("", "--interlaced"), + ("", "--slice-max-size 1000"), ("", "--frame-packing 5"), [ "--preset %s" % p for p in ("ultrafast", "superfast",