]> git.sesse.net Git - x264/commitdiff
Fix y4m input with C420paldv colorspace
authorAnton Mitrofanov <BugMaster@narod.ru>
Tue, 26 Mar 2013 15:54:36 +0000 (19:54 +0400)
committerFiona Glaser <fiona@x264.com>
Tue, 23 Apr 2013 18:47:26 +0000 (11:47 -0700)
input/y4m.c

index 009afa6d7604f1ff2ab32ee924175402e490c2f6..014450cba1130aafa99817e38672676b8c63173e 100644 (file)
@@ -46,7 +46,6 @@ typedef struct
 static int parse_csp_and_depth( char *csp_name, int *bit_depth )
 {
     int csp    = X264_CSP_MAX;
-    *bit_depth = 8;
 
     /* Set colorspace from known variants */
     if( !strncmp( "420", csp_name, 3 ) )
@@ -57,8 +56,8 @@ static int parse_csp_and_depth( char *csp_name, int *bit_depth )
         csp = X264_CSP_I444;
 
     /* Set high bit depth from known extensions */
-    if( !strncmp( "p", csp_name + 3, 1 ) )
-        *bit_depth = strtol( csp_name + 4, NULL, 10 );
+    if( sscanf( csp_name, "%*d%*[pP]%d", bit_depth ) != 1 )
+        *bit_depth = 8;
 
     return csp;
 }