summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLaurent Aimar <[email protected]>2011-09-29 23:13:35 +0000
committerReinhard Tartler <[email protected]>2012-03-18 17:50:31 +0100
commit39de0e008d473662fd8381da4cbd5887e4fd5cc2 (patch)
tree071ebd80c235cd54a36657aea19ef8c8bc153814
parentf2f2a00d39a458e23c018744b9aacb3f94501d67 (diff)
motionpixels: Fix the size of workspace buffers
Some buffers must be mod 4 in width and/or height. Signed-off-by: Janne Grunau <[email protected]> (cherry picked from commit 210c80331e0604edf9c800865c26ba06ed3c2082) Signed-off-by: Anton Khirnov <[email protected]>
-rw-r--r--libavcodec/motionpixels.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/libavcodec/motionpixels.c b/libavcodec/motionpixels.c
index 91eb7f9017..cee21d3aa1 100644
--- a/libavcodec/motionpixels.c
+++ b/libavcodec/motionpixels.c
@@ -52,14 +52,16 @@ typedef struct MotionPixelsContext {
static av_cold int mp_decode_init(AVCodecContext *avctx)
{
MotionPixelsContext *mp = avctx->priv_data;
+ int w4 = (avctx->width + 3) & ~3;
+ int h4 = (avctx->height + 3) & ~3;
motionpixels_tableinit();
mp->avctx = avctx;
dsputil_init(&mp->dsp, avctx);
- mp->changes_map = av_mallocz(avctx->width * avctx->height);
+ mp->changes_map = av_mallocz(avctx->width * h4);
mp->offset_bits_len = av_log2(avctx->width * avctx->height) + 1;
mp->vpt = av_mallocz(avctx->height * sizeof(YuvPixel));
- mp->hpt = av_mallocz(avctx->height * avctx->width / 16 * sizeof(YuvPixel));
+ mp->hpt = av_mallocz(h4 * w4 / 16 * sizeof(YuvPixel));
avctx->pix_fmt = PIX_FMT_RGB555;
return 0;
}