]> granicus.if.org Git - libx264/commitdiff
Configurable level. Levels are still not enforced; it's up to the user to select...
authorLoren Merritt <pengvado@videolan.org>
Sun, 20 Feb 2005 01:26:03 +0000 (01:26 +0000)
committerLoren Merritt <pengvado@videolan.org>
Sun, 20 Feb 2005 01:26:03 +0000 (01:26 +0000)
Patch by Jeff Clagg <snacky at ikaruga dot co dot uk>.

git-svn-id: svn://svn.videolan.org/x264/trunk@132 df754926-b1dd-0310-bc7b-ec298dee348c

common/common.c
encoder/set.c
x264.c
x264.h

index 9550df1ee9ec6ffca081dbc3bf0aee201077cf32..dbdc3f0db59bf6dde3edf54167c3121ad83da831 100644 (file)
@@ -55,6 +55,8 @@ void    x264_param_default( x264_param_t *param )
     param->i_fps_num       = 25;
     param->i_fps_den       = 1;
     param->i_maxframes     = 0;
+    param->i_level_idc     = 40; /* level 4.0 is sufficient for 720x576 with 
+                                    16 reference frames */
 
     /* Encoder parameters */
     param->i_frame_reference = 1;
index 8d559d3c59e096edae0f49e808748dadea12f575..1adb819fc661ea66031c13c13e81920fdabbe2ec 100644 (file)
@@ -43,10 +43,8 @@ void x264_sps_init( x264_sps_t *sps, int i_id, x264_param_t *param )
         sps->i_profile_idc      = PROFILE_MAIN;
     else
         sps->i_profile_idc      = PROFILE_BASELINE;
+    sps->i_level_idc = param->i_level_idc;
 
-    /* FIXME: level 4.0 is sufficient for 720x576 with 16 reference frames,
-     * but this should be adjustable */
-    sps->i_level_idc        = 40;
     sps->b_constraint_set0  = 0;
     sps->b_constraint_set1  = 0;
     sps->b_constraint_set2  = 0;
@@ -213,7 +211,7 @@ void x264_sps_write( bs_t *s, x264_sps_t *sps )
             }
             else
             {
-                bs_write( s, 8, 255);   /* aspect_ration_idc (extented) */
+                bs_write( s, 8, 255);   /* aspect_ratio_idc (extented) */
                 bs_write( s, 16, sps->vui.i_sar_width );
                 bs_write( s, 16, sps->vui.i_sar_height );
             }
diff --git a/x264.c b/x264.c
index 52d40066c18e74b4502c0ad87c56826248a41a56..3ffa4f22c01a750f4b204acc3ff4b161196be1b9 100644 (file)
--- a/x264.c
+++ b/x264.c
@@ -139,6 +139,7 @@ static void Help( x264_param_t *defaults )
              "                                  - none, spatial, temporal\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"
@@ -213,6 +214,7 @@ static int  Parse( int argc, char **argv,
 #define OPT_FRAMES 273
 #define OPT_FPS 274
 #define OPT_DIRECT 275
+#define OPT_LEVEL 276
 
         static struct option long_options[] =
         {
@@ -238,6 +240,7 @@ static int  Parse( int argc, char **argv,
             { "analyse", required_argument, NULL, 'A' },
             { "direct",  required_argument, NULL, OPT_DIRECT },
             { "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 },
@@ -385,6 +388,9 @@ static int  Parse( int argc, char **argv,
             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;
diff --git a/x264.h b/x264.h
index fa24186a3c9c9956849295daf7128b5746077fc9..1c1b325118e0508c7365c3e849e7e804b68e497f 100644 (file)
--- a/x264.h
+++ b/x264.h
@@ -94,6 +94,7 @@ typedef struct
     int         i_width;
     int         i_height;
     int         i_csp;  /* CSP of encoded bitstream, only i420 supported */
+    int         i_level_idc; 
 
     struct
     {