[x264-devel] Fix two bugs in slice-min-mbs and slices-max

Jason Garrett-Glaser git at videolan.org
Mon Apr 29 21:31:47 CEST 2013


x264 | branch: master | Jason Garrett-Glaser <jason at x264.com> | Mon Apr 29 12:14:01 2013 -0700| [76a5c3a19f97cd34b65aeff050de4042b054bc65] | committer: Jason Garrett-Glaser

Fix two bugs in slice-min-mbs and slices-max

Slices-max broke slice-max-size when slice-max wasn't used.
Slice-min-mbs broke in rare cases near the end of a threadslice.

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

 encoder/encoder.c |    5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/encoder/encoder.c b/encoder/encoder.c
index 21bb136..d091ff5 100644
--- a/encoder/encoder.c
+++ b/encoder/encoder.c
@@ -722,7 +722,8 @@ static int x264_validate_parameters( x264_t *h, int b_open )
         if( h->param.i_slice_max_mbs || h->param.i_slice_max_size )
             h->param.i_slice_count = 0;
     }
-    h->param.i_slice_count_max = X264_MAX( h->param.i_slice_count, h->param.i_slice_count_max );
+    if( h->param.i_slice_count_max > 0 )
+        h->param.i_slice_count_max = X264_MAX( h->param.i_slice_count, h->param.i_slice_count_max );
 
     if( h->param.b_bluray_compat )
     {
@@ -2481,7 +2482,7 @@ reencode:
                      * If possible, roll back to the last checkpoint and try again.
                      * We could try raising QP, but that would break in the case where a slice spans multiple
                      * rows, which the re-encoding infrastructure can't currently handle. */
-                    if( mb_xy < thread_last_mb && (thread_last_mb+1-mb_xy) < h->param.i_slice_min_mbs )
+                    if( mb_xy <= thread_last_mb && (thread_last_mb+1-mb_xy) < h->param.i_slice_min_mbs )
                     {
                         if( thread_last_mb-h->param.i_slice_min_mbs < h->sh.i_first_mb+h->param.i_slice_min_mbs )
                         {



More information about the x264-devel mailing list