]> git.sesse.net Git - x264/blobdiff - x264.c
Take into account keyint_max in B-frame decision.
[x264] / x264.c
diff --git a/x264.c b/x264.c
index 52d40066c18e74b4502c0ad87c56826248a41a56..415e314f567341bb024f10051981301a7dd67c98 100644 (file)
--- a/x264.c
+++ b/x264.c
@@ -106,6 +106,8 @@ static void Help( x264_param_t *defaults )
              "  -i, --min-keyint <integer>  Minimum GOP size [%d]\n"
              "      --scenecut <integer>    How aggresively to insert extra I frames [%d]\n"
              "  -b, --bframe <integer>      Number of B-frames between I and P [%d]\n"
+             "      --no-b-adapt            Disable adaptive B-frame decision\n"
+             "      --b-bias <integer>      Influences how often B-frames are used [%d]\n"
              "\n"
              "  -c, --cabac                 Enable CABAC\n"
              "  -r, --ref <integer>         Number of reference frames [%d]\n"
@@ -137,8 +139,10 @@ static void Help( x264_param_t *defaults )
              "                                  - none, all\n"
              "      --direct <string>       Direct MV prediction mode [\"temporal\"]\n"
              "                                  - none, spatial, temporal\n"
+             "  -w, --weightb               Weighted prediction for B-frames\n"
              "  -m, --subme <integer>       Subpixel motion estimation quality: 1=fast, 5=best. [%d]\n"
              "\n"
+             "      --level <integer>       Specify IDC level\n"
              "  -s, --sar width:height      Specify Sample Aspect Ratio\n"
              "      --fps <float|rational>  Specify framerate\n"
              "      --frames <integer>      Maximum number of frames to encode\n"
@@ -154,6 +158,7 @@ static void Help( x264_param_t *defaults )
             defaults->i_keyint_min,
             defaults->i_scenecut_threshold,
             defaults->i_bframe,
+            defaults->i_bframe_bias,
             defaults->i_frame_reference,
             defaults->i_deblocking_filter_alphac0,
             defaults->rc.i_qp_constant,
@@ -213,12 +218,17 @@ static int  Parse( int argc, char **argv,
 #define OPT_FRAMES 273
 #define OPT_FPS 274
 #define OPT_DIRECT 275
+#define OPT_LEVEL 276
+#define OPT_NOBADAPT 277
+#define OPT_BBIAS 278
 
         static struct option long_options[] =
         {
             { "help",    no_argument,       NULL, 'h' },
             { "bitrate", required_argument, NULL, 'B' },
             { "bframe",  required_argument, NULL, 'b' },
+            { "no-b-adapt", no_argument,    NULL, OPT_NOBADAPT },
+            { "b-bias",  required_argument, NULL, OPT_BBIAS },
             { "min-keyint",required_argument,NULL,'i' },
             { "keyint",  required_argument, NULL, 'I' },
             { "scenecut",required_argument, NULL, OPT_SCENECUT },
@@ -237,7 +247,9 @@ static int  Parse( int argc, char **argv,
             { "output",  required_argument, NULL, 'o' },
             { "analyse", required_argument, NULL, 'A' },
             { "direct",  required_argument, NULL, OPT_DIRECT },
+            { "weightb", no_argument,       NULL, 'w' },
             { "subme",   required_argument, NULL, 'm' },
+            { "level",   required_argument, NULL, OPT_LEVEL },
             { "rcsens",  required_argument, NULL, OPT_RCSENS },
             { "rcbuf",   required_argument, NULL, OPT_RCBUF },
             { "rcinitbuf",required_argument,NULL, OPT_RCIBUF },
@@ -257,7 +269,7 @@ static int  Parse( int argc, char **argv,
 
         int c;
 
-        c = getopt_long( argc, argv, "hi:I:b:r:cxB:q:nf:o:s:A:m:p:v",
+        c = getopt_long( argc, argv, "hi:I:b:r:cxB:q:nf:o:s:A:m:p:vw",
                          long_options, &long_options_index);
 
         if( c == -1 )
@@ -280,6 +292,12 @@ static int  Parse( int argc, char **argv,
             case 'b':
                 param->i_bframe = atol( optarg );
                 break;
+            case OPT_NOBADAPT:
+                param->b_bframe_adaptive = 0;
+                break;
+            case OPT_BBIAS:
+                param->i_bframe_bias = atol( optarg );
+                break;
             case 'i':
                 param->i_keyint_min = atol( optarg );
                 break;
@@ -382,9 +400,15 @@ static int  Parse( int argc, char **argv,
                 else
                     param->analyse.i_direct_mv_pred = atoi( optarg );
                 break;
+            case 'w':
+                param->analyse.b_weighted_bipred = 1;
+                break;
             case 'm':
                 param->analyse.i_subpel_refine = atoi(optarg);
                 break;
+            case OPT_LEVEL:
+                param->i_level_idc = atoi(optarg);
+                break;
             case OPT_RCBUF:
                 param->rc.i_rc_buffer_size = atoi(optarg);
                 break;
@@ -699,7 +723,7 @@ static int  Encode( x264_param_t  *param, FILE *fyuv, FILE *fout )
 
         /* Do not force any parameters */
         pic.i_type = X264_TYPE_AUTO;
-        if( x264_encoder_encode( h, &nal, &i_nal, &pic ) < 0 )
+        if( x264_encoder_encode( h, &nal, &i_nal, &pic, &pic ) < 0 )
         {
             fprintf( stderr, "x264_encoder_encode failed\n" );
         }