diff options
author | Mike Melanson <mike@multimedia.cx> | 2003-10-30 08:40:58 +0300 |
---|---|---|
committer | Mike Melanson <mike@multimedia.cx> | 2003-10-30 08:40:58 +0300 |
commit | 2a2bbcb05fde486eef76d070f26eecddd4de0ace (patch) | |
tree | 781c3c83552a80cb71014d3ff66ff05df14f5f7e /libavcodec/idcinvideo.c | |
parent | 9df1d2490d61c273a3ac9573c49cf4d20b4d750e (diff) |
revised palette API, courtesy of Roberto Togni (rtogni at freemail.it)
Originally committed as revision 2451 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavcodec/idcinvideo.c')
-rw-r--r-- | libavcodec/idcinvideo.c | 27 |
1 files changed, 7 insertions, 20 deletions
diff --git a/libavcodec/idcinvideo.c b/libavcodec/idcinvideo.c index d516e39fbf..b3a658296a 100644 --- a/libavcodec/idcinvideo.c +++ b/libavcodec/idcinvideo.c @@ -72,8 +72,6 @@ typedef struct IdcinContext { unsigned char *buf; int size; - unsigned char palette[PALETTE_COUNT * 4]; - hnode_t huff_nodes[256][HUF_TOKENS*2]; int num_huff_nodes[256]; @@ -218,27 +216,11 @@ static int idcin_decode_frame(AVCodecContext *avctx, uint8_t *buf, int buf_size) { IdcinContext *s = (IdcinContext *)avctx->priv_data; - AVPaletteControl *palette_control = - (AVPaletteControl *)avctx->extradata; - int i; - unsigned int *palette32; - int palette_index = 0; - unsigned char r, g, b; + AVPaletteControl *palette_control = avctx->palctrl; s->buf = buf; s->size = buf_size; - if (palette_control->palette_changed) { - palette32 = (unsigned int *)s->palette; - for (i = 0; i < PALETTE_COUNT; i++) { - r = palette_control->palette[palette_index++] * 1; - g = palette_control->palette[palette_index++] * 1; - b = palette_control->palette[palette_index++] * 1; - palette32[i] = (r << 16) | (g << 8) | (b); - } - palette_control->palette_changed = 0; - } - if (s->frame.data[0]) avctx->release_buffer(avctx, &s->frame); @@ -250,7 +232,12 @@ static int idcin_decode_frame(AVCodecContext *avctx, idcin_decode_vlcs(s); /* make the palette available on the way out */ - memcpy(s->frame.data[1], s->palette, PALETTE_COUNT * 4); + memcpy(s->frame.data[1], palette_control->palette, PALETTE_COUNT * 4); + /* If palette changed inform application*/ + if (palette_control->palette_changed) { + palette_control->palette_changed = 0; + s->frame.palette_has_changed = 1; + } *data_size = sizeof(AVFrame); *(AVFrame*)data = s->frame; |