diff options
author | Kostya Shishkov <kostya.shishkov@gmail.com> | 2010-02-22 14:59:51 +0000 |
---|---|---|
committer | Kostya Shishkov <kostya.shishkov@gmail.com> | 2010-02-22 14:59:51 +0000 |
commit | 1d6065ad089741626711853ee1ed07f5b439e5ad (patch) | |
tree | e79c725e8bfd67c483c9c8f8b07bf938a7e37240 /libavcodec | |
parent | 9068f36dccb15646480e8751385f086215287655 (diff) | |
download | ffmpeg-1d6065ad089741626711853ee1ed07f5b439e5ad.tar.gz |
Make Bink decoder able to skip alpha plane
Originally committed as revision 21963 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavcodec')
-rw-r--r-- | libavcodec/bink.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/libavcodec/bink.c b/libavcodec/bink.c index fb483e0716..a573d7be30 100644 --- a/libavcodec/bink.c +++ b/libavcodec/bink.c @@ -77,6 +77,7 @@ typedef struct BinkContext { DSPContext dsp; AVFrame pic, last; int version; ///< internal Bink file version + int has_alpha; int swap_planes; ScanTable scantable; ///< permutated scantable for DCT coeffs decoding @@ -692,6 +693,14 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *data_size, AVPac } init_get_bits(&gb, pkt->data, bits_count); + if (c->has_alpha) { + int aplane_bits = get_bits_long(&gb, 32) << 3; + if (aplane_bits <= 32 || (aplane_bits & 0x1F)) { + av_log(avctx, AV_LOG_ERROR, "Incorrect alpha plane size %d\n", aplane_bits); + return -1; + } + skip_bits_long(&gb, aplane_bits - 32); + } if (c->version >= 'i') skip_bits_long(&gb, 32); @@ -927,6 +936,7 @@ static av_cold int decode_init(AVCodecContext *avctx) av_log(avctx, AV_LOG_ERROR, "Too old version '%c'\n", c->version); return -1; } + c->has_alpha = 0; //TODO: demuxer should supply decoder with flags c->swap_planes = c->version >= 'i'; if (!bink_trees[15].table) { for (i = 0; i < 16; i++) { |