aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec/mjpegdec.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michael@niedermayer.cc>2015-09-11 13:28:51 +0200
committerMichael Niedermayer <michael@niedermayer.cc>2015-09-11 13:42:05 +0200
commit055e56e9f76da3298f1b59bf5ea46f570e844600 (patch)
tree92e57b4b436c9ab46e0027fb510971ca2ec867fa /libavcodec/mjpegdec.c
parent07d33439f3107d3e84d6408a7be2d6c794c8e256 (diff)
downloadffmpeg-055e56e9f76da3298f1b59bf5ea46f570e844600.tar.gz
avcodec/mjpegdec: Fix decoding RGBA RCT LJPEG
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
Diffstat (limited to 'libavcodec/mjpegdec.c')
-rw-r--r--libavcodec/mjpegdec.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/libavcodec/mjpegdec.c b/libavcodec/mjpegdec.c
index 396f05ed1e..1a86b7bc31 100644
--- a/libavcodec/mjpegdec.c
+++ b/libavcodec/mjpegdec.c
@@ -995,7 +995,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) {