[vlc-devel] commit: FFmpeg: create --ffmpeg-fast to enable CODEC_FLAG2_FAST ( Jean-Baptiste Kempf )

git version control git at videolan.org
Sun May 3 17:06:45 CEST 2009


vlc | branch: master | Jean-Baptiste Kempf <jb at videolan.org> | Sun May  3 16:58:44 2009 +0200| [6ea16503aba418406737e190d220a3b62a26e553] | committer: Jean-Baptiste Kempf 

FFmpeg: create --ffmpeg-fast to enable CODEC_FLAG2_FAST

This makes decoding faster but could lead to errors.
Pointed by Jason, and original code by Ludovic Fauvet.

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

 modules/codec/avcodec/avcodec.c |    1 +
 modules/codec/avcodec/avcodec.h |    4 ++++
 modules/codec/avcodec/video.c   |    3 +++
 3 files changed, 8 insertions(+), 0 deletions(-)

diff --git a/modules/codec/avcodec/avcodec.c b/modules/codec/avcodec/avcodec.c
index c4f9ff3..0d4026e 100644
--- a/modules/codec/avcodec/avcodec.c
+++ b/modules/codec/avcodec/avcodec.c
@@ -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 ()
diff --git a/modules/codec/avcodec/avcodec.h b/modules/codec/avcodec/avcodec.h
index be0f1d1..88ba3eb 100644
--- a/modules/codec/avcodec/avcodec.h
+++ b/modules/codec/avcodec/avcodec.h
@@ -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 " \
diff --git a/modules/codec/avcodec/video.c b/modules/codec/avcodec/video.c
index 4aafc2e..1c2a2ef 100644
--- a/modules/codec/avcodec/video.c
+++ b/modules/codec/avcodec/video.c
@@ -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 );




More information about the vlc-devel mailing list