[Libav-user] Multithread decode and scaler

Nicolas George george at nsup.org
Fri Aug 19 18:13:37 EEST 2022


wolverin via Libav-user (12022-08-19):
> Thanks for the answer.
>  
> Yes, I tried to configure for mjpeg
>  
>     if (!(pInpCdcCtx = avcodec_alloc_context3(pInpCdc)))
>     {
>         PrintError("Error allocate decoder context", (rt = AVERROR(ENOMEM)));
>         return rt;
>     }
>     pInpCdcCtx->thread_count = 4;
>  
> and after your answer I added
>  
>         if (!(pSwsCtx = sws_getContext(pInpCdcCtx->width, pInpCdcCtx->height, pInpCdcCtx->pix_fmt,
>                                     pOutCdcCtx->width, pOutCdcCtx->height, pOutCdcCtx->pix_fmt,
>                                     SCALE_FLAGS, NULL, NULL, NULL)))
>         {
>             PrintError("Error initialize the conversion context", (rt = AVERROR(ENOMEM)));
>             return rt;
>         }
>         else
>              av_opt_set_int(pSwsCtx, "threads", 20, 0);
>  
> But there is no effect, what am I doing wrong?

I do not konw. I notice that vf_scale() is not using
sws_alloc_context(), then setting options then sws_init_context() while
you use sws_getContext(), which includes sws_init_context(), and then
you set the threads options. Therefore, I suspect you need to set the
threads options before sws_init_context() is called.

> >Have you tried setting "threads" option to the sws_scale context? And to
> >the codec context?

Please remember that top-posting is forbidden on this mailing-list; if
you do not know what it means look it up.

Regards,

-- 
  Nicolas George
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <https://ffmpeg.org/pipermail/libav-user/attachments/20220819/c40a86b0/attachment.sig>


More information about the Libav-user mailing list