diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2013-09-15 23:13:52 +0200 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2013-09-15 23:36:11 +0200 |
commit | b4a5fcb9988ce7cbe0a16f8f81a06a081db0973e (patch) | |
tree | 6c2fe50864d908e287c28a45506faaf4e75491c4 /libavcodec/mjpegdec.c | |
parent | 069010ffaec1270777f8e30e8b81310204c8e435 (diff) | |
download | ffmpeg-b4a5fcb9988ce7cbe0a16f8f81a06a081db0973e.tar.gz |
avcodec/mjpegdec: Fix rgb48 ljpeg
Fixes Ticket894
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec/mjpegdec.c')
-rw-r--r-- | libavcodec/mjpegdec.c | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/libavcodec/mjpegdec.c b/libavcodec/mjpegdec.c index d08818f2e2..470ff8d69b 100644 --- a/libavcodec/mjpegdec.c +++ b/libavcodec/mjpegdec.c @@ -357,7 +357,7 @@ int ff_mjpeg_decode_sof(MJpegDecodeContext *s) switch (pix_fmt_id) { case 0x11111100: if (s->rgb) - s->avctx->pix_fmt = AV_PIX_FMT_BGR24; + s->avctx->pix_fmt = s->bits <= 8 ? AV_PIX_FMT_BGR24 : AV_PIX_FMT_BGR48; else { if (s->component_id[0] == 'Q' && s->component_id[1] == 'F' && s->component_id[2] == 'A') { s->avctx->pix_fmt = s->bits <= 8 ? AV_PIX_FMT_GBRP : AV_PIX_FMT_GBRP16; @@ -887,8 +887,14 @@ static int ljpeg_decode_rgb_scan(MJpegDecodeContext *s, int nb_components, int p } else { for(i=0; i<nb_components; i++) { int c= s->comp_index[i]; - for(mb_x = 0; mb_x < s->mb_width; mb_x++) { - ptr[3*mb_x+2-c] = buffer[mb_x][i]; + if (s->bits <= 8) { + for(mb_x = 0; mb_x < s->mb_width; mb_x++) { + ptr[3*mb_x+2-c] = buffer[mb_x][i]; + } + } else { + for(mb_x = 0; mb_x < s->mb_width; mb_x++) { + ((uint16_t*)ptr)[3*mb_x+2-c] = buffer[mb_x][i]; + } } } } |