diff options
author | Roberto Togni <r_togni@tiscali.it> | 2003-11-02 21:57:55 +0000 |
---|---|---|
committer | Roberto Togni <r_togni@tiscali.it> | 2003-11-02 21:57:55 +0000 |
commit | 875efafac8afe22971c87fc7dfee83d27364ab50 (patch) | |
tree | 6e5eccbb88c54ce20ab80082a838eb3726c70fe5 /libavcodec/msrle.c | |
parent | 5e29abf8b7efe6cfeee41d9f5e5f9fc98c1fcb93 (diff) | |
download | ffmpeg-875efafac8afe22971c87fc7dfee83d27364ab50.tar.gz |
Moved to new palette API
Added check to aviod stride change between frames
Originally committed as revision 2466 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavcodec/msrle.c')
-rw-r--r-- | libavcodec/msrle.c | 25 |
1 files changed, 11 insertions, 14 deletions
diff --git a/libavcodec/msrle.c b/libavcodec/msrle.c index 4d8ceaa8b7..6ec36fa33b 100644 --- a/libavcodec/msrle.c +++ b/libavcodec/msrle.c @@ -26,7 +26,7 @@ * The MS RLE decoder outputs PAL8 colorspace data. * * Note that this decoder expects the palette colors from the end of the - * BITMAPINFO header passed through extradata. + * BITMAPINFO header passed through palctrl. */ #include <stdio.h> @@ -46,7 +46,6 @@ typedef struct MsrleContext { unsigned char *buf; int size; - unsigned int palette[256]; } MsrleContext; #define FETCH_NEXT_STREAM_BYTE() \ @@ -130,7 +129,11 @@ static void msrle_decode_pal8(MsrleContext *s) } /* make the palette available */ - memcpy(s->frame.data[1], s->palette, 256 * 4); + memcpy(s->frame.data[1], s->avctx->palctrl->palette, AVPALETTE_SIZE); + if (s->avctx->palctrl->palette_changed) { + s->frame.palette_has_changed = 1; + s->avctx->palctrl->palette_changed = 0; + } /* one last sanity check on the way out */ if (stream_ptr < s->size) @@ -141,8 +144,6 @@ static void msrle_decode_pal8(MsrleContext *s) static int msrle_decode_init(AVCodecContext *avctx) { MsrleContext *s = (MsrleContext *)avctx->priv_data; - int i, j; - unsigned char *palette; s->avctx = avctx; @@ -150,15 +151,6 @@ static int msrle_decode_init(AVCodecContext *avctx) avctx->has_b_frames = 0; s->frame.data[0] = s->prev_frame.data[0] = NULL; - /* convert palette */ - palette = (unsigned char *)s->avctx->extradata; - memset (s->palette, 0, 256 * 4); - for (i = 0, j = 0; i < s->avctx->extradata_size / 4; i++, j += 4) - s->palette[i] = - (palette[j + 2] << 16) | - (palette[j + 1] << 8) | - (palette[j + 0] << 0); - return 0; } @@ -177,6 +169,11 @@ static int msrle_decode_frame(AVCodecContext *avctx, return -1; } + if (s->prev_frame.data[0] && (s->frame.linesize[0] != s->prev_frame.linesize[0])) + printf (" MS RLE: Buffer linesize changed: current %u, previous %u.\n" + " Expect wrong image and/or crash!\n", + s->frame.linesize[0], s->prev_frame.linesize[0]); + /* grossly inefficient, but...oh well */ if (s->prev_frame.data[0] != NULL) memcpy(s->frame.data[0], s->prev_frame.data[0], |