motionpixels: Fix the size of workspace buffers
Some buffers must be mod 4 in width and/or height.
Signed-off-by: Janne Grunau <janne-libav@jannau.net>
(cherry picked from commit 210c80331e)
Signed-off-by: Anton Khirnov <anton@khirnov.net>
This commit is contained in:
committed by
Reinhard Tartler
parent
f2f2a00d39
commit
39de0e008d
@@ -52,14 +52,16 @@ typedef struct MotionPixelsContext {
|
|||||||
static av_cold int mp_decode_init(AVCodecContext *avctx)
|
static av_cold int mp_decode_init(AVCodecContext *avctx)
|
||||||
{
|
{
|
||||||
MotionPixelsContext *mp = avctx->priv_data;
|
MotionPixelsContext *mp = avctx->priv_data;
|
||||||
|
int w4 = (avctx->width + 3) & ~3;
|
||||||
|
int h4 = (avctx->height + 3) & ~3;
|
||||||
|
|
||||||
motionpixels_tableinit();
|
motionpixels_tableinit();
|
||||||
mp->avctx = avctx;
|
mp->avctx = avctx;
|
||||||
dsputil_init(&mp->dsp, 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->offset_bits_len = av_log2(avctx->width * avctx->height) + 1;
|
||||||
mp->vpt = av_mallocz(avctx->height * sizeof(YuvPixel));
|
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;
|
avctx->pix_fmt = PIX_FMT_RGB555;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user