[MPlayer-dev-eng] [PATCH] (bit hackish) palette support for libav*

Reimar Döffinger Reimar.Doeffinger at stud.uni-karlsruhe.de
Mon Jan 29 18:29:15 CET 2007


Hello,
On Mon, Jan 29, 2007 at 05:52:54PM +0100, Michael Niedermayer wrote:
> On Mon, Jan 29, 2007 at 02:34:19PM +0100, Reimar Doeffinger wrote:
> > attached patch fixes e.g.
> > http://samples.mplayerhq.hu/V-codecs/KMVC/AIRSTRKE.AVI on big-endian
> > and
> > http://samples.mplayerhq.hu/game-formats/interplay-mve/baldursgate-camp.mve
> > in general.
> > Does it seems clean enough for you to be applied as-is (and yes, I
> > noticed AVPaletteControl is deprecated and the later file probably
> > should preferably be fixed in libavformat/libavcodec directly).
> 
> i refuse to accept any patch which depends on deprecated things
> as this only increases the work for whoever removes AVPaletteControl

Forgot to say, attached is the bigendian palette fix, MPlayer expects it
to be in the same order independent of endianness.
Has nothing to do with AVPaletteControl ;-)
I think it will have a problem with FF_BUFFER_HINTS_PRESERVE, I don't
know the code well enough to know how to solve this.

Greetings,
Reimar Döffinger
-------------- next part --------------
Index: libmpcodecs/vd_ffmpeg.c
===================================================================
--- libmpcodecs/vd_ffmpeg.c	(revision 22060)
+++ libmpcodecs/vd_ffmpeg.c	(working copy)
@@ -717,6 +720,12 @@
     uint32_t chunktab;	// offset to chunk offset array
 } dp_hdr_t;
 
+void swap_palette(void *pal) {
+    int i;
+    uint32_t *p = pal;
+    for (i = 0; i < AVPALETTE_COUNT; i++)
+        p[i] = le2me_32(p[i]);
+}
 
 // decode a frame
 static mp_image_t* decode(sh_video_t *sh,void* data,int len,int flags){
@@ -884,6 +897,10 @@
 	mpi->stride[2]*=2;
     }
     
+#ifdef WORDS_BIGENDIAN
+    if (mpi->bpp == 8)
+        swap_palette(mpi->planes[1]);
+#endif
 /* to comfirm with newer lavc style */
     mpi->qscale =pic->qscale_table;
     mpi->qstride=pic->qstride;


More information about the MPlayer-dev-eng mailing list