diff --git a/libavcodec/mpegvideo.c b/libavcodec/mpegvideo.c index b8096cc094..1cef34ab0b 100644 --- a/libavcodec/mpegvideo.c +++ b/libavcodec/mpegvideo.c @@ -2497,19 +2497,20 @@ static av_always_inline void mpeg_motion_lowres(MpegEncContext *s, v_edge_pos); ptr_y = s->edge_emu_buffer; if (!CONFIG_GRAY || !(s->flags & CODEC_FLAG_GRAY)) { - uint8_t *uvbuf = s->edge_emu_buffer + 18 * s->linesize; - s->vdsp.emulated_edge_mc(uvbuf, ptr_cb, + uint8_t *ubuf = s->edge_emu_buffer + 18 * s->linesize; + uint8_t *vbuf =ubuf + 9 * s->uvlinesize; + s->vdsp.emulated_edge_mc(ubuf, ptr_cb, uvlinesize >> field_based, uvlinesize >> field_based, 9, 9 + field_based, uvsrc_x, uvsrc_y << field_based, h_edge_pos >> 1, v_edge_pos >> 1); - s->vdsp.emulated_edge_mc(uvbuf + 16, ptr_cr, + s->vdsp.emulated_edge_mc(vbuf, ptr_cr, uvlinesize >> field_based,uvlinesize >> field_based, 9, 9 + field_based, uvsrc_x, uvsrc_y << field_based, h_edge_pos >> 1, v_edge_pos >> 1); - ptr_cb = uvbuf; - ptr_cr = uvbuf + 16; + ptr_cb = ubuf; + ptr_cr = vbuf; } } diff --git a/libavcodec/mpegvideo_motion.c b/libavcodec/mpegvideo_motion.c index a844a2ca43..b006b99002 100644 --- a/libavcodec/mpegvideo_motion.c +++ b/libavcodec/mpegvideo_motion.c @@ -324,19 +324,20 @@ void mpeg_motion_internal(MpegEncContext *s, s->h_edge_pos, s->v_edge_pos); ptr_y = s->edge_emu_buffer; if (!CONFIG_GRAY || !(s->flags & CODEC_FLAG_GRAY)) { - uint8_t *uvbuf = s->edge_emu_buffer + 18 * s->linesize; - s->vdsp.emulated_edge_mc(uvbuf, ptr_cb, + uint8_t *ubuf = s->edge_emu_buffer + 18 * s->linesize; + uint8_t *vbuf = ubuf + 9 * s->uvlinesize; + s->vdsp.emulated_edge_mc(ubuf, ptr_cb, s->uvlinesize, s->uvlinesize, 9, 9 + field_based, uvsrc_x, uvsrc_y << field_based, s->h_edge_pos >> 1, s->v_edge_pos >> 1); - s->vdsp.emulated_edge_mc(uvbuf + 16, ptr_cr, + s->vdsp.emulated_edge_mc(vbuf, ptr_cr, s->uvlinesize, s->uvlinesize, 9, 9 + field_based, uvsrc_x, uvsrc_y << field_based, s->h_edge_pos >> 1, s->v_edge_pos >> 1); - ptr_cb = uvbuf; - ptr_cr = uvbuf + 16; + ptr_cb = ubuf; + ptr_cr = vbuf; } } @@ -545,19 +546,20 @@ static inline void qpel_motion(MpegEncContext *s, s->h_edge_pos, s->v_edge_pos); ptr_y = s->edge_emu_buffer; if (!CONFIG_GRAY || !(s->flags & CODEC_FLAG_GRAY)) { - uint8_t *uvbuf = s->edge_emu_buffer + 18 * s->linesize; - s->vdsp.emulated_edge_mc(uvbuf, ptr_cb, + uint8_t *ubuf = s->edge_emu_buffer + 18 * s->linesize; + uint8_t *vbuf = ubuf + 9 * s->uvlinesize; + s->vdsp.emulated_edge_mc(ubuf, ptr_cb, s->uvlinesize, s->uvlinesize, 9, 9 + field_based, uvsrc_x, uvsrc_y << field_based, s->h_edge_pos >> 1, s->v_edge_pos >> 1); - s->vdsp.emulated_edge_mc(uvbuf + 16, ptr_cr, + s->vdsp.emulated_edge_mc(vbuf, ptr_cr, s->uvlinesize, s->uvlinesize, 9, 9 + field_based, uvsrc_x, uvsrc_y << field_based, s->h_edge_pos >> 1, s->v_edge_pos >> 1); - ptr_cb = uvbuf; - ptr_cr = uvbuf + 16; + ptr_cb = ubuf; + ptr_cr = vbuf; } }