[x264-devel] Fix open-gop with no-psy

Anton Mitrofanov git at videolan.org
Tue Apr 26 07:49:11 CEST 2011


x264 | branch: master | Anton Mitrofanov <BugMaster at narod.ru> | Thu Apr 14 12:14:52 2011 -0700| [f87bc0421e873dd83769e768ee62431f01118999] | committer: Jason Garrett-Glaser

Fix open-gop with no-psy

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

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

diff --git a/encoder/slicetype.c b/encoder/slicetype.c
index 1661d32..0c9ba7a 100644
--- a/encoder/slicetype.c
+++ b/encoder/slicetype.c
@@ -1258,6 +1258,8 @@ void x264_slicetype_analyse( x264_t *h, int keyframe )
      * more RD-optimal. */
     if( (h->param.analyse.b_psy && h->param.rc.b_mb_tree) || vbv_lookahead )
         num_frames = framecnt;
+    else if( h->param.b_open_gop && num_frames < framecnt )
+        num_frames++;
     else if( num_frames == 0 )
     {
         frames[1]->i_type = X264_TYPE_I;
@@ -1280,10 +1282,10 @@ void x264_slicetype_analyse( x264_t *h, int keyframe )
             if( num_frames > 1 )
             {
                 char best_paths[X264_BFRAME_MAX+1][X264_LOOKAHEAD_MAX] = {"","P"};
-                int best_path_index = (num_frames-1) % (X264_BFRAME_MAX+1);
+                int best_path_index = num_frames % (X264_BFRAME_MAX+1);
 
                 /* Perform the frametype analysis. */
-                for( int j = 2; j < num_frames; j++ )
+                for( int j = 2; j <= num_frames; j++ )
                     x264_slicetype_path( h, &a, frames, j, best_paths );
 
                 num_bframes = strspn( best_paths[best_path_index], "B" );



More information about the x264-devel mailing list