Commit 7e5ef401 authored by Mike Melanson's avatar Mike Melanson

forgot to apply the palette component lookup table

Originally committed as revision 2259 to svn://svn.ffmpeg.org/ffmpeg/trunk
parent 541ae140
...@@ -93,7 +93,7 @@ typedef struct Wc3DemuxContext { ...@@ -93,7 +93,7 @@ typedef struct Wc3DemuxContext {
} Wc3DemuxContext; } Wc3DemuxContext;
/* bizarre palette lookup table */ /* bizarre palette lookup table */
const unsigned char wc3_pal_lookup[] = { static const unsigned char wc3_pal_lookup[] = {
0x00, 0x03, 0x05, 0x07, 0x09, 0x0B, 0x0D, 0x0E, 0x00, 0x03, 0x05, 0x07, 0x09, 0x0B, 0x0D, 0x0E,
0x10, 0x12, 0x13, 0x15, 0x16, 0x18, 0x19, 0x1A, 0x10, 0x12, 0x13, 0x15, 0x16, 0x18, 0x19, 0x1A,
0x1C, 0x1D, 0x1F, 0x20, 0x21, 0x23, 0x24, 0x25, 0x1C, 0x1D, 0x1F, 0x20, 0x21, 0x23, 0x24, 0x25,
...@@ -154,7 +154,7 @@ static int wc3_read_header(AVFormatContext *s, ...@@ -154,7 +154,7 @@ static int wc3_read_header(AVFormatContext *s,
int current_palette = 0; int current_palette = 0;
int bytes_to_read; int bytes_to_read;
int i; int i;
int temp; unsigned char rotate;
/* default context members */ /* default context members */
wc3->width = WC3_DEFAULT_WIDTH; wc3->width = WC3_DEFAULT_WIDTH;
...@@ -225,9 +225,11 @@ static int wc3_read_header(AVFormatContext *s, ...@@ -225,9 +225,11 @@ static int wc3_read_header(AVFormatContext *s,
/* transform the current palette in place */ /* transform the current palette in place */
for (i = current_palette * PALETTE_SIZE; for (i = current_palette * PALETTE_SIZE;
i < (current_palette + 1) * PALETTE_SIZE; i++) { i < (current_palette + 1) * PALETTE_SIZE; i++) {
/* rotate each palette component left by 2 */ /* rotate each palette component left by 2 and use the result
temp = wc3->palettes[i] << 2; * as an index into the color component table */
wc3->palettes[i] = (temp & 0xFF) | (temp >> 8); rotate = ((wc3->palettes[i] << 2) & 0xFF) |
((wc3->palettes[i] >> 6) & 0xFF);
wc3->palettes[i] = wc3_pal_lookup[rotate];
} }
current_palette++; current_palette++;
break; break;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment