Commit 69db85c3 authored by Michael Niedermayer's avatar Michael Niedermayer

mjpegdec: Support 16bit DQT

Fixes Ticket2072
Signed-off-by: 's avatarMichael Niedermayer <michaelni@gmx.at>
parent 10a3fa8f
...@@ -129,10 +129,10 @@ int ff_mjpeg_decode_dqt(MJpegDecodeContext *s) ...@@ -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) ...@@ -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
......
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