diff options
author | Alex Beregszaszi <alex@rtfs.hu> | 2006-10-19 23:03:47 +0000 |
---|---|---|
committer | Alex Beregszaszi <alex@rtfs.hu> | 2006-10-19 23:03:47 +0000 |
commit | 1e4051aaa041ca83ddfe09973558c2e9d2f32ec0 (patch) | |
tree | 89d47f42d78089fcdb77025fc771c2c040781e9c | |
parent | ba9fb5da3afd74ab5c0c97ecd7a1fdac006f8bd4 (diff) | |
download | ffmpeg-1e4051aaa041ca83ddfe09973558c2e9d2f32ec0.tar.gz |
correct signaling of palette change
Originally committed as revision 6739 to svn://svn.ffmpeg.org/ffmpeg/trunk
-rw-r--r-- | libavcodec/flicvideo.c | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/libavcodec/flicvideo.c b/libavcodec/flicvideo.c index d5c55f666f..f53aabfad9 100644 --- a/libavcodec/flicvideo.c +++ b/libavcodec/flicvideo.c @@ -190,7 +190,6 @@ static int flic_decode_frame_8BPP(AVCodecContext *avctx, case FLI_256_COLOR: case FLI_COLOR: stream_ptr_after_color_chunk = stream_ptr + chunk_size - 6; - s->new_palette = 1; /* check special case: If this file is from the Magic Carpet * game and uses 6-bit colors even though it reports 256-color @@ -216,6 +215,7 @@ static int flic_decode_frame_8BPP(AVCodecContext *avctx, color_changes = 256; for (j = 0; j < color_changes; j++) { + unsigned int entry; /* wrap around, for good measure */ if ((unsigned)palette_ptr >= 256) @@ -224,7 +224,10 @@ static int flic_decode_frame_8BPP(AVCodecContext *avctx, r = buf[stream_ptr++] << color_shift; g = buf[stream_ptr++] << color_shift; b = buf[stream_ptr++] << color_shift; - s->palette[palette_ptr++] = (r << 16) | (g << 8) | b; + entry = (r << 16) | (g << 8) | b; + if (s->palette[palette_ptr] != entry) + s->new_palette = 1; + s->palette[palette_ptr++] = entry; } } @@ -404,9 +407,8 @@ static int flic_decode_frame_8BPP(AVCodecContext *avctx, "and final chunk ptr = %d\n", buf_size, stream_ptr); /* make the palette available on the way out */ -// if (s->new_palette) { - if (1) { - memcpy(s->frame.data[1], s->palette, AVPALETTE_SIZE); + memcpy(s->frame.data[1], s->palette, AVPALETTE_SIZE); + if (s->new_palette) { s->frame.palette_has_changed = 1; s->new_palette = 0; } |