[x264-devel] Re: [TRIVIAL PATCH] user-configurable idc level (patch included this time)

Jeff snacky at ikaruga.co.uk
Sat Feb 19 21:44:35 CET 2005


On Sat, Feb 19, 2005 at 02:42:47PM -0600, Jeff wrote:
> If I overlooked some important consideration, please let me know.

ahem... patch attached.
-------------- next part --------------
diff -ruN -x '.*' x264.orig/common/common.c x264/common/common.c
--- x264.orig/common/common.c	2005-02-19 15:03:18.000000000 -0500
+++ x264/common/common.c	2005-02-19 14:59:15.000000000 -0500
@@ -55,6 +55,8 @@
     param->i_fps_num       = 25;
     param->i_fps_den       = 1;
     param->i_maxframes     = 0;
+    param->i_idc_level     = 40; /* level 4.0 is sufficient for 720x576 with 
+                                    16 reference frames */
 
     /* Encoder parameters */
     param->i_frame_reference = 1;
diff -ruN -x '.*' x264.orig/encoder/set.c x264/encoder/set.c
--- x264.orig/encoder/set.c	2005-02-19 15:03:18.000000000 -0500
+++ x264/encoder/set.c	2005-02-19 15:01:56.000000000 -0500
@@ -44,9 +44,6 @@
     else
         sps->i_profile_idc      = PROFILE_BASELINE;
 
-    /* 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;
diff -ruN -x '.*' x264.orig/x264.c x264/x264.c
--- x264.orig/x264.c	2005-02-19 15:03:18.000000000 -0500
+++ x264/x264.c	2005-02-19 14:58:56.000000000 -0500
@@ -139,6 +139,7 @@
              "                                  - 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 @@
 #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 @@
             { "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 @@
             case 'm':
                 param->analyse.i_subpel_refine = atoi(optarg);
                 break;
+            case OPT_LEVEL:
+                param->i_idc_level = atoi(optarg);
+                break;
             case OPT_RCBUF:
                 param->rc.i_rc_buffer_size = atoi(optarg);
                 break;
diff -ruN -x '.*' x264.orig/x264.h x264/x264.h
--- x264.orig/x264.h	2005-02-19 15:03:19.000000000 -0500
+++ x264/x264.h	2005-02-19 14:59:48.000000000 -0500
@@ -94,6 +94,7 @@
     int         i_width;
     int         i_height;
     int         i_csp;  /* CSP of encoded bitstream, only i420 supported */
+    int         i_idc_level; 
 
     struct
     {


More information about the x264-devel mailing list