[x264-devel] Yet another updated threaded slicetype patch (v14)

Steven Walters kemuri9 at gmail.com
Wed Apr 15 22:34:01 CEST 2009


I've had some more time to try and nail this down and applying the
following diff on top of the v14 patch i no longer get any seg faults:

diff --git a/encoder/slicetype.c b/encoder/slicetype.c
index f795d4c..a2d62cd 100644
--- a/encoder/slicetype.c
+++ b/encoder/slicetype.c
@@ -364,8 +364,8 @@ static int x264_slicetype_path_cost( x264_t *h,
x264_mb_analysis_t *a, x264_fram
         /* Find the location of the next P-frame. */
         while( path[next_p] && path[next_p] != 'P' )
             next_p++;
-        /* Return if the path doesn't end on a P-frame. */
-        if( path[next_p] != 'P' )
+        /* Return if the path doesn't end on a P-frame or reaches max length */
+        if( path[next_p] != 'P' || next_p > MAX_LENGTH )
             return cost;

         /* Add the cost of the P-frame found above */
@@ -422,7 +422,7 @@ static void x264_slicetype_path( x264_t *h,
x264_mb_analysis_t *a, x264_frame_t

 static int x264_slicetype_path_search( x264_t *h, x264_mb_analysis_t
*a, x264_frame_t **frames, int length, int bframes, int buffer )
 {
-    char best_paths[MAX_LENGTH][MAX_LENGTH] = {"","P"};
+    char best_paths[MAX_LENGTH+1][MAX_LENGTH] = {"","P"};
     int n;
     for( n = 2; n < length-1; n++ )
         x264_slicetype_path( h, a, frames, n, bframes, buffer, best_paths );

this should probably be confirmed as being correct.


More information about the x264-devel mailing list