mirror of
https://github.com/mpv-player/mpv
synced 2025-01-24 19:37:30 +01:00
fixed some major flaws; decoder is now almost correct
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@4299 b3059339-0415-0410-9bf9-f77b7e298cf2
This commit is contained in:
parent
df864731f8
commit
ec6bacbca3
40
qtsmc.c
40
qtsmc.c
@ -49,10 +49,6 @@ int qt_init_decode_smc(void)
|
|||||||
COLORS_PER_TABLE * BYTES_PER_COLOR * 8)) == 0)
|
COLORS_PER_TABLE * BYTES_PER_COLOR * 8)) == 0)
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
color_pair_index = 0;
|
|
||||||
color_quad_index = 0;
|
|
||||||
color_octet_index = 0;
|
|
||||||
|
|
||||||
// if execution got this far, initialization succeeded
|
// if execution got this far, initialization succeeded
|
||||||
smc_initialized = 1;
|
smc_initialized = 1;
|
||||||
return 0;
|
return 0;
|
||||||
@ -65,6 +61,7 @@ int qt_init_decode_smc(void)
|
|||||||
pixel_ptr += block_x_inc; \
|
pixel_ptr += block_x_inc; \
|
||||||
if (pixel_ptr >= (width * bytes_per_pixel)) \
|
if (pixel_ptr >= (width * bytes_per_pixel)) \
|
||||||
{ \
|
{ \
|
||||||
|
counter++; \
|
||||||
pixel_ptr = 0; \
|
pixel_ptr = 0; \
|
||||||
row_ptr += block_y_inc * 4; \
|
row_ptr += block_y_inc * 4; \
|
||||||
} \
|
} \
|
||||||
@ -118,6 +115,11 @@ counter = 0;
|
|||||||
if (!smc_initialized)
|
if (!smc_initialized)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
// reset color tables
|
||||||
|
color_pair_index = 0;
|
||||||
|
color_quad_index = 0;
|
||||||
|
color_octet_index = 0;
|
||||||
|
|
||||||
chunk_size = BE_32(&encoded[stream_ptr]) & 0x00FFFFFF;
|
chunk_size = BE_32(&encoded[stream_ptr]) & 0x00FFFFFF;
|
||||||
stream_ptr += 4;
|
stream_ptr += 4;
|
||||||
if (chunk_size != encoded_size)
|
if (chunk_size != encoded_size)
|
||||||
@ -148,8 +150,8 @@ counter = 0;
|
|||||||
}
|
}
|
||||||
|
|
||||||
opcode = encoded[stream_ptr++];
|
opcode = encoded[stream_ptr++];
|
||||||
//printf ("opcode %02X\n", opcode & 0xF0);
|
//if (counter < 3)
|
||||||
counter++;
|
//printf ("%d: opcode %02X\n", counter, opcode);
|
||||||
switch (opcode & 0xF0)
|
switch (opcode & 0xF0)
|
||||||
{
|
{
|
||||||
// skip n blocks
|
// skip n blocks
|
||||||
@ -263,6 +265,7 @@ counter++;
|
|||||||
case 0x60:
|
case 0x60:
|
||||||
case 0x70:
|
case 0x70:
|
||||||
n_blocks = GET_BLOCK_COUNT;
|
n_blocks = GET_BLOCK_COUNT;
|
||||||
|
//printf ("1-color encoding for %d blocks\n", n_blocks);
|
||||||
color_index = encoded[stream_ptr++] * 4;
|
color_index = encoded[stream_ptr++] * 4;
|
||||||
|
|
||||||
while (n_blocks--)
|
while (n_blocks--)
|
||||||
@ -428,14 +431,27 @@ counter++;
|
|||||||
|
|
||||||
while (n_blocks--)
|
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
|
// build the color flags
|
||||||
color_flags_a = color_flags_b = 0;
|
color_flags_a = color_flags_b = 0;
|
||||||
color_flags_a |= (encoded[stream_ptr++] << 16);
|
color_flags_a =
|
||||||
color_flags_b |= (encoded[stream_ptr++] << 16);
|
(encoded[stream_ptr + 0] << 16) |
|
||||||
color_flags_a |= (encoded[stream_ptr++] << 8);
|
((encoded[stream_ptr + 1] & 0xF0) << 8) |
|
||||||
color_flags_b |= (encoded[stream_ptr++] << 8);
|
((encoded[stream_ptr + 2] & 0xF0) << 4) |
|
||||||
color_flags_a |= (encoded[stream_ptr++] << 0);
|
((encoded[stream_ptr + 2] & 0x0F) << 4) |
|
||||||
color_flags_b |= (encoded[stream_ptr++] << 0);
|
((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;
|
color_flags = color_flags_a;
|
||||||
// flag mask actually acts as a bit shift count here
|
// flag mask actually acts as a bit shift count here
|
||||||
|
Loading…
Reference in New Issue
Block a user