[x264-devel] [PATCH] disable bframe adaptive can't work

Limin Wang lance.lmwang at gmail.com
Wed Jul 11 10:23:59 CEST 2007


Hi,

> > Yes, at beginning, I disable the two place also, but by the test, it'll cause
> > scenecut detection can't work as expected. So haven't check adaption in the
> > first two place, I feel it's for scenecut detection. Haven't understand the
> > whole logic yet.
> 
> x264 is first checking for potential B frame. If it decides to reject B 
> frame, then and only then it checks for a potential scenecut. (I 
> personnaly think that the goto/label is reducing ease of understanding a 
> bit).
> In your case, you would want to disable adaptive b frames, but still 
> pass trough the lines 395-400 part.

Thanks, I have updated the patch again. By the test, the result is expected.
Please review it, maybe there are other better way to achieve that?


Thanks,
Limin

-------------- next part --------------
Index: encoder/slicetype.c
===================================================================
--- encoder/slicetype.c	(revision 664)
+++ encoder/slicetype.c	(working copy)
@@ -391,7 +391,11 @@
     if( num_frames == 1 )
     {
 no_b_frames:
-        frames[1]->i_type = X264_TYPE_P;
+        if( h->param.b_bframe_adaptive )
+            frames[1]->i_type = X264_TYPE_P;
+        else 
+            frames[1]->i_type = X264_TYPE_B;
+
         if( h->param.b_pre_scenecut )
         {
             x264_slicetype_frame_cost( h, &a, frames, 0, 1, 1, 0 );
@@ -425,7 +429,7 @@
 //      fprintf( stderr, "frm%d+%d: %d <=> %d, I:%d/%d \n",
 //               frames[0]->i_frame, j-1, pthresh, pcost/i_mb_count,
 //               frames[j+1]->i_intra_mbs[j+1], i_mb_count );
-        if( pcost > pthresh*i_mb_count || frames[j+1]->i_intra_mbs[j+1] > i_mb_count/3 )
+        if( h->param.b_bframe_adaptive && (pcost > pthresh*i_mb_count || frames[j+1]->i_intra_mbs[j+1] > i_mb_count/3) )
         {
             frames[j]->i_type = X264_TYPE_P;
             break;
-------------- next part --------------
_______________________________________________
x264-devel mailing list
x264-devel at videolan.org
http://mailman.videolan.org/listinfo/x264-devel


More information about the x264-devel mailing list