[x264-devel] commit: Give more meaningful error if 1st/2nd pass resolution differ ( Jason Garrett-Glaser )

git version control git at videolan.org
Mon Nov 23 15:17:19 CET 2009


x264 | branch: master | Jason Garrett-Glaser <darkshikari at gmail.com> | Fri Nov 20 23:27:51 2009 -0800| [5ddd61bbfecb6e782b096ddebef127ab73bee006] | committer: Jason Garrett-Glaser 

Give more meaningful error if 1st/2nd pass resolution differ

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

 encoder/ratecontrol.c |   13 ++++++++++++-
 1 files changed, 12 insertions(+), 1 deletions(-)

diff --git a/encoder/ratecontrol.c b/encoder/ratecontrol.c
index 68b288c..720a339 100644
--- a/encoder/ratecontrol.c
+++ b/encoder/ratecontrol.c
@@ -546,13 +546,24 @@ int x264_ratecontrol_new( x264_t *h )
         /* check whether 1st pass options were compatible with current options */
         if( !strncmp( stats_buf, "#options:", 9 ) )
         {
-            int i;
+            int i, j;
             char *opts = stats_buf;
             stats_in = strchr( stats_buf, '\n' );
             if( !stats_in )
                 return -1;
             *stats_in = '\0';
             stats_in++;
+            if( sscanf( opts, "#options: %dx%d", &i, &j ) != 2 )
+            {
+                x264_log( h, X264_LOG_ERROR, "resolution specified in stats file not valid\n" );
+                return -1;
+            }
+            else if( h->param.rc.b_mb_tree && (i != h->param.i_width || j != h->param.i_height)  )
+            {
+                x264_log( h, X264_LOG_ERROR, "MB-tree doesn't support different resolution than 1st pass (%dx%d vs %dx%d)\n",
+                          h->param.i_width, h->param.i_height, i, j );
+                return -1;
+            }
 
             if( ( p = strstr( opts, "bframes=" ) ) && sscanf( p, "bframes=%d", &i )
                 && h->param.i_bframe != i )



More information about the x264-devel mailing list