[MPlayer-dev-eng] [PATCH] jpeg decoder bigendian bug

Alan Curry pacman at theworld.com
Thu Apr 20 23:52:11 CEST 2006


Get yourself a big-endian CPU, a gaggle of jpegs, and run:

  mplayer -vc ijpg -vf format=bgr32,scale mf://*.jpg

This is a bug in vd_ijpg, the decoder that nobody uses because ffmjpeg does
the same job and more. Nevertheless, it is a bug.

Index: libmpcodecs/vd_ijpg.c
===================================================================
RCS file: /cvsroot/mplayer/main/libmpcodecs/vd_ijpg.c,v
retrieving revision 1.10
diff -u -r1.10 vd_ijpg.c
--- libmpcodecs/vd_ijpg.c	22 Sep 2002 02:33:25 -0000	1.10
+++ libmpcodecs/vd_ijpg.c	20 Apr 2006 21:24:26 -0000
@@ -190,9 +190,15 @@
        // rgb24 -> bgr32
        case IMGFMT_BGR32:
            for(x=0;x<width;x++){
+#ifdef WORDS_BIGENDIAN
+	       drow[4*x+1]=row[3*x+0];
+	       drow[4*x+2]=row[3*x+1];
+	       drow[4*x+3]=row[3*x+2];
+#else
 	       drow[4*x+0]=row[3*x+2];
 	       drow[4*x+1]=row[3*x+1];
 	       drow[4*x+2]=row[3*x+0];
+#endif
 	   }
 	   break;
        }




More information about the MPlayer-dev-eng mailing list