32bpp support added

git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@3186 b3059339-0415-0410-9bf9-f77b7e298cf2
This commit is contained in:
alex 2001-11-28 15:32:56 +00:00
parent 37e8289dd0
commit 22c633f15e
1 changed files with 21 additions and 3 deletions

24
fli.c
View File

@ -2,6 +2,8 @@
FLI Decoder for MPlayer FLI Decoder for MPlayer
(C) 2001 Mike Melanson (C) 2001 Mike Melanson
32bpp support (c) alex
*/ */
#define LE_16(x) *(unsigned short *)(x) #define LE_16(x) *(unsigned short *)(x)
@ -119,7 +121,7 @@ void AVI_Decode_Fli(
for (i = 0; i < line_packets; i++) for (i = 0; i < line_packets; i++)
{ {
// account for the skip bytes // account for the skip bytes
pixel_ptr += encoded[stream_ptr++] * 3; pixel_ptr += encoded[stream_ptr++] * bytes_per_pixel;
byte_run = encoded[stream_ptr++]; byte_run = encoded[stream_ptr++];
if (byte_run < 0) if (byte_run < 0)
{ {
@ -131,10 +133,14 @@ void AVI_Decode_Fli(
decoded[pixel_ptr++] = palette[palette_ptr1 + 0]; decoded[pixel_ptr++] = palette[palette_ptr1 + 0];
decoded[pixel_ptr++] = palette[palette_ptr1 + 1]; decoded[pixel_ptr++] = palette[palette_ptr1 + 1];
decoded[pixel_ptr++] = palette[palette_ptr1 + 2]; decoded[pixel_ptr++] = palette[palette_ptr1 + 2];
if (bytes_per_pixel == 4) /* 32bpp */
pixel_ptr++;
decoded[pixel_ptr++] = palette[palette_ptr2 + 0]; decoded[pixel_ptr++] = palette[palette_ptr2 + 0];
decoded[pixel_ptr++] = palette[palette_ptr2 + 1]; decoded[pixel_ptr++] = palette[palette_ptr2 + 1];
decoded[pixel_ptr++] = palette[palette_ptr2 + 2]; decoded[pixel_ptr++] = palette[palette_ptr2 + 2];
if (bytes_per_pixel == 4) /* 32bpp */
pixel_ptr++;
} }
} }
else else
@ -145,6 +151,8 @@ void AVI_Decode_Fli(
decoded[pixel_ptr++] = palette[palette_ptr1 + 0]; decoded[pixel_ptr++] = palette[palette_ptr1 + 0];
decoded[pixel_ptr++] = palette[palette_ptr1 + 1]; decoded[pixel_ptr++] = palette[palette_ptr1 + 1];
decoded[pixel_ptr++] = palette[palette_ptr1 + 2]; decoded[pixel_ptr++] = palette[palette_ptr1 + 2];
if (bytes_per_pixel == 4) /* 32bpp */
pixel_ptr++;
} }
} }
} }
@ -172,7 +180,7 @@ void AVI_Decode_Fli(
for (i = 0; i < line_packets; i++) for (i = 0; i < line_packets; i++)
{ {
// account for the skip bytes // account for the skip bytes
pixel_ptr += encoded[stream_ptr++] * 3; pixel_ptr += encoded[stream_ptr++] * bytes_per_pixel;
byte_run = encoded[stream_ptr++]; byte_run = encoded[stream_ptr++];
if (byte_run > 0) if (byte_run > 0)
{ {
@ -182,6 +190,8 @@ void AVI_Decode_Fli(
decoded[pixel_ptr++] = palette[palette_ptr1 + 0]; decoded[pixel_ptr++] = palette[palette_ptr1 + 0];
decoded[pixel_ptr++] = palette[palette_ptr1 + 1]; decoded[pixel_ptr++] = palette[palette_ptr1 + 1];
decoded[pixel_ptr++] = palette[palette_ptr1 + 2]; decoded[pixel_ptr++] = palette[palette_ptr1 + 2];
if (bytes_per_pixel == 4) /* 32bpp */
pixel_ptr++;
} }
} }
else else
@ -193,6 +203,8 @@ void AVI_Decode_Fli(
decoded[pixel_ptr++] = palette[palette_ptr1 + 0]; decoded[pixel_ptr++] = palette[palette_ptr1 + 0];
decoded[pixel_ptr++] = palette[palette_ptr1 + 1]; decoded[pixel_ptr++] = palette[palette_ptr1 + 1];
decoded[pixel_ptr++] = palette[palette_ptr1 + 2]; decoded[pixel_ptr++] = palette[palette_ptr1 + 2];
if (bytes_per_pixel == 4) /* 32bpp */
pixel_ptr++;
} }
} }
} }
@ -205,11 +217,13 @@ void AVI_Decode_Fli(
case FLI_BLACK: case FLI_BLACK:
// set the whole frame to color 0 (which is usually black) // set the whole frame to color 0 (which is usually black)
for (pixel_ptr = 0; pixel_ptr < (width * height * 3); pixel_ptr++) for (pixel_ptr = 0; pixel_ptr < (width * height * bytes_per_pixel); pixel_ptr++)
{ {
decoded[pixel_ptr++] = palette[0]; decoded[pixel_ptr++] = palette[0];
decoded[pixel_ptr++] = palette[1]; decoded[pixel_ptr++] = palette[1];
decoded[pixel_ptr++] = palette[2]; decoded[pixel_ptr++] = palette[2];
if (bytes_per_pixel == 4) /* 32bpp */
pixel_ptr++;
} }
break; break;
@ -232,6 +246,8 @@ void AVI_Decode_Fli(
decoded[pixel_ptr++] = palette[palette_ptr1 + 0]; decoded[pixel_ptr++] = palette[palette_ptr1 + 0];
decoded[pixel_ptr++] = palette[palette_ptr1 + 1]; decoded[pixel_ptr++] = palette[palette_ptr1 + 1];
decoded[pixel_ptr++] = palette[palette_ptr1 + 2]; decoded[pixel_ptr++] = palette[palette_ptr1 + 2];
if (bytes_per_pixel == 4) /* 32bpp */
pixel_ptr++;
} }
} }
else // copy bytes if byte_run < 0 else // copy bytes if byte_run < 0
@ -243,6 +259,8 @@ void AVI_Decode_Fli(
decoded[pixel_ptr++] = palette[palette_ptr1 + 0]; decoded[pixel_ptr++] = palette[palette_ptr1 + 0];
decoded[pixel_ptr++] = palette[palette_ptr1 + 1]; decoded[pixel_ptr++] = palette[palette_ptr1 + 1];
decoded[pixel_ptr++] = palette[palette_ptr1 + 2]; decoded[pixel_ptr++] = palette[palette_ptr1 + 2];
if (bytes_per_pixel == 4) /* 32bpp */
pixel_ptr++;
} }
} }
} }