[XviD-devel] [PATCH] Make xvid_decraw tga output usable on big endian hosts

Edouard Gomez ed.gomez at free.fr
Mon Jul 25 22:34:19 CEST 2005


# HG changeset patch
# User ed.gomez at free.fr
# Node ID 2cb6e75029e770596f2550d4b5687d9f36d1b05a
# Parent  ff04915d8c22e96d33716a4f0a1c28cf36dfebcd
Fix big endian tga output for decraw.


>From ed.gomez:
 * Writing pointed data is always better than memory
   addresses

diff -r ff04915d8c22 -r 2cb6e75029e7 examples/xvid_decraw.c
--- a/examples/xvid_decraw.c	Thu Jul 14 14:25:43 2005
+++ b/examples/xvid_decraw.c	Mon Jul 25 19:45:25 2005
@@ -576,19 +576,19 @@
 		int i;
 		for (i=0; i<width*height*BPP;i+=BPP) {
 			if (BPP == 1) {
-				fputc(image+i, f);
+				fputc(*(image+i), f);
 			} else if (BPP == 2) {
-				fputc(image+i+1, f);
-				fputc(image+i+0, f);
+				fputc(*(image+i+1), f);
+				fputc(*(image+i+0), f);
 			} else if (BPP == 3) {
-				fputc(image+i+2, f);
-				fputc(image+i+1, f);
-				fputc(image+i+0, f);
+				fputc(*(image+i+2), f);
+				fputc(*(image+i+1), f);
+				fputc(*(image+i+0), f);
 			} else if (BPP == 4) {
-				fputc(image+i+3, f);
-				fputc(image+i+2, f);
-				fputc(image+i+1, f);
-				fputc(image+i+0, f);
+				fputc(*(image+i+3), f);
+				fputc(*(image+i+2), f);
+				fputc(*(image+i+1), f);
+				fputc(*(image+i+0), f);
 			}
 		}
 	}

-- 
Edouard Gomez


More information about the XviD-devel mailing list