changeset 12515:7ddeffd0dbda

Big Endian fix. Patch by Romain Dolbeau
author nplourde
date Mon, 31 May 2004 15:07:58 +0000
parents a6acf2b87bd5
children 6f7b5123ac56
files libmpcodecs/vf.c
diffstat 1 files changed, 11 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/libmpcodecs/vf.c	Mon May 31 15:07:20 2004 +0000
+++ b/libmpcodecs/vf.c	Mon May 31 15:07:58 2004 +0000
@@ -217,12 +217,19 @@
 	    unsigned int* p=(unsigned int*) dst;
 	    int size=(mpi->bpp>>3)*w/4;
 	    int i;
+#ifdef WORDS_BIGENDIAN
+#define CLEAR_PACKEDYUV_PATTERN 0x00800080
+#define CLEAR_PACKEDYUV_PATTERN_SWAPPED 0x80008000
+#else
+#define CLEAR_PACKEDYUV_PATTERN 0x80008000
+#define CLEAR_PACKEDYUV_PATTERN_SWAPPED 0x00800080
+#endif
 	    if(mpi->flags&MP_IMGFLAG_SWAPPED){
-	        for(i=0;i<size;i+=4) p[i]=p[i+1]=p[i+2]=p[i+3]=0x00800080;
-		for(;i<size;i++) p[i]=0x00800080;
+	        for(i=0;i<size-3;i+=4) p[i]=p[i+1]=p[i+2]=p[i+3]=CLEAR_PACKEDYUV_PATTERN_SWAPPED;
+		for(;i<size;i++) p[i]=CLEAR_PACKEDYUV_PATTERN_SWAPPED;
 	    } else {
-	        for(i=0;i<size;i+=4) p[i]=p[i+1]=p[i+2]=p[i+3]=0x80008000;
-		for(;i<size;i++) p[i]=0x80008000;
+	        for(i=0;i<size-3;i+=4) p[i]=p[i+1]=p[i+2]=p[i+3]=CLEAR_PACKEDYUV_PATTERN;
+		for(;i<size;i++) p[i]=CLEAR_PACKEDYUV_PATTERN;
 	    }
 	} else
 	    memset(dst,0,(mpi->bpp>>3)*w);