1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2024-12-23 12:43:46 +02:00

mjpegdec: Support 16bit DQT

Fixes Ticket2072

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
This commit is contained in:
Michael Niedermayer 2012-12-27 23:16:54 +01:00
parent 10a3fa8f31
commit 69db85c30c

View File

@ -129,10 +129,10 @@ int ff_mjpeg_decode_dqt(MJpegDecodeContext *s)
len = get_bits(&s->gb, 16) - 2; len = get_bits(&s->gb, 16) - 2;
while (len >= 65) { while (len >= 65) {
/* only 8 bit precision handled */ int pr = get_bits(&s->gb, 4);
if (get_bits(&s->gb, 4) != 0) { if (pr > 1) {
av_log(s->avctx, AV_LOG_ERROR, "dqt: 16bit precision\n"); av_log(s->avctx, AV_LOG_ERROR, "dqt: invalid precision\n");
return -1; return AVERROR_INVALIDDATA;
} }
index = get_bits(&s->gb, 4); index = get_bits(&s->gb, 4);
if (index >= 4) if (index >= 4)
@ -141,7 +141,7 @@ int ff_mjpeg_decode_dqt(MJpegDecodeContext *s)
/* read quant table */ /* read quant table */
for (i = 0; i < 64; i++) { for (i = 0; i < 64; i++) {
j = s->scantable.permutated[i]; j = s->scantable.permutated[i];
s->quant_matrixes[index][j] = get_bits(&s->gb, 8); s->quant_matrixes[index][j] = get_bits(&s->gb, pr ? 16 : 8);
} }
// XXX FIXME finetune, and perhaps add dc too // XXX FIXME finetune, and perhaps add dc too