Commit d7443f67 authored by Loren Merritt's avatar Loren Merritt

Configurable level. Levels are still not enforced; it's up to the user to...

Configurable level. Levels are still not enforced; it's up to the user to select a level compatible with the rest of the encoding options.
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
parent 15450dbe
......@@ -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;
......
......@@ -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 );
}
......
......@@ -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;
......
......@@ -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
{
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment