mpegvideo_enc: draw edges on input
authorMichael Niedermayer <michaelni@gmx.at>
Sat, 16 Feb 2013 09:44:38 +0000 (10:44 +0100)
committerMichael Niedermayer <michaelni@gmx.at>
Sat, 16 Feb 2013 10:08:21 +0000 (11:08 +0100)
Improves Motion estimation, avoids using out of picture areas for %16 != 0

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
libavcodec/mpegvideo_enc.c

index a3f9e76..57608b1 100644 (file)
@@ -1119,12 +1119,21 @@ static int load_input_picture(MpegEncContext *s, const AVFrame *pic_arg)
                     if (src_stride == dst_stride)
                         memcpy(dst, src, src_stride * h);
                     else {
-                        while (h--) {
-                            memcpy(dst, src, w);
-                            dst += dst_stride;
+                        int h2 = h;
+                        uint8_t *dst2 = dst;
+                        while (h2--) {
+                            memcpy(dst2, src, w);
+                            dst2 += dst_stride;
                             src += src_stride;
                         }
                     }
+                    if ((s->width & 15) || (s->height & 15)) {
+                        s->dsp.draw_edges(dst, dst_stride,
+                                          w, h,
+                                          16>>h_shift,
+                                          16>>v_shift,
+                                          EDGE_BOTTOM);
+                    }
                 }
             }
         }