changeset 22076:e81065a87c2d

Swap palette on bigendian.
author reimar
date Wed, 31 Jan 2007 18:14:47 +0000
parents c604c9a97c35
children 40135eba142f
files libmpcodecs/vd_ffmpeg.c
diffstat 1 files changed, 11 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/libmpcodecs/vd_ffmpeg.c	Wed Jan 31 15:28:50 2007 +0000
+++ b/libmpcodecs/vd_ffmpeg.c	Wed Jan 31 18:14:47 2007 +0000
@@ -717,6 +717,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 +890,11 @@
 	mpi->stride[2]*=2;
     }
     
+#ifdef WORDS_BIGENDIAN
+    // FIXME: this might cause problems for buffers with FF_BUFFER_HINTS_PRESERVE
+    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;