[FFmpeg-devel] sws_Context

C Chatterjee cchatterj at hotmail.com
Fri Oct 28 22:23:00 CEST 2011

Thanks - just checked the latest FFMPEG. It uses sws_freeContext() instead of av_freep used a year ago.
Will check next time before reporting issues.
Time to upgrade my FFMPEG.

I agree on the surface there does not seem to be any global other than the filters.
So all threads will have all instances of the filters. But since you can not modify them, the code can run from multiple threads.

Thanks again,


Date: Fri, 28 Oct 2011 21:54:38 +0200
From: michaelni at gmx.at
To: ffmpeg-devel at ffmpeg.org
Subject: Re: [FFmpeg-devel] sws_Context

On Fri, Oct 28, 2011 at 05:58:53PM +0000, C Chatterjee wrote:
> I am working with MJPEG 422.
> I noticed the following issues:
> 1. Color conversion from 422 to 420 with sws_Context using SINC filter causes color artifacts.
do not use SINC
> 2. sws_Contexts have memory allocation. In ffmpeg cmdutils.c init_opts() we do:
>     sws_opts = sws_getContext(16, 16, 0, 16, 16, 0, SWS_BICUBIC, NULL, NULL, NULL);
>     and in uninit_opts() we do:
>     av_freep(&sws_opts);
no, uninit_opts() uses sws_freeContext()
>     Are we freeing all memories allocated?
>    See ff_yuv2rgb_c_init_tables() where we do c->yuvTable = av_malloc(1024*3);
> 3. Is sws_Context non-reentrant due to global variables?
There exists nothing with this name in ffmpeg.
If you talk about libswscale, its possible to create multiple contexts
and use them from multiple threads at the same time.
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
Rewriting code that is poorly written but fully understood is good.
Rewriting code that one doesnt understand is a sign that one is less smart
then the original author, trying to rewrite it will not make it better.

ffmpeg-devel mailing list
ffmpeg-devel at ffmpeg.org

More information about the ffmpeg-devel mailing list