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

Michael Niedermayer michaelni at gmx.at
Wed Dec 18 13:01:30 CET 2013


On Wed, Dec 18, 2013 at 10:42:25AM +0100, Carl Eugen Hoyos wrote:
> Hi!
> 
> Attached patch fixes cbr mjpeg encoding on multi-core hardware.
> 
> Please comment, Carl Eugen

>  frame_thread_encoder.c |    4 ++++
>  1 file changed, 4 insertions(+)
> 711bfe8d8d317fbf74e73a5d5cfefcd04b768333  patchmjpegthreads.diff
> 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->codec_id or avctx->codec->id


> +       && !(avctx->flags & CODEC_FLAG_QSCALE))
> +        avctx->thread_type &= ~FF_THREAD_FRAME;

i would reduce the number of threads to 1
with slice threads you generate jpegs with resync markers, i have no
idea how widely binary decoders support such mjpegs


>      if(   !(avctx->thread_type & FF_THREAD_FRAME)
>         || !(avctx->codec->capabilities & CODEC_CAP_INTRA_ONLY))
>          return 0;

> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel at ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Old school: Use the lowest level language in which you can solve the problem
            conveniently.
New school: Use the highest level language in which the latest supercomputer
            can solve the problem without the user falling asleep waiting.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20131218/d50045e1/attachment.asc>


More information about the ffmpeg-devel mailing list