summaryrefslogtreecommitdiff
path: root/libavcodec/smacker.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2012-03-26 20:34:29 +0200
committerMichael Niedermayer <michaelni@gmx.at>2012-03-26 20:52:52 +0200
commit7e496e154583b5fe11ccf04b833c418b22f05ca4 (patch)
tree51ff1dc2484ab90ede1d715d30e935ce22b1af7d /libavcodec/smacker.c
parent60497cb984221268ef95d2b63476f4f3379fb7e2 (diff)
parent72ccfb3cb7a85d35cfe2c99ab53e981974e599cd (diff)
Merge remote-tracking branch 'qatar/master'
* qatar/master: build: ppc: drop stray leftover backslash build: Only clean the architecture subdirectory we build for. build: drop some unnecessary dependencies from the H.264 parser build: prettyprinting cosmetics libavutil: Remove pointless rational test program. libavutil: Remove broken and pointless lzo test program. lavf doxy: expand AVStream.codec doxy. lavf doxy: improve AVStream.time_base doxy. lavf doxy: add some basic documentation about reading from the demuxer. lavf doxy: document passing options to demuxers. lavf doxy: clarify that an AVPacket contains encoded data. mpegtsenc: allow user triggered PES packet flushing APIchanges: mark the place where 0.7 was cut. APIchanges: mark the place where 0.8 was cut. APIchanges: fill in missing dates and hashes. smacker: convert palette and header reading to bytestream2. alac: convert extradata reading to bytestream2. Conflicts: doc/APIchanges libavcodec/smacker.c libavcodec/x86/Makefile libavfilter/Makefile libavutil/Makefile Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec/smacker.c')
-rw-r--r--libavcodec/smacker.c20
1 files changed, 10 insertions, 10 deletions
diff --git a/libavcodec/smacker.c b/libavcodec/smacker.c
index 3c979ebbfa..04994b2d0c 100644
--- a/libavcodec/smacker.c
+++ b/libavcodec/smacker.c
@@ -362,17 +362,17 @@ static av_always_inline int smk_get_code(GetBitContext *gb, int *recode, int *la
static int decode_frame(AVCodecContext *avctx, void *data, int *data_size, AVPacket *avpkt)
{
- const uint8_t *buf = avpkt->data;
- int buf_size = avpkt->size;
SmackVContext * const smk = avctx->priv_data;
uint8_t *out;
uint32_t *pal;
+ GetByteContext gb2;
GetBitContext gb;
int blocks, blk, bw, bh;
int i;
int stride;
+ int flags;
- if(buf_size <= 769)
+ if (avpkt->size <= 769)
return 0;
smk->pic.reference = 3;
@@ -384,23 +384,23 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *data_size, AVPac
/* make the palette available on the way out */
pal = (uint32_t*)smk->pic.data[1];
- smk->pic.palette_has_changed = buf[0] & 1;
- smk->pic.key_frame = !!(buf[0] & 2);
+ bytestream2_init(&gb2, avpkt->data, avpkt->size);
+ flags = bytestream2_get_byteu(&gb2);
+ smk->pic.palette_has_changed = flags & 1;
+ smk->pic.key_frame = !!(flags & 2);
if(smk->pic.key_frame)
smk->pic.pict_type = AV_PICTURE_TYPE_I;
else
smk->pic.pict_type = AV_PICTURE_TYPE_P;
- buf++;
for(i = 0; i < 256; i++)
- *pal++ = 0xFF << 24 | bytestream_get_be24(&buf);
- buf_size -= 769;
+ *pal++ = 0xFF << 24 | bytestream2_get_be24u(&gb2);
last_reset(smk->mmap_tbl, smk->mmap_last);
last_reset(smk->mclr_tbl, smk->mclr_last);
last_reset(smk->full_tbl, smk->full_last);
last_reset(smk->type_tbl, smk->type_last);
- init_get_bits(&gb, buf, buf_size * 8);
+ init_get_bits(&gb, avpkt->data + 769, (avpkt->size - 769) * 8);
blk = 0;
bw = avctx->width >> 2;
@@ -511,7 +511,7 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *data_size, AVPac
*(AVFrame*)data = smk->pic;
/* always report that the buffer was completely consumed */
- return buf_size;
+ return avpkt->size;
}