[FFmpeg-cvslog] Fix nonsense non-mod16 AMV flipping code.

Reimar Döffinger git at videolan.org
Sun Jun 1 20:05:40 CEST 2014


ffmpeg | branch: master | Reimar Döffinger <Reimar.Doeffinger at gmx.de> | Sat Apr 28 23:37:08 2012 +0200| [6d695d7acc4cb1da84eb73710e05a4c090e5ab31] | committer: Michael Niedermayer

Fix nonsense non-mod16 AMV flipping code.

It is obviously nonsense since it produces wrong results
or even crashes (crashes should be encode-only though).
Fixes trac issue #1092.

Signed-off-by: Reimar Döffinger <Reimar.Doeffinger at gmx.de>
Signed-off-by: Michael Niedermayer <michaelni at gmx.at>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=6d695d7acc4cb1da84eb73710e05a4c090e5ab31
---

 libavcodec/mjpegenc.c      |    2 +-
 libavcodec/mpegvideo_enc.c |    4 ----
 2 files changed, 1 insertion(+), 5 deletions(-)

diff --git a/libavcodec/mjpegenc.c b/libavcodec/mjpegenc.c
index e33e75f..7a87f24 100644
--- a/libavcodec/mjpegenc.c
+++ b/libavcodec/mjpegenc.c
@@ -552,7 +552,7 @@ static int amv_encode_picture(AVCodecContext *avctx, AVPacket *pkt,
     //picture should be flipped upside-down
     for(i=0; i < 3; i++) {
         int vsample = i ? 2 >> chroma_v_shift : 2;
-        pic->data[i] += (pic->linesize[i] * (vsample * (8 * s->mb_height -((s->height/V_MAX)&7)) - 1 ));
+        pic->data[i] += pic->linesize[i] * (vsample * s->height / V_MAX - 1);
         pic->linesize[i] *= -1;
     }
     ret = ff_MPV_encode_picture(avctx, pkt, pic, got_packet);
diff --git a/libavcodec/mpegvideo_enc.c b/libavcodec/mpegvideo_enc.c
index f27ef7b..9f36c8f 100644
--- a/libavcodec/mpegvideo_enc.c
+++ b/libavcodec/mpegvideo_enc.c
@@ -1110,10 +1110,6 @@ static int load_input_picture(MpegEncContext *s, const AVFrame *pic_arg)
                     uint8_t *src = pic_arg->data[i];
                     uint8_t *dst = pic->f->data[i];
 
-                    if (s->codec_id == AV_CODEC_ID_AMV && !(s->avctx->flags & CODEC_FLAG_EMU_EDGE)) {
-                        h = ((s->height + 15)/16*16) >> v_shift;
-                    }
-
                     if (!s->avctx->rc_buffer_size)
                         dst += INPLACE_OFFSET;
 



More information about the ffmpeg-cvslog mailing list