[x264-devel] Fix crash with sliced threads and input height <= 112

Anton Mitrofanov git at videolan.org
Mon Jan 16 02:11:53 CET 2012


x264 | branch: master | Anton Mitrofanov <BugMaster at narod.ru> | Wed Dec 21 11:08:56 2011 +0400| [b081d179e741ceffee2217f6fda06779693dce56] | committer: Jason Garrett-Glaser

Fix crash with sliced threads and input height <= 112

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

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

diff --git a/encoder/encoder.c b/encoder/encoder.c
index b1a99e6..0ab200c 100644
--- a/encoder/encoder.c
+++ b/encoder/encoder.c
@@ -472,7 +472,6 @@ static int x264_validate_parameters( x264_t *h, int b_open )
 
     if( h->param.i_threads == X264_THREADS_AUTO )
         h->param.i_threads = x264_cpu_num_processors() * (h->param.b_sliced_threads?2:3)/2;
-    h->param.i_threads = x264_clip3( h->param.i_threads, 1, X264_THREAD_MAX );
     if( h->param.i_threads > 1 )
     {
 #if !HAVE_THREAD
@@ -487,7 +486,8 @@ static int x264_validate_parameters( x264_t *h, int b_open )
             h->param.i_threads = X264_MIN( h->param.i_threads, max_threads );
         }
     }
-    else
+    h->param.i_threads = x264_clip3( h->param.i_threads, 1, X264_THREAD_MAX );
+    if( h->param.i_threads == 1 )
         h->param.b_sliced_threads = 0;
     h->i_thread_frames = h->param.b_sliced_threads ? 1 : h->param.i_threads;
     if( h->i_thread_frames > 1 )



More information about the x264-devel mailing list