summaryrefslogtreecommitdiffstats
path: root/fli.c
diff options
context:
space:
mode:
authormelanson <melanson@b3059339-0415-0410-9bf9-f77b7e298cf2>2001-12-16 00:26:21 +0000
committermelanson <melanson@b3059339-0415-0410-9bf9-f77b7e298cf2>2001-12-16 00:26:21 +0000
commita59608c8ca062a3a325863e699e10d8b142e559c (patch)
treee7bca12eb1249303a98239102c0b4fc4e2d3106c /fli.c
parentbd695cbb5cfebcb6adf4e8aabf9d9971147bc438 (diff)
downloadmpv-a59608c8ca062a3a325863e699e10d8b142e559c.tar.bz2
mpv-a59608c8ca062a3a325863e699e10d8b142e559c.tar.xz
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 git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@3510 b3059339-0415-0410-9bf9-f77b7e298cf2
Diffstat (limited to 'fli.c')
-rw-r--r--fli.c24
1 files changed, 19 insertions, 5 deletions
diff --git a/fli.c b/fli.c
index d65da3bcd7..fee3cfbcd8 100644
--- a/fli.c
+++ b/fli.c
@@ -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 @@ void AVI_Decode_Fli(
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 @@ void AVI_Decode_Fli(
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: