[SCM] libav/experimental: 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.

siretart at users.alioth.debian.org siretart at users.alioth.debian.org
Sun Jun 30 16:08:09 UTC 2013


The following commit has been merged in the experimental branch:
commit 3c3704d28179e533e2f42a20e3234827b3f52685
Author: Vladimir Voroshilov <voroshil at gmail.com>
Date:   Sat Oct 13 17:38:58 2007 +0000

    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

diff --git a/libavcodec/mjpegdec.c b/libavcodec/mjpegdec.c
index d1d81d3..ea9e4cc 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;
         }
     }
diff --git a/libavcodec/sp5xdec.c b/libavcodec/sp5xdec.c
index ada46ca..104ed31 100644
--- a/libavcodec/sp5xdec.c
+++ b/libavcodec/sp5xdec.c
@@ -87,6 +87,7 @@ static int sp5x_decode_frame(AVCodecContext *avctx,
     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
 };

-- 
Libav/FFmpeg packaging



More information about the pkg-multimedia-commits mailing list