[FFmpeg-cvslog] avcodec/mjpegdec: fix shift_output() with lowres

Michael Niedermayer git at videolan.org
Mon Sep 9 01:53:24 CEST 2013


ffmpeg | branch: master | Michael Niedermayer <michaelni at gmx.at> | Mon Sep  9 01:35:34 2013 +0200| [ce228206274b832b21f1c43390c3b0268b4e1091] | committer: Michael Niedermayer

avcodec/mjpegdec: fix shift_output() with lowres

Fixes Ticket2940

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

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

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

diff --git a/libavcodec/mjpegdec.c b/libavcodec/mjpegdec.c
index 4f68b9c..8c4e916 100644
--- a/libavcodec/mjpegdec.c
+++ b/libavcodec/mjpegdec.c
@@ -1047,13 +1047,14 @@ static av_always_inline void mjpeg_copy_block(MJpegDecodeContext *s,
 static void shift_output(MJpegDecodeContext *s, uint8_t *ptr, int linesize)
 {
     int block_x, block_y;
+    int size = 8 >> s->avctx->lowres;
     if (s->bits > 8) {
-        for (block_y=0; block_y<8; block_y++)
-            for (block_x=0; block_x<8; block_x++)
+        for (block_y=0; block_y<size; block_y++)
+            for (block_x=0; block_x<size; block_x++)
                 *(uint16_t*)(ptr + 2*block_x + block_y*linesize) <<= 16 - s->bits;
     } else {
-        for (block_y=0; block_y<8; block_y++)
-            for (block_x=0; block_x<8; block_x++)
+        for (block_y=0; block_y<size; block_y++)
+            for (block_x=0; block_x<size; block_x++)
                 *(ptr + block_x + block_y*linesize) <<= 8 - s->bits;
     }
 }



More information about the ffmpeg-cvslog mailing list