Mercurial > libavcodec.hg
comparison mjpegdec.c @ 5818:e0a872dd3ea1 libavcodec
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.
author | voroshil |
---|---|
date | Sat, 13 Oct 2007 17:38:58 +0000 |
parents | 810067f2c33d |
children | 01e909d2a435 |
comparison
equal
deleted
inserted
replaced
5817:ced30500e2b1 | 5818:e0a872dd3ea1 |
---|---|
669 int c = s->comp_index[i]; | 669 int c = s->comp_index[i]; |
670 data[c] = s->picture.data[c]; | 670 data[c] = s->picture.data[c]; |
671 linesize[c]=s->linesize[c]; | 671 linesize[c]=s->linesize[c]; |
672 if(s->avctx->codec->id==CODEC_ID_AMV) { | 672 if(s->avctx->codec->id==CODEC_ID_AMV) { |
673 //picture should be flipped upside-down for this codec | 673 //picture should be flipped upside-down for this codec |
674 data[c] += (linesize[c] * (s->v_scount[i] * 8 * s->mb_height - 1)); | 674 assert(!(s->avctx->flags & CODEC_FLAG_EMU_EDGE)); |
675 data[c] += (linesize[c] * (s->v_scount[i] * (8 * s->mb_height -((s->height/s->v_max)&7)) - 1 )); | |
675 linesize[c] *= -1; | 676 linesize[c] *= -1; |
676 } | 677 } |
677 } | 678 } |
678 | 679 |
679 for(mb_y = 0; mb_y < s->mb_height; mb_y++) { | 680 for(mb_y = 0; mb_y < s->mb_height; mb_y++) { |