[x264-devel] Fix interlaced + extremal slice-max-size

Jason Garrett-Glaser git at videolan.org
Wed Mar 7 03:20:12 CET 2012


x264 | branch: master | Jason Garrett-Glaser <jason at x264.com> | Mon Feb 13 16:40:32 2012 -0800| [39a4c6fecaaa0d6cde8d89d31ef6cd1d25ab802b] | committer: Jason Garrett-Glaser

Fix interlaced + extremal slice-max-size
Broke if the first macroblock in the slice exceeded the set slice-max-size.

> http://git.videolan.org/gitweb.cgi/x264.git/?a=commit;h=39a4c6fecaaa0d6cde8d89d31ef6cd1d25ab802b
---

 encoder/encoder.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/encoder/encoder.c b/encoder/encoder.c
index 4bb4ec5..c97d6f4 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;



More information about the x264-devel mailing list