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
This commit is contained in:
melanson 2001-12-16 00:26:21 +00:00
parent bd695cbb5c
commit a59608c8ca
2 changed files with 24 additions and 6 deletions

24
fli.c
View File

@ -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:

View File

@ -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 @@ void AVI_Decode_Video1_16(
{
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]);