[FFmpeg-devel] sws_Context

Michael Niedermayer michaelni at gmx.at
Fri Oct 28 21:54:38 CEST 2011

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.
-------------- 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/20111028/63538426/attachment.asc>

More information about the ffmpeg-devel mailing list