[MPlayer-cvslog] r22246 - trunk/libmpcodecs/vf_scale.c

michael subversion at mplayerhq.hu
Sat Feb 17 13:58:35 CET 2007


Author: michael
Date: Sat Feb 17 13:58:35 2007
New Revision: 22246

Modified:
   trunk/libmpcodecs/vf_scale.c

Log:
swap palette on big endian


Modified: trunk/libmpcodecs/vf_scale.c
==============================================================================
--- trunk/libmpcodecs/vf_scale.c	(original)
+++ trunk/libmpcodecs/vf_scale.c	Sat Feb 17 13:58:35 2007
@@ -11,6 +11,7 @@
 #include "mp_image.h"
 #include "vf.h"
 #include "fmt-conversion.h"
+#include "bswap.h"
 
 #include "libvo/fastmemcpy.h"
 #include "libswscale/swscale.h"
@@ -323,9 +324,19 @@
 
 static void scale(struct SwsContext *sws1, struct SwsContext *sws2, uint8_t *src[3], int src_stride[3], int y, int h, 
                   uint8_t *dst[3], int dst_stride[3], int interlaced){
+    uint8_t *src2[3]={src[0], src[1], src[2]};
+#ifdef WORDS_BIGENDIAN
+    uint32_t pal2[256];
+    if (src[1] && !src[2]){
+        int i;
+        for(i=0; i<256; i++)
+            pal2[i]= bswap_32(((uint32_t*)src[1])[i]);
+        src2[1]= pal2;
+    }
+#endif
+
     if(interlaced){
         int i;
-        uint8_t *src2[3]={src[0], src[1], src[2]};
         uint8_t *dst2[3]={dst[0], dst[1], dst[2]};
         int src_stride2[3]={2*src_stride[0], 2*src_stride[1], 2*src_stride[2]};
         int dst_stride2[3]={2*dst_stride[0], 2*dst_stride[1], 2*dst_stride[2]};
@@ -337,7 +348,7 @@
         }
         sws_scale_ordered(sws2, src2, src_stride2, y>>1, h>>1, dst2, dst_stride2);
     }else{
-        sws_scale_ordered(sws1, src, src_stride, y, h, dst, dst_stride);
+        sws_scale_ordered(sws1, src2, src_stride, y, h, dst, dst_stride);
     }                  
 }
 



More information about the MPlayer-cvslog mailing list