1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2025-01-24 13:56:33 +02:00

Decode alpha plane in Bink video

Originally committed as revision 21982 to svn://svn.ffmpeg.org/ffmpeg/trunk
This commit is contained in:
Kostya Shishkov 2010-02-23 07:07:54 +00:00
parent bf0d54a381
commit 4f974de6f6

View File

@ -911,12 +911,10 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *data_size, AVPac
init_get_bits(&gb, pkt->data, bits_count); init_get_bits(&gb, pkt->data, bits_count);
if (c->has_alpha) { if (c->has_alpha) {
int aplane_bits = get_bits_long(&gb, 32) << 3; if (c->version >= 'i')
if (aplane_bits <= 32 || (aplane_bits & 0x1F)) { skip_bits_long(&gb, 32);
av_log(avctx, AV_LOG_ERROR, "Incorrect alpha plane size %d\n", aplane_bits); if (bink_decode_plane(c, &gb, 3, 0) < 0)
return -1; return -1;
}
skip_bits_long(&gb, aplane_bits - 32);
} }
if (c->version >= 'i') if (c->version >= 'i')
skip_bits_long(&gb, 32); skip_bits_long(&gb, 32);
@ -977,7 +975,7 @@ static av_cold int decode_init(AVCodecContext *avctx)
return 1; return 1;
} }
avctx->pix_fmt = PIX_FMT_YUV420P; avctx->pix_fmt = c->has_alpha ? PIX_FMT_YUVA420P : PIX_FMT_YUV420P;
avctx->idct_algo = FF_IDCT_BINK; avctx->idct_algo = FF_IDCT_BINK;
dsputil_init(&c->dsp, avctx); dsputil_init(&c->dsp, avctx);