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

git version control git at videolan.org
Tue Oct 20 17:16:46 CEST 2009


vlc | branch: 1.0-bugfix | Ilkka Ollakka <ileoo at videolan.org> | Wed Aug 19 16:11:23 2009 +0300| [9bc5d5cfbf4102ac7611d283435f18735e61e74c] | 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},...."

(Cherry-picked from: e3e4c0d76e3381d23f2b9cd7a34235c562ded973)

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=9bc5d5cfbf4102ac7611d283435f18735e61e74c
---

 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 243bcba..f73b0be 100644
--- a/modules/codec/x264.c
+++ b/modules/codec/x264.c
@@ -130,6 +130,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 */
@@ -398,6 +402,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[] =
@@ -485,6 +492,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 )
@@ -732,7 +743,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",NULL
+    "aq-strength", "profile", NULL
 };
 
 static block_t *Encode( encoder_t *, picture_t * );
@@ -1255,6 +1266,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) )




More information about the vlc-devel mailing list