It caused errors (see e.g. a066b8a809fa6d8b31398d41787822803f8762f2) and would not support negative linesizes (this is currently impossible to trigger as avcodec_default_get_buffer2() (used internally by ff_encode_alloc_frame()) does not use negative linesizes at all).
Signed-off-by: Andreas Rheinhardt <andreas.rheinha...@outlook.com> --- libavcodec/mpegvideo_enc.c | 19 ++++--------------- 1 file changed, 4 insertions(+), 15 deletions(-) diff --git a/libavcodec/mpegvideo_enc.c b/libavcodec/mpegvideo_enc.c index a65ecc6839..f3e45c18d2 100644 --- a/libavcodec/mpegvideo_enc.c +++ b/libavcodec/mpegvideo_enc.c @@ -36,6 +36,7 @@ #include <stdint.h> #include "libavutil/emms.h" +#include "libavutil/imgutils.h" #include "libavutil/internal.h" #include "libavutil/intmath.h" #include "libavutil/mathematics.h" @@ -1214,28 +1215,16 @@ static int load_input_picture(MpegEncContext *s, const AVFrame *pic_arg) int w = s->width >> h_shift; int h = s->height >> v_shift; const uint8_t *src = pic_arg->data[i]; - uint8_t *dst = pic->f->data[i]; + uint8_t *dst = pic->f->data[i] + !s->avctx->rc_buffer_size * INPLACE_OFFSET; int vpad = 16; + av_image_copy_plane(dst, dst_stride, src, src_stride, w, h); + if ( s->codec_id == AV_CODEC_ID_MPEG2VIDEO && !s->progressive_sequence && FFALIGN(s->height, 32) - s->height > 16) vpad = 32; - if (!s->avctx->rc_buffer_size) - dst += INPLACE_OFFSET; - - if (src_stride == dst_stride) - memcpy(dst, src, src_stride * h - src_stride + w); - else { - 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 & (vpad-1))) { s->mpvencdsp.draw_edges(dst, dst_stride, w, h, -- 2.40.1 _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".