[FFmpeg-cvslog] avcodec/mjpegdec: Fix normal jpeg with bits < 8

Michael Niedermayer git at videolan.org
Fri Sep 6 01:26:04 CEST 2013


ffmpeg | branch: master | Michael Niedermayer <michaelni at gmx.at> | Fri Sep  6 00:56:44 2013 +0200| [1deeb9437c9c0e1f9cb708b24a4d0dedaee7bab3] | committer: Michael Niedermayer

avcodec/mjpegdec: Fix normal jpeg with bits < 8

Untested due to lack of testcase

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

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

 libavcodec/mjpegdec.c |    6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/libavcodec/mjpegdec.c b/libavcodec/mjpegdec.c
index a1b7e8a..0d619ef 100644
--- a/libavcodec/mjpegdec.c
+++ b/libavcodec/mjpegdec.c
@@ -1121,6 +1121,12 @@ static int mjpeg_decode_scan(MJpegDecodeContext *s, int nb_components, int Ah,
                                 return AVERROR_INVALIDDATA;
                             }
                             s->dsp.idct_put(ptr, linesize[c], s->block);
+                            if (s->bits & 7) {
+                                int block_x, block_y;
+                                    for (block_y=0; block_y<8; block_y++)
+                                        for (block_x=0; block_x<8; block_x++)
+                                            *(ptr + 2*block_x + block_y*linesize[c]) <<= 8 - s->bits;
+                            }
                         }
                     } else {
                         int block_idx  = s->block_stride[c] * (v * mb_y + y) +



More information about the ffmpeg-cvslog mailing list