[FFmpeg-devel] lavfi state of affairs

Michael Niedermayer michaelni
Fri Feb 6 00:52:44 CET 2009


On Thu, Feb 05, 2009 at 03:35:24PM -0800, Baptiste Coudurier wrote:
> On 2/5/2009 3:18 PM, Michael Niedermayer wrote:
[...]
> 
> >>   >>  [...]
> >>   >>
> >>>> 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
> 
> and
> 
> PIX_FMT_BGR8,      ///< packed RGB 3:3:2,  8bpp, (msb)2B 3G 3R(lsb)
> 

> Btw, in cpu endianess ? ;)

yes, in cpu endianness, little endian and big endian, its 1 byte so all at
the same time :)


> 
> So what should gif encoder _use_ ?

i would say PAL8 + BGR8 + RGB8, in principle PAL8 alone should work too
but then some code somewhere has to turn that into BGR8/RGB8.
supporting all 3 directly is slightly nicer i think, it would allow the
user to choose between PAL8 (custom palette) once this is supported and
RGB8 (fixed palette) via -pix_fmt


> 
> 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.

good

[...]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Many things microsoft did are stupid, but not doing something just because
microsoft did it is even more stupid. If everything ms did were stupid they
would be bankrupt already.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20090206/c693ca37/attachment.pgp>



More information about the ffmpeg-devel mailing list