]> git.sesse.net Git - vlc/blobdiff - modules/codec/x264.c
contribs: slimmed the OS X package
[vlc] / modules / codec / x264.c
index 6cb4abc42ed50c7e7f8f3f85d527fdd2eb0af731..36eefa5c72531123bc47585b142df4da4c50b0c8 100644 (file)
@@ -142,6 +142,20 @@ static void Close( vlc_object_t * );
 #define INTERLACED_TEXT N_("Interlaced mode")
 #define INTERLACED_LONGTEXT N_( "Pure-interlaced mode.")
 
+#define INTRAREFRESH_TEXT N_("Use Periodic Intra Refresh")
+#define INTRAREFRESH_LONGTEXT N_("Use Periodic Intra Refresh instead of IDR frames")
+
+#define MBTREE_TEXT N_("Use mb-tree ratecontrol")
+#define MBTREE_LONGTEXT N_("You can disable use of Macroblock-tree on ratecontrol")
+
+#define SLICE_COUNT N_("Force number of slices per frame")
+#define SLICE_COUNT_LONGTEXT N_("Force rectangular slices and is overridden by other slicing optinos")
+
+#define SLICE_MAX_SIZE N_("Limit the size of each slice in bytes")
+#define SLICE_MAX_SIZE_LONGTEXT N_("Sets a maximum slice size in bytes, Includes NAL overhead in size")
+
+#define SLICE_MAX_MBS N_("Limit the size of each slice in macroblocks")
+#define SLICE_MAX_MBS_LONGTEXT N_("Sets a maximum number of macroblocks per slice")
 /* Ratecontrol */
 
 #define QP_TEXT N_("Set QP")
@@ -315,6 +329,9 @@ static void Close( vlc_object_t * );
 #define DCT_DECIMATE_LONGTEXT N_( "Coefficient thresholding on P-frames." \
     "Eliminate dct blocks containing only a small single coefficient.")
 
+#define PSY_TEXT N_("Use Psy-optimizations")
+#define PSY_LONGTEXT N_("Use all visual optimizations that can worsen both PSNR and SSIM")
+
 /* Noise reduction 1 is too weak to measure, suggest at least 10 */
 #define NR_TEXT N_("Noise reduction")
 #define NR_LONGTEXT N_( "Dct-domain noise reduction. Adaptive pseudo-deadzone. " \
@@ -451,6 +468,8 @@ vlc_module_begin ()
     add_string( SOUT_CFG_PREFIX "psy-rd", "1.0:0.0", NULL, PSY_RD_TEXT,
                 PSY_RD_LONGTEXT, false )
 
+    add_bool( SOUT_CFG_PREFIX "psy", true, NULL, PSY_TEXT, PSY_LONGTEXT, false )
+
     add_string( SOUT_CFG_PREFIX "level", "5.1", NULL, LEVEL_TEXT,
                LEVEL_LONGTEXT, false )
 
@@ -461,6 +480,11 @@ vlc_module_begin ()
     add_bool( SOUT_CFG_PREFIX "interlaced", false, NULL, INTERLACED_TEXT, INTERLACED_LONGTEXT,
               false )
 
+    add_integer( SOUT_CFG_PREFIX "slices", 0, NULL, SLICE_COUNT, SLICE_COUNT_LONGTEXT, false )
+    add_integer( SOUT_CFG_PREFIX "slice-max-size", 0, NULL, SLICE_MAX_SIZE, SLICE_MAX_SIZE_LONGTEXT, false )
+    add_integer( SOUT_CFG_PREFIX "slice-max-mbs", 0, NULL, SLICE_MAX_MBS, SLICE_MAX_MBS_LONGTEXT, false )
+
+
 /* Ratecontrol */
 
     add_integer( SOUT_CFG_PREFIX "qp", -1, NULL, QP_TEXT, QP_LONGTEXT,
@@ -594,6 +618,11 @@ vlc_module_begin ()
                  LOOKAHEAD_LONGTEXT, false )
         change_integer_range( 0, 60 )
 
+    add_bool( SOUT_CFG_PREFIX "intra-refresh", false, NULL, INTRAREFRESH_TEXT,
+              INTRAREFRESH_LONGTEXT, false )
+
+    add_bool( SOUT_CFG_PREFIX "mbtree", true, NULL, MBTREE_TEXT, MBTREE_LONGTEXT, false )
+
     add_bool( SOUT_CFG_PREFIX "fast-pskip", true, NULL, FAST_PSKIP_TEXT,
               FAST_PSKIP_LONGTEXT, false )
 
@@ -659,8 +688,9 @@ static const char *const ppsz_sout_options[] = {
     "pre-scenecut", "psnr", "qblur", "qp", "qcomp", "qpstep", "qpmax",
     "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", "weightp", "aq-mode",
-    "aq-strength", "psy-rd", "profile", "lookahead", NULL
+    "verbose", "vbv-bufsize", "vbv-init", "vbv-maxrate", "weightb", "weightp",
+    "aq-mode", "aq-strength", "psy-rd", "psy", "profile", "lookahead", "slices",
+    "slice-max-size", "slice-max-mbs", "intra-refresh", "mbtree", NULL
 };
 
 static block_t *Encode( encoder_t *, picture_t * );
@@ -815,6 +845,8 @@ static int  Open ( vlc_object_t *p_this )
         free( psz_val );
     }
 
+    p_sys->param.analyse.b_psy = var_GetBool( p_enc, SOUT_CFG_PREFIX "psy" );
+
     psz_val = var_GetString( p_enc, SOUT_CFG_PREFIX "level" );
     if( psz_val )
     {
@@ -856,6 +888,10 @@ static int  Open ( vlc_object_t *p_this )
     if( i_val >= 0 && i_val <= 16 )
         p_sys->param.i_bframe = i_val;
 
+#if X264_BUILD >= 82
+    p_sys->param.b_intra_refresh = var_GetBool( p_enc, SOUT_CFG_PREFIX "intra-refresh" );
+#endif
+
 #if X264_BUILD >= 78
     psz_val = var_GetString( p_enc, SOUT_CFG_PREFIX "bpyramid" );
     p_sys->param.i_bframe_pyramid = X264_B_PYRAMID_NONE;
@@ -1044,6 +1080,18 @@ static int  Open ( vlc_object_t *p_this )
         p_sys->param.i_fps_den = p_enc->fmt_in.video.i_frame_rate_base;
     }
 
+    /* Check slice-options */
+    i_val = var_GetInteger( p_enc, SOUT_CFG_PREFIX "slices" );
+    if( i_val > 0 )
+        p_sys->param.i_slice_count = i_val;
+    i_val = var_GetInteger( p_enc, SOUT_CFG_PREFIX "slice-max-size" );
+    if( i_val > 0 )
+        p_sys->param.i_slice_max_size = i_val;
+    i_val = var_GetInteger( p_enc, SOUT_CFG_PREFIX "slice-max-mbs" );
+    if( i_val > 0 )
+        p_sys->param.i_slice_max_mbs = i_val;
+
+
     /* x264 vbv-bufsize = 0 (default). if not provided set period
        in seconds for local maximum bitrate (cache/bufsize) based
        on average bitrate when use has told bitrate.
@@ -1123,6 +1171,8 @@ static int  Open ( vlc_object_t *p_this )
         p_sys->param.rc.b_stat_read = i_val & 2;
     }
 
+    p_sys->param.rc.b_mb_tree = var_GetBool( p_enc, SOUT_CFG_PREFIX "mbtree" );
+
     /* We need to initialize pthreadw32 before we open the encoder,
        but only once for the whole application. Since pthreadw32
        doesn't keep a refcount, do it ourselves. */