Commit 1c5ad67d authored by Dennis van Amerongen's avatar Dennis van Amerongen

* backported [17009],[17010] modules/codec/x264.c: x264 options.

parent 4c1995ba
......@@ -102,6 +102,12 @@ static void Close( vlc_object_t * );
#define FILTER_LONGTEXT N_( "Loop filter AlphaC0 and Beta parameters. " \
"Range -6 to 6 for both alpha and beta parameters. -6 means light " \
"filter, 6 means strong.")
#define LEVEL_TEXT N_("H.264 level")
#define LEVEL_LONGTEXT N_( "Specify H.264 level (as defined by Annex A " \
"of the standard). Levels are not enforced; it's up to the user to select " \
"a level compatible with the rest of the encoding options. Range 1 to 5.1 " \
"(10 to 51 is also allowed).")
/* In order to play an interlaced output stream encoded by x264, a decoder needs
mbaff support. r570 is using the 'mb' part and not 'aff' yet; so it's really
......@@ -293,6 +299,15 @@ static void Close( vlc_object_t * );
#define VERBOSE_TEXT N_("Statistics")
#define VERBOSE_LONGTEXT N_( "Print stats for each frame.")
#if X264_BUILD >= 47 /* r518 */
#define SPS_ID_TEXT N_("SPS and PPS id numbers")
#define SPS_ID_LONGTEXT N_( "Set SPS and PPS id numbers to allow concatenating " \
"streams with different settings.")
#endif
#define AUD_TEXT N_("Access unit delimiters")
#define AUD_LONGTEXT N_( "Generate access unit delimiter NAL units.")
#if X264_BUILD >= 24
static char *enc_me_list[] =
{ "", "dia", "hex", "umh", "esa" };
......@@ -366,8 +381,12 @@ vlc_module_begin();
NF_LONGTEXT, VLC_FALSE );
add_deprecated( SOUT_CFG_PREFIX "loopfilter", VLC_FALSE ); /* Deprecated since 0.8.5 */
add_string( SOUT_CFG_PREFIX "filter", "", NULL, FILTER_TEXT,
add_string( SOUT_CFG_PREFIX "deblock", "", NULL, FILTER_TEXT,
FILTER_LONGTEXT, VLC_FALSE );
add_deprecated( SOUT_CFG_PREFIX "filter", VLC_FALSE ); /* Deprecated since 0.8.6 */
add_string( SOUT_CFG_PREFIX "level", "5.1", NULL, LEVEL_TEXT,
LEVEL_LONGTEXT, VLC_FALSE );
#if X264_BUILD >= 51 /* r570 */
add_bool( SOUT_CFG_PREFIX "interlaced", 0, NULL, INTERLACED_TEXT, INTERLACED_LONGTEXT,
......@@ -440,9 +459,10 @@ vlc_module_begin();
/* Analysis */
/* x264 analyse = none (default). set at least "normal" mode. */
add_string( SOUT_CFG_PREFIX "analyse", "normal", NULL, ANALYSE_TEXT,
/* x264 partitions = none (default). set at least "normal" mode. */
add_string( SOUT_CFG_PREFIX "partitions", "normal", NULL, ANALYSE_TEXT,
ANALYSE_LONGTEXT, VLC_FALSE );
add_deprecated( SOUT_CFG_PREFIX "analyse", VLC_FALSE ); /* Deprecated since 0.8.6 */
change_string_list( enc_analyse_list, enc_analyse_list_text, 0 );
add_string( SOUT_CFG_PREFIX "direct", "spatial", NULL, DIRECT_PRED_TEXT,
......@@ -555,6 +575,14 @@ vlc_module_begin();
add_bool( SOUT_CFG_PREFIX "quiet", 0, NULL, QUIET_TEXT,
QUIET_LONGTEXT, VLC_FALSE );
#if X264_BUILD >= 47 /* r518 */
add_integer( SOUT_CFG_PREFIX "sps-id", 0, NULL, SPS_ID_TEXT,
SPS_ID_LONGTEXT, VLC_FALSE );
#endif
add_bool( SOUT_CFG_PREFIX "aud", 0, NULL, AUD_TEXT,
AUD_LONGTEXT, VLC_FALSE );
#if X264_BUILD >= 0x000e /* r81 */
add_bool( SOUT_CFG_PREFIX "verbose", 0, NULL, VERBOSE_TEXT,
VERBOSE_LONGTEXT, VLC_FALSE );
......@@ -566,14 +594,15 @@ vlc_module_end();
* Local prototypes
*****************************************************************************/
static const char *ppsz_sout_options[] = {
"8x8dct", "analyse", "asm", "bframes", "bime", "bpyramid", "b-adapt",
"b-bias", "b-rdo", "cabac", "chroma-me", "chroma-qp-offset", "cplxblur",
"crf", "dct-decimate", "deadzone-inter", "deadzone-intra", "direct",
"direct-8x8", "filter", "fast-pskip", "frameref", "interlaced", "ipratio",
"keyint", "keyint-min", "loopfilter", "me", "merange", "min-keyint",
"mixed-refs", "nf", "nr", "pbratio", "psnr", "qblur", "qp", "qcomp",
"qpstep", "qpmax", "qpmin", "qp-max", "qp-min", "quiet", "ratetol",
"ref", "scenecut", "ssim", "subme", "subpel", "tolerance", "trellis", "verbose",
"8x8dct", "analyse", "asm", "aud", "bframes", "bime", "bpyramid",
"b-adapt", "b-bias", "b-rdo", "cabac", "chroma-me", "chroma-qp-offset",
"cplxblur", "crf", "dct-decimate", "deadzone-inter", "deadzone-intra",
"deblock", "direct", "direct-8x8", "filter", "fast-pskip", "frameref",
"interlaced", "ipratio", "keyint", "keyint-min", "level", "loopfilter",
"me", "merange", "min-keyint", "mixed-refs", "nf", "nr", "partitions",
"pbratio", "psnr", "qblur", "qp", "qcomp", "qpstep", "qpmax", "qpmin",
"qp-max", "qp-min", "quiet", "ratetol", "ref", "scenecut", "sps-id",
"ssim", "subme", "subpel", "tolerance", "trellis", "verbose",
"vbv-bufsize", "vbv-init", "vbv-maxrate", "weightb", NULL
};
......@@ -610,7 +639,7 @@ static int Open ( vlc_object_t *p_this )
#if X264_BUILD < 37
if( p_enc->fmt_in.video.i_width % 16 != 0 ||
p_enc->fmt_in.video.i_height % 16!= 0 )
p_enc->fmt_in.video.i_height % 16 != 0 )
{
msg_Warn( p_enc, "size is not a multiple of 16 (%ix%i)",
p_enc->fmt_in.video.i_width, p_enc->fmt_in.video.i_height );
......@@ -711,7 +740,7 @@ static int Open ( vlc_object_t *p_this )
var_Get( p_enc, SOUT_CFG_PREFIX "nf", &val );
p_sys->param.b_deblocking_filter = !val.b_bool;
var_Get( p_enc, SOUT_CFG_PREFIX "filter", &val );
var_Get( p_enc, SOUT_CFG_PREFIX "deblock", &val );
if( val.psz_string )
{
char *p = strchr( val.psz_string, ':' );
......@@ -720,6 +749,16 @@ static int Open ( vlc_object_t *p_this )
free( val.psz_string );
}
var_Get( p_enc, SOUT_CFG_PREFIX "level", &val );
if( val.psz_string )
{
if( atof (val.psz_string) < 6 )
p_sys->param.i_level_idc = (int) ( 10 * atof (val.psz_string) + .5);
else
p_sys->param.i_level_idc = atoi (val.psz_string);
free( val.psz_string );
}
#if X264_BUILD >= 51 /* r570 */
var_Get( p_enc, SOUT_CFG_PREFIX "interlaced", &val );
p_sys->param.b_interlaced = val.b_bool;
......@@ -748,6 +787,14 @@ static int Open ( vlc_object_t *p_this )
var_Get( p_enc, SOUT_CFG_PREFIX "quiet", &val );
if( val.b_bool ) p_sys->param.i_log_level = X264_LOG_NONE;
#if X264_BUILD >= 47 /* r518 */
var_Get( p_enc, SOUT_CFG_PREFIX "sps-id", &val );
if( val.i_int >= 0 ) p_sys->param.i_sps_id = val.i_int;
#endif
var_Get( p_enc, SOUT_CFG_PREFIX "aud", &val );
if( val.b_bool ) p_sys->param.b_aud = val.b_bool;
var_Get( p_enc, SOUT_CFG_PREFIX "keyint", &val );
#if X264_BUILD >= 0x000e
if( val.i_int > 0 ) p_sys->param.i_keyint_max = val.i_int;
......@@ -928,7 +975,7 @@ static int Open ( vlc_object_t *p_this )
#ifndef X264_ANALYSE_BSUB16x16
# define X264_ANALYSE_BSUB16x16 0
#endif
var_Get( p_enc, SOUT_CFG_PREFIX "analyse", &val );
var_Get( p_enc, SOUT_CFG_PREFIX "partitions", &val );
if( !strcmp( val.psz_string, "none" ) )
{
p_sys->param.analyse.inter = 0;
......
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