[FFmpeg-devel] [PATCH]Do not use mjpeg frame-threads with cbr and threads=auto

Carl Eugen Hoyos cehoyos at ag.or.at
Wed Dec 18 10:42:25 CET 2013


Hi!

Attached patch fixes cbr mjpeg encoding on multi-core hardware.

Please comment, Carl Eugen
-------------- next part --------------
diff --git a/libavcodec/frame_thread_encoder.c b/libavcodec/frame_thread_encoder.c
index b9acefc..977f011 100644
--- a/libavcodec/frame_thread_encoder.c
+++ b/libavcodec/frame_thread_encoder.c
@@ -121,6 +121,10 @@ int ff_frame_thread_encoder_init(AVCodecContext *avctx, AVDictionary *options){
     ThreadContext *c;
 
 
+    if(   !avctx->thread_count
+       && !strcmp(avctx->codec->name, "mjpeg")
+       && !(avctx->flags & CODEC_FLAG_QSCALE))
+        avctx->thread_type &= ~FF_THREAD_FRAME;
     if(   !(avctx->thread_type & FF_THREAD_FRAME)
        || !(avctx->codec->capabilities & CODEC_CAP_INTRA_ONLY))
         return 0;


More information about the ffmpeg-devel mailing list