[vlc-devel] commit: x264: add profile-limitter, pretty much same as in x264.exe ( Ilkka Ollakka )

Kaarlo Räihä agent_007 at luukku.com
Wed Aug 19 21:41:14 CEST 2009


Thanks. This was really needed patch. Should this be added to NEWS?

git version control kirjoitti 19.08.2009 kello 16:13:
> vlc | branch: master | Ilkka Ollakka <ileoo at videolan.org> | Wed Aug 19
> 16:11:23 2009 +0300| [e3e4c0d76e3381d23f2b9cd7a34235c562ded973] |
> committer: Ilkka Ollakka 
> 
> x264: add profile-limitter, pretty much same as in x264.exe
> 
> so eg mobile-stream goes like this
> --sout="#transcode{vcodec=h264,venc=x264{profile=baseline,level=12},...."
> 
> >
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=e3e4c0d76e3381d23f2b9
> cd7a34235c562ded973
> ---
> 
>  modules/codec/x264.c |   34 +++++++++++++++++++++++++++++++++-
>  1 files changed, 33 insertions(+), 1 deletions(-)
> 
> diff --git a/modules/codec/x264.c b/modules/codec/x264.c
> index ed07e0c..cf53ecd 100644
> --- a/modules/codec/x264.c
> +++ b/modules/codec/x264.c
> @@ -128,6 +128,10 @@ static void Close( vlc_object_t * );
> "a level compatible with the rest of the encoding options. Range 1 to
> 5.1 " \
>      "(10 to 51 is also allowed).")
>  
> +#define PROFILE_TEXT N_("H.264 profile")
> +#define PROFILE_LONGTEXT N_("Specify H.264 profile which limits are
> enforced over" \
> +        "other settings" )
> +
> /* 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
>     'pure-interlaced' mode */
> @@ -403,6 +407,9 @@ static const char *const enc_me_list_text[] =
>    { N_("dia"), N_("hex"), N_("umh"), N_("esa"), N_("tesa") };
>  #endif
>  
> +static const char *const profile_list[] =
> +  { "baseline", "main", "high" };
> +
>  static const char *const enc_analyse_list[] =
>    { "none", "fast", "normal", "slow", "all" };
>  static const char *const enc_analyse_list_text[] =
> @@ -495,6 +502,10 @@ vlc_module_begin ()
>      add_string( SOUT_CFG_PREFIX "level", "5.1", NULL, LEVEL_TEXT,
>                 LEVEL_LONGTEXT, false )
>  
> +    add_string( SOUT_CFG_PREFIX "profile", "high", NULL, PROFILE_TEXT,
> +               PROFILE_LONGTEXT, false )
> +        change_string_list( profile_list, profile_list, 0 );
> +
>  #if X264_BUILD >= 51 /* r570 */
> add_bool( SOUT_CFG_PREFIX "interlaced", 0, NULL, INTERLACED_TEXT,
> INTERLACED_LONGTEXT,
>                false )
> @@ -742,7 +753,7 @@ static const char *const ppsz_sout_options[] = {
>      "qpmin", "qp-max", "qp-min", "quiet", "ratetol", "ref", "scenecut",
>      "sps-id", "ssim", "stats", "subme", "subpel", "tolerance",
>  "trellis",
> "verbose", "vbv-bufsize", "vbv-init", "vbv-maxrate", "weightb",
> "aq-mode",
> -    "aq-strength", "psy-rd", NULL
> +    "aq-strength", "psy-rd", "profile", NULL
>  };
>  
>  static block_t *Encode( encoder_t *, picture_t * );
> @@ -1272,6 +1283,27 @@ static int  Open ( vlc_object_t *p_this )
>          p_sys->param.rc.i_vbv_buffer_size /= p_sys->param.i_fps_num;
>      }
>  
> +    /* Check if user has given some profile (baseline,main,high) to
>  limit
> +     * settings, and apply those*/
> +    var_Get( p_enc, SOUT_CFG_PREFIX "profile", &val );
> +    if( val.psz_string )
> +    {
> +        if( !strcasecmp( val.psz_string, "baseline" ) )
> +        {
> +            msg_Dbg( p_enc, "Limiting to baseline profile");
> +            p_sys->param.analyse.b_transform_8x8 = 0;
> +            p_sys->param.b_cabac = 0;
> +            p_sys->param.i_bframe = 0;
> +        }
> +        else if (!strcasecmp( val.psz_string, "main" ) )
> +        {
> +            msg_Dbg( p_enc, "Limiting to main-profile");
> +            p_sys->param.analyse.b_transform_8x8 = 0;
> +        }
> +        /* high profile don't restrict stuff*/
> +    }
> +    free( val.psz_string );
> +
>  
>      unsigned i_cpu = vlc_CPU();
>      if( !(i_cpu & CPU_CAPABILITY_MMX) )
> 
> _______________________________________________
> vlc-devel mailing list
> To unsubscribe or modify your subscription options:
> http://mailman.videolan.org/listinfo/vlc-devel


....................................................................
Luukku Plus -paketilla pääset eroon tila- ja turvallisuusongelmista.
Hanki Luukku Plus ja helpotat elämääsi. http://www.mtv3.fi/luukku



More information about the vlc-devel mailing list