[FFmpeg-cvslog] avcodec/mjpegdec: fix yuv ljpeg prediction 5/6/7 with point transforms

Michael Niedermayer git at videolan.org
Thu Sep 5 01:47:47 CEST 2013


ffmpeg | branch: master | Michael Niedermayer <michaelni at gmx.at> | Thu Sep  5 01:25:59 2013 +0200| [38f8640df81e96b83ac8d33fddbe3ab3046d50ff] | committer: Michael Niedermayer

avcodec/mjpegdec: fix yuv ljpeg prediction 5/6/7 with point transforms

Fixes Ticket2826

Signed-off-by: Michael Niedermayer <michaelni at gmx.at>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=38f8640df81e96b83ac8d33fddbe3ab3046d50ff
---

 libavcodec/mjpegdec.c |    8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/libavcodec/mjpegdec.c b/libavcodec/mjpegdec.c
index 8b48ea2..c18502b 100644
--- a/libavcodec/mjpegdec.c
+++ b/libavcodec/mjpegdec.c
@@ -944,7 +944,7 @@ static int ljpeg_decode_yuv_scan(MJpegDecodeContext *s, int predictor,
 
                         if (s->interlaced && s->bottom_field)
                             ptr += linesize >> 1;
-                        pred &= (-1)<<(8-s->bits);
+                        pred &= (-1)<<(8 - s->bits + point_transform);
                         *ptr= pred + (dc << point_transform);
                         }else{
                             ptr16 = (uint16_t*)(s->picture.data[c] + 2*(linesize * (v * mb_y + y)) + 2*(h * mb_x + x)); //FIXME optimize this crap
@@ -964,7 +964,7 @@ static int ljpeg_decode_yuv_scan(MJpegDecodeContext *s, int predictor,
 
                             if (s->interlaced && s->bottom_field)
                                 ptr16 += linesize >> 1;
-                            pred &= (-1)<<(16-s->bits);
+                            pred &= (-1)<<(16 - s->bits + point_transform);
                             *ptr16= pred + (dc << point_transform);
                         }
                         if (++x == h) {
@@ -1000,13 +1000,13 @@ static int ljpeg_decode_yuv_scan(MJpegDecodeContext *s, int predictor,
                               (h * mb_x + x); //FIXME optimize this crap
                             PREDICT(pred, ptr[-linesize-1], ptr[-linesize], ptr[-1], predictor);
 
-                            pred &= (-1)<<(8-s->bits);
+                            pred &= (-1)<<(8 - s->bits + point_transform);
                             *ptr = pred + (dc << point_transform);
                         }else{
                             ptr16 = (uint16_t*)(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);
+                            pred &= (-1)<<(16 - s->bits + point_transform);
                             *ptr16= pred + (dc << point_transform);
                         }
 



More information about the ffmpeg-cvslog mailing list