From patchwork Sat Nov 12 11:31:34 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Niedermayer X-Patchwork-Id: 1397 Delivered-To: ffmpegpatchwork@gmail.com Received: by 10.103.90.1 with SMTP id o1csp205543vsb; Sat, 12 Nov 2016 03:31:56 -0800 (PST) X-Received: by 10.194.41.40 with SMTP id c8mr12394732wjl.173.1478950315997; Sat, 12 Nov 2016 03:31:55 -0800 (PST) Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id o205si37477297wmo.36.2016.11.12.03.31.55; Sat, 12 Nov 2016 03:31:55 -0800 (PST) Received-SPF: pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) client-ip=79.124.17.100; Authentication-Results: mx.google.com; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 395D9689FC4; Sat, 12 Nov 2016 13:31:49 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from vie01a-qmta-pe01-2.mx.upcmail.net (vie01a-qmta-pe01-2.mx.upcmail.net [62.179.121.179]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id B0DE2689FBE for ; Sat, 12 Nov 2016 13:31:43 +0200 (EET) Received: from [172.31.218.39] (helo=vie01a-dmta-pe03-3.mx.upcmail.net) by vie01a-pqmta-pe01.mx.upcmail.net with esmtp (Exim 4.87) (envelope-from ) id 1c5WX9-0004n1-6P for ffmpeg-devel@ffmpeg.org; Sat, 12 Nov 2016 12:31:43 +0100 Received: from [172.31.216.43] (helo=vie01a-pemc-psmtp-pe01) by vie01a-dmta-pe03.mx.upcmail.net with esmtp (Exim 4.87) (envelope-from ) id 1c5WX3-0004BY-70 for ffmpeg-devel@ffmpeg.org; Sat, 12 Nov 2016 12:31:37 +0100 Received: from localhost ([213.47.41.20]) by vie01a-pemc-psmtp-pe01 with SMTP @ mailcloud.upcmail.net id 6zXb1u01D0S5wYM01zXc0v; Sat, 12 Nov 2016 12:31:37 +0100 X-SourceIP: 213.47.41.20 From: Michael Niedermayer To: FFmpeg development discussions and patches Date: Sat, 12 Nov 2016 12:31:34 +0100 Message-Id: <20161112113135.20799-1-michael@niedermayer.cc> X-Mailer: git-send-email 2.10.2 Subject: [FFmpeg-devel] [PATCH 1/2] avcodec/mpegvideo: Fix edge emu buffer overlap with interlaced mpeg4 X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: FFmpeg development discussions and patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: FFmpeg development discussions and patches MIME-Version: 1.0 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Fixes Ticket5936 Signed-off-by: Michael Niedermayer --- libavcodec/mpegpicture.c | 2 +- libavcodec/mpegvideo.c | 2 +- libavcodec/mpegvideo_enc.c | 2 +- libavcodec/mpegvideo_motion.c | 4 ++-- libavcodec/version.h | 2 +- 5 files changed, 6 insertions(+), 6 deletions(-) diff --git a/libavcodec/mpegpicture.c b/libavcodec/mpegpicture.c index 6748fc2..302f9d2 100644 --- a/libavcodec/mpegpicture.c +++ b/libavcodec/mpegpicture.c @@ -76,7 +76,7 @@ int ff_mpeg_framesize_alloc(AVCodecContext *avctx, MotionEstContext *me, // at uvlinesize. It supports only YUV420 so 24x24 is enough // linesize * interlaced * MBsize // we also use this buffer for encoding in encode_mb_internal() needig an additional 32 lines - FF_ALLOCZ_ARRAY_OR_GOTO(avctx, sc->edge_emu_buffer, alloc_size, 4 * 68, + FF_ALLOCZ_ARRAY_OR_GOTO(avctx, sc->edge_emu_buffer, alloc_size, 4 * 70, fail); FF_ALLOCZ_ARRAY_OR_GOTO(avctx, me->scratchpad, alloc_size, 4 * 16 * 2, diff --git a/libavcodec/mpegvideo.c b/libavcodec/mpegvideo.c index 9a17a6e..59be078 100644 --- a/libavcodec/mpegvideo.c +++ b/libavcodec/mpegvideo.c @@ -2116,7 +2116,7 @@ static av_always_inline void mpeg_motion_lowres(MpegEncContext *s, ptr_y = s->sc.edge_emu_buffer; if (!CONFIG_GRAY || !(s->avctx->flags & AV_CODEC_FLAG_GRAY)) { uint8_t *ubuf = s->sc.edge_emu_buffer + 18 * s->linesize; - uint8_t *vbuf =ubuf + 9 * s->uvlinesize; + uint8_t *vbuf =ubuf + 10 * s->uvlinesize; s->vdsp.emulated_edge_mc(ubuf, ptr_cb, uvlinesize >> field_based, uvlinesize >> field_based, 9, 9 + field_based, diff --git a/libavcodec/mpegvideo_enc.c b/libavcodec/mpegvideo_enc.c index 1540e5c..10b4c5b 100644 --- a/libavcodec/mpegvideo_enc.c +++ b/libavcodec/mpegvideo_enc.c @@ -2276,7 +2276,7 @@ static av_always_inline void encode_mb_internal(MpegEncContext *s, (mb_y * mb_block_height * wrap_c) + mb_x * mb_block_width; if((mb_x * 16 + 16 > s->width || mb_y * 16 + 16 > s->height) && s->codec_id != AV_CODEC_ID_AMV){ - uint8_t *ebuf = s->sc.edge_emu_buffer + 36 * wrap_y; + uint8_t *ebuf = s->sc.edge_emu_buffer + 38 * wrap_y; 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, diff --git a/libavcodec/mpegvideo_motion.c b/libavcodec/mpegvideo_motion.c index c29810f..b97a6cb 100644 --- a/libavcodec/mpegvideo_motion.c +++ b/libavcodec/mpegvideo_motion.c @@ -326,7 +326,7 @@ void mpeg_motion_internal(MpegEncContext *s, ptr_y = s->sc.edge_emu_buffer; if (!CONFIG_GRAY || !(s->avctx->flags & AV_CODEC_FLAG_GRAY)) { uint8_t *ubuf = s->sc.edge_emu_buffer + 18 * s->linesize; - uint8_t *vbuf = ubuf + 9 * s->uvlinesize; + uint8_t *vbuf = ubuf + 10 * s->uvlinesize; uvsrc_y = (unsigned)uvsrc_y << field_based; s->vdsp.emulated_edge_mc(ubuf, ptr_cb, s->uvlinesize, s->uvlinesize, @@ -549,7 +549,7 @@ static inline void qpel_motion(MpegEncContext *s, ptr_y = s->sc.edge_emu_buffer; if (!CONFIG_GRAY || !(s->avctx->flags & AV_CODEC_FLAG_GRAY)) { uint8_t *ubuf = s->sc.edge_emu_buffer + 18 * s->linesize; - uint8_t *vbuf = ubuf + 9 * s->uvlinesize; + uint8_t *vbuf = ubuf + 10 * s->uvlinesize; s->vdsp.emulated_edge_mc(ubuf, ptr_cb, s->uvlinesize, s->uvlinesize, 9, 9 + field_based, diff --git a/libavcodec/version.h b/libavcodec/version.h index 9799cfe..e05c310 100644 --- a/libavcodec/version.h +++ b/libavcodec/version.h @@ -29,7 +29,7 @@ #define LIBAVCODEC_VERSION_MAJOR 57 #define LIBAVCODEC_VERSION_MINOR 66 -#define LIBAVCODEC_VERSION_MICRO 101 +#define LIBAVCODEC_VERSION_MICRO 102 #define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \ LIBAVCODEC_VERSION_MINOR, \