Commit 5d744b40 authored by Antoine Cellerier's avatar Antoine Cellerier

x264 options patch by Alex Izvorski (plus some checks on x264 version)

"This patch adds some missing x264 options, namely: me, merange, no-psnr,
no-b-adapt, b-bias.  The names and expected values are exactly the same
as for the x264 commandline encoder."
parent 406c3f7c
......@@ -8,6 +8,7 @@ Michel Lespinasse <walken at zoy.org> - AC3 decoder, MPEG audio and video decode
The VideoLAN team would like to thank the following contributors:
Alex Izvorski <aizvorski at gmail dot com> - some more x264 options
André de Barros Martins Ribeiro <andrerib at ajato.com.br> - Brazilian portuguese localization
Andre Pang <adre.pang at csiro dot au> - Annodex support
Andres Krapf <dae at via.ecp.fr> - FreeBSD port and tests, KDE interface
......
......@@ -118,6 +118,37 @@ static void Close( vlc_object_t * );
"tradeoffs involved in the motion estimation decision process " \
"(lower = quicker and higher = better quality)." )
#define ME_TEXT N_("Motion estimation algorithm.")
#define ME_LONGTEXT N_( "Selects the motion estimation algorithm: "\
" dia - diamond (fastest) \n" \
" hex - hexagon (default setting) \n" \
" umh - uneven multi-hexagon (better but slower) \n" \
" esa - exhaustive search (extremely slow, primarily for testing) " )
#define MERANGE_TEXT N_("Motion estimation search range.")
#define MERANGE_LONGTEXT N_( "Maximum distance to search for motion estimation, "\
"measured from predicted position(s). Default of 16 is good for most footage, "\
"high motion sequences may benefit from settings between 24-32." )
#define NO_PSNR_TEXT N_("Disable PSNR calculation.")
#define NO_PSNR_LONGTEXT N_( "This has no effect on actual encoding quality, "\
"it just prevents the stats from being calculated (for speed)." )
#define NO_B_ADAPT_TEXT N_("Disable adaptive B-frames.")
#define NO_B_ADAPT_LONGTEXT N_( "If this is on, the specified number of consequtive B-frames "\
"will always be used, except possibly before an I-frame. " )
#define B_BIAS_TEXT N_("Bias the choice to use B-frames.")
#define B_BIAS_LONGTEXT N_( "Positive values cause more= B-frames, negative values cause less B-frames. " )
#if X264_BUILD >= 23
static char *enc_me_list[] =
{ "", "dia", "hex", "umh", "esa" };
static char *enc_me_list_text[] =
{ N_("default"), N_("dia"), N_("hex"), N_("umh"), N_("esa") };
#endif
static char *enc_analyse_list[] =
{ "", "all", "normal", "fast", "none" };
static char *enc_analyse_list_text[] =
......@@ -196,6 +227,29 @@ vlc_module_begin();
change_integer_range( 1, 5 );
#endif
#if X264_BUILD >= 23
/* r221 */ add_string( SOUT_CFG_PREFIX "me", "hex", NULL, ME_TEXT,
ME_LONGTEXT, VLC_FALSE );
change_string_list( enc_me_list, enc_me_list_text, 0 );
/* r221 */ add_integer( SOUT_CFG_PREFIX "merange", 16, NULL, MERANGE_TEXT,
MERANGE_LONGTEXT, VLC_FALSE );
change_integer_range( 1, 64 );
#endif
/* r44 */ add_bool( SOUT_CFG_PREFIX "no-psnr", 0, NULL, NO_PSNR_TEXT,
NO_PSNR_LONGTEXT, VLC_FALSE );
#if X264_BUILD >= 0x0013
/* r137 */ add_bool( SOUT_CFG_PREFIX "no-b-adapt", 0, NULL, NO_B_ADAPT_TEXT,
NO_B_ADAPT_LONGTEXT, VLC_FALSE );
/* r137 */ add_integer( SOUT_CFG_PREFIX "b-bias", 0, NULL, B_BIAS_TEXT,
B_BIAS_LONGTEXT, VLC_FALSE );
change_integer_range( -100, 100 );
#endif
vlc_module_end();
/*****************************************************************************
......@@ -204,7 +258,8 @@ vlc_module_end();
static const char *ppsz_sout_options[] = {
"qp", "qp-min", "qp-max", "cabac", "loopfilter", "analyse",
"keyint", "keyint-min", "bframes", "bpyramid", "frameref", "scenecut",
"subpel", "tolerance", "vbv-maxrate", "vbv-bufsize", "vbv-init", NULL
"subpel", "me", "merange", "no-psnr", "no-b-adapt", "b-bias", "tolerance",
"vbv-maxrate", "vbv-bufsize", "vbv-init", NULL
};
static block_t *Encode( encoder_t *, picture_t * );
......@@ -370,6 +425,42 @@ static int Open ( vlc_object_t *p_this )
p_sys->param.analyse.i_subpel_refine = val.i_int;
#endif
#if X264_BUILD >= 23
var_Get( p_enc, SOUT_CFG_PREFIX "me", &val );
if( !strcmp( val.psz_string, "dia" ) )
{
p_sys->param.analyse.i_me_method = X264_ME_DIA;
}
else if( !strcmp( val.psz_string, "hex" ) )
{
p_sys->param.analyse.i_me_method = X264_ME_HEX;
}
else if( !strcmp( val.psz_string, "umh" ) )
{
p_sys->param.analyse.i_me_method = X264_ME_UMH;
}
else if( !strcmp( val.psz_string, "esa" ) )
{
p_sys->param.analyse.i_me_method = X264_ME_ESA;
}
if( val.psz_string ) free( val.psz_string );
var_Get( p_enc, SOUT_CFG_PREFIX "merange", &val );
if( val.i_int >= 1 && val.i_int <= 64 ) p_sys->param.analyse.i_me_range = val.i_int;
#endif
var_Get( p_enc, SOUT_CFG_PREFIX "no-psnr", &val );
p_sys->param.analyse.b_psnr = ! val.b_bool;
#if X264_BUILD >= 0x0013
var_Get( p_enc, SOUT_CFG_PREFIX "no-b-adapt", &val );
p_sys->param.b_bframe_adaptive = ! val.b_bool;
var_Get( p_enc, SOUT_CFG_PREFIX "b-bias", &val );
if( val.i_int >= -100 && val.i_int <= 100 )
p_sys->param.i_bframe_bias = val.i_int;
#endif
#ifndef X264_ANALYSE_BSUB16x16
# define X264_ANALYSE_BSUB16x16 0
#endif
......
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