[FFmpeg-cvslog] mpegvideo_enc: fix edge emulation of dimension%16 != 0 for YUV != 420

Michael Niedermayer git at videolan.org
Sun Dec 23 04:21:15 CET 2012


ffmpeg | branch: master | Michael Niedermayer <michaelni at gmx.at> | Sun Dec 23 04:13:17 2012 +0100| [ca9eb9305aa21c7d579b29c6499d2a50c88aab47] | committer: Michael Niedermayer

mpegvideo_enc: fix edge emulation of dimension%16 != 0 for YUV != 420

Fixes Ticket2041

Signed-off-by: Michael Niedermayer <michaelni at gmx.at>

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

 libavcodec/mpegvideo_enc.c |   14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)

diff --git a/libavcodec/mpegvideo_enc.c b/libavcodec/mpegvideo_enc.c
index a9dd009..1e4c58d 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) {



More information about the ffmpeg-cvslog mailing list