summaryrefslogtreecommitdiff
path: root/libavcodec/mjpegdec.c
diff options
context:
space:
mode:
authorVladimir Voroshilov <voroshil@gmail.com>2007-10-13 17:38:58 +0000
committerVladimir Voroshilov <voroshil@gmail.com>2007-10-13 17:38:58 +0000
commit3c3704d28179e533e2f42a20e3234827b3f52685 (patch)
treee94a57ec72b323f890ba4ac1cea38d987333791a /libavcodec/mjpegdec.c
parent4d570f94ba055d75f469aacadfccf0bdffcbae6c (diff)
Fix MJPEG decoder for AMV files.
Since decoding is doing from the end and aligned by 16 previous code worked correctly only when picture height was dividable by 16, otherwise it provides garbage in top lines and truncates bottom. New code adjusts data[] pointers taking in account alignment issue. Originally committed as revision 10727 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavcodec/mjpegdec.c')
-rw-r--r--libavcodec/mjpegdec.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/libavcodec/mjpegdec.c b/libavcodec/mjpegdec.c
index d1d81d3493..ea9e4ccf55 100644
--- a/libavcodec/mjpegdec.c
+++ b/libavcodec/mjpegdec.c
@@ -671,7 +671,8 @@ static int mjpeg_decode_scan(MJpegDecodeContext *s, int nb_components, int ss, i
linesize[c]=s->linesize[c];
if(s->avctx->codec->id==CODEC_ID_AMV) {
//picture should be flipped upside-down for this codec
- data[c] += (linesize[c] * (s->v_scount[i] * 8 * s->mb_height - 1));
+ assert(!(s->avctx->flags & CODEC_FLAG_EMU_EDGE));
+ data[c] += (linesize[c] * (s->v_scount[i] * (8 * s->mb_height -((s->height/s->v_max)&7)) - 1 ));
linesize[c] *= -1;
}
}