[FFmpeg-devel] [PATCH] swscale sometimes treats PIX_FMT_RGB8 as paletted sometimes not

Michael Niedermayer michaelni
Wed Jun 6 02:35:40 CEST 2007


On Thu, May 31, 2007 at 03:58:49PM +0200, Reimar D?ffinger wrote:
> Hello,
> currently
> http://movies.apple.com/trailers/fox/ice_age_2/images5/ia2_tsr_land_r4c5a.mov
> plays wrong in MPlayer because it uses libswscale to convert it to
> non-paletted (ffplay does it somehow else).
> The problem is that in swscale.c, line 2521 the palette is only
> converted to YUV for PIX_FMT_PAL8 but not PIX_FMT_BGR8 and PIX_FMT_RGB8.
> While that is correct if PIX_FMT_BGR8 is supposed to be a different,
> non-paletted format that does not fit swscale_template.c, line 2541:
> >     else if (srcFormat==PIX_FMT_RGB8 || srcFormat==PIX_FMT_BGR8 || srcFormat==PIX_FMT_PAL8 || srcFormat==PIX_FMT_BGR4_BYTE  || srcFormat==PIX_FMT_RGB4_BYTE)
> >        {
> >	        RENAME(palToY)(formatConvBuffer, src, srcW, pal);
> I would propose attached patch as a quick hack that IMO at least doesn't
> make things worse, but feel free to implement a proper solution ;-) (I

iam fine with the patch if you are fine with being flamed if it does break
something :)

> will care of the MPlayer side if you make swscale consistent and explain
> how things are supposed to work - esp. when e.g. setting destination
> format to PIX_FMT_PAL8, things like where it will take the palette from
> (generate it, generate it only if the source has none, ...?)).

well the BGR8 and similar stuff was definitly intended to be 332 style non
paletted format originally, that though doesnt mean we shouldnt give it
a 332 palette ...

about PAL output, IIRC there was someone (alex?) working on that

also note that the ELBG codebook generator should be very well capable
of generating a good palette (256 3 component codebooks)

Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

There will always be a question for which you do not know the correct awnser.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20070606/70b7e3b4/attachment.pgp>

More information about the ffmpeg-devel mailing list