]> git.sesse.net Git - vlc/commitdiff
FFmpeg: create --ffmpeg-fast to enable CODEC_FLAG2_FAST
authorJean-Baptiste Kempf <jb@videolan.org>
Sun, 3 May 2009 14:58:44 +0000 (16:58 +0200)
committerJean-Baptiste Kempf <jb@videolan.org>
Sun, 3 May 2009 15:01:33 +0000 (17:01 +0200)
This makes decoding faster but could lead to errors.
Pointed by Jason, and original code by Ludovic Fauvet.

modules/codec/avcodec/avcodec.c
modules/codec/avcodec/avcodec.h
modules/codec/avcodec/video.c

index c4f9ff3470947bd84b41d86529b34d8873a7083a..0d4026e275fb4cc9ae49a0dae44f61818d4cbce0 100644 (file)
@@ -121,6 +121,7 @@ vlc_module_begin ()
     add_integer ( "ffmpeg-lowres", 0, NULL, LOWRES_TEXT, LOWRES_LONGTEXT,
         true )
         change_integer_range( 0, 2 )
+    add_bool( "ffmpeg-fast", 0, NULL, FAST_TEXT, FAST_LONGTEXT, true )
     add_integer ( "ffmpeg-skiploopfilter", 0, NULL, SKIPLOOPF_TEXT,
                   SKIPLOOPF_LONGTEXT, true )
         change_safe ()
index be0f1d1912c9ed20b4cb542926828a58194d8beb..88ba3ebf99cb4444e5d37d995015f3825a878793 100644 (file)
@@ -91,6 +91,10 @@ void EndAudioDec( decoder_t *p_dec );
     "when there is not enough time. It's useful with low CPU power " \
     "but it can produce distorted pictures.")
 
+#define FAST_TEXT N_("Allow speed tricks")
+#define FAST_LONGTEXT N_( \
+    "Allow non specification compliant speedup tricks. Faster but error-prone.")
+
 #define SKIP_FRAME_TEXT N_("Skip frame (default=0)")
 #define SKIP_FRAME_LONGTEXT N_( \
     "Force skipping of frames to speed up decoding " \
index 4aafc2e12b09e883c9a1f738e6b48df10870787f..1c2a2efc8eaa73d6279458041dcf17e0cfe0d206 100644 (file)
@@ -228,6 +228,9 @@ int InitVideoDec( decoder_t *p_dec, AVCodecContext *p_context,
     if( val.i_int > 2 ) p_sys->p_context->skip_loop_filter = AVDISCARD_NONKEY;
     if( val.i_int > 3 ) p_sys->p_context->skip_loop_filter = AVDISCARD_ALL;
 
+    bool b_fast = var_CreateGetBool( p_dec, "ffmpeg-fast" );
+    if( b_fast ) p_sys->p_context->flags2 |= CODEC_FLAG2_FAST;
+
     /* ***** ffmpeg frame skipping ***** */
     var_Create( p_dec, "ffmpeg-hurry-up", VLC_VAR_BOOL | VLC_VAR_DOINHERIT );
     var_Get( p_dec, "ffmpeg-hurry-up", &val );