diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2012-12-27 23:16:54 +0100 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2012-12-27 23:18:40 +0100 |
commit | 69db85c30c9199f523b0e218927fb90b0fb8f924 (patch) | |
tree | 8593e03d5cb3df3f42cca5a4bd90af80ca7aacdf /libavcodec/mjpegdec.c | |
parent | 10a3fa8f31810e954c8ce6268f40ea9e112dafeb (diff) | |
download | ffmpeg-streaming-69db85c30c9199f523b0e218927fb90b0fb8f924.zip ffmpeg-streaming-69db85c30c9199f523b0e218927fb90b0fb8f924.tar.gz |
mjpegdec: Support 16bit DQT
Fixes Ticket2072
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec/mjpegdec.c')
-rw-r--r-- | libavcodec/mjpegdec.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/libavcodec/mjpegdec.c b/libavcodec/mjpegdec.c index c1712ea..c62df72 100644 --- a/libavcodec/mjpegdec.c +++ b/libavcodec/mjpegdec.c @@ -129,10 +129,10 @@ int ff_mjpeg_decode_dqt(MJpegDecodeContext *s) len = get_bits(&s->gb, 16) - 2; while (len >= 65) { - /* only 8 bit precision handled */ - if (get_bits(&s->gb, 4) != 0) { - av_log(s->avctx, AV_LOG_ERROR, "dqt: 16bit precision\n"); - return -1; + int pr = get_bits(&s->gb, 4); + if (pr > 1) { + av_log(s->avctx, AV_LOG_ERROR, "dqt: invalid precision\n"); + return AVERROR_INVALIDDATA; } index = get_bits(&s->gb, 4); if (index >= 4) @@ -141,7 +141,7 @@ int ff_mjpeg_decode_dqt(MJpegDecodeContext *s) /* read quant table */ for (i = 0; i < 64; 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 |