[FFmpeg-cvslog] mpegvideo: allocate sufficiently large scratch buffer for interlaced vid

Jindrich Makovicka git at videolan.org
Mon Jun 3 00:22:22 CEST 2013


ffmpeg | branch: release/1.1 | Jindrich Makovicka <makovick at gmail.com> | Thu May 16 16:49:28 2013 +0200| [7f451cb01f9f7a749b503179ba58b2f999056905] | committer: Reinhard Tartler

mpegvideo: allocate sufficiently large scratch buffer for interlaced vid

MPV_decode_mb_internal needs 3 * 16 * linesize bytes of scratch buffer

For interlaced content, linesize is multiplied by two after the allocation
of the scratch buffer, and the dest_cr pointer ends past the buffer.

This patch makes ff_mpv_frame_size_alloc allocate a total of
(aligned line_size) * 2 * 16 * 3 bytes, which suffices even for the
interlaced case.

CC:libav-stable at libav.org

Signed-off-by: Jindrich Makovicka <makovick at gmail.com>
Signed-off-by: Anton Khirnov <anton at khirnov.net>
(cherry picked from commit 259af1b92370b32f6d0b9a6de314db4b44c2481d)

Signed-off-by: Reinhard Tartler <siretart at tauware.de>

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

 libavcodec/mpegvideo.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavcodec/mpegvideo.c b/libavcodec/mpegvideo.c
index 10b13b5..77e21d2 100644
--- a/libavcodec/mpegvideo.c
+++ b/libavcodec/mpegvideo.c
@@ -248,7 +248,7 @@ int ff_mpv_frame_size_alloc(MpegEncContext *s, int linesize)
     FF_ALLOCZ_OR_GOTO(s->avctx, s->edge_emu_buffer, alloc_size * 2 * 24,
                       fail);
 
-    FF_ALLOCZ_OR_GOTO(s->avctx, s->me.scratchpad, alloc_size * 2 * 16 * 2,
+    FF_ALLOCZ_OR_GOTO(s->avctx, s->me.scratchpad, alloc_size * 2 * 16 * 3,
                       fail)
     s->me.temp         = s->me.scratchpad;
     s->rd_scratchpad   = s->me.scratchpad;



More information about the ffmpeg-cvslog mailing list