OSDN Git Service

avcodec/mjpegdec: fix green vertical line at the right with upscale h
authorMichael Niedermayer <michaelni@gmx.at>
Sun, 31 Aug 2014 12:42:53 +0000 (14:42 +0200)
committerMichael Niedermayer <michaelni@gmx.at>
Sun, 31 Aug 2014 13:16:36 +0000 (15:16 +0200)
Fixes Ticket3891

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
libavcodec/mjpegdec.c

index b6e0e68..ac898bb 100644 (file)
@@ -2097,8 +2097,11 @@ the_end:
                 continue;
             if (p==1 || p==2)
                 w >>= hshift;
+            av_assert0(w > 0);
             for (i = 0; i < s->chroma_height; i++) {
-                for (index = w - 1; index; index--) {
+                if (is16bit) ((uint16_t*)line)[w - 1] = ((uint16_t*)line)[(w - 1) / 2];
+                else                      line[w - 1] = line[(w - 1) / 2];
+                for (index = w - 2; index > 0; index--) {
                     if (is16bit)
                         ((uint16_t*)line)[index] = (((uint16_t*)line)[index / 2] + ((uint16_t*)line)[(index + 1) / 2]) >> 1;
                     else