[FFmpeg-devel] lavfi state of affairs

Baptiste Coudurier baptiste.coudurier
Fri Feb 6 00:35:24 CET 2009

On 2/5/2009 3:18 PM, Michael Niedermayer wrote:
>>> [...]
>>> swscale is messy and cleanup is welcome but thats hardly a reason not
>>> to remove imgconvert/resample which isnt any better.
>>> Also you are comparing a very basic and slow schoolbook implementation
>>> against a highly optimized one, its clear the schoolbook one is
>>> easier to understand and looks cleaner
>> Don't get me wrong, I'm not asking for specific routines to be
>> "schoolbook" like, what I'd like is to have the common code clean and
>> simple.
>> Like a neat func pointer array, with simple selection based on
>> architecture.
> /me points to an empty area with one brick ehm i mean gsoc

Well, yes ...

>>   >>  [...]
>>   >>
>>>> Also libswscale does not support palette output, this makes GIF encoder
>>>> _useless_.
>>> swscale supports 4bit and 8bit palette output with a fixed palette
>> Huh ? PAL8 is not mentioned in isSupportedOut(). Is this a mistake ?
> yes and no
> PAL8 in sws means generic PAL8 with arbitrary palette or maybe optimized
> by sws palette, neither we support.
> fixed palette that imgconvert calls pal8 is bgr8/rgb8 but with a different
> palette than imgconvert (swss is simpler to quantize to)

And here I'm lost, according to avutil.h:

PIX_FMT_PAL8,      ///< 8 bit with PIX_FMT_RGB32 palette


PIX_FMT_BGR8,      ///< packed RGB 3:3:2,  8bpp, (msb)2B 3G 3R(lsb)

Btw, in cpu endianess ? ;)

So what should gif encoder _use_ ?

What you described seems more like PAL8 to me.

>>> imgconvert supportes 8bit with a fixed palette
>>> swscale supports ordered dither providing MUCH higher quality over imgconvert
>>> imgconvert uses only 216 of 256 colors, swscale uses all.
>>> imgconvert does 6 divisions and modulo operations per pixel for pal8
>>> output swscales does 0
>> This is true if you say so.
>>> and gif.c has the imgconvert palette hardcoded. Which id say is not such
>>> a bright idea ...
>> ?? Not libavcodec/gif.c definitely.
> static const rgb_triplet gif_clut[216]
> gif_clut_index() in gif.c, duplicated in libavcodec/imgconvert.c so
> technically it doesnt use code from gif.c but ohh well ...
> and static void glue(RGB_NAME, _to_pal8)() from
> libavcodec/imgconvert_template.c then uses it

Ah well, but this code is only used when picture->data[1] is NULL, which 
should not arise with PAL8, picture->data[1] is passed as "palette" to 
gif_image_write_header. I will even remove it asap.


Baptiste COUDURIER                              GnuPG Key Id: 0x5C1ABAAA
Key fingerprint                 8D77134D20CC9220201FC5DB0AC9325C5C1ABAAA
checking for life_signs in -lkenny... no
FFmpeg maintainer                                  http://www.ffmpeg.org

More information about the ffmpeg-devel mailing list