Fix nonsense non-mod16 AMV flipping code.
authorReimar Döffinger <Reimar.Doeffinger@gmx.de>
Sat, 28 Apr 2012 21:37:08 +0000 (23:37 +0200)
committerMichael Niedermayer <michaelni@gmx.at>
Sun, 1 Jun 2014 17:47:07 +0000 (19:47 +0200)
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@gmx.de>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
libavcodec/mjpegenc.c
libavcodec/mpegvideo_enc.c

index e33e75f..7a87f24 100644 (file)
@@ -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);
index f27ef7b..9f36c8f 100644 (file)
@@ -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;