[FFmpeg-cvslog] mjpegdec: fix undefined shift

Vittorio Giovara git at videolan.org
Thu Nov 6 18:43:01 CET 2014


ffmpeg | branch: master | Vittorio Giovara <vittorio.giovara at gmail.com> | Wed Nov  5 10:29:55 2014 -0500| [199d9f995da53fe2507821f6d96bbc692574e1a9] | committer: Vittorio Giovara

mjpegdec: fix undefined shift

Add a comment to explain the code.

CC: libav-stable at libav.org
Bug-Id: CID 1194388

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

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

diff --git a/libavcodec/mjpegdec.c b/libavcodec/mjpegdec.c
index d9a73d8..01e11be 100644
--- a/libavcodec/mjpegdec.c
+++ b/libavcodec/mjpegdec.c
@@ -964,7 +964,9 @@ static int mjpeg_decode_scan_progressive_ac(MJpegDecodeContext *s, int ss,
         init_get_bits(&mb_bitmask_gb, mb_bitmask, s->mb_width * s->mb_height);
 
     if (!Al) {
-        s->coefs_finished[c] |= (1LL << (se + 1)) - (1LL << ss);
+        // s->coefs_finished is a bitmask for coefficients coded
+        // ss and se are parameters telling start and end coefficients
+        s->coefs_finished[c] |= (~0ULL >> (63 - (se - ss))) << ss;
         last_scan = !~s->coefs_finished[c];
     }
 



More information about the ffmpeg-cvslog mailing list