]> granicus.if.org Git - libx264/commitdiff
Take into account keyint_max in B-frame decision.
authorLoren Merritt <pengvado@videolan.org>
Thu, 24 Feb 2005 08:17:31 +0000 (08:17 +0000)
committerLoren Merritt <pengvado@videolan.org>
Thu, 24 Feb 2005 08:17:31 +0000 (08:17 +0000)
git-svn-id: svn://svn.videolan.org/x264/trunk@138 df754926-b1dd-0310-bc7b-ec298dee348c

encoder/voptype_decision.c

index c1284ac5530f9d072058d0bfd1c0210040cfac6d..00168cc924e4dc62cd45d25797069b591195ec7e 100644 (file)
@@ -224,6 +224,7 @@ void x264_voptype_analyse( x264_t *h )
     x264_mb_analysis_t a;
     x264_frame_t *frames[X264_BFRAME_MAX+3] = { NULL, };
     int num_frames;
+    int keyint_limit;
     int j;
 
     if( !h->frames.last_nonb )
@@ -231,7 +232,8 @@ void x264_voptype_analyse( x264_t *h )
     frames[0] = h->frames.last_nonb;
     for( j = 0; h->frames.next[j]; j++ )
         frames[j+1] = h->frames.next[j];
-    num_frames = j;
+    keyint_limit = h->param.i_keyint_max - frames[0]->i_frame + h->frames.i_last_idr - 1;
+    num_frames = X264_MIN( j, keyint_limit );
     if( num_frames == 0 )
         return;
     if( num_frames == 1 )