Commit 3e368d72 authored by Reimar Döffinger's avatar Reimar Döffinger

Use bytestream_get_be24 to simplify palette parsing.

Originally committed as revision 11821 to svn://svn.ffmpeg.org/ffmpeg/trunk
parent 04deea9a
...@@ -35,6 +35,7 @@ ...@@ -35,6 +35,7 @@
#define ALT_BITSTREAM_READER_LE #define ALT_BITSTREAM_READER_LE
#include "bitstream.h" #include "bitstream.h"
#include "bytestream.h"
#define SMKTREE_BITS 9 #define SMKTREE_BITS 9
#define SMK_NODE 0x80000000 #define SMK_NODE 0x80000000
...@@ -367,7 +368,6 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *data_size, const ...@@ -367,7 +368,6 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *data_size, const
} }
/* make the palette available on the way out */ /* make the palette available on the way out */
out = buf + 1;
pal = (uint32_t*)smk->pic.data[1]; pal = (uint32_t*)smk->pic.data[1];
smk->pic.palette_has_changed = buf[0] & 1; smk->pic.palette_has_changed = buf[0] & 1;
smk->pic.key_frame = !!(buf[0] & 2); smk->pic.key_frame = !!(buf[0] & 2);
...@@ -376,19 +376,16 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *data_size, const ...@@ -376,19 +376,16 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *data_size, const
else else
smk->pic.pict_type = FF_P_TYPE; smk->pic.pict_type = FF_P_TYPE;
for(i = 0; i < 256; i++) { buf++;
int r, g, b; for(i = 0; i < 256; i++)
r = *out++; *pal++ = bytestream_get_be24(&buf);
g = *out++; buf_size -= 769;
b = *out++;
*pal++ = (r << 16) | (g << 8) | b;
}
last_reset(smk->mmap_tbl, smk->mmap_last); last_reset(smk->mmap_tbl, smk->mmap_last);
last_reset(smk->mclr_tbl, smk->mclr_last); last_reset(smk->mclr_tbl, smk->mclr_last);
last_reset(smk->full_tbl, smk->full_last); last_reset(smk->full_tbl, smk->full_last);
last_reset(smk->type_tbl, smk->type_last); last_reset(smk->type_tbl, smk->type_last);
init_get_bits(&gb, buf + 769, (buf_size - 769) * 8); init_get_bits(&gb, buf, buf_size * 8);
blk = 0; blk = 0;
bw = avctx->width >> 2; bw = avctx->width >> 2;
......
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