diff options
author | Laurent Aimar <fenrir@videolan.org> | 2011-09-30 00:05:49 +0200 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2011-09-30 02:09:59 +0200 |
commit | 62234a4d3a30f3949694781ef8a941ef55b210fa (patch) | |
tree | e542eb7c965a81f3ab07b47889b104dd544eca96 /libavcodec/motionpixels.c | |
parent | e60619f9b4bdaf9af46887cdb2c86454567b4a61 (diff) | |
download | ffmpeg-62234a4d3a30f3949694781ef8a941ef55b210fa.tar.gz |
Fix the size of workspace buffers in the motion pixels decoder.
Some buffers must be mod 4 in width and/or height.
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec/motionpixels.c')
-rw-r--r-- | libavcodec/motionpixels.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/libavcodec/motionpixels.c b/libavcodec/motionpixels.c index 01d3c20658..ff1152822f 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; avcodec_get_frame_defaults(&mp->frame); return 0; |