[x264-devel] commit: Add optional more optimal B-frame decision method ( Jason Garrett-Glaser )

Dave Brueck x264list at protoven.com
Mon Sep 15 20:47:35 CEST 2008


On Sep 14, 2008, at 10:24 PM, git version control wrote:

> Add optional more optimal B-frame decision method
> This method (--b-adapt 2) uses a Viterbi algorithm somewhat similar  
> to that used in trellis quantization.
[snip]
> This patch also reads b_adapt and scenecut settings from the first  
> pass so that the x264 header information in the output file will  
> have correct information (since frametype decision is only done on  
> the first pass).
[snip]
>
> Diff:   http://git.videolan.org/gitweb.cgi/x264.git/?a=commitdiff;h=9818865c1f5eccbc04fb51f062cb1b3abff02db0

I've been trying the above patch and now get "x264_encoder_open  
failed" errors when encoding content without b-frames. Is it possible  
that b-frames are now accidentally "required" for multi-pass encodes  
due to the following?

--- a/encoder/ratecontrol.c
+++ b/encoder/ratecontrol.c
@@ -397,6 +397,25 @@ int x264_ratecontrol_new( x264_t *h )

+
+            if( ( p = strstr( opts, "b_adapt=" ) ) && sscanf( p,  
"b_adapt=%d", &i ) && i >= X264_B_ADAPT_NONE && i <=  
X264_B_ADAPT_TRELLIS )
+                h->param.i_bframe_adaptive = i;
+            else
+            {
+                x264_log( h, X264_LOG_ERROR, "b_adapt method  
specified in stats file not valid\n" );
+                return -1;
+            }

If b_adapt isn't present in the 1st-pass stats file, you get the  
error... where probably it should be doing the validation only if  
b_adapt is in the first pass stats file. Looking at the code, it seems  
that b_adapt is written to the stats file only if i_bframe != 0.

Apologies in advance if I'm reading it wrong,
-Dave


More information about the x264-devel mailing list