summaryrefslogtreecommitdiffstats
path: root/qtsmc.c
diff options
context:
space:
mode:
authormelanson <melanson@b3059339-0415-0410-9bf9-f77b7e298cf2>2002-01-22 02:00:57 +0000
committermelanson <melanson@b3059339-0415-0410-9bf9-f77b7e298cf2>2002-01-22 02:00:57 +0000
commitec6bacbca35c3b8d45ae86cd8dfb89fd1c591652 (patch)
treecf93aa1020630667501597d96c89e3fb380d60f8 /qtsmc.c
parentdf864731f8354ca4fea9ca5ee4450c61f4a9c0b9 (diff)
downloadmpv-ec6bacbca35c3b8d45ae86cd8dfb89fd1c591652.tar.bz2
mpv-ec6bacbca35c3b8d45ae86cd8dfb89fd1c591652.tar.xz
fixed some major flaws; decoder is now almost correct
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@4299 b3059339-0415-0410-9bf9-f77b7e298cf2
Diffstat (limited to 'qtsmc.c')
-rw-r--r--qtsmc.c40
1 files changed, 28 insertions, 12 deletions
diff --git a/qtsmc.c b/qtsmc.c
index a0bd168bd6..b7e8f96ccb 100644
--- a/qtsmc.c
+++ b/qtsmc.c
@@ -49,10 +49,6 @@ int qt_init_decode_smc(void)
COLORS_PER_TABLE * BYTES_PER_COLOR * 8)) == 0)
return 1;
- color_pair_index = 0;
- color_quad_index = 0;
- color_octet_index = 0;
-
// if execution got this far, initialization succeeded
smc_initialized = 1;
return 0;
@@ -65,6 +61,7 @@ int qt_init_decode_smc(void)
pixel_ptr += block_x_inc; \
if (pixel_ptr >= (width * bytes_per_pixel)) \
{ \
+counter++; \
pixel_ptr = 0; \
row_ptr += block_y_inc * 4; \
} \
@@ -118,6 +115,11 @@ counter = 0;
if (!smc_initialized)
return;
+ // reset color tables
+ color_pair_index = 0;
+ color_quad_index = 0;
+ color_octet_index = 0;
+
chunk_size = BE_32(&encoded[stream_ptr]) & 0x00FFFFFF;
stream_ptr += 4;
if (chunk_size != encoded_size)
@@ -148,8 +150,8 @@ counter = 0;
}
opcode = encoded[stream_ptr++];
-//printf ("opcode %02X\n", opcode & 0xF0);
-counter++;
+//if (counter < 3)
+//printf ("%d: opcode %02X\n", counter, opcode);
switch (opcode & 0xF0)
{
// skip n blocks
@@ -263,6 +265,7 @@ counter++;
case 0x60:
case 0x70:
n_blocks = GET_BLOCK_COUNT;
+//printf ("1-color encoding for %d blocks\n", n_blocks);
color_index = encoded[stream_ptr++] * 4;
while (n_blocks--)
@@ -428,14 +431,27 @@ counter++;
while (n_blocks--)
{
+ /*
+ For this input:
+ 01 23 45 67 89 AB
+ This is the output:
+ flags_a = xx012456, flags_b = xx89A37B
+ */
// build the color flags
color_flags_a = color_flags_b = 0;
- color_flags_a |= (encoded[stream_ptr++] << 16);
- color_flags_b |= (encoded[stream_ptr++] << 16);
- color_flags_a |= (encoded[stream_ptr++] << 8);
- color_flags_b |= (encoded[stream_ptr++] << 8);
- color_flags_a |= (encoded[stream_ptr++] << 0);
- color_flags_b |= (encoded[stream_ptr++] << 0);
+ color_flags_a =
+ (encoded[stream_ptr + 0] << 16) |
+ ((encoded[stream_ptr + 1] & 0xF0) << 8) |
+ ((encoded[stream_ptr + 2] & 0xF0) << 4) |
+ ((encoded[stream_ptr + 2] & 0x0F) << 4) |
+ ((encoded[stream_ptr + 3] & 0xF0) >> 4);
+ color_flags_b =
+ (encoded[stream_ptr + 4] << 16) |
+ ((encoded[stream_ptr + 5] & 0xF0) << 8) |
+ ((encoded[stream_ptr + 1] & 0x0F) << 8) |
+ ((encoded[stream_ptr + 3] & 0x0F) << 4) |
+ (encoded[stream_ptr + 5] & 0x0F);
+ stream_ptr += 6;
color_flags = color_flags_a;
// flag mask actually acts as a bit shift count here