[FFmpeg-devel] [PATCH 2/2] ljpeg: Fix bits != 8 or 16 support
Michael Niedermayer
michaelni at gmx.at
Fri Jan 6 21:31:53 CET 2012
Fixes 2nd half of Ticket889
Signed-off-by: Michael Niedermayer <michaelni at gmx.at>
---
libavcodec/mjpegdec.c | 4 ++++
1 files changed, 4 insertions(+), 0 deletions(-)
diff --git a/libavcodec/mjpegdec.c b/libavcodec/mjpegdec.c
index be7ad83..b64bba0 100644
--- a/libavcodec/mjpegdec.c
+++ b/libavcodec/mjpegdec.c
@@ -813,6 +813,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
@@ -832,6 +833,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) {
@@ -865,11 +867,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) {
--
1.7.5.4
More information about the ffmpeg-devel
mailing list