[FFmpeg-cvslog] r10727 - in trunk/libavcodec: mjpegdec.c sp5xdec.c

voroshil subversion
Sat Oct 13 19:38:58 CEST 2007


Author: voroshil
Date: Sat Oct 13 19:38:58 2007
New Revision: 10727

Log:
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.



Modified:
   trunk/libavcodec/mjpegdec.c
   trunk/libavcodec/sp5xdec.c

Modified: trunk/libavcodec/mjpegdec.c
==============================================================================
--- trunk/libavcodec/mjpegdec.c	(original)
+++ trunk/libavcodec/mjpegdec.c	Sat Oct 13 19:38:58 2007
@@ -671,7 +671,8 @@ static int mjpeg_decode_scan(MJpegDecode
         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;
         }
     }

Modified: trunk/libavcodec/sp5xdec.c
==============================================================================
--- trunk/libavcodec/sp5xdec.c	(original)
+++ trunk/libavcodec/sp5xdec.c	Sat Oct 13 19:38:58 2007
@@ -87,6 +87,7 @@ static int sp5x_decode_frame(AVCodecCont
     recoded[j++] = 0xFF;
     recoded[j++] = 0xD9;
 
+    avctx->flags &= ~CODEC_FLAG_EMU_EDGE;
     i = ff_mjpeg_decode_frame(avctx, data, data_size, recoded, j);
 
     av_free(recoded);
@@ -207,6 +208,5 @@ AVCodec amv_decoder = {
     ff_mjpeg_decode_init,
     NULL,
     ff_mjpeg_decode_end,
-    sp5x_decode_frame,
-    CODEC_CAP_DR1
+    sp5x_decode_frame
 };




More information about the ffmpeg-cvslog mailing list