From 504475f38ef049996c2c7954de00e92668a05de5 Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Sat, 28 Jun 2014 06:28:21 +0200 Subject: [PATCH] avcodec/mpegvideo: dont overwrite emu_edge buffer Fixes vsynth3 fate failures on mips Signed-off-by: Michael Niedermayer --- libavcodec/mpegvideo.c | 3 ++- libavcodec/mpegvideo_enc.c | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/libavcodec/mpegvideo.c b/libavcodec/mpegvideo.c index 4d1a70f33c..ef8905ab2c 100644 --- a/libavcodec/mpegvideo.c +++ b/libavcodec/mpegvideo.c @@ -450,7 +450,8 @@ static int frame_size_alloc(MpegEncContext *s, int linesize) // VC1 computes luma and chroma simultaneously and needs 19X19 + 9x9 // at uvlinesize. It supports only YUV420 so 24x24 is enough // linesize * interlaced * MBsize - FF_ALLOCZ_OR_GOTO(s->avctx, s->edge_emu_buffer, alloc_size * 4 * 24, + // we also use this buffer for encoding in encode_mb_internal() needig an additional 32 lines + FF_ALLOCZ_OR_GOTO(s->avctx, s->edge_emu_buffer, alloc_size * 4 * 68, fail); FF_ALLOCZ_OR_GOTO(s->avctx, s->me.scratchpad, alloc_size * 4 * 16 * 2, diff --git a/libavcodec/mpegvideo_enc.c b/libavcodec/mpegvideo_enc.c index 925721aa38..b8a243f646 100644 --- a/libavcodec/mpegvideo_enc.c +++ b/libavcodec/mpegvideo_enc.c @@ -2024,7 +2024,7 @@ static av_always_inline void encode_mb_internal(MpegEncContext *s, (mb_y * mb_block_height * wrap_c) + mb_x * mb_block_width; if((mb_x * 16 + 16 > s->width || mb_y * 16 + 16 > s->height) && s->codec_id != AV_CODEC_ID_AMV){ - uint8_t *ebuf = s->edge_emu_buffer + 32; + uint8_t *ebuf = s->edge_emu_buffer + 36 * wrap_y; int cw = (s->width + s->chroma_x_shift) >> s->chroma_x_shift; int ch = (s->height + s->chroma_y_shift) >> s->chroma_y_shift; s->vdsp.emulated_edge_mc(ebuf, ptr_y,