diff options
author | Michael Niedermayer <michael@niedermayer.cc> | 2015-09-11 13:28:51 +0200 |
---|---|---|
committer | Michael Niedermayer <michael@niedermayer.cc> | 2015-12-06 12:40:49 +0100 |
commit | 7cdd319b01cfacc5ab07744ee3422a46b6f2c754 (patch) | |
tree | 83ac6dc953b70391e2fb4a43014b9038fd8157ce | |
parent | 3ea20e60dc5d6362dba02c4fb19e44e4943046ad (diff) | |
download | ffmpeg-7cdd319b01cfacc5ab07744ee3422a46b6f2c754.tar.gz |
avcodec/mjpegdec: Fix decoding RGBA RCT LJPEG
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit 055e56e9f76da3298f1b59bf5ea46f570e844600)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
-rw-r--r-- | libavcodec/mjpegdec.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/libavcodec/mjpegdec.c b/libavcodec/mjpegdec.c index c2a92fae36..4a7862520c 100644 --- a/libavcodec/mjpegdec.c +++ b/libavcodec/mjpegdec.c @@ -946,7 +946,14 @@ static int ljpeg_decode_rgb_scan(MJpegDecodeContext *s, int nb_components, int p skip_bits(&s->gb, 16); /* skip RSTn */ } } - if (s->nb_components == 4) { + if (s->rct && s->nb_components == 4) { + for (mb_x = 0; mb_x < s->mb_width; mb_x++) { + ptr[4*mb_x + 2] = buffer[mb_x][0] - ((buffer[mb_x][1] + buffer[mb_x][2] - 0x200) >> 2); + ptr[4*mb_x + 1] = buffer[mb_x][1] + ptr[4*mb_x + 2]; + ptr[4*mb_x + 3] = buffer[mb_x][2] + ptr[4*mb_x + 2]; + ptr[4*mb_x + 0] = buffer[mb_x][3]; + } + } else if (s->nb_components == 4) { for(i=0; i<nb_components; i++) { int c= s->comp_index[i]; if (s->bits <= 8) { |