From ca9eb9305aa21c7d579b29c6499d2a50c88aab47 Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Sun, 23 Dec 2012 04:13:17 +0100 Subject: mpegvideo_enc: fix edge emulation of dimension%16 != 0 for YUV != 420 Fixes Ticket2041 Signed-off-by: Michael Niedermayer --- libavcodec/mpegvideo_enc.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) (limited to 'libavcodec') diff --git a/libavcodec/mpegvideo_enc.c b/libavcodec/mpegvideo_enc.c index a9dd009fa0..1e4c58d9ce 100644 --- a/libavcodec/mpegvideo_enc.c +++ b/libavcodec/mpegvideo_enc.c @@ -1886,17 +1886,19 @@ static av_always_inline void encode_mb_internal(MpegEncContext *s, 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; + 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, wrap_y, 16, 16, mb_x * 16, mb_y * 16, s->width, s->height); ptr_y = ebuf; s->vdsp.emulated_edge_mc(ebuf + 18 * wrap_y, ptr_cb, wrap_c, mb_block_width, - mb_block_height, mb_x * 8, mb_y * 8, - (s->width+1) >> 1, (s->height+1) >> 1); + mb_block_height, mb_x * mb_block_width, mb_y * mb_block_height, + cw, ch); ptr_cb = ebuf + 18 * wrap_y; - s->vdsp.emulated_edge_mc(ebuf + 18 * wrap_y + 8, ptr_cr, wrap_c, mb_block_width, - mb_block_height, mb_x * 8, mb_y * 8, - (s->width+1) >> 1, (s->height+1) >> 1); - ptr_cr = ebuf + 18 * wrap_y + 8; + s->vdsp.emulated_edge_mc(ebuf + 18 * wrap_y + 16, ptr_cr, wrap_c, mb_block_width, + mb_block_height, mb_x * mb_block_width, mb_y * mb_block_height, + cw, ch); + ptr_cr = ebuf + 18 * wrap_y + 16; } if (s->mb_intra) { -- cgit v1.2.3