aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2012-01-06 21:29:25 +0100
committerMichael Niedermayer <michaelni@gmx.at>2012-01-07 00:11:43 +0100
commit12d8340f16eed211f153e859b749ad415c1ba384 (patch)
tree5d5092d565e7150b51f1cc04289b9a5879adfb01 /libavcodec
parent5152beeba81021e6b0988615efe398fdd48d8c23 (diff)
downloadffmpeg-12d8340f16eed211f153e859b749ad415c1ba384.tar.gz
ljpeg: Fix bits != 8 or 16 support
Fixes 2nd half of Ticket889 Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec')
-rw-r--r--libavcodec/mjpegdec.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/libavcodec/mjpegdec.c b/libavcodec/mjpegdec.c
index 7c27f5d987..58bbd63104 100644
--- a/libavcodec/mjpegdec.c
+++ b/libavcodec/mjpegdec.c
@@ -804,6 +804,7 @@ static int ljpeg_decode_yuv_scan(MJpegDecodeContext *s, int predictor, int point
if (s->interlaced && s->bottom_field)
ptr += linesize >> 1;
+ pred &= (-1)<<(8-s->bits);
*ptr= pred + (dc << point_transform);
}else{
ptr16 = s->picture.data[c] + 2*(linesize * (v * mb_y + y)) + 2*(h * mb_x + x); //FIXME optimize this crap
@@ -823,6 +824,7 @@ static int ljpeg_decode_yuv_scan(MJpegDecodeContext *s, int predictor, int point
if (s->interlaced && s->bottom_field)
ptr16 += linesize >> 1;
+ pred &= (-1)<<(16-s->bits);
*ptr16= pred + (dc << point_transform);
}
if (++x == h) {
@@ -856,11 +858,13 @@ static int ljpeg_decode_yuv_scan(MJpegDecodeContext *s, int predictor, int point
ptr = s->picture.data[c] + (linesize * (v * mb_y + y)) + (h * mb_x + x); //FIXME optimize this crap
PREDICT(pred, ptr[-linesize-1], ptr[-linesize], ptr[-1], predictor);
+ pred &= (-1)<<(8-s->bits);
*ptr= pred + (dc << point_transform);
}else{
ptr16 = s->picture.data[c] + 2*(linesize * (v * mb_y + y)) + 2*(h * mb_x + x); //FIXME optimize this crap
PREDICT(pred, ptr16[-linesize-1], ptr16[-linesize], ptr16[-1], predictor);
+ pred &= (-1)<<(16-s->bits);
*ptr16= pred + (dc << point_transform);
}
if (++x == h) {