[x264-devel] commit: Fix bugs in qpfile parsing with omitted QPs (Jason Garrett-Glaser )

git at videolan.org git at videolan.org
Sun Nov 14 08:10:00 CET 2010


x264 | branch: master | Jason Garrett-Glaser <darkshikari at gmail.com> | Sat Nov 13 04:38:44 2010 -0800| [39787c80bdd5992935c480a8eedcfb6d50625334] | committer: Jason Garrett-Glaser 

Fix bugs in qpfile parsing with omitted QPs

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

 x264.c |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/x264.c b/x264.c
index 41054fc..387d7e1 100644
--- a/x264.c
+++ b/x264.c
@@ -1484,7 +1484,8 @@ static void parse_qpfile( cli_opt_t *opt, x264_picture_t *pic, int i_frame )
     while( num < i_frame )
     {
         file_pos = ftell( opt->qpfile );
-        ret = fscanf( opt->qpfile, "%d %c %d\n", &num, &type, &qp );
+        qp = -1;
+        ret = fscanf( opt->qpfile, "%d %c%*[ \t]%d\n", &num, &type, &qp );
         pic->i_type = X264_TYPE_AUTO;
         pic->i_qpplus1 = X264_QP_AUTO;
         if( num > i_frame || ret == EOF )
@@ -1492,7 +1493,7 @@ static void parse_qpfile( cli_opt_t *opt, x264_picture_t *pic, int i_frame )
             fseek( opt->qpfile, file_pos, SEEK_SET );
             break;
         }
-        if( num < i_frame && ret == 3 )
+        if( num < i_frame && ret >= 2 )
             continue;
         if( ret == 3 && qp >= 0 )
             pic->i_qpplus1 = qp+1;



More information about the x264-devel mailing list