[Mplayer-cvslog] CVS: main msvidc.c,1.5,1.6 fli.c,1.2,1.3

Mike Melanson melanson at mplayer.dev.hu
Sun Dec 16 01:26:24 CET 2001


Update of /cvsroot/mplayer/main
In directory mplayer:/var/tmp.root/cvs-serv3028

Modified Files:
	msvidc.c fli.c 
Log Message:
fixed endian-ness for FLI and MS Video 1 decoders; fixed padding bug in
FLI decoder and also implemented (untested due to lack of sample data) the
FLI_COPY chunk type


Index: msvidc.c
===================================================================
RCS file: /cvsroot/mplayer/main/msvidc.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- msvidc.c	5 Dec 2001 04:17:24 -0000	1.5
+++ msvidc.c	16 Dec 2001 00:26:21 -0000	1.6
@@ -9,7 +9,10 @@
     32bpp support (c) alex
 */
 
-#define LE_16(x) *(unsigned short *)(x)
+#include "config.h"
+#include "bswap.h"
+
+#define LE_16(x) (le2me_16(*(unsigned short *)(x)))
 
 #define DECODE_BGR555_TO_BGR888(x) \
         x.c1_b = (x.c1 >> 7) & 0xF8; \
@@ -100,6 +103,7 @@
       {
         flags = (byte_b << 8) | byte_a;
 
+//        quad[0][0].c1 = LE_16(&encoded[stream_ptr]);
         quad[0][0].c1 = LE_16(&encoded[stream_ptr]);
         stream_ptr += 2;
         quad[0][0].c2 = LE_16(&encoded[stream_ptr]);

Index: fli.c
===================================================================
RCS file: /cvsroot/mplayer/main/fli.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- fli.c	28 Nov 2001 15:32:56 -0000	1.2
+++ fli.c	16 Dec 2001 00:26:21 -0000	1.3
@@ -6,8 +6,11 @@
     32bpp support (c) alex
 */
 
-#define LE_16(x) *(unsigned short *)(x)
-#define LE_32(x) *(unsigned int *)(x)
+#include "config.h"
+#include "bswap.h"
+
+#define LE_16(x) (le2me_16(*(unsigned short *)(x)))
+#define LE_32(x) (le2me_32(*(unsigned int *)(x)))
 
 #define FLI_256_COLOR 4
 #define FLI_DELTA     7
@@ -99,6 +102,10 @@
           stream_ptr += 3;
         }
       }
+      // it seems that a color packet has to be an even number of bytes
+      // so account for a pad byte
+      if (stream_ptr & 0x01)
+        stream_ptr++;
       break;
 
     case FLI_DELTA:
@@ -270,9 +277,16 @@
       break;
 
     case FLI_COPY:
-// currently unimplemented
-printf ("FLI_COPY chunk (currently unimplemented)\n");
-stream_ptr += chunk_size - 6;
+      // copy the chunk (uncompressed frame)
+      for (pixel_ptr = 0; pixel_ptr < chunk_size - 6; pixel_ptr++)
+      {
+        palette_ptr1 = encoded[stream_ptr++] * 4;
+        decoded[pixel_ptr++] = palette[palette_ptr1 + 0];
+        decoded[pixel_ptr++] = palette[palette_ptr1 + 1];
+        decoded[pixel_ptr++] = palette[palette_ptr1 + 2];
+        if (bytes_per_pixel == 4) /* 32bpp */
+          pixel_ptr++;
+      }
       break;
 
     case FLI_MINI:




More information about the MPlayer-cvslog mailing list